account = TNY_ACCOUNT (g_object_ref (folder_store));
}
- if (tny_account_get_account_type (account) == TNY_ACCOUNT_TYPE_STORE) {
+ if (account && (tny_account_get_account_type (account) == TNY_ACCOUNT_TYPE_STORE)) {
if (!modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account))) {
/* No need to connect a local account */
if (callback)
modest_folder_view_set_filter (MODEST_FOLDER_VIEW (folder_view), MODEST_FOLDER_VIEW_FILTER_HIDE_FOLDERS);
hildon_pannable_area_jump_to (HILDON_PANNABLE_AREA (pannable), 0, 0);
+ g_object_set (G_OBJECT (folder_view),
+ "hildon-ui-mode", HILDON_UI_MODE_NORMAL,
+ NULL);
+
g_object_set_data (G_OBJECT (dialog), MOVE_TO_DIALOG_SHOWING_FOLDERS, GINT_TO_POINTER (FALSE));
}
gtk_widget_set_sensitive (back_button, TRUE);
gtk_widget_set_sensitive (action_button, FALSE);
+ g_object_set (G_OBJECT (folder_view),
+ "hildon-ui-mode", HILDON_UI_MODE_EDIT,
+ NULL);
+
account = TNY_ACCOUNT (folder_store);
if (modest_tny_account_is_virtual_local_folders (account)) {
gchar *device_name;
dialog = (GtkWidget *) user_data;
showing_folders = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), MOVE_TO_DIALOG_SHOWING_FOLDERS));
- if (showing_folders) {
- move_to_dialog_set_selected_folder (dialog, selected);
- } else {
+ if (!showing_folders) {
folder_view = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog), MOVE_TO_DIALOG_FOLDER_VIEW));
selected = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
}
}
+static void
+on_move_to_dialog_selection_changed (GtkTreeSelection *selection,
+ gpointer user_data)
+{
+ TnyFolderStore *selected;
+ GtkWidget *dialog;
+ GtkWidget *folder_view;
+ gboolean showing_folders;
+
+ dialog = (GtkWidget *) user_data;
+ showing_folders = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), MOVE_TO_DIALOG_SHOWING_FOLDERS));
+ if (showing_folders) {
+ folder_view = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog), MOVE_TO_DIALOG_FOLDER_VIEW));
+ selected = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
+
+ if (selected)
+ move_to_dialog_set_selected_folder (dialog, selected);
+ }
+}
+
+static void
+on_move_to_dialog_action_clicked (GtkButton *selection,
+ gpointer user_data)
+{
+ TnyFolderStore *selected;
+ GtkWidget *dialog;
+ GtkWidget *folder_view;
+ gboolean showing_folders;
+
+ dialog = (GtkWidget *) user_data;
+ showing_folders = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), MOVE_TO_DIALOG_SHOWING_FOLDERS));
+ if (showing_folders) {
+ folder_view = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog), MOVE_TO_DIALOG_FOLDER_VIEW));
+ selected = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
+
+ if (selected)
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+ }
+}
+
GtkWidget *
modest_platform_create_move_to_dialog (GtkWindow *parent_window,
GtkWidget **folder_view)
GdkPixbuf *back_pixbuf;
GtkWidget *top_vbox;
GtkWidget *action_button;
+ GtkTreeSelection *selection;
/* Create dialog. We cannot use a touch selector because we
need to use here the folder view widget directly */
G_CALLBACK (on_move_to_dialog_folder_activated),
dialog);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*folder_view));
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (on_move_to_dialog_selection_changed),
+ dialog);
+
+ g_signal_connect (action_button, "clicked",
+ G_CALLBACK (on_move_to_dialog_action_clicked),
+ dialog);
+
g_signal_connect (back_button, "clicked",
G_CALLBACK (on_move_to_dialog_back_clicked),
dialog);