aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-12 20:56:23 -0500
committerTed Gould <ted@gould.cx>2010-07-12 20:56:23 -0500
commita994c55bc39f419ce752d02a60bc01d5659aad62 (patch)
treed61a7cbd4b868d10d247f4f08c6243329ec36805 /src
parent5c0172d8d390f7f5ff1d8475ef7aea40106f58ea (diff)
downloadayatana-indicator-datetime-a994c55bc39f419ce752d02a60bc01d5659aad62.tar.gz
ayatana-indicator-datetime-a994c55bc39f419ce752d02a60bc01d5659aad62.tar.bz2
ayatana-indicator-datetime-a994c55bc39f419ce752d02a60bc01d5659aad62.zip
Going into the gsettings world.
Diffstat (limited to 'src')
-rw-r--r--src/indicator-datetime.c20
1 files changed, 20 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
/* Indicator Stuff */
#include <libindicator/indicator.h>
@@ -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;
}