diff options
author | Ted Gould <ted@gould.cx> | 2010-07-15 23:42:44 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-07-15 23:42:44 -0500 |
commit | 4da93424d08120d6eb46515d3de65928e4a90b14 (patch) | |
tree | c9066ccc97e214ea623cf7ac448f8439878f0a3b | |
parent | d0f7773e9d902204b567a319e1a14ecf2d3d4199 (diff) | |
download | ayatana-indicator-datetime-4da93424d08120d6eb46515d3de65928e4a90b14.tar.gz ayatana-indicator-datetime-4da93424d08120d6eb46515d3de65928e4a90b14.tar.bz2 ayatana-indicator-datetime-4da93424d08120d6eb46515d3de65928e4a90b14.zip |
Filling out set too.
-rw-r--r-- | src/indicator-datetime.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 5c785f9..334ecd8 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -361,22 +361,61 @@ bind_enum_get (GValue * value, GVariant * variant, gpointer user_data) static void set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { + IndicatorDatetime * self = INDICATOR_DATETIME(object); + gboolean update = FALSE; + switch(prop_id) { - case PROP_TIME_FORMAT: + case PROP_TIME_FORMAT: { + gint newval = g_value_get_int(value); + if (newval != self->priv->time_mode) { + update = TRUE; + self->priv->time_mode = newval; + } break; + } case PROP_SHOW_SECONDS: + if (g_value_get_boolean(value) != self->priv->show_seconds) { + self->priv->show_seconds = !self->priv->show_seconds; + update = TRUE; + } break; case PROP_SHOW_DAY: + if (g_value_get_boolean(value) != self->priv->show_day) { + self->priv->show_day = !self->priv->show_day; + update = TRUE; + } break; case PROP_SHOW_DATE: + if (g_value_get_boolean(value) != self->priv->show_date) { + self->priv->show_date = !self->priv->show_date; + update = TRUE; + } break; - case PROP_CUSTOM_TIME_FORMAT: + case PROP_CUSTOM_TIME_FORMAT: { + const gchar * newstr = g_value_get_string(value); + if (g_strcmp0(newstr, self->priv->custom_string) != 0) { + if (self->priv->custom_string != NULL) { + g_free(self->priv->custom_string); + self->priv->custom_string = NULL; + } + self->priv->custom_string = g_strdup(newstr); + if (self->priv->time_mode == SETTINGS_TIME_CUSTOM) { + update = TRUE; + } + } break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); return; } + if (!update) { + return; + } + + g_debug("Updating format string"); + return; } |