notification_closed_cb (NotifyNotification *notification,
EmpathyNotificationsApprover *self)
{
- g_object_unref (notification);
-
if (self->priv->notification == notification)
- self->priv->notification = NULL;
+ tp_clear_object (&self->priv->notification);
}
static void
if (self->priv->notification != NULL)
{
notify_notification_close (self->priv->notification, NULL);
- self->priv->notification = NULL;
+ tp_clear_object (&self->priv->notification);
}
}
GdkPixbuf *pixbuf = NULL;
gchar *message_esc = NULL;
gboolean has_x_canonical_append;
- NotifyNotification *notification = self->priv->notification;
+ NotifyNotification *notification;
if (!empathy_notify_manager_notification_is_enabled (self->priv->notify_mgr))
{
has_x_canonical_append = empathy_notify_manager_has_capability (
self->priv->notify_mgr, EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND);
- if (notification != NULL && ! has_x_canonical_append)
+ if (self->priv->notification != NULL && ! has_x_canonical_append)
{
/* if the notification server does NOT supports x-canonical-append, it is
* better to not use notify_notification_update to avoid
* overwriting the current notification message */
+ notification = g_object_ref (self->priv->notification);
+
notify_notification_update (notification,
self->priv->event->header, message_esc, NULL);
}
message_esc, NULL);
if (self->priv->notification == NULL)
- self->priv->notification = notification;
+ {
+ self->priv->notification = g_object_ref (notification);
+
+ g_signal_connect (notification, "closed",
+ G_CALLBACK (notification_closed_cb), self);
+ }
notify_notification_set_timeout (notification,
NOTIFY_EXPIRES_DEFAULT);
if (empathy_notify_manager_has_capability (self->priv->notify_mgr,
EMPATHY_NOTIFY_MANAGER_CAP_ACTIONS))
add_notification_actions (self, notification);
-
- g_signal_connect (notification, "closed",
- G_CALLBACK (notification_closed_cb), self);
}
pixbuf = empathy_notify_manager_get_pixbuf_for_notification (
notify_notification_show (notification, NULL);
g_free (message_esc);
+ g_object_unref (notification);
}
static void