diff options
author | Milan Crha <mcrha@redhat.com> | 2011-02-16 20:14:49 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-02-16 20:14:49 +0800 |
commit | 94e43758de5e90ff3acf70654a53ddf787495f1b (patch) | |
tree | 0f7e8bd91d339d92f94221cf61e1623624fdbeba | |
parent | fd0b59503481461304b8c9818066eb7ce28dfe25 (diff) | |
download | gsoc2013-evolution-94e43758de5e90ff3acf70654a53ddf787495f1b.tar gsoc2013-evolution-94e43758de5e90ff3acf70654a53ddf787495f1b.tar.gz gsoc2013-evolution-94e43758de5e90ff3acf70654a53ddf787495f1b.tar.bz2 gsoc2013-evolution-94e43758de5e90ff3acf70654a53ddf787495f1b.tar.lz gsoc2013-evolution-94e43758de5e90ff3acf70654a53ddf787495f1b.tar.xz gsoc2013-evolution-94e43758de5e90ff3acf70654a53ddf787495f1b.tar.zst gsoc2013-evolution-94e43758de5e90ff3acf70654a53ddf787495f1b.zip |
Bug #638333 - Critical warning when invoking File->New->Mail Folder
-rw-r--r-- | mail/em-folder-selector.c | 2 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 11 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 12 | ||||
-rw-r--r-- | mail/em-folder-utils.h | 1 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 15 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 2 | ||||
-rw-r--r-- | shell/e-shell-window-private.c | 2 |
7 files changed, 33 insertions, 12 deletions
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index b05ba3549d..514493664e 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -116,7 +116,7 @@ emfs_response (GtkWidget *dialog, gint response, EMFolderSelector *emfs) g_object_set_data ((GObject *)emfs->emft, "select", GUINT_TO_POINTER (1)); - em_folder_utils_create_folder (NULL, emfs->emft, GTK_WINDOW (dialog)); + em_folder_utils_create_folder (NULL, emfs->emft, em_folder_tree_get_session (emfs->emft), GTK_WINDOW (dialog)); g_signal_stop_emission_by_name (emfs, "response"); } diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 51a116f643..69a34357a6 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -64,6 +64,7 @@ #include "e-mail-local.h" #include "e-mail-session.h" +#include "e-mail-store.h" #define d(x) @@ -1695,8 +1696,18 @@ em_folder_tree_get_type (void) GtkWidget * em_folder_tree_new (EMailSession *session) { + const gchar *data_dir; + EShell *default_shell; + EShellBackend *mail_backend; + g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL); + default_shell = e_shell_get_default (); + mail_backend = e_shell_get_backend_by_name (default_shell, "mail"); + data_dir = e_shell_backend_get_data_dir (mail_backend); + + e_mail_store_init (session, data_dir); + return g_object_new ( EM_TYPE_FOLDER_TREE, "session", session, NULL); } diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index e84152e574..eed9298f07 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -650,11 +650,11 @@ new_folder_created_cb (CamelFolderInfo *fi, gpointer user_data) { struct _EMCreateFolderTempData *emcftd=user_data; if (fi) { - gtk_widget_destroy ((GtkWidget *) emcftd->emfs); - /* Exapnding newly created folder */ if (emcftd->emft) em_folder_tree_set_selected ((EMFolderTree *) emcftd->emft, emcftd->uri, GPOINTER_TO_INT(g_object_get_data ((GObject *)emcftd->emft, "select")) ? FALSE : TRUE); + + gtk_widget_destroy ((GtkWidget *) emcftd->emfs); } g_object_unref (emcftd->emfs); g_free (emcftd->uri); @@ -727,16 +727,12 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, void em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft, + EMailSession *session, GtkWindow *parent) { EMFolderTree *folder_tree; - EMailSession *session; GtkWidget *dialog; - g_return_if_fail (EM_IS_FOLDER_TREE (emft)); - - session = em_folder_tree_get_session (emft); - folder_tree = (EMFolderTree *) em_folder_tree_new (session); emu_restore_folder_tree_state (folder_tree); @@ -746,7 +742,7 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, _("Specify where to create the folder:")); if (folderinfo != NULL) em_folder_selector_set_selected ((EMFolderSelector *) dialog, folderinfo->uri); - g_signal_connect (dialog, "response", G_CALLBACK (emfu_popup_new_folder_response), emft); + g_signal_connect (dialog, "response", G_CALLBACK (emfu_popup_new_folder_response), emft ? emft : folder_tree); if (!parent || !GTK_IS_DIALOG (parent)) gtk_widget_show (dialog); diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h index 9d937d2424..03aacc15fd 100644 --- a/mail/em-folder-utils.h +++ b/mail/em-folder-utils.h @@ -48,6 +48,7 @@ void em_folder_utils_delete_folder (EMailBackend *backend, CamelFolder *folder); void em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft, + EMailSession *session, GtkWindow *parent); const gchar * em_folder_utils_get_icon_name (guint32 flags); diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index c7bba4944a..601b8e0c25 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -108,24 +108,35 @@ action_mail_folder_new_cb (GtkAction *action, { EMFolderTree *folder_tree = NULL; EMailShellSidebar *mail_shell_sidebar; + EMailSession *mail_session; EShellSidebar *shell_sidebar; EShellView *shell_view; const gchar *view_name; /* Take care not to unnecessarily load the mail shell view. */ view_name = e_shell_window_get_active_view (shell_window); - if (g_strcmp0 (view_name, BACKEND_NAME) != 0) + if (g_strcmp0 (view_name, BACKEND_NAME) != 0) { + EShellBackend *mail_backend; + + mail_backend = e_shell_get_backend_by_name (e_shell_window_get_shell (shell_window), BACKEND_NAME); + g_return_if_fail (mail_backend != NULL); + + mail_session = e_mail_backend_get_session (E_MAIL_BACKEND (mail_backend)); + g_return_if_fail (mail_session != NULL); + goto exit; + } shell_view = e_shell_window_get_shell_view (shell_window, view_name); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + mail_session = em_folder_tree_get_session (folder_tree); exit: em_folder_utils_create_folder ( - NULL, folder_tree, GTK_WINDOW (shell_window)); + NULL, folder_tree, mail_session, GTK_WINDOW (shell_window)); } static void diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 1665b8e8ce..e0a445abdd 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -394,7 +394,7 @@ action_mail_folder_new_cb (GtkAction *action, g_return_if_fail (folder_info != NULL); em_folder_utils_create_folder ( - folder_info, folder_tree, GTK_WINDOW (shell_window)); + folder_info, folder_tree, em_folder_tree_get_session (folder_tree), GTK_WINDOW (shell_window)); camel_folder_info_free (folder_info); } diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c index 1f12c9c41e..6dcba975bc 100644 --- a/shell/e-shell-window-private.c +++ b/shell/e-shell-window-private.c @@ -266,7 +266,9 @@ e_shell_window_private_constructed (EShellWindow *shell_window) GConfBridge *bridge; GtkAction *action; GtkAccelGroup *accel_group; +#if 0 GtkActionGroup *action_group; +#endif GtkUIManager *ui_manager; GtkBox *box; GtkPaned *paned; |