diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-08-06 20:02:52 +0800 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2009-08-06 20:03:21 +0800 |
commit | 52a4fda0785b6e49be175221350c8f90d7982527 (patch) | |
tree | eaec20cbbaf3fb9e36eee6ab1f04538f1c6fbacf | |
parent | 0d01019a5c90edb5dd7b97037e49bdd508d2f9f9 (diff) | |
parent | faef8889c4331af839cbec91691fe97ade60f9f7 (diff) | |
download | gsoc2013-empathy-52a4fda0785b6e49be175221350c8f90d7982527.tar gsoc2013-empathy-52a4fda0785b6e49be175221350c8f90d7982527.tar.gz gsoc2013-empathy-52a4fda0785b6e49be175221350c8f90d7982527.tar.bz2 gsoc2013-empathy-52a4fda0785b6e49be175221350c8f90d7982527.tar.lz gsoc2013-empathy-52a4fda0785b6e49be175221350c8f90d7982527.tar.xz gsoc2013-empathy-52a4fda0785b6e49be175221350c8f90d7982527.tar.zst gsoc2013-empathy-52a4fda0785b6e49be175221350c8f90d7982527.zip |
Merge branch 'escape-notifications'
Fixes #580134
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r-- | src/empathy-chat-window.c | 16 | ||||
-rw-r--r-- | src/empathy-status-icon.c | 32 |
2 files changed, 26 insertions, 22 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 6dbbc0b3b..e818e4240 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -969,28 +969,26 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window, body = empathy_message_get_body (message); escaped = g_markup_escape_text (body, -1); - pixbuf = empathy_misc_get_pixbuf_for_notification (sender, EMPATHY_IMAGE_NEW_MESSAGE); - if (priv->notification != NULL) { notify_notification_update (priv->notification, header, escaped, NULL); - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); } else { priv->notification = notify_notification_new (header, escaped, NULL, NULL); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT); - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); g_signal_connect (priv->notification, "closed", G_CALLBACK (chat_window_notification_closed_cb), cb_data); } + pixbuf = empathy_misc_get_pixbuf_for_notification (sender, EMPATHY_IMAGE_NEW_MESSAGE); + + if (pixbuf != NULL) { + notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); + g_object_unref (pixbuf); + } + notify_notification_show (priv->notification, NULL); - g_object_unref (pixbuf); g_free (escaped); } diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index f6c63c537..79e59c5f5 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -23,6 +23,8 @@ #include <string.h> +#include <glib.h> + #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> @@ -136,30 +138,34 @@ status_icon_update_notification (EmpathyStatusIcon *icon) } if (priv->event) { - pixbuf = empathy_misc_get_pixbuf_for_notification (priv->event->contact, - priv->event->icon_name); + gchar *message_esc = g_markup_escape_text (priv->event->message, -1); if (priv->notification) { notify_notification_update (priv->notification, - priv->event->header, priv->event->message, + priv->event->header, message_esc, NULL); } else { priv->notification = notify_notification_new_with_status_icon - (priv->event->header, priv->event->message, NULL, priv->icon); + (priv->event->header, message_esc, NULL, priv->icon); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT); g_signal_connect (priv->notification, "closed", G_CALLBACK (status_icon_notification_closed_cb), icon); + } - } - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) + pixbuf = empathy_misc_get_pixbuf_for_notification (priv->event->contact, + priv->event->icon_name); + + if (pixbuf != NULL) { notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); + g_object_unref (pixbuf); + } + notify_notification_show (priv->notification, NULL); - g_object_unref (pixbuf); + g_free (message_esc); } else { notification_close_helper (priv); } @@ -173,12 +179,12 @@ status_icon_update_tooltip (EmpathyStatusIcon *icon) if (priv->event) { if (priv->event->message != NULL) - tooltip = g_strdup_printf ("<i>%s</i>\n%s", - priv->event->header, - priv->event->message); + tooltip = g_markup_printf_escaped ("<i>%s</i>\n%s", + priv->event->header, + priv->event->message); else - tooltip = g_strdup_printf ("<i>%s</i>", - priv->event->header); + tooltip = g_markup_printf_escaped ("<i>%s</i>", + priv->event->header); gtk_status_icon_set_tooltip_markup (priv->icon, tooltip); } else { tooltip = g_strdup (empathy_idle_get_status (priv->idle)); |