[Xfce4-commits] <xfce4-panel:xfce-4.6> Remove the hour interval from the clock, minutes are good enough.

Nick Schermer noreply at xfce.org
Fri Oct 16 14:30:03 CEST 2009


Updating branch refs/heads/xfce-4.6
         to 2cb1bafd18cee705de645e8d564167fb681b3be8 (commit)
       from 3e0a58c8880d1e755b86d084a6de16a67dcd0fac (commit)

commit 2cb1bafd18cee705de645e8d564167fb681b3be8
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Oct 6 10:24:04 2009 +0200

    Remove the hour interval from the clock, minutes are good enough.

 plugins/clock/clock.c |   29 ++++++-----------------------
 plugins/clock/clock.h |    1 -
 2 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index e18304e..325fef1 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -121,10 +121,9 @@ static guint
 xfce_clock_util_interval_from_format (const gchar *format)
 {
     const gchar *p;
-    guint        interval = CLOCK_INTERVAL_HOUR;
 
     if (G_UNLIKELY (format == NULL))
-        return CLOCK_INTERVAL_HOUR;
+        return CLOCK_INTERVAL_MINUTE;
 
     for (p = format; *p != '\0'; ++p)
     {
@@ -140,16 +139,11 @@ xfce_clock_util_interval_from_format (const gchar *format)
                 case 'T':
                 case 'X':
                     return CLOCK_INTERVAL_SECOND;
-
-                case 'M':
-                case 'R':
-                    interval = CLOCK_INTERVAL_MINUTE;
-                    break;
             }
         }
     }
 
-    return interval;
+    return CLOCK_INTERVAL_MINUTE;
 }
 
 
@@ -171,22 +165,11 @@ xfce_clock_util_next_interval (guint timeout_interval)
     xfce_clock_util_get_localtime (&tm);
 
     /* add the interval time to the next update */
-    switch (timeout_interval)
+    if (timeout_interval == CLOCK_INTERVAL_MINUTE)
     {
-        case CLOCK_INTERVAL_HOUR:
-            /* ms to next hour */
-            interval += (60 - tm.tm_min) * CLOCK_INTERVAL_MINUTE;
-
-            /* fall-through to add the minutes */
-
-        case CLOCK_INTERVAL_MINUTE:
-            /* ms to next minute */
-            interval += (60 - tm.tm_sec) * CLOCK_INTERVAL_SECOND;
-            break;
-
-        default:
-            break;
-    }
+        /* ms to next minute */
+        interval += (60 - tm.tm_sec) * CLOCK_INTERVAL_SECOND;
+	}
 
     return interval;
 }
diff --git a/plugins/clock/clock.h b/plugins/clock/clock.h
index 9f31ff3..f387bdd 100644
--- a/plugins/clock/clock.h
+++ b/plugins/clock/clock.h
@@ -28,7 +28,6 @@ G_BEGIN_DECLS
 
 #define CLOCK_INTERVAL_SECOND (1000)
 #define CLOCK_INTERVAL_MINUTE (60 * 1000)
-#define CLOCK_INTERVAL_HOUR   (3600 * 1000)
 
 #define BUFFER_SIZE            256
 #define DEFAULT_TOOLTIP_FORMAT "%A %d %B %Y"



More information about the Xfce4-commits mailing list