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
|
#!/usr/bin/perl
################################################################################
# Mageia Online #
# #
# Copyright (C) 2008-2010 Mandriva #
# 2010-2016 Mageia #
# #
# Thierry Vignaud <thierry.vignaud at gmail dot com> #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License Version 2 as #
# published by the Free Software Foundation. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, see <http://www.gnu.org/licenses/>. #
################################################################################
use strict;
use lib qw(/usr/lib/libDrakX /usr/lib/libDrakX/drakfirsttime);
use standalone; # for explanations
use common;
BEGIN { unshift @::textdomains, 'mgaonline' }
use mygtk3 qw(gtknew); #- do not import gtkadd which conflicts with ugtk3 version
use ugtk3 qw(:all);
use mgaonline;
use mgaapplet_gui;
use interactive;
get_product_id();
configure();
ugtk3::exit(0);
sub configure() {
my $w = ugtk3->new(N("Updates Configuration"), width => -1);
my %config = getVarsFromSh($config_file);
# convert from ms to seconds:
$config{FIRST_CHECK_DELAY} /= 1000;
# convert from seconds to minutes :
$config{FIRST_CHECK_DELAY} /= 60;
# convert from seconds to hours :
$config{UPDATE_FREQUENCY} /= 3600;
# sanity check:
$config{UPDATE_FREQUENCY} = 1 if $config{UPDATE_FREQUENCY} < 1;
# config file has negative options but GUI want positive options (HIG):
invbools_for_display(\%config);
my $res =
fill_n_run_portable_dialog(
$w,
[
if_(!$::isEmbedded, get_banner(N("Updates Configuration"))),
gtknew('Label_Left', text => N("Here you can configure the updates applet"), @common),
gtknew('Table', col_spacings => 5, row_spacings => 5, children => [
[ gtknew('Label', alignment => [ 0, 1 ], text => N("Update frequency (hours)")),
gtknew('HScale',
digits => 0,
lower => 1,
upper => 24,
step_increment => 1,
width => 100,
value_ref => \$config{UPDATE_FREQUENCY}) ],
[ gtknew('Label', alignment => [ 0, 1 ], text => N("First check delay (minutes)")),
gtknew('HScale',
digits => 0,
lower => 5,
upper => 30,
step_increment => 1,
value_ref => \$config{FIRST_CHECK_DELAY}) ],
[ gtknew('CheckButton',
text => N("Check for newer Mageia releases"),
active_ref => \$config{DO_NOT_ASK_FOR_DISTRO_UPGRADE},
),
],
]),
create_okcancel($w), #, N("Next"), N("Cancel")),
]);
if ($res) {
# convert from seconds to minutes :
$config{FIRST_CHECK_DELAY} *= 60;
# convert from seconds to hours :
$config{UPDATE_FREQUENCY} *= 3600;
# convert back into ms from seconds:
$config{FIRST_CHECK_DELAY} *= 1000;
# config file has negative options but GUI want positive options (HIG):
invbools_for_display(\%config);
setVarsInSh($config_file, \%config);
}
}
sub invbools_for_display {
my ($config) = @_;
foreach (qw(DO_NOT_ASK_FOR_DISTRO_UPGRADE)) {
invbool(\$config->{$_});
}
}
|