summaryrefslogtreecommitdiffstats
path: root/clock.pl
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-02-20 15:10:19 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-02-20 15:10:19 +0000
commit55ae3d490d62866017c7235b80466594e862d5db (patch)
tree1e30e50c9b690d5234ce91f9b7f275793ab00285 /clock.pl
parent0c21cc7ac7b9edde8bcb6e09d2b62e86a6b156d4 (diff)
downloadcontrol-center-55ae3d490d62866017c7235b80466594e862d5db.tar
control-center-55ae3d490d62866017c7235b80466594e862d5db.tar.gz
control-center-55ae3d490d62866017c7235b80466594e862d5db.tar.bz2
control-center-55ae3d490d62866017c7235b80466594e862d5db.tar.xz
control-center-55ae3d490d62866017c7235b80466594e862d5db.zip
- adapt to new ugtk2 utf8/l10n scheme
- fix #1922
Diffstat (limited to 'clock.pl')
-rwxr-xr-xclock.pl20
1 files changed, 10 insertions, 10 deletions
diff --git a/clock.pl b/clock.pl
index 8416b442..90288bf7 100755
--- a/clock.pl
+++ b/clock.pl
@@ -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;