Author: nick
Date: 2007-10-17 09:15:21 +0000 (Wed, 17 Oct 2007)
New Revision: 26138

Modified:
   xfce4-panel/trunk/plugins/clock/clock-lcd.c
   xfce4-panel/trunk/plugins/clock/clock.c
Log:
* Resize the lcd clock when the number of hour digits changed. Reported by 
Moritz.


Modified: xfce4-panel/trunk/plugins/clock/clock-lcd.c
===================================================================
--- xfce4-panel/trunk/plugins/clock/clock-lcd.c 2007-10-17 08:51:27 UTC (rev 
26137)
+++ xfce4-panel/trunk/plugins/clock/clock-lcd.c 2007-10-17 09:15:21 UTC (rev 
26138)
@@ -303,13 +303,17 @@
     {
         /* get the local time */
         xfce_clock_util_get_localtime (&tm);
-
+        
         /* draw the hours */
         ticks = tm.tm_hour;
 
         /* convert 24h clock to 12h clock */
         if (!clock->show_military && ticks > 12)
             ticks -= 12;
+            
+        /* queue a resize when the number of hour digits changed */
+        if (G_UNLIKELY ((ticks == 10 || ticks == 0) && tm.tm_min == 0 && 
tm.tm_sec == 0))
+          gtk_widget_queue_resize (widget);
 
         if (ticks >= 10)
         {

Modified: xfce4-panel/trunk/plugins/clock/clock.c
===================================================================
--- xfce4-panel/trunk/plugins/clock/clock.c     2007-10-17 08:51:27 UTC (rev 
26137)
+++ xfce4-panel/trunk/plugins/clock/clock.c     2007-10-17 09:15:21 UTC (rev 
26138)
@@ -33,8 +33,14 @@
 #include "clock-lcd.h"
 
 
+#define USE_DEBUG_TIME (0)
 
+
+
 /** prototypes **/
+#if USE_DEBUG_TIME
+static void         xfce_clock_util_get_debug_localtime  (struct tm       *tm);
+#endif
 static guint        xfce_clock_util_interval_from_format (const gchar     
*format);
 static guint        xfce_clock_util_next_interval        (guint            
timeout_interval);
 static gboolean     xfce_clock_tooltip_update            (gpointer         
user_data);
@@ -67,10 +73,50 @@
 #else
     localtime_r (&now, tm);
 #endif
+
+#if USE_DEBUG_TIME
+    xfce_clock_util_get_debug_localtime (tm);
+#endif
 }
 
 
 
+#if USE_DEBUG_TIME
+static void
+xfce_clock_util_get_debug_localtime (struct tm *tm)
+{
+    static gint hour = 23;
+    static gint min = 59;
+    static gint sec = 45;
+    
+    /* add 1 seconds */
+    sec++;
+    
+    /* update times */
+    if (sec > 59)
+    {
+        sec = 0;
+        min++;
+    }
+    if (min > 59)
+    {
+        min = 0;
+        hour++;
+    }
+    if (hour > 23)
+    {
+        hour = 0;
+    }
+    
+    /* set time structure */
+    tm->tm_sec = sec;
+    tm->tm_min = min;
+    tm->tm_hour = hour;
+}
+#endif
+
+
+
 static guint
 xfce_clock_util_interval_from_format (const gchar *format)
 {

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to