aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-chat-window.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:08:13 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:08:13 +0800
commitb7e7e719a516879202323b2dc6bf73403909bc32 (patch)
tree2254332566912a98b1e8430d82934ebf75c3b9a6 /src/empathy-chat-window.c
parent7730ffdcd842e21ea10002dba6855285128e6d5c (diff)
downloadgsoc2013-empathy-b7e7e719a516879202323b2dc6bf73403909bc32.tar
gsoc2013-empathy-b7e7e719a516879202323b2dc6bf73403909bc32.tar.gz
gsoc2013-empathy-b7e7e719a516879202323b2dc6bf73403909bc32.tar.bz2
gsoc2013-empathy-b7e7e719a516879202323b2dc6bf73403909bc32.tar.lz
gsoc2013-empathy-b7e7e719a516879202323b2dc6bf73403909bc32.tar.xz
gsoc2013-empathy-b7e7e719a516879202323b2dc6bf73403909bc32.tar.zst
gsoc2013-empathy-b7e7e719a516879202323b2dc6bf73403909bc32.zip
Unref the notification after it has been closed.
svn path=/trunk/; revision=2297
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r--src/empathy-chat-window.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 85504c0d7..90091c795 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -836,27 +836,29 @@ chat_window_set_urgency_hint (EmpathyChatWindow *window,
gtk_window_set_urgency_hint (GTK_WINDOW (priv->dialog), urgent);
}
-static gboolean
-notification_closed_idle_cb (EmpathyChat *chat)
-{
- empathy_chat_window_present_chat (chat);
-
- return FALSE;
-}
+typedef struct {
+ EmpathyChatWindow *window;
+ EmpathyChat *chat;
+} NotificationData;
static void
chat_window_notification_closed_cb (NotifyNotification *notify,
- EmpathyChat *chat)
+ NotificationData *cb_data)
{
int reason = 1;
+ EmpathyChatWindowPriv *priv = GET_PRIV (cb_data->window);
#ifdef notify_notification_get_closed_reason
reason = notify_notification_get_closed_reason (notify);
#endif
-
if (reason == 2) {
- g_idle_add ((GSourceFunc) notification_closed_idle_cb, chat);
+ empathy_chat_window_present_chat (cb_data->chat);
}
+
+ g_object_unref (notify);
+ priv->notification = NULL;
+ g_object_unref (cb_data->chat);
+ g_slice_free (NotificationData, cb_data);
}
static void
@@ -868,6 +870,7 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
char *header, *escaped;
const char *body;
GdkPixbuf *pixbuf;
+ NotificationData *cb_data;
EmpathyChatWindowPriv *priv = GET_PRIV (window);
gboolean res;
@@ -881,6 +884,10 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
}
}
+ cb_data = g_slice_new0 (NotificationData);
+ cb_data->chat = g_object_ref (chat);
+ cb_data->window = window;
+
sender = empathy_message_get_sender (message);
header = g_strdup_printf (_("New message from %s"),
empathy_contact_get_name (sender));
@@ -902,7 +909,7 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf);
g_signal_connect (priv->notification, "closed",
- G_CALLBACK (chat_window_notification_closed_cb), chat);
+ G_CALLBACK (chat_window_notification_closed_cb), cb_data);
}
notify_notification_show (priv->notification, NULL);