diff options
author | Ted Gould <ted@gould.cx> | 2011-02-17 12:32:30 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-02-17 12:32:30 -0600 |
commit | a764938d409a848154fbeb88a1370f0235d47405 (patch) | |
tree | bf2dff42691b1a727fec3c21630327dedc0aef01 /src | |
parent | 4bc78d5d1b25f514828a0fb9652f65e529a4e7cf (diff) | |
download | ayatana-indicator-datetime-a764938d409a848154fbeb88a1370f0235d47405.tar.gz ayatana-indicator-datetime-a764938d409a848154fbeb88a1370f0235d47405.tar.bz2 ayatana-indicator-datetime-a764938d409a848154fbeb88a1370f0235d47405.zip |
Encapsulating the updating of the description into a function
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-datetime.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 38050f9..c7eb9d5 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -605,12 +605,31 @@ idle_measure (gpointer data) return FALSE; } +/* Updates the accessible description */ +static void +update_accessible_description (IndicatorDatetime * io) +{ + GList * entries = indicator_object_get_entries(INDICATOR_OBJECT(io)); + IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data; + + entry->accessible_desc = get_accessible_desc(INDICATOR_OBJECT(io)); + + g_signal_emit(G_OBJECT(io), + INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, + 0, + entry, + TRUE); + + g_list_free(entries); + + return; +} + /* Updates the label to be the current time. */ static struct tm * update_label (IndicatorDatetime * io) { IndicatorDatetime * self = INDICATOR_DATETIME(io); - GList * entry = indicator_object_get_entries(INDICATOR_OBJECT(io)); if (self->priv->label == NULL) return NULL; @@ -625,12 +644,8 @@ update_label (IndicatorDatetime * io) g_debug("Error getting local time"); gtk_label_set_label(self->priv->label, _("Error getting time")); - g_signal_emit(G_OBJECT(self), - INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, - 0, - entry->data, - TRUE); - g_list_free(entry); + update_accessible_description(io); + return NULL; } @@ -652,12 +667,7 @@ update_label (IndicatorDatetime * io) self->priv->idle_measure = g_idle_add(idle_measure, io); } - g_signal_emit(G_OBJECT(self), - INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, - 0, - entry->data, - TRUE); - g_list_free(entry); + update_accessible_description(io); return ltime; } |