GtkWidget*
modest_platform_create_move_to_dialog (GtkWindow *parent_window,
- GtkWidget **folder_view_container)
+ GtkWidget **folder_view)
{
- GtkWidget *dialog;
+ GtkWidget *dialog, *folder_view_container;
dialog = gtk_dialog_new_with_buttons (_("mcen_ti_moveto_folders_title"),
GTK_WINDOW (parent_window),
_("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL,
NULL);
+ /* Create folder view */
+ *folder_view = modest_platform_create_folder_view (NULL);
+
/* Create pannable and add it to the dialog */
- *folder_view_container = gtk_scrolled_window_new (NULL, NULL);
+ folder_view_container = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (*folder_view_container),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), *folder_view_container);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), folder_view_container);
+ gtk_container_add (GTK_CONTAINER (folder_view_container), *folder_view);
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 300);
g_free (active_profile);
}
-GtkWidget*
+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_OK);
+}
+
+GtkWidget *
modest_platform_create_move_to_dialog (GtkWindow *parent_window,
- GtkWidget **folder_view_container)
+ GtkWidget **folder_view)
{
- GtkWidget *dialog;
+ GtkWidget *dialog, *folder_view_container;
+ /* Create dialog. We cannot use a touch selector because we
+ need to use here the folder view widget directly */
dialog = gtk_dialog_new_with_buttons (_("mcen_ti_moveto_folders_title"),
GTK_WINDOW (parent_window),
GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR |
_("mcen_bd_new"), MODEST_GTK_RESPONSE_NEW_FOLDER,
NULL);
+ /* Create folder view */
+ *folder_view = modest_platform_create_folder_view (NULL);
+
+ /* Simulate the behaviour of a HildonPickerDialog by emitting
+ a response when a folder is selected */
+ g_signal_connect (*folder_view, "row-activated",
+ G_CALLBACK (on_move_to_dialog_folder_activated),
+ dialog);
+
/* Create pannable and add it to the dialog */
- *folder_view_container = hildon_pannable_area_new ();
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), *folder_view_container);
+ folder_view_container = hildon_pannable_area_new ();
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), folder_view_container);
+ gtk_container_add (GTK_CONTAINER (folder_view_container), *folder_view);
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 300);
GtkWidget*
modest_platform_create_move_to_dialog (GtkWindow *parent_window,
- GtkWidget **folder_view_container)
+ GtkWidget **folder_view)
{
- GtkWidget *dialog;
+ GtkWidget *dialog, *folder_view_container;
dialog = gtk_dialog_new_with_buttons (_("mcen_ti_moveto_folders_title"),
GTK_WINDOW (parent_window),
_("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL,
NULL);
+ /* Create folder view */
+ *folder_view = modest_platform_create_folder_view (NULL);
+
/* Create pannable and add it to the dialog */
- *folder_view_container = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (*folder_view_container),
+ folder_view_container = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (folder_view_container),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), *folder_view_container);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), folder_view_container);
+ gtk_container_add (GTK_CONTAINER (folder_view_container), *folder_view);
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 300);
GtkWidget* modest_platform_create_move_to_dialog (GtkWindow *parent_window,
- GtkWidget **folder_view_container);
+ GtkWidget **folder_view);
G_END_DECLS
modest_msg_edit_window_check_names (window, FALSE);
}
-#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_OK);
-}
-#else
+#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
create_move_to_dialog (GtkWindow *win,
GtkWidget *folder_view)
{
- GtkWidget *dialog, *folder_view_container, *tree_view;
-
- dialog = modest_platform_create_move_to_dialog (win, &folder_view_container);
+ GtkWidget *dialog, *tree_view = NULL;
- /* Create folder view */
- tree_view = modest_platform_create_folder_view (NULL);
+ dialog = modest_platform_create_move_to_dialog (win, &tree_view);
-#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
+#ifndef MODEST_TOOLKIT_HILDON2
/* Track changes in the selection to
* disable the OK button whenever "Move to" is not possible
* disbale NEW button whenever New is not possible */
/* Hide special folders */
modest_folder_view_show_non_move_folders (MODEST_FOLDER_VIEW (tree_view), FALSE);
+#ifndef MODEST_TOOLKIT_HILDON2
modest_folder_view_select_first_inbox_or_local (MODEST_FOLDER_VIEW (tree_view));
+#endif
- /* Add the tree view to its container */
- gtk_container_add (GTK_CONTAINER (folder_view_container), tree_view);
-
- gtk_widget_show (GTK_WIDGET (folder_view_container));
gtk_widget_show (GTK_WIDGET (tree_view));
return dialog;