From a764938d409a848154fbeb88a1370f0235d47405 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Feb 2011 12:32:30 -0600 Subject: Encapsulating the updating of the description into a function --- src/indicator-datetime.c | 36 +++++++++++++++++++++++------------- 1 file 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; } -- cgit v1.2.3