[Xfce4-commits] r25723 - xfce4-panel/branches/xfce_4_4/plugins/clock

Jasper Huijsmans jasper at xfce.org
Sun May 20 11:40:44 CEST 2007


Author: jasper
Date: 2007-05-20 09:40:44 +0000 (Sun, 20 May 2007)
New Revision: 25723

Modified:
   xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c
Log:
Make sure tooltips are set for more than 1 clock instance (bug #3109).

Modified: xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c
===================================================================
--- xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c	2007-05-20 09:40:35 UTC (rev 25722)
+++ xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c	2007-05-20 09:40:44 UTC (rev 25723)
@@ -70,6 +70,7 @@
     gboolean secs;
 
     gboolean show_frame;
+    gint mday;
 }
 Clock;
 
@@ -100,16 +101,15 @@
 {
     time_t ticks;
     struct tm *tm;
-    static gint mday = -1;
     char date_s[255];
     char *utf8date = NULL;
 
     ticks = time (0);
     tm = localtime (&ticks);
 
-    if (mday != tm->tm_mday)
+    if (clock->mday != tm->tm_mday)
     {
-        mday = tm->tm_mday;
+        clock->mday = tm->tm_mday;
 
         /* Use format characters from strftime(3)
 	 * to get the proper string for your locale.
@@ -293,25 +293,6 @@
 }
 
 static void
-clock_screen_changed (GtkWidget *plugin, GdkScreen *screen, 
-                      Clock *clock)
-{
-	/* return when the widget is not visible (when moving the plugin) */
-	if (GTK_IS_INVISIBLE (clock->clock) == FALSE)
-	    return;
-	
-	gtk_widget_destroy (clock->clock);
-	
-	clock->clock = xfce_clock_new ();
-    gtk_widget_show (clock->clock);
-    gtk_container_add (GTK_CONTAINER (clock->frame), clock->clock);
-
-    xfce_clock_set_interval (XFCE_CLOCK (clock->clock), 1000);
-    
-    clock_read_rc_file (clock->plugin, clock);
-}
-
-static void
 clock_write_rc_file (XfcePanelPlugin *plugin, Clock *clock)
 {
     char *file;
@@ -335,6 +316,27 @@
     xfce_rc_close (rc);
 }
 
+static void
+clock_screen_changed (GtkWidget *plugin, GdkScreen *screen, 
+                      Clock *clock)
+{
+    /* return when the widget is not visible (when moving the plugin) */
+    if (GTK_IS_INVISIBLE (clock->clock) == FALSE)
+        return;
+
+    gtk_widget_destroy (clock->clock);
+
+    clock->clock = xfce_clock_new ();
+    gtk_widget_show (clock->clock);
+    gtk_container_add (GTK_CONTAINER (clock->frame), clock->clock);
+
+    clock->mday = -1;
+
+    xfce_clock_set_interval (XFCE_CLOCK (clock->clock), 1000);
+    
+    clock_read_rc_file (clock->plugin, clock);
+}
+
 /* Create widgets and connect to signals */
 
 static void 
@@ -373,6 +375,8 @@
 
     clock_read_rc_file (plugin, clock);
     
+    clock->mday = -1;
+
     clock->tips = gtk_tooltips_new ();
     g_object_ref (G_OBJECT (clock->tips));
     gtk_object_sink (GTK_OBJECT (clock->tips));
@@ -388,7 +392,7 @@
  * -------------------------------------------------------------------- */
 
 static void
-clock_set_sensative (ClockDialog *cd)
+clock_set_sensitive (ClockDialog *cd)
 {
     if (cd->clock->mode == XFCE_CLOCK_ANALOG)
     {
@@ -423,7 +427,7 @@
 	xfce_clock_show_military (XFCE_CLOCK (cd->clock->clock),
 	                          active);
 	
-	clock_set_sensative (cd);
+	clock_set_sensitive (cd);
     }
     else if (cb == cd->cb_ampm)
     {
@@ -448,7 +452,7 @@
     cd->clock->mode = gtk_combo_box_get_active(cb);
     xfce_clock_set_mode (XFCE_CLOCK (cd->clock->clock), cd->clock->mode);
     
-    clock_set_sensative (cd);
+    clock_set_sensitive (cd);
     
     clock_update_size (cd->clock, 
             xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (cd->clock->plugin)));
@@ -548,7 +552,7 @@
     g_signal_connect (cb, "toggled",
             G_CALLBACK (clock_button_toggled), cd);
 
-    clock_set_sensative (cd);
+    clock_set_sensitive (cd);
 
     g_signal_connect (dlg, "response",
             G_CALLBACK (clock_dialog_response), cd);



More information about the Xfce4-commits mailing list