1 |
#!/usr/bin/perl |
2 |
|
3 |
use strict; |
4 |
use lib qw(/usr/lib/libDrakX); |
5 |
use common; |
6 |
# i18n : IMPORTANT to get correct namespace (drakconf instead of libDrakX) |
7 |
BEGIN { unshift @::textdomains, 'drakconf' } |
8 |
use ugtk2 qw(:helpers :wrappers); |
9 |
use interactive; |
10 |
use standalone; |
11 |
|
12 |
sub gtkcan_default { |
13 |
$_[0]->can_default($_->[1]); |
14 |
$_[0]; |
15 |
} |
16 |
|
17 |
my $bindir = "/usr/bin/"; |
18 |
my $my_win = ugtk2->new('print_launcher'); |
19 |
$my_win->{rwindow}->set_title(N("Menu Configuration Center")) unless $::isEmbedded; |
20 |
$my_win->{window}->signal_connect(delete_event => sub { |
21 |
gtkset_mousecursor_normal(); |
22 |
ugtk2->exit(0); |
23 |
}); |
24 |
my $table = Gtk2::Table->new(3, 2, 0); |
25 |
$table->set_border_width(5); |
26 |
$table->set_row_spacings(5); |
27 |
$table->set_col_spacings(5); |
28 |
$table->attach(Gtk2::Label->new(N("System menu")), 0, 1, 0, 1, 'fill', 'fill', 0, 0); |
29 |
my $b1 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), clicked => sub { system("$bindir/menudrake --systemmenu &") }); |
30 |
$table->attach($b1, 1, 2, 0, 1, 'fill', 'fill', 0, 0); |
31 |
$table->attach(Gtk2::Label->new(N("User menu")), 0, 1, 1, 2, 'fill', 'fill', 0, 0); |
32 |
|
33 |
my $combo = Gtk2::OptionMenu->new; |
34 |
$combo->set_popdown_strings("root", sort(list_users())); |
35 |
$table->attach($combo, 2, 3, 1, 2, 'fill', 'fill', 0, 0); |
36 |
my $b2 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), |
37 |
clicked => sub { my $a = $combo->entry->get_text(); system($a eq "root" ? "$bindir/menudrake --usermenu &" : " su $a -c \"$bindir/menudrake\" &") }); |
38 |
$table->attach($b2, 1, 2, 1, 2, 'fill', 'fill', 0, 0); |
39 |
|
40 |
$my_win->{window}->add(gtkpack(Gtk2::VBox->new(0, 0), |
41 |
Gtk2::Label->new(N("Menu Configuration Center") . N("\n\nChoose which menu you want to configure")), |
42 |
Gtk2::HSeparator->new, |
43 |
$table, |
44 |
Gtk2::HSeparator->new, |
45 |
gtkpack(gtkset_layout(Gtk2::HButtonBox->new, 'end'), |
46 |
gtkcan_default(gtksignal_connect(Gtk2::Button->new_from_stock('gtk-close'), clicked => sub { ugtk2->exit(0) }), 1) |
47 |
), |
48 |
), |
49 |
); |
50 |
|
51 |
|
52 |
$my_win->{window}->show_all; |
53 |
$my_win->main; |
54 |
ugtk2->exit(0); |