From 76fa3d1b53ac22d8d63b280a412a4364eaaccc0b Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 13 May 2008 16:26:26 +0000 Subject: Add a func to activate any event svn path=/trunk/; revision=1098 --- src/empathy-status-icon.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index f33447033..9d8a8c8c2 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -198,6 +198,27 @@ status_icon_delete_event_cb (GtkWidget *widget, return TRUE; } +static void +status_icon_event_activate (EmpathyStatusIcon *icon, + StatusIconEvent *event) +{ + EmpathyStatusIconPriv *priv = GET_PRIV (icon); + + if (event->func) { + event->func (icon, event->user_data); + } + + priv->events = g_slist_remove (priv->events, event); + status_icon_event_free (event); + status_icon_update_tooltip (icon); + status_icon_update_icon (icon); + + if (!priv->events && priv->blink_timeout) { + g_source_remove (priv->blink_timeout); + priv->blink_timeout = 0; + } +} + static void status_icon_activate_cb (GtkStatusIcon *status_icon, EmpathyStatusIcon *icon) @@ -207,21 +228,7 @@ status_icon_activate_cb (GtkStatusIcon *status_icon, DEBUG ("Activated: %s", priv->events ? "event" : "toggle"); if (priv->events) { - StatusIconEvent *event; - - event = priv->events->data; - if (event->func) { - event->func (icon, event->user_data); - } - status_icon_event_free (event); - priv->events = g_slist_remove (priv->events, event); - status_icon_update_tooltip (icon); - status_icon_update_icon (icon); - - if (!priv->events && priv->blink_timeout) { - g_source_remove (priv->blink_timeout); - priv->blink_timeout = 0; - } + status_icon_event_activate (icon, priv->events->data); } else { status_icon_toggle_visibility (icon); } -- cgit v1.2.3