diff options
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | src/app-section.c | 3 | ||||
-rw-r--r-- | src/im-source-menu-item.c | 34 | ||||
-rw-r--r-- | src/messages-service.c | 1 |
4 files changed, 35 insertions, 5 deletions
diff --git a/debian/changelog b/debian/changelog index a64d578..32ab45a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,7 +12,7 @@ indicator-messages (12.10.0-0ubuntu1) UNRELEASED; urgency=low * Updated packaging to dh9, current standards * Drop gtk2 build from the packaging since support for it was dropped in trunk, thanks Lars Uebernickel - * Backported fixes from trunk up to r289 + * Backported fixes from trunk up to r291 -- Sebastien Bacher <seb128@ubuntu.com> Tue, 21 Aug 2012 18:17:34 +0200 diff --git a/src/app-section.c b/src/app-section.c index 1574892..0487fbb 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -695,6 +695,5 @@ app_section_get_uses_chat_status (AppSection *self) { AppSectionPrivate * priv = self->priv; - /* chat status is only useful when the app is running */ - return priv->uses_chat_status && priv->source_actions; + return priv->uses_chat_status; } diff --git a/src/im-source-menu-item.c b/src/im-source-menu-item.c index 269c75d..43c0afb 100644 --- a/src/im-source-menu-item.c +++ b/src/im-source-menu-item.c @@ -29,6 +29,9 @@ struct _ImSourceMenuItemPrivate GtkWidget *icon; GtkWidget *label; GtkWidget *detail; + + gint64 time; + guint timer_id; }; enum @@ -144,6 +147,19 @@ im_source_menu_item_time_span_string (gint64 timestamp) } static gboolean +im_source_menu_item_update_time (gpointer data) +{ + ImSourceMenuItem *self = data; + gchar *str; + + str = im_source_menu_item_time_span_string (self->priv->time); + gtk_label_set_text (GTK_LABEL (self->priv->detail), str); + + g_free (str); + return TRUE; +} + +static gboolean im_source_menu_item_set_state (ImSourceMenuItem *self, GVariant *state) { @@ -153,6 +169,12 @@ im_source_menu_item_set_state (ImSourceMenuItem *self, const gchar *str; gchar *detail; + if (priv->timer_id != 0) + { + g_source_remove (priv->timer_id); + priv->timer_id = 0; + } + g_return_val_if_fail (g_variant_is_of_type (state, G_VARIANT_TYPE ("(uxsb)")), FALSE); g_variant_get (state, "(ux&sb)", &count, &time, &str, NULL); @@ -160,7 +182,11 @@ im_source_menu_item_set_state (ImSourceMenuItem *self, if (count != 0) detail = g_strdup_printf ("%d", count); else if (time != 0) - detail = im_source_menu_item_time_span_string (time); + { + priv->time = time; + detail = im_source_menu_item_time_span_string (time); + priv->timer_id = g_timeout_add_seconds (59, im_source_menu_item_update_time, self); + } else if (str != NULL && *str) detail = collapse_whitespace (str); else @@ -275,6 +301,12 @@ im_source_menu_item_dispose (GObject *object) { ImSourceMenuItem *self = IM_SOURCE_MENU_ITEM (object); + if (self->priv->timer_id != 0) + { + g_source_remove (self->priv->timer_id); + self->priv->timer_id = 0; + } + if (self->priv->action_group) im_source_menu_item_set_action_group (self, NULL); diff --git a/src/messages-service.c b/src/messages-service.c index 407b8ba..db7a8d7 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -313,7 +313,6 @@ change_status_action (GSimpleAction *action, g_str_equal (status, "offline")); if (!g_action_state_equal (G_ACTION (action), value)) { - g_message ("%s", status); g_simple_action_set_state (action, value); indicator_messages_service_emit_status_changed (messages_service, status); } |