[gnome-control-center] display: use the setting for 12/24 time in the panel



commit 1a4d551780edc210538c4e675e2a0d99081209c9
Author: William Jon McCann <jmccann redhat com>
Date:   Thu Jan 20 17:32:09 2011 -0500

    display: use the setting for 12/24 time in the panel

 panels/display/xrandr-capplet.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/panels/display/xrandr-capplet.c b/panels/display/xrandr-capplet.c
index 4396753..a0cc85c 100644
--- a/panels/display/xrandr-capplet.c
+++ b/panels/display/xrandr-capplet.c
@@ -35,11 +35,15 @@
 #include <glib/gi18n.h>
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-bindings.h>
+#include <gsettings-desktop-schemas/gdesktop-enums.h>
 
 #include "xrandr-capplet.h"
 
 #define TOP_BAR_HEIGHT 10
 
+#define CLOCK_SCHEMA "org.gnome.desktop.interface"
+#define CLOCK_FORMAT_KEY "clock-format"
+
 typedef struct App App;
 typedef struct GrabInfo GrabInfo;
 
@@ -50,6 +54,7 @@ struct App
   GnomeRRLabeler *labeler;
   GnomeRROutputInfo         *current_output;
 
+  GSettings      *clock_settings;
   GtkBuilder     *builder;
 
   GtkWidget      *panel;
@@ -1918,6 +1923,7 @@ paint_output (App *app, cairo_t *cr, int i)
       char *text;
       gboolean use_24;
       GDateTime *dt;
+      GDesktopClockFormat value;
 
       /* top bar */
       cairo_rectangle (cr, x, y, w * scale + 0.5, TOP_BAR_HEIGHT);
@@ -1931,6 +1937,8 @@ paint_output (App *app, cairo_t *cr, int i)
 
       /* clock */
       /* FIXME: set 12/24 hour */
+      value = g_settings_get_enum (app->clock_settings, CLOCK_FORMAT_KEY);
+      use_24 = value == G_DESKTOP_CLOCK_FORMAT_24H;
       if (use_24)
         clock_format = _("%a %R");
       else
@@ -2455,6 +2463,10 @@ destroy_app (App *app)
 {
   g_object_unref (app->screen);
   g_object_unref (app->builder);
+
+  if (app->clock_settings != NULL)
+    g_object_unref (app->clock_settings);
+
   gnome_rr_labeler_hide (app->labeler);
   g_object_unref (app->labeler);
 
@@ -2497,6 +2509,8 @@ run_application (void)
       return NULL;
     }
 
+  app->clock_settings = g_settings_new (CLOCK_SCHEMA);
+
   app->panel = _gtk_builder_get_widget (builder, "display-panel");
 
   if (!app->panel)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]