diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 00:37:48 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 00:37:48 +0800 |
commit | 84e30dab1428affe335ef904377d07f8b5fdeb66 (patch) | |
tree | fee9c8ec124a2b5804f6bb4ee31772db56a6e374 /src/empathy-status-icon.c | |
parent | fd8e9c5dc2584055177c7a79021cdd53ca431c22 (diff) | |
parent | 3803736b4326d4bc00d58ccd25f910907f0b4521 (diff) | |
download | gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.gz gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.zst gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.zip |
Merge back from master
Diffstat (limited to 'src/empathy-status-icon.c')
-rw-r--r-- | src/empathy-status-icon.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index aca2d85c2..430c93343 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,37 @@ 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 = NULL; + + if (priv->event->message != NULL) + 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 +182,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)); |