diff options
-rwxr-xr-x | clock.pl | 20 | ||||
-rwxr-xr-x | menus_launcher.pl | 12 | ||||
-rwxr-xr-x | print_launcher.pl | 10 |
3 files changed, 15 insertions, 27 deletions
@@ -4,15 +4,13 @@ use strict; use lib qw(/usr/lib/libDrakX); use POSIX; use common; +# i18n : IMPORTANT to get correct namespace (drakconf instead of libDrakX) +BEGIN { unshift @::textdomains, 'drakconf' } use ugtk2 qw(:helpers :wrappers); use interactive; use standalone; use timezone; -#------------------------------------------------------------- -# i18n : IMPORTANT to get correct namespace (drakconf instead of libDrakX) -unshift @::textdomains, 'drakconf'; - my $in = interactive->vnew('su'); my $pixmap; my $radius; @@ -57,6 +55,8 @@ my $button_reset; my (undef, undef, $h_old, $old_day, $old_month, $old_year) = localtime(time()); +my @image_size = (300, 300); + $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0), 1, gtkpack_(Gtk2::HBox->new(0,0), 1, gtkpack_(Gtk2::VBox->new(0,0), @@ -65,7 +65,7 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0), ), 1, gtkpack_(Gtk2::VBox->new(0,0), 0, gtkpack_(Gtk2::HBox->new(0,0), - 0, $drawing_area = gtkset_size_request(Gtk2::DrawingArea->new, 300, 300), + 0, $drawing_area = gtkset_size_request(Gtk2::DrawingArea->new, @image_size), ), 0, gtkpack_(Gtk2::HBox->new(1,0), 0, Gtk2::HBox->new(1,0), @@ -104,6 +104,11 @@ $my_win->{window}->add(gtkpack_(Gtk2::VBox->new(0,0), my $pressed; $drawing_area->set_events([ 'button_press_mask', 'button_release_mask', "pointer_motion_mask" ]); $drawing_area->signal_connect(expose_event => \&expose_event); +$drawing_area->signal_connect(realize => sub { + my $window = $drawing_area->window; + $pixmap = Gtk2::Gdk::Pixmap->new($window, @image_size, $window->get_depth); + }); + $drawing_area->signal_connect(button_press_event => sub { $pressed = 1 }); $drawing_area->signal_connect(button_release_event => sub { $first = 1; $pressed = 0 }); $drawing_area->signal_connect(motion_notify_event => \&motion_event); @@ -199,10 +204,6 @@ sub determine_radian { sub expose_event { my ($widget, $event) = @_; my ($x, $y, $width, $height) = $event->area->values; - unless ($pixmap) { - my $window = $widget->window; - $pixmap = Gtk2::Gdk::Pixmap->new($window, $width, $height, $window->get_depth); - } $widget->window->draw_drawable($widget->style->fg_gc('normal'), $pixmap, $x, $y, $x, $y, $width, $height); 0; } @@ -225,7 +226,6 @@ sub time_to_rad { sub Repaint { my ($drawing_area, $update_time) = @_; - time_to_rad(localtime(time())) if $update_time; my ($width, $height) = ($drawing_area->allocation->width, $drawing_area->allocation->height); my $dRadians_hour_real = POSIX::floor($dRadians_hour / $PI*6) * $PI/6.0 + $dRadians_min / 12; diff --git a/menus_launcher.pl b/menus_launcher.pl index fc798eca..764eafe7 100755 --- a/menus_launcher.pl +++ b/menus_launcher.pl @@ -3,18 +3,12 @@ use strict; use lib qw(/usr/lib/libDrakX); use common; +# i18n : IMPORTANT to get correct namespace (drakconf instead of libDrakX) +BEGIN { unshift @::textdomains, 'drakconf' } use ugtk2 qw(:helpers :wrappers); use interactive; use standalone; -#------------------------------------------------------------- -# i18n -# IMPORTANT: next code is needed to get correct namespace : drakconf instead of libDrakX -# (This version is now UTF8 compliant - Sg 2001-08-18) -#------------------------------------------------------------- - -unshift @::textdomains, 'drakconf'; - my $bindir = "/usr/bin/"; my $my_win = ugtk2->new('print_launcher'); $my_win->{rwindow}->set_title(N("Menu Configuration Center")) unless $::isEmbedded; @@ -38,7 +32,7 @@ my $b1 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), clicked => sub $table->attach($b1, 1, 2, 0, 1, 'fill', 'fill', 0, 0); $table->attach(Gtk2::Label->new(N("User menu")), 0, 1, 1, 2, 'fill', 'fill', 0, 0); -my $combo = Gtk2::Combo->new; +my $combo = Gtk2::Combo->new;* $combo->set_popdown_strings("root", sort(list_users())); $table->attach($combo, 2, 3, 1, 2, 'fill', 'fill', 0, 0); my $b2 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), diff --git a/print_launcher.pl b/print_launcher.pl index fca534b0..1f21665e 100755 --- a/print_launcher.pl +++ b/print_launcher.pl @@ -3,18 +3,12 @@ use strict; use lib qw(/usr/lib/libDrakX); use common; +# i18n : IMPORTANT to get correct namespace (drakconf instead of libDrakX) +BEGIN { unshift @::textdomains, 'drakconf' } use ugtk2 qw(:helpers :wrappers);; use interactive; use standalone; -#------------------------------------------------------------- -# i18n -# IMPORTANT: next code is needed to get correct namespace : drakconf instead of libDrakX -# (This version is now UTF8 compliant - Sg 2001-08-18) -#------------------------------------------------------------- - -unshift @::textdomains, 'drakconf'; - my $sbindir = "/usr/sbin/"; my $my_win = ugtk2->new('print_launcher'); $my_win->{rwindow}->set_title(N("Printing configuration")) unless $::isEmbedded; |