Make move to folder dialog send ok on activation
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 10 Dec 2008 17:02:25 +0000 (17:02 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 10 Dec 2008 17:02:25 +0000 (17:02 +0000)
pmo-drop-split-view-r6751

src/modest-ui-actions.c
src/widgets/modest-folder-view.c

index 14dd6f4..ec46c83 100644 (file)
@@ -4521,6 +4521,7 @@ create_move_to_dialog_on_new_folder(GtkWidget *button, gpointer user_data)
                                         GTK_WIDGET (user_data));
 }
 
+#ifndef MODEST_TOOLKIT_HILDON2
 /*
  * This function is used to track changes in the selection of the
  * folder view that is inside the "move to" dialog to enable/disable
@@ -4671,6 +4672,18 @@ on_move_to_dialog_folder_selection_changed (ModestFolderView* self,
        /* Set sensitivity of the NEW button */
        gtk_widget_set_sensitive (new_button, new_sensitive);
 }
+#endif
+
+#ifdef MODEST_TOOLKIT_HILDON2
+static void
+on_move_to_dialog_folder_activated (GtkTreeView       *tree_view,
+                                   GtkTreePath       *path,
+                                   GtkTreeViewColumn *column,
+                                   gpointer           user_data)
+{
+       gtk_dialog_response (GTK_DIALOG (user_data), GTK_RESPONSE_ACCEPT);
+}
+#endif
 
 
 #define MODEST_MOVE_TO_DIALOG_FOLDER_VIEW "move-to-dialog-folder-view"
@@ -4692,8 +4705,9 @@ create_move_to_dialog (GtkWindow *win,
        GtkWidget *pannable;
 #else
        GtkWidget *scroll;
+       GtkWidget *ok_button;
 #endif
-       GtkWidget *new_button, *ok_button;
+       GtkWidget *new_button;
 
        dialog = gtk_dialog_new_with_buttons (_("mcen_ti_moveto_folders_title"),
                                              GTK_WINDOW (win),
@@ -4701,15 +4715,18 @@ create_move_to_dialog (GtkWindow *win,
                                              NULL);
 
 #ifndef MODEST_TOOLKIT_GTK
+#ifndef MODEST_TOOLKIT_HILDON2
        ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_dialog_ok"), GTK_RESPONSE_ACCEPT);
+#endif
        /* We do this manually so GTK+ does not associate a response ID for
         * the button. */
        new_button = gtk_button_new_from_stock (_("mcen_bd_new"));
        gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->action_area), new_button, FALSE, FALSE, 0);
-       gtk_widget_show (new_button);
 #ifndef MODEST_TOOLKIT_HILDON2
+       hildon_gtk_widget_set_theme_size (new_button, HILDON_SIZE_FINGER_HEIGHT);
        gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_dialog_cancel"), GTK_RESPONSE_REJECT);
 #endif
+       gtk_widget_show (new_button);
 #else
        /* We do this manually so GTK+ does not associate a response ID for
         * the button. */
@@ -4721,7 +4738,10 @@ create_move_to_dialog (GtkWindow *win,
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
        gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 24);
 #endif
+
+#ifndef MODEST_TOOLKIT_HILDON2
        g_object_set_data (G_OBJECT (dialog), MOVE_FOLDER_OK_BUTTON, ok_button);
+#endif
        g_object_set_data (G_OBJECT (dialog), MOVE_FOLDER_NEW_BUTTON, new_button);
 
        /* Create scrolled window */
@@ -4741,6 +4761,13 @@ create_move_to_dialog (GtkWindow *win,
        /* Create folder view */
        *tree_view = modest_platform_create_folder_view (NULL);
 
+#ifdef MODEST_TOOLKIT_HILDON2
+       /* We return OK on activation */
+       g_signal_connect (*tree_view,
+                         "row-activated",
+                         G_CALLBACK (on_move_to_dialog_folder_activated),
+                         dialog);
+#else
        /* Track changes in the selection to
         * disable the OK button whenever "Move to" is not possible
         * disbale NEW button whenever New is not possible */
@@ -4748,6 +4775,7 @@ create_move_to_dialog (GtkWindow *win,
                          "folder_selection_changed",
                          G_CALLBACK (on_move_to_dialog_folder_selection_changed),
                          win);
+#endif
 
        /* Listen to clicks on New button */
        g_signal_connect (G_OBJECT (new_button), 
index 97c5805..fa35d73 100644 (file)
@@ -1823,6 +1823,16 @@ on_row_activated (GtkTreeView *treeview,
                       signals[FOLDER_ACTIVATED_SIGNAL],
                       0, folder);
 
+#ifdef MODEST_TOOLKIT_HILDON2
+       HildonUIMode ui_mode;
+       g_object_get (G_OBJECT (self), "hildon-ui-mode", &ui_mode, NULL);
+       if (ui_mode == HILDON_UI_MODE_NORMAL) {
+               if (priv->cur_folder_store)
+                       g_object_unref (priv->cur_folder_store);
+               priv->cur_folder_store = g_object_ref (folder);
+       }
+#endif
+
        g_object_unref (folder);
 }