From daa269fbc7127860a96ba9609058d69ca175e829 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 14 Nov 2002 14:00:57 +0000 Subject: - perl_checker fixes - don't use "perl -w" - use common to simplify i18n - fix undefined quit_global ... which was not a visible bug in embedded case - sync with latest libDrakx i18n changes --- menus_launcher.pl | 60 ++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) (limited to 'menus_launcher.pl') diff --git a/menus_launcher.pl b/menus_launcher.pl index 1054508c..011e1dc6 100755 --- a/menus_launcher.pl +++ b/menus_launcher.pl @@ -1,38 +1,34 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl -use POSIX; -use Gtk; +use strict; use lib qw(/usr/lib/libDrakX); +use POSIX; +use ugtk; +use common; use interactive; use standalone; init Gtk; Gtk->set_locale; -use strict; #------------------------------------------------------------- -# i18n routines -# IMPORTANT: next two routines have to be redefined here to -# get correct namespace (drakconf instead of libDrakX) -# (This version is now UTF8 compliant - Sg 2001-08-18) +# i18n +# IMPORTANT: next code is needed to get correct namespace +# (drakconf instead of libDrakX) +# (This version is now UTF8 compliant - Sg 2001-08-18) #------------------------------------------------------------- -sub _ { - my $s = shift @_; my $t = translate($s); - sprintf $t, @_; -} - -sub translate { - my ($s) = @_; - $s ? c::dgettext('drakconf', $s) : ''; -} +push @::textdomains, 'drakconf'; -my $_bindir = "/usr/bin/"; +my $bindir = "/usr/bin/"; my $window = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel; -$window->signal_connect ( delete_event => \&quit_global ); +$window->signal_connect (delete_event => sub { + ugtk::gtkset_mousecursor_normal(); + Gtk->exit(0); +} ); my $vbox = new Gtk::VBox(0,0); -$window->set_title(_("Menu Configuration Center")); +$window->set_title(N("Menu Configuration Center")); $window->add($vbox); -$vbox->pack_start(new Gtk::Label(_("Menu Configuration Center") . _("\n\nChoose which menu you want to configure")),0,0,5); +$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); @@ -41,33 +37,33 @@ $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); -$table->attach (new Gtk::Label(_("System menu")), 0, 1, 0, 1, 'fill', 'fill', 0, 0); -my $b1 = new Gtk::Button(_("Configure...")); -$b1->signal_connect( clicked => sub { system("$_bindir/menudrake --systemmenu & "); } ); +$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 &") } ); $table->attach ($b1, 1, 2, 0, 1, 'fill', 'fill', 0, 0); -$table->attach (new Gtk::Label(_("User menu")), 0, 1, 1, 2, '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]; - push (@usernames, $uname) if ($uid > 500 && $uname eq $ENV{INITIAL_USER}); + 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(_("Configure...")); -$b2->signal_connect( clicked => sub { my $a = $combo->entry->get_text(); +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 &\""); + system("$bindir/menudrake --usermenu &") : + system(" 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); my $bbox = new Gtk::HButtonBox; $vbox->pack_start($bbox,0,0,5); $bbox->set_layout(-end); -my $button_ok = new Gtk::Button _("Done"); -$button_ok->signal_connect ( clicked => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0); }); +my $button_ok = new Gtk::Button N("Done"); +$button_ok->signal_connect (clicked => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) }); $button_ok->can_default(1); $bbox->add($button_ok); -- cgit v1.2.1