summaryrefslogtreecommitdiffstats
path: root/menus_launcher.pl
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-11-18 07:55:55 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-11-18 07:55:55 +0000
commit6bdda06d2f204d64c9b5aa7da10d517b5db01f93 (patch)
tree189f5fc079be72ee2667c600d6511e10c2251ec1 /menus_launcher.pl
parentaf3ad14e2e0e37bb94f74dfc9691c70fee83393f (diff)
downloadcontrol-center-6bdda06d2f204d64c9b5aa7da10d517b5db01f93.tar
control-center-6bdda06d2f204d64c9b5aa7da10d517b5db01f93.tar.gz
control-center-6bdda06d2f204d64c9b5aa7da10d517b5db01f93.tar.bz2
control-center-6bdda06d2f204d64c9b5aa7da10d517b5db01f93.tar.xz
control-center-6bdda06d2f204d64c9b5aa7da10d517b5db01f93.zip
code cleaning/shrunking
clock.pl, menus_launchers.pl, print_launcher.pl - use my_gtk & common to : o automatically handle embedding o simplify code o ease gtk2 port o don't uselessly initialize gtk & locales o ... don't do what my_gtk already offer to do for us clock.pl: kill stupid code copied between two signal handlers whereas it has no purpose since my_gtk just exited in second handler mcc: - explain why we initialize interactive without using it - global workaround for broken locales - bump version
Diffstat (limited to 'menus_launcher.pl')
-rwxr-xr-xmenus_launcher.pl57
1 files changed, 23 insertions, 34 deletions
diff --git a/menus_launcher.pl b/menus_launcher.pl
index ce94c41f..e598f362 100755
--- a/menus_launcher.pl
+++ b/menus_launcher.pl
@@ -2,72 +2,61 @@
use strict;
use lib qw(/usr/lib/libDrakX);
-use ugtk;
-use my_gtk;
use common;
+use my_gtk qw(:helpers :wrappers :various);;
use interactive;
use standalone;
-init Gtk;
-Gtk->set_locale;
#-------------------------------------------------------------
# i18n
-# IMPORTANT: next code is needed to get correct namespace
-# (drakconf instead of libDrakX)
+# IMPORTANT: next code is needed to get correct namespace : drakconf instead of libDrakX
# (This version is now UTF8 compliant - Sg 2001-08-18)
#-------------------------------------------------------------
push @::textdomains, 'drakconf';
my $bindir = "/usr/bin/";
-my $window = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
-$window->signal_connect (delete_event => sub {
- ugtk::gtkset_mousecursor_normal();
+my $my_win = my_gtk->new('print_launcher');
+$my_win->{rwindow}->set_title(N("Menu Configuration Center")) unless $::isEmbedded;
+$my_win->{window}->signal_connect(delete_event => sub {
+ gtkset_mousecursor_normal();
my_gtk->exit(0);
} );
-my $vbox = new Gtk::VBox(0,0);
-$window->set_title(N("Menu Configuration Center"));
-$window->add($vbox);
-$vbox->pack_start(new Gtk::Label(N("Menu Configuration Center") . N("\n\nChoose which menu you want to configure")),0,0,5);
-$vbox->pack_start(new Gtk::HSeparator,0,0,5);
-my $table = new Gtk::Table (3,2, 0);
+my $vbox = new Gtk::VBox(0, 0);
+$my_win->{window}->add($vbox);
+$vbox->pack_start(new Gtk::Label(N("Menu Configuration Center") . N("\n\nChoose which menu you want to configure")), 0, 0, 5);
+$vbox->pack_start(new Gtk::HSeparator, 0, 0, 5);
+my $table = new Gtk::Table (3, 2, 0);
$table->set_border_width(5);
$table->set_row_spacings(5);
$table->set_col_spacings(5);
-my $hbox = new Gtk::HBox(0,0);
-$vbox->pack_start($hbox,1,1,1);
-$hbox->pack_start($table,0,0,5);
+my $hbox = new Gtk::HBox(0, 0);
+$vbox->pack_start($hbox, 1, 1, 1);
+$hbox->pack_start($table, 0, 0, 5);
$table->attach (new Gtk::Label(N("System menu")), 0, 1, 0, 1, 'fill', 'fill', 0, 0);
-my $b1 = new Gtk::Button(N("Configure..."));
-$b1->signal_connect(clicked => sub { system("$bindir/menudrake --systemmenu &") } );
+my $b1 = gtksignal_connect(new Gtk::Button(N("Configure...")), clicked => sub { system("$bindir/menudrake --systemmenu &") } );
$table->attach ($b1, 1, 2, 0, 1, 'fill', 'fill', 0, 0);
$table->attach (new Gtk::Label(N("User menu")), 0, 1, 1, 2, 'fill', 'fill', 0, 0);
my (@user_info, @usernames);
setpwent();
do { @user_info = getpwent();
- my ($uname, $uid) = @user_info[0,2];
+ my ($uname, $uid) = @user_info[0, 2];
push (@usernames, $uname) if $uid > 500 && $uname eq $ENV{INITIAL_USER};
} while (@user_info);
my $combo = new Gtk::Combo;
$combo->set_popdown_strings (@usernames, "root");
$table->attach ($combo, 2, 3, 1, 2, 'fill', 'fill', 0, 0);
-my $b2 = new Gtk::Button(N("Configure..."));
-$b2->signal_connect(clicked => sub { my $a = $combo->entry->get_text();
- $a eq "root" ?
- system("$bindir/menudrake --usermenu &") :
- system(" su $a -c \"$bindir/menudrake &\"");
- } );
+my $b2 = gtksignal_connect(new Gtk::Button(N("Configure...")),
+ clicked => sub { system($combo->entry->get_text() eq "root" ? "$bindir/menudrake --usermenu &" : " su $a -c \"$bindir/menudrake &\"") } );
$table->attach ($b2, 1, 2, 1, 2, 'fill', 'fill', 0, 0);
-$vbox->pack_start(new Gtk::HSeparator,0,0,5);
+$vbox->pack_start(new Gtk::HSeparator, 0, 0, 5);
my $bbox = new Gtk::HButtonBox;
-$vbox->pack_start($bbox,0,0,5);
+$vbox->pack_start($bbox, 0, 0, 5);
$bbox->set_layout(-end);
-my $button_ok = new Gtk::Button N("Done");
-$button_ok->signal_connect (clicked => sub { my_gtk->exit(0) });
+my $button_ok = gtksignal_connect(new Gtk::Button(N("Done")), clicked => sub { my_gtk->exit(0) });
$button_ok->can_default(1);
$bbox->add($button_ok);
-$window->show_all;
-
-Gtk->main;
+$my_win->{window}->show_all;
+$my_win->main;
my_gtk->exit(0);