]> git.0d.be Git - empathy.git/blobdiff - src/empathy-status-icon.c
Add -Wformat and and fix some compile warnings with gcc 4.3. Fixes bug #537129 (Cosim...
[empathy.git] / src / empathy-status-icon.c
index 2ab49a63b12e66810e69226443bbc94867cef42f..3c2e7a679202627c0327c180ba13760a0899ce91 100644 (file)
@@ -26,6 +26,7 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 #include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
 
 #include <telepathy-glib/util.h>
 
@@ -275,7 +276,7 @@ status_icon_set_visibility (EmpathyStatusIcon *icon,
                GList *accounts;
 
                empathy_window_present (GTK_WINDOW (priv->window), TRUE);
-       
+
                /* Show the accounts dialog if there is no enabled accounts */
                accounts = mc_accounts_list_by_enabled (TRUE);
                if (accounts) {
@@ -326,6 +327,17 @@ status_icon_delete_event_cb (GtkWidget         *widget,
        return TRUE;
 }
 
+static gboolean
+status_icon_key_press_event_cb  (GtkWidget *window,
+                                GdkEventKey *event,
+                                EmpathyStatusIcon *icon)
+{
+       if (event->keyval == GDK_Escape) {
+               status_icon_set_visibility (icon, FALSE, TRUE);
+       }
+       return FALSE;
+}
+                               
 static void
 status_icon_activate_cb (GtkStatusIcon     *status_icon,
                         EmpathyStatusIcon *icon)
@@ -542,7 +554,8 @@ status_icon_tube_process (EmpathyStatusIcon *icon,
 
                dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
                                                 GTK_MESSAGE_ERROR,
-                                                GTK_BUTTONS_OK, str);
+                                                GTK_BUTTONS_OK,
+                                                "%s", str);
                gtk_window_set_title (GTK_WINDOW (dialog),
                                      _("Invitation Error"));
                g_free (str);
@@ -739,7 +752,7 @@ empathy_status_icon_init (EmpathyStatusIcon *icon)
 }
 
 EmpathyStatusIcon *
-empathy_status_icon_new (GtkWindow *window)
+empathy_status_icon_new (GtkWindow *window, gboolean hide_contact_list)
 {
        EmpathyStatusIconPriv *priv;
        EmpathyStatusIcon     *icon;
@@ -752,13 +765,21 @@ empathy_status_icon_new (GtkWindow *window)
 
        priv->window = g_object_ref (window);
 
+       g_signal_connect (priv->window, "key-press-event",
+                         G_CALLBACK (status_icon_key_press_event_cb),
+                         icon);
+
        g_signal_connect (priv->window, "delete-event",
                          G_CALLBACK (status_icon_delete_event_cb),
                          icon);
 
-       empathy_conf_get_bool (empathy_conf_get (),
-                             EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
-                             &should_hide);
+       if (!hide_contact_list) {
+               empathy_conf_get_bool (empathy_conf_get (),
+                                      EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
+                                      &should_hide);
+       } else {
+               should_hide = TRUE;
+       }
 
        if (gtk_window_is_active (priv->window) == should_hide) {
                status_icon_set_visibility (icon, !should_hide, FALSE);