From a994c55bc39f419ce752d02a60bc01d5659aad62 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 20:56:23 -0500 Subject: Going into the gsettings world. --- src/indicator-datetime.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 854bf4d..4779313 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -27,6 +27,7 @@ with this program. If not, see . #include #include #include +#include /* Indicator Stuff */ #include @@ -70,6 +71,8 @@ struct _IndicatorDatetimePrivate { IndicatorServiceManager * sm; DbusmenuGtkMenu * menu; + + GSettings * settings; }; /* Enum for the properties so that they can be quickly @@ -81,6 +84,7 @@ enum { #define PROP_TIME_FORMAT_S "time-format" +#define SETTING_INTERFACE "org.ayatana.indicator.datetime" #define SETTING_TIME_FORMAT_S "indicator-time-format" #define DEFAULT_TIME_FORMAT "%l:%M %p" @@ -155,6 +159,17 @@ indicator_datetime_init (IndicatorDatetime *self) self->priv->sm = NULL; self->priv->menu = NULL; + self->priv->settings = g_settings_new(SETTING_INTERFACE); + if (self->priv->settings != NULL) { + g_settings_bind(self->priv->settings, + SETTING_TIME_FORMAT_S, + self, + PROP_TIME_FORMAT_S, + G_SETTINGS_BIND_DEFAULT); + } else { + g_warning("Unable to get settings for '" SETTING_INTERFACE "'"); + } + self->priv->sm = indicator_service_manager_new_version(SERVICE_NAME, SERVICE_VERSION); return; @@ -190,6 +205,11 @@ indicator_datetime_dispose (GObject *object) self->priv->sm = NULL; } + if (self->priv->settings != NULL) { + g_object_unref(G_OBJECT(self->priv->settings)); + self->priv->settings = NULL; + } + G_OBJECT_CLASS (indicator_datetime_parent_class)->dispose (object); return; } -- cgit v1.2.3