diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-31 01:06:57 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-31 01:06:57 +0800 |
commit | 4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156 (patch) | |
tree | c2c6f340560432bece864cd530e6ede7804a9e99 /src | |
parent | 6dfde45e768fc63e112c23088415c9fdaafa8418 (diff) | |
download | gsoc2013-empathy-4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156.tar gsoc2013-empathy-4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156.tar.gz gsoc2013-empathy-4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156.tar.bz2 gsoc2013-empathy-4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156.tar.lz gsoc2013-empathy-4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156.tar.xz gsoc2013-empathy-4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156.tar.zst gsoc2013-empathy-4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156.zip |
Require latest libnotify. Don't crash when clicking the notification.
svn path=/trunk/; revision=2274
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-status-icon.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index dc1e8ddbc..bb96e65e5 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -71,39 +71,33 @@ typedef struct { G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT); static gboolean -status_icon_idle_event_activate (gpointer data) +activate_event (EmpathyEvent *event) { - EmpathyStatusIcon *icon = EMPATHY_STATUS_ICON (data); - EmpathyStatusIconPriv *priv = GET_PRIV (icon); - - if (priv->event) { - empathy_event_activate (priv->event); - } + empathy_event_activate (event); return FALSE; } static void -status_icon_notification_cb (NotifyNotification *notification, - gchar *action_id, - gpointer data) -{ - EmpathyStatusIcon *icon = EMPATHY_STATUS_ICON (data); - - g_idle_add (status_icon_idle_event_activate, icon); -} - -static void status_icon_notification_closed_cb (NotifyNotification *notification, - gpointer data) + EmpathyStatusIcon *icon) { - EmpathyStatusIcon *icon = EMPATHY_STATUS_ICON (data); EmpathyStatusIconPriv *priv = GET_PRIV (icon); + int reason; + + reason = notify_notification_get_closed_reason (notification); if (priv->notification) { g_object_unref (priv->notification); priv->notification = NULL; } + + /* the notification has been closed by the user, see the + * DesktopNotification spec. + */ + if (reason == 2 && priv->event) { + g_idle_add ((GSourceFunc) activate_event, priv->event); + } } static void @@ -112,15 +106,12 @@ status_icon_update_notification (EmpathyStatusIcon *icon) EmpathyStatusIconPriv *priv = GET_PRIV (icon); if (priv->event) { - priv->notification = notify_notification_new_with_status_icon ("New Event", priv->event->message, priv->event->icon_name, priv->icon); - notify_notification_add_action (priv->notification, - "activate", - "Activate", - status_icon_notification_cb, - icon, NULL); + priv->notification = notify_notification_new_with_status_icon + ("New Event", priv->event->message, priv->event->icon_name, priv->icon); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT); - g_signal_connect (priv->notification, "closed", G_CALLBACK (status_icon_notification_closed_cb), (gpointer) icon); + g_signal_connect (priv->notification, "closed", + G_CALLBACK (status_icon_notification_closed_cb), icon); notify_notification_show (priv->notification, NULL); } else { if (priv->notification) { |