-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathSettings.pm
147 lines (130 loc) · 4.42 KB
/
Settings.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# ClamTk, copyright (C) 2004-2024 Dave M
#
# This file is part of ClamTk
# https://github.com/dave-theunsub/clamtk/
# https://gitlab.com/dave_m/clamtk/
#
# ClamTk is free software; you can redistribute it and/or modify it
# under the terms of either:
#
# a) the GNU General Public License as published by the Free Software
# Foundation; either version 1, or (at your option) any later version, or
#
# b) the "Artistic License".
package ClamTk::Settings;
# use strict;
# use warnings;
$| = 1;
use File::Basename 'basename';
use Glib 'TRUE', 'FALSE';
use POSIX 'locale_h';
use Locale::gettext;
sub show_window {
my $top_box = Gtk3::EventBox->new;
my $box = Gtk3::Box->new( 'vertical', 0 );
# $box->set_homogeneous(TRUE);
$top_box->add( $box );
my %prefs = ClamTk::Prefs->get_all_prefs();
my $grid = Gtk3::Grid->new();
$box->pack_start( $grid, FALSE, FALSE, 10 );
$grid->set_column_spacing( 10 );
$grid->set_column_homogeneous( TRUE );
$grid->set_row_spacing( 10 );
$grid->set_row_homogeneous( TRUE );
my $option = Gtk3::CheckButton->new_with_label( _( 'Scan for PUAs' ) );
$option->set_tooltip_text(
_( 'Detect packed binaries, password recovery tools, and more' ) );
$option->set_active( TRUE ) if ( $prefs{ Thorough } );
$grid->attach( $option, 0, 0, 1, 1 );
$option->signal_connect(
toggled => sub {
my $btn = shift;
ClamTk::Prefs->set_preference( 'Thorough', $btn->get_active
? 1
: 0 );
}
);
$option
= Gtk3::CheckButton->new_with_label( _( 'Use heuristic scanning' ) );
# $option->set_tooltip_text(
# _( 'tooltip here' ) );
$option->set_active( TRUE ) if ( $prefs{ Heuristic } );
$grid->attach( $option, 0, 1, 1, 1 );
$option->signal_connect(
toggled => sub {
my $btn = shift;
ClamTk::Prefs->set_preference( 'Heuristic', $btn->get_active
? 1
: 0 );
}
);
$option = Gtk3::CheckButton->new_with_label(
_( 'Scan files beginning with a dot (.*)' ) );
$option->set_tooltip_text( _( 'Scan files typically hidden from view' ) );
$option->set_active( TRUE ) if ( $prefs{ ScanHidden } );
$grid->attach( $option, 0, 2, 1, 1 );
$option->signal_connect(
toggled => sub {
my $btn = shift;
ClamTk::Prefs->set_preference( 'ScanHidden', $btn->get_active
? 1
: 0 );
}
);
$option = Gtk3::CheckButton->new_with_label(
_( 'Scan files larger than 20 MB' ) );
$option->set_tooltip_text(
_( 'Scan large files which are typically not examined' ) );
$option->set_active( TRUE ) if ( $prefs{ SizeLimit } );
$grid->attach( $option, 0, 3, 1, 1 );
$option->signal_connect(
toggled => sub {
my $btn = shift;
ClamTk::Prefs->set_preference( 'SizeLimit', $btn->get_active
? 1
: 0 );
}
);
$option = Gtk3::CheckButton->new_with_label(
_( 'Scan directories recursively' ) );
$option->set_tooltip_text(
_( 'Scan all files and directories within a directory' ) );
$option->set_active( TRUE ) if ( $prefs{ Recursive } );
$grid->attach( $option, 0, 4, 1, 1 );
$option->signal_connect(
toggled => sub {
my $btn = shift;
ClamTk::Prefs->set_preference( 'Recursive', $btn->get_active
? 1
: 0 );
}
);
$option = Gtk3::CheckButton->new_with_label(
_( 'Check for updates to this program' ) );
$option->set_tooltip_text(
_( 'Check online for application and signature updates' ) );
$option->set_active( TRUE ) if ( $prefs{ GUICheck } );
$grid->attach( $option, 0, 5, 1, 1 );
$option->signal_connect(
toggled => sub {
my $btn = shift;
ClamTk::Prefs->set_preference( 'GUICheck', $btn->get_active
? 1
: 0 );
}
);
my $infobar = Gtk3::InfoBar->new;
#$box->pack_start( $infobar, FALSE, FALSE, 10 );
$infobar->set_message_type( 'other' );
my $use_image = ClamTk::Icons->get_image( 'go-previous' );
$infobar->add_button( $use_image, -7 );
$infobar->signal_connect(
response => sub {
ClamTk::GUI->swap_button;
ClamTk::GUI->add_default_view;
}
);
$top_box->show_all;
return $top_box;
}
1;