[gnome-control-center] datetime: Don't depend on gnome-shell for the clock format
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] datetime: Don't depend on gnome-shell for the clock format
- Date: Thu, 2 Dec 2010 15:39:25 +0000 (UTC)
commit 6de52cfb9728d4ae9fe8e5cd8e51325240eb0886
Author: Bastien Nocera <hadess hadess net>
Date: Thu Dec 2 15:37:47 2010 +0000
datetime: Don't depend on gnome-shell for the clock format
We really don't want to depend on a module that might not be
installed for this setting. Use the one in gsettings-desktop-schemas
instead.
panels/datetime/cc-datetime-panel.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index ca56ac2..9ff5af2 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -23,6 +23,7 @@
#include "cc-timezone-map.h"
#include "set-timezone.h"
+#include <gsettings-desktop-schemas/gdesktop-enums.h>
#include <string.h>
#include <stdlib.h>
@@ -40,8 +41,8 @@ enum {
#define W(x) (GtkWidget*) gtk_builder_get_object (priv->builder, x)
-#define CLOCK_SCHEMA "org.gnome.shell.clock"
-#define CLOCK_FORMAT_KEY "format"
+#define CLOCK_SCHEMA "org.gnome.desktop.interface"
+#define CLOCK_FORMAT_KEY "clock-format"
struct _CcDateTimePanelPrivate
{
@@ -155,9 +156,9 @@ change_clock_settings (GtkWidget *widget,
panel);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (W ("12_radiobutton"))))
- g_settings_set_string (priv->settings, CLOCK_FORMAT_KEY, "12-hour");
+ g_settings_set_enum (priv->settings, CLOCK_FORMAT_KEY, G_DESKTOP_CLOCK_FORMAT_12H);
else
- g_settings_set_string (priv->settings, CLOCK_FORMAT_KEY, "24-hour");
+ g_settings_set_enum (priv->settings, CLOCK_FORMAT_KEY, G_DESKTOP_CLOCK_FORMAT_24H);
g_signal_handlers_unblock_by_func (priv->settings, clock_settings_changed_cb,
panel);
@@ -171,14 +172,14 @@ clock_settings_changed_cb (GSettings *settings,
CcDateTimePanelPrivate *priv = panel->priv;
GtkWidget *radio12, *radio24;
gboolean use_12_hour;
- gchar *value;
+ GDesktopClockFormat value;
- value = g_settings_get_string (settings, CLOCK_FORMAT_KEY);
+ value = g_settings_get_enum (settings, CLOCK_FORMAT_KEY);
radio12 = W ("12_radiobutton");
radio24 = W ("24_radiobutton");
- use_12_hour = (g_strcmp0 (value, "12-hour") == 0);
+ use_12_hour = (value == G_DESKTOP_CLOCK_FORMAT_12H);
g_signal_handlers_block_by_func (radio12, change_clock_settings, panel);
g_signal_handlers_block_by_func (radio24, change_clock_settings, panel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]