aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:06:57 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:06:57 +0800
commit4e1b88dae5c7fa56c82cb8c0fbcdfdc0d1479156 (patch)
treec2c6f340560432bece864cd530e6ede7804a9e99
parent6dfde45e768fc63e112c23088415c9fdaafa8418 (diff)
downloadgsoc2013-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
-rw-r--r--configure.ac3
-rw-r--r--src/empathy-status-icon.c43
2 files changed, 19 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac
index 2797c0f80..23b1cbb37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ TELEPATHY_GLIB_REQUIRED=0.7.19
MISSION_CONTROL_REQUIRED=4.61
ENCHANT_REQUIRED=1.2.0
ISO_CODES_REQUIRED=0.35
+LIBNOTIFY_REQUIRED=0.4.5
# Uncomment that to build with deprecated symbols disabled
#AC_DEFINE(G_DISABLE_DEPRECATED, [], [Disable deprecated GLib symbols])
@@ -108,7 +109,7 @@ PKG_CHECK_MODULES(EMPATHY,
libglade-2.0 >= $LIBGLADE_REQUIRED
libebook-1.2
libcanberra-gtk >= 0.4
- libnotify
+ libnotify >= $LIBNOTIFY_REQUIRED
])
# -----------------------------------------------------------
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) {