]> git.0d.be Git - empathy.git/blobdiff - src/empathy-status-icon.c
Merge back from master
[empathy.git] / src / empathy-status-icon.c
index f6c63c5372c85c95fbc86610a256a5bc578df1e1..430c9334393778c00d2f4538ed8736f97b264ca1 100644 (file)
@@ -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));
@@ -305,24 +314,7 @@ status_icon_set_visibility (EmpathyStatusIcon *icon,
        if (!visible) {
                empathy_window_iconify (priv->window, priv->icon);
        } else {
-               GList *accounts;
-               GList *l;
-               gboolean one_enabled = FALSE;
-
                empathy_window_present (GTK_WINDOW (priv->window), TRUE);
-
-               /* Show the accounts dialog if there is no enabled accounts */
-               accounts = empathy_account_manager_dup_accounts (priv->account_manager);
-               for (l = accounts ; l != NULL ; l = g_list_next (l)) {
-                       one_enabled = empathy_account_is_enabled (EMPATHY_ACCOUNT (l->data))
-                               || one_enabled;
-                       g_object_unref (l->data);
-               }
-               g_list_free (accounts);
-               if (!one_enabled) {
-                       DEBUG ("No enabled account, Showing account dialog");
-                       empathy_accounts_dialog_show (GTK_WINDOW (priv->window), NULL);
-               }
        }
 }