* src/maemo/modest-msg-view-window.c:
authorJose Dapena Paz <jdapena@igalia.com>
Thu, 6 Sep 2007 17:35:21 +0000 (17:35 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Thu, 6 Sep 2007 17:35:21 +0000 (17:35 +0000)
* Added a method that catches move-focus signal. In case the
  focus is on attachments view, it stops signal handler,
  preventing this way the focus (fixes NB#66802).

pmo-trunk-r3231

src/maemo/modest-msg-view-window.c

index da512a0..71236bd 100644 (file)
@@ -133,6 +133,10 @@ static void on_account_removed  (TnyAccountStore *account_store,
                                 TnyAccount *account,
                                 gpointer user_data);
 
+static void on_move_focus (ModestMsgViewWindow *window,
+                          GtkDirectionType direction,
+                          gpointer userdata);
+
 static void view_msg_cb         (ModestMailOperation *mail_op, 
                                 TnyHeader *header, 
                                 TnyMsg *msg, 
@@ -795,6 +799,9 @@ modest_msg_view_window_construct (ModestMsgViewWindow *self, TnyMsg *msg,
                          G_CALLBACK (modest_msg_view_window_window_state_event),
                          NULL);
 
+       g_signal_connect (G_OBJECT (obj), "move-focus",
+                         G_CALLBACK (on_move_focus), obj);
+
        /* Mail Operation Queue */
        priv->queue_change_handler = g_signal_connect (G_OBJECT (modest_runtime_get_mail_operation_queue ()),
                                                       "queue-changed",
@@ -2601,3 +2608,17 @@ update_window_title (ModestMsgViewWindow *window)
 
        gtk_window_set_title (GTK_WINDOW (window), subject);
 }
+
+static void on_move_focus (ModestMsgViewWindow *window,
+                          GtkDirectionType direction,
+                          gpointer userdata)
+{
+       GtkWidget *current_focus = NULL;
+
+       current_focus = gtk_window_get_focus (GTK_WINDOW (window));
+       if ((current_focus != NULL) &&
+           MODEST_IS_ATTACHMENTS_VIEW (current_focus)) {
+               g_signal_stop_emission_by_name (G_OBJECT (window), "move-focus");
+       }
+}
+