28 |
$window->set_title(N('autologin configuration')); |
$window->set_title(N('autologin configuration')); |
29 |
$window->set_size_request(500, 400); |
$window->set_size_request(500, 400); |
30 |
|
|
|
# we build the table |
|
|
my $table = Gtk2::Table->new(0, 2, 0); |
|
|
$table->set_col_spacings(5); |
|
|
$table->set_row_spacings(5); |
|
|
|
|
|
# first control : we put the label, and ask libconf to build the best widget it can, for the key AUTOLOGIN of the $autologin object |
|
|
$table->attach(Gtk2::Label->new(N('Activate autologin')), 0, 1, 0, 1, ['fill', 'expand'], ['shrink', 'shrink'], 0, 0); |
|
|
$table->attach(my $widget_AUTOLOGIN=getBestWidget($autologin, 'AUTOLOGIN'), 1, 2, 0, 1, ['fill', 'expand'], ['shrink', 'shrink'], 0, 0); |
|
|
|
|
|
# second control : we put the label, and ask libconf to build the best widget it can, for the key USER of the $autologin object |
|
|
$table->attach(Gtk2::Label->new(N('User')), 0, 1, 1, 2, ['fill', 'expand'], ['shrink', 'shrink'], 0, 0); |
|
|
$table->attach(my $widget_USER=getBestWidget($autologin, 'USER'), 1, 2, 1, 2, ['fill', 'expand'], ['shrink', 'shrink'], 0, 0); |
|
|
|
|
|
# third control : we put the label, and ask libconf to build the best widget it can, for the key DESKTOP of the $desktop object |
|
|
$table->attach(Gtk2::Label->new(N('Window Manager')), 0, 1, 2, 3, ['fill', 'expand'], ['shrink', 'shrink'], 0, 0); |
|
|
$table->attach(my $widget_WM=getBestWidget($desktop, 'DESKTOP'), 1, 2, 2, 3, ['fill', 'expand'], ['shrink', 'shrink'], 0, 0); |
|
|
|
|
31 |
gtkadd($window, |
gtkadd($window, |
32 |
gtkpack_(Gtk2::VBox->new(0,10), |
gtkpack_(Gtk2::VBox->new(0,10), |
33 |
1, $table, |
1, create_packtable({ col_spacings => 5, row_spacings => 5 }, |
34 |
|
[ |
35 |
|
# first control : we put the label, and ask libconf to build the best widget for the key AUTOLOGIN of $autologin |
36 |
|
new Gtk2::Label(N('Activate autologin')), |
37 |
|
my $widget_AUTOLOGIN = getBestWidget($autologin, '{AUTOLOGIN}'), |
38 |
|
], |
39 |
|
[ |
40 |
|
# second control : we put the label, and ask libconf to build the best widget for the key USER of $autologin |
41 |
|
new Gtk2::Label(N('User')), |
42 |
|
my $widget_USER = getBestWidget($autologin, '{USER}'), |
43 |
|
], |
44 |
|
[ |
45 |
|
# third control : we put the label, and ask libconf to build the best widget it can, for the key DESKTOP of $desktop |
46 |
|
new Gtk2::Label(N('Window Manager')), |
47 |
|
my $widget_WM = getBestWidget($autologin, '{DESKTOP}'), |
48 |
|
] |
49 |
|
), |
50 |
0, gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'), |
0, gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'end'), |
51 |
gtksignal_connect(new Gtk2::Button(N("OK")), |
gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { save_exit(); }), |
52 |
clicked => sub { save_exit(); }), |
gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { cancel_exit(); }) |
|
gtksignal_connect(new Gtk2::Button(N("Cancel")), |
|
|
clicked => sub { cancel_exit(); }) |
|
53 |
), |
), |
54 |
) |
) |
55 |
); |
); |
73 |
} |
} |
74 |
|
|
75 |
sub save_exit { |
sub save_exit { |
|
|
|
76 |
# we saves the modifications |
# we saves the modifications |
77 |
save(); |
save(); |
|
|
|
78 |
# we exit the gtk2 main loop |
# we exit the gtk2 main loop |
79 |
Gtk2->main_quit(); |
Gtk2->main_quit(); |
80 |
} |
} |
81 |
|
|
82 |
# the function called when the user clicks on the Cancel button |
# the function called when the user clicks on the Cancel button |
83 |
sub cancel_exit { |
sub cancel_exit { |
|
|
|
84 |
# we exit the gtk2 main loop |
# we exit the gtk2 main loop |
85 |
Gtk2->main_quit(); |
Gtk2->main_quit(); |
86 |
} |
} |