diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 40 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 46 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.h | 1 |
3 files changed, 79 insertions, 8 deletions
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index b8afd2c2d3..e74086f204 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -34,9 +34,9 @@ #include <mail/e-mail-browser.h> #include <mail/e-mail-config-assistant.h> #include <mail/e-mail-config-window.h> +#include <mail/e-mail-folder-create-dialog.h> #include <mail/e-mail-reader.h> #include <mail/em-composer-utils.h> -#include <mail/em-folder-utils.h> #include <mail/em-utils.h> #include <mail/mail-send-recv.h> #include <mail/mail-vfolder-ui.h> @@ -194,6 +194,28 @@ mail_shell_backend_mail_icon_cb (EShellWindow *shell_window, } static void +mail_shell_backend_folder_created_cb (EMailFolderCreateDialog *dialog, + CamelStore *store, + const gchar *folder_name, + GWeakRef *folder_tree_weak_ref) +{ + EMFolderTree *folder_tree; + + folder_tree = g_weak_ref_get (folder_tree_weak_ref); + + if (folder_tree != NULL) { + gchar *folder_uri; + + /* Select the newly created folder. */ + folder_uri = e_mail_folder_uri_build (store, folder_name); + em_folder_tree_set_selected (folder_tree, folder_uri, FALSE); + g_free (folder_uri); + + g_object_unref (folder_tree); + } +} + +static void action_mail_folder_new_cb (GtkAction *action, EShellWindow *shell_window) { @@ -202,6 +224,7 @@ action_mail_folder_new_cb (GtkAction *action, EMailSession *session; EShellSidebar *shell_sidebar; EShellView *shell_view; + GtkWidget *dialog; const gchar *view_name; /* Take care not to unnecessarily load the mail shell view. */ @@ -231,8 +254,19 @@ action_mail_folder_new_cb (GtkAction *action, session = em_folder_tree_get_session (folder_tree); exit: - em_folder_utils_create_folder ( - GTK_WINDOW (shell_window), session, folder_tree, NULL); + dialog = e_mail_folder_create_dialog_new ( + GTK_WINDOW (shell_window), + E_MAIL_UI_SESSION (session)); + + if (folder_tree != NULL) { + g_signal_connect_data ( + dialog, "folder-created", + G_CALLBACK (mail_shell_backend_folder_created_cb), + e_weak_ref_new (folder_tree), + (GClosureNotify) e_weak_ref_free, 0); + } + + gtk_widget_show (GTK_WIDGET (dialog)); } static void diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index a93191cf7c..76159950a5 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -25,6 +25,28 @@ #include "e-mail-shell-view-private.h" static void +mail_shell_view_folder_created_cb (EMailFolderCreateDialog *dialog, + CamelStore *store, + const gchar *folder_name, + GWeakRef *folder_tree_weak_ref) +{ + EMFolderTree *folder_tree; + + folder_tree = g_weak_ref_get (folder_tree_weak_ref); + + if (folder_tree != NULL) { + gchar *folder_uri; + + /* Select the newly created folder. */ + folder_uri = e_mail_folder_uri_build (store, folder_name); + em_folder_tree_set_selected (folder_tree, folder_uri, FALSE); + g_free (folder_uri); + + g_object_unref (folder_tree); + } +} + +static void action_mail_account_disable_cb (GtkAction *action, EMailShellView *mail_shell_view) { @@ -775,7 +797,9 @@ action_mail_folder_new_cb (GtkAction *action, EMailSession *session; EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; - gchar *selected_uri; + GtkWidget *dialog; + CamelStore *store = NULL; + gchar *folder_name = NULL; shell_view = E_SHELL_VIEW (mail_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -784,13 +808,25 @@ action_mail_folder_new_cb (GtkAction *action, folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); session = em_folder_tree_get_session (folder_tree); - selected_uri = em_folder_tree_get_selected_uri (folder_tree); - em_folder_utils_create_folder ( + dialog = e_mail_folder_create_dialog_new ( GTK_WINDOW (shell_window), - session, folder_tree, selected_uri); + E_MAIL_UI_SESSION (session)); - g_free (selected_uri); + g_signal_connect_data ( + dialog, "folder-created", + G_CALLBACK (mail_shell_view_folder_created_cb), + e_weak_ref_new (folder_tree), + (GClosureNotify) e_weak_ref_free, 0); + + if (em_folder_tree_get_selected (folder_tree, &store, &folder_name)) { + em_folder_selector_set_selected ( + EM_FOLDER_SELECTOR (dialog), store, folder_name); + g_object_unref (store); + g_free (folder_name); + } + + gtk_widget_show (GTK_WIDGET (dialog)); } static void diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index 377ebd8025..2925f4e63c 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -27,6 +27,7 @@ #include <gtkhtml/gtkhtml.h> #include <camel/camel-search-private.h> /* for camel_search_word */ +#include <mail/e-mail-folder-create-dialog.h> #include <mail/e-mail-label-action.h> #include <mail/e-mail-label-dialog.h> #include <mail/e-mail-label-list-store.h> |