aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-12 20:35:50 -0500
committerTed Gould <ted@gould.cx>2010-07-12 20:35:50 -0500
commit72de11ccac28b0bad7485a5501bc87329560f39b (patch)
treed96d776962f6ff3468cf9b36fad0a250d14adb20
parenta173af9719ee3183c360c9e2416c1e16e9e68397 (diff)
downloadayatana-indicator-datetime-72de11ccac28b0bad7485a5501bc87329560f39b.tar.gz
ayatana-indicator-datetime-72de11ccac28b0bad7485a5501bc87329560f39b.tar.bz2
ayatana-indicator-datetime-72de11ccac28b0bad7485a5501bc87329560f39b.zip
Setting up a 'time_format' variable and pulling it into a property.
-rw-r--r--src/indicator-datetime.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index deef2f5..847cb8e 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -63,6 +63,8 @@ struct _IndicatorDatetimePrivate {
GtkLabel * label;
guint timer;
+ gchar * time_format;
+
guint idle_measure;
gint max_width;
@@ -146,6 +148,8 @@ indicator_datetime_init (IndicatorDatetime *self)
self->priv->idle_measure = 0;
self->priv->max_width = 0;
+ self->priv->time_format = NULL;
+
self->priv->sm = NULL;
self->priv->menu = NULL;
@@ -191,6 +195,12 @@ indicator_datetime_dispose (GObject *object)
static void
indicator_datetime_finalize (GObject *object)
{
+ IndicatorDatetime * self = INDICATOR_DATETIME(object);
+
+ if (self->priv->time_format != NULL) {
+ g_free(self->priv->time_format);
+ self->priv->time_format = NULL;
+ }
G_OBJECT_CLASS (indicator_datetime_parent_class)->finalize (object);
return;
@@ -199,6 +209,16 @@ indicator_datetime_finalize (GObject *object)
static void
set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
{
+ g_return_if_fail(prop_id == PROP_TIME_FORMAT);
+ IndicatorDatetime * self = INDICATOR_DATETIME(object);
+
+ if (self->priv->time_format != NULL) {
+ g_free(self->priv->time_format);
+ self->priv->time_format = NULL;
+ }
+
+ self->priv->time_format = g_value_dup_string(value);
+ g_debug("Changing time format to '%s'", self->priv->time_format);
return;
}
@@ -206,6 +226,10 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
static void
get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
{
+ g_return_if_fail(prop_id == PROP_TIME_FORMAT);
+ IndicatorDatetime * self = INDICATOR_DATETIME(object);
+
+ g_value_set_string(value, self->priv->time_format);
return;
}