diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-notebook-view.c | 14 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 7 | ||||
-rw-r--r-- | mail/e-mail-reader-utils.c | 2 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 22 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 6 | ||||
-rw-r--r-- | mail/em-folder-selector.c | 14 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 49 | ||||
-rw-r--r-- | mail/em-folder-tree.h | 10 | ||||
-rw-r--r-- | mail/mail.error.xml | 6 |
9 files changed, 74 insertions, 56 deletions
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c index bd92b52d14..d5a7965bab 100644 --- a/mail/e-mail-notebook-view.c +++ b/mail/e-mail-notebook-view.c @@ -981,7 +981,7 @@ mail_netbook_view_open_mail (EMailView *view, E_MAIL_READER (pane), "folder-loaded", G_CALLBACK (reconnect_folder_loaded_event), nview); e_mail_reader_set_folder ( - E_MAIL_READER (pane), folder, folder_uri); + E_MAIL_READER (pane), folder); e_mail_reader_set_group_by_threads ( E_MAIL_READER (pane), e_mail_reader_get_group_by_threads (E_MAIL_READER (view))); @@ -1078,22 +1078,23 @@ build_histogram (GtkWidget *widget, CamelFolder *folder) static void mail_notebook_view_set_folder (EMailReader *reader, - CamelFolder *folder, - const gchar *folder_uri) + CamelFolder *folder) { EMailNotebookViewPrivate *priv; GtkWidget *new_view; + const gchar *folder_uri; #if HAVE_CLUTTER EMailTab *tab; ClutterActor *clone; ClutterTimeline *timeline; #endif - if (!folder_uri) + if (folder == NULL) return; priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv; + folder_uri = camel_folder_get_uri (folder); new_view = g_hash_table_lookup (priv->views, folder_uri); if (new_view) { gint curr = emnv_get_page_num (E_MAIL_NOTEBOOK_VIEW (reader), new_view); @@ -1123,7 +1124,8 @@ mail_notebook_view_set_folder (EMailReader *reader, return; } - if (folder || folder_uri) { + /* FIXME Redundant NULL check. */ + if (folder != NULL) { gint page; #if HAVE_CLUTTER GtkWidget *list; @@ -1221,7 +1223,7 @@ mail_notebook_view_set_folder (EMailReader *reader, g_object_set_data ((GObject *)list, "actor", priv->actor); #endif - e_mail_reader_set_folder (E_MAIL_READER (priv->current_view), folder, folder_uri); + e_mail_reader_set_folder (E_MAIL_READER (priv->current_view), folder); g_hash_table_insert (priv->views, g_strdup (folder_uri), priv->current_view); g_signal_connect ( priv->current_view, "changed", diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index c1e4cc415a..62d3e67c8e 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -456,8 +456,7 @@ mail_paned_view_get_window (EMailReader *reader) static void mail_paned_view_set_folder (EMailReader *reader, - CamelFolder *folder, - const gchar *folder_uri) + CamelFolder *folder) { EMailPanedViewPrivate *priv; EMailView *view; @@ -469,6 +468,7 @@ mail_paned_view_set_folder (EMailReader *reader, GtkWidget *message_list; GKeyFile *key_file; gchar *group_name; + const gchar *folder_uri; const gchar *key; gboolean value; GError *error = NULL; @@ -488,7 +488,7 @@ mail_paned_view_set_folder (EMailReader *reader, /* Chain up to interface's default set_folder() method. */ default_interface = g_type_default_interface_peek (E_TYPE_MAIL_READER); - default_interface->set_folder (reader, folder, folder_uri); + default_interface->set_folder (reader, folder); if (folder == NULL) goto exit; @@ -507,6 +507,7 @@ mail_paned_view_set_folder (EMailReader *reader, /* Restore the folder's preview and threaded state. */ + folder_uri = camel_folder_get_uri (folder); key_file = e_shell_view_get_state_key_file (shell_view); group_name = g_strdup_printf ("Folder %s", folder_uri); diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index c74caadc34..7f7d57d438 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -294,7 +294,7 @@ e_mail_reader_open_selected (EMailReader *reader) browser = e_mail_browser_new (backend); e_mail_reader_set_folder ( - E_MAIL_READER (browser), folder, folder_uri); + E_MAIL_READER (browser), folder); e_mail_reader_set_message (E_MAIL_READER (browser), uid); copy_tree_state (reader, E_MAIL_READER (browser)); e_mail_reader_set_group_by_threads ( diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index f26921c328..c9a43869fb 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1697,11 +1697,9 @@ action_mail_show_source_cb (GtkAction *action, CamelFolder *folder; GtkWidget *browser; GPtrArray *uids; - const gchar *folder_uri; backend = e_mail_reader_get_backend (reader); folder = e_mail_reader_get_folder (reader); - folder_uri = e_mail_reader_get_folder_uri (reader); uids = e_mail_reader_get_selected_uids (reader); g_return_if_fail (uids->len > 0); @@ -1714,7 +1712,7 @@ action_mail_show_source_cb (GtkAction *action, em_format_set_mode ( EM_FORMAT (formatter), EM_FORMAT_MODE_SOURCE); - e_mail_reader_set_folder (reader, folder, folder_uri); + e_mail_reader_set_folder (reader, folder); e_mail_reader_set_message (reader, uids->pdata[0]); gtk_widget_show (browser); @@ -2899,8 +2897,7 @@ mail_reader_get_enable_show_folder (EMailReader *reader) static void mail_reader_set_folder (EMailReader *reader, - CamelFolder *folder, - const gchar *folder_uri) + CamelFolder *folder) { EMailReaderPrivate *priv; EMFormatHTML *formatter; @@ -2908,7 +2905,7 @@ mail_reader_set_folder (EMailReader *reader, GtkWidget *message_list; EMailBackend *backend; EShell *shell; - const gchar *previous_folder_uri; + const gchar *folder_uri = NULL; gboolean outgoing; priv = E_MAIL_READER_GET_PRIVATE (reader); @@ -2918,7 +2915,6 @@ mail_reader_set_folder (EMailReader *reader, message_list = e_mail_reader_get_message_list (reader); previous_folder = e_mail_reader_get_folder (reader); - previous_folder_uri = e_mail_reader_get_folder_uri (reader); shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend)); @@ -2927,9 +2923,12 @@ mail_reader_set_folder (EMailReader *reader, mail_sync_folder (previous_folder, NULL, NULL); /* Skip the rest if we're already viewing the folder. */ - if (g_strcmp0 (folder_uri, previous_folder_uri) == 0) + if (folder == previous_folder) return; + if (folder != NULL) + folder_uri = camel_folder_get_uri (folder); + outgoing = folder != NULL && folder_uri != NULL && ( em_utils_folder_is_drafts (folder, folder_uri) || em_utils_folder_is_outbox (folder, folder_uri) || @@ -4109,8 +4108,7 @@ e_mail_reader_get_folder_uri (EMailReader *reader) void e_mail_reader_set_folder (EMailReader *reader, - CamelFolder *folder, - const gchar *folder_uri) + CamelFolder *folder) { EMailReaderInterface *interface; @@ -4119,7 +4117,7 @@ e_mail_reader_set_folder (EMailReader *reader, interface = E_MAIL_READER_GET_INTERFACE (reader); g_return_if_fail (interface->set_folder != NULL); - interface->set_folder (reader, folder, folder_uri); + interface->set_folder (reader, folder); } /* Helper for e_mail_reader_set_folder_uri () */ @@ -4130,7 +4128,7 @@ mail_reader_got_folder_cb (gchar *folder_uri, { EMailReader *reader = user_data; - e_mail_reader_set_folder (reader, folder, folder_uri); + e_mail_reader_set_folder (reader, folder); } void diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index d9a78f2cc9..8076b08061 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -98,8 +98,7 @@ struct _EMailReaderInterface { CamelFolder * (*get_folder) (EMailReader *reader); const gchar * (*get_folder_uri) (EMailReader *reader); void (*set_folder) (EMailReader *reader, - CamelFolder *folder, - const gchar *folder_uri); + CamelFolder *folder); void (*set_message) (EMailReader *reader, const gchar *uid); guint (*open_selected_mail) (EMailReader *reader); @@ -136,8 +135,7 @@ GtkWindow * e_mail_reader_get_window (EMailReader *reader); CamelFolder * e_mail_reader_get_folder (EMailReader *reader); const gchar * e_mail_reader_get_folder_uri (EMailReader *reader); void e_mail_reader_set_folder (EMailReader *reader, - CamelFolder *folder, - const gchar *folder_uri); + CamelFolder *folder); void e_mail_reader_set_folder_uri (EMailReader *reader, const gchar *folder_uri); void e_mail_reader_set_message (EMailReader *reader, diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 514493664e..ae3092d4df 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -139,16 +139,24 @@ emfs_create_name_changed (GtkEntry *entry, EMFolderSelector *emfs) } static void -folder_selected_cb (EMFolderTree *emft, const gchar *path, const gchar *uri, guint32 flags, EMFolderSelector *emfs) +folder_selected_cb (EMFolderTree *emft, + CamelStore *store, + const gchar *folder_name, + CamelFolderInfoFlags flags, + EMFolderSelector *emfs) { if (emfs->name_entry) emfs_create_name_changed (emfs->name_entry, emfs); else - gtk_dialog_set_response_sensitive (GTK_DIALOG (emfs), GTK_RESPONSE_OK, TRUE); + gtk_dialog_set_response_sensitive ( + GTK_DIALOG (emfs), GTK_RESPONSE_OK, TRUE); } static void -folder_activated_cb (EMFolderTree *emft, const gchar *path, const gchar *uri, EMFolderSelector *emfs) +folder_activated_cb (EMFolderTree *emft, + CamelStore *store, + const gchar *folder_name, + EMFolderSelector *emfs) { gtk_dialog_response ((GtkDialog *) emfs, GTK_RESPONSE_OK); } diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index e0ce87b89c..849fb87c82 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -672,11 +672,11 @@ folder_tree_selection_changed_cb (EMFolderTree *folder_tree, GtkTreeModel *model; GtkTreeIter iter; GList *list; - guint32 flags = 0; + CamelStore *store = NULL; + CamelFolderInfoFlags flags = 0; guint unread = 0; guint old_unread = 0; - gchar *full_name = NULL; - gchar *uri = NULL; + gchar *folder_name = NULL; list = gtk_tree_selection_get_selected_rows (selection, &model); @@ -687,10 +687,11 @@ folder_tree_selection_changed_cb (EMFolderTree *folder_tree, gtk_tree_model_get ( model, &iter, - COL_STRING_FULL_NAME, &full_name, - COL_STRING_URI, &uri, COL_UINT_FLAGS, &flags, - COL_UINT_UNREAD, &unread, COL_UINT_UNREAD_LAST_SEL, - &old_unread, -1); + COL_POINTER_CAMEL_STORE, &store, + COL_STRING_FULL_NAME, &folder_name, + COL_UINT_FLAGS, &flags, + COL_UINT_UNREAD, &unread, + COL_UINT_UNREAD_LAST_SEL, &old_unread, -1); /* Sync unread counts to distinguish new incoming mail. */ if (unread != old_unread) @@ -700,10 +701,10 @@ folder_tree_selection_changed_cb (EMFolderTree *folder_tree, exit: g_signal_emit ( - folder_tree, signals[FOLDER_SELECTED], 0, full_name, uri, flags); + folder_tree, signals[FOLDER_SELECTED], 0, + store, folder_name, flags); - g_free (full_name); - g_free (uri); + g_free (folder_name); g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL); g_list_free (list); @@ -972,9 +973,10 @@ folder_tree_row_activated (GtkTreeView *tree_view, { EMFolderTreePrivate *priv; GtkTreeModel *model; - gchar *full_name, *uri; + gchar *folder_name; GtkTreeIter iter; - guint32 flags; + CamelStore *store; + CamelFolderInfoFlags flags; priv = EM_FOLDER_TREE (tree_view)->priv; @@ -987,19 +989,22 @@ folder_tree_row_activated (GtkTreeView *tree_view, return; gtk_tree_model_get ( - model, &iter, COL_STRING_FULL_NAME, &full_name, - COL_STRING_URI, &uri, COL_UINT_FLAGS, &flags, -1); + model, &iter, + COL_POINTER_CAMEL_STORE, &store, + COL_STRING_FULL_NAME, &folder_name, + COL_UINT_FLAGS, &flags, -1); folder_tree_clear_selected_list (EM_FOLDER_TREE (tree_view)); g_signal_emit ( - tree_view, signals[FOLDER_SELECTED], 0, full_name, uri, flags); + tree_view, signals[FOLDER_SELECTED], 0, + store, folder_name, flags); g_signal_emit ( - tree_view, signals[FOLDER_ACTIVATED], 0, full_name, uri); + tree_view, signals[FOLDER_ACTIVATED], 0, + store, folder_name); - g_free (full_name); - g_free (uri); + g_free (folder_name); } static gboolean @@ -1132,9 +1137,9 @@ folder_tree_class_init (EMFolderTreeClass *class) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EMFolderTreeClass, folder_selected), NULL, NULL, - e_marshal_VOID__STRING_STRING_UINT, + e_marshal_VOID__OBJECT_STRING_UINT, G_TYPE_NONE, 3, - G_TYPE_STRING, + CAMEL_TYPE_STORE, G_TYPE_STRING, G_TYPE_UINT); @@ -1144,9 +1149,9 @@ folder_tree_class_init (EMFolderTreeClass *class) G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (EMFolderTreeClass, folder_activated), NULL, NULL, - e_marshal_VOID__STRING_STRING, + e_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, - G_TYPE_STRING, + CAMEL_TYPE_STORE, G_TYPE_STRING); signals[POPUP_EVENT] = g_signal_new ( diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index c824e86ed2..4cb032b6b3 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -78,12 +78,12 @@ struct _EMFolderTreeClass { /* signals */ void (*folder_activated) (EMFolderTree *folder_tree, - const gchar *full_name, - const gchar *uri); + CamelStore *store, + const gchar *folder_name); void (*folder_selected) (EMFolderTree *folder_tree, - const gchar *full_name, - const gchar *uri, - guint32 flags); + CamelStore *store, + const gchar *folder_name, + CamelFolderInfoFlags flags); void (*popup_event) (EMFolderTree *folder_tree); void (*hidden_key_event) (EMFolderTree *emft, GdkEvent *event); }; diff --git a/mail/mail.error.xml b/mail/mail.error.xml index 4b9b98699e..67b7e09961 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -504,5 +504,11 @@ An mbox account will be created to preserve the old mbox folders. You can delete <_primary>Unable to retrieve message.</_primary> <_secondary xml:space="preserve">{0}</_secondary> </error> + + <error id="folder-open" type="error"> + <_primary>Failed to open folder.</_primary> + <_secondary>The reported error was "{0}".</_secondary> + </error> + </error-list> |