* Fixes NB#64889, the connection specific SMTP window is closed now in response...
authorSergio Villar Senin <svillar@igalia.com>
Mon, 10 Sep 2007 17:53:56 +0000 (17:53 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 10 Sep 2007 17:53:56 +0000 (17:53 +0000)
pmo-trunk-r3261

src/maemo/modest-connection-specific-smtp-window.c

index b6d276e..2f6dbe4 100644 (file)
@@ -65,6 +65,8 @@ struct _ModestConnectionSpecificSmtpWindowPrivate
        ModestAccountMgr *account_manager;
 };
 
+static gboolean on_key_pressed (GtkWidget *self, GdkEventKey *event, gpointer user_data);
+
 static void
 modest_connection_specific_smtp_window_get_property (GObject *object, guint property_id,
                                                                                                                        GValue *value, GParamSpec *pspec)
@@ -452,6 +454,11 @@ modest_connection_specific_smtp_window_init (ModestConnectionSpecificSmtpWindow
 
        /* Set window title */
        gtk_window_set_title (GTK_WINDOW (self), _("mcen_ti_optionalsmtp_servers"));
+
+       /* Track key presses to close the window if the Escape is pressed */
+       g_signal_connect (G_OBJECT (self), 
+                         "key-press-event", 
+                         G_CALLBACK (on_key_pressed), NULL);
 }
 
 ModestConnectionSpecificSmtpWindow*
@@ -583,3 +590,15 @@ void update_model_server_names (ModestConnectionSpecificSmtpWindow *self)
        }
 }
 
+static gboolean
+on_key_pressed (GtkWidget *self,
+               GdkEventKey *event,
+               gpointer user_data)
+{
+       if (event->keyval == GDK_Escape) {
+               /* Simulate a press on Cancel to close the dialog */
+               on_button_cancel (NULL, self);
+       }
+       
+       return FALSE;
+}