aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mark-all-read
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-25 05:36:21 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-25 07:41:59 +0800
commita9dff2f33a06879403277a422fc579854aa99885 (patch)
tree36d8ccdaf876cc6ca36db80069dcbef8a26a60bf /plugins/mark-all-read
parentb6fecfcd53bc5a733a7aaf3684cda077bfdd2e5e (diff)
downloadgsoc2013-evolution-a9dff2f33a06879403277a422fc579854aa99885.tar
gsoc2013-evolution-a9dff2f33a06879403277a422fc579854aa99885.tar.gz
gsoc2013-evolution-a9dff2f33a06879403277a422fc579854aa99885.tar.bz2
gsoc2013-evolution-a9dff2f33a06879403277a422fc579854aa99885.tar.lz
gsoc2013-evolution-a9dff2f33a06879403277a422fc579854aa99885.tar.xz
gsoc2013-evolution-a9dff2f33a06879403277a422fc579854aa99885.tar.zst
gsoc2013-evolution-a9dff2f33a06879403277a422fc579854aa99885.zip
Use em_folder_tree_get_selected() in places to simplify code.
There were a few places where we were accessing the folder tree model directly to get the selected store + folder name, or were asking for the selected URI only to parse back into its store + folder name components.
Diffstat (limited to 'plugins/mark-all-read')
-rw-r--r--plugins/mark-all-read/mark-all-read.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 7a5c79e95f..10ea043fee 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -515,14 +515,9 @@ action_mail_mark_read_recursive_cb (GtkAction *action,
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EMFolderTree *folder_tree;
- EMailBackend *backend;
- EMailSession *session;
AsyncContext *context;
- CamelStore *store = NULL;
- CamelStoreGetFolderInfoFlags flags;
- gchar *folder_name = NULL;
- gchar *folder_uri;
- GError *error = NULL;
+ CamelStore *store;
+ gchar *folder_name;
shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
@@ -530,28 +525,11 @@ action_mail_mark_read_recursive_cb (GtkAction *action,
g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
- backend = em_folder_tree_get_backend (folder_tree);
- session = e_mail_backend_get_session (backend);
-
- folder_uri = em_folder_tree_get_selected_uri (folder_tree);
- g_return_if_fail (folder_uri != NULL);
-
- e_mail_folder_uri_parse (
- CAMEL_SESSION (session), folder_uri,
- &store, &folder_name, &error);
+ /* This action should only be activatable if a folder is selected. */
+ if (!em_folder_tree_get_selected (folder_tree, &store, &folder_name))
+ g_return_if_reached ();
g_object_unref (folder_tree);
- g_free (folder_uri);
-
- /* Failure here is unlikely enough that we don't need an
- * EAlert for it, but we should still leave a breadcrumb. */
- if (error != NULL) {
- g_warning ("%s", error->message);
- return;
- }
-
- g_return_if_fail (CAMEL_IS_STORE (store));
- g_return_if_fail (folder_name != NULL);
/* Open the selected folder asynchronously. */
@@ -567,11 +545,10 @@ action_mail_mark_read_recursive_cb (GtkAction *action,
e_shell_backend_add_activity (shell_backend, context->activity);
- flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE |
- CAMEL_STORE_FOLDER_INFO_FAST;
-
camel_store_get_folder_info (
- store, folder_name, flags,
+ store, folder_name,
+ CAMEL_STORE_FOLDER_INFO_FAST |
+ CAMEL_STORE_FOLDER_INFO_RECURSIVE,
G_PRIORITY_DEFAULT, cancellable,
(GAsyncReadyCallback) mar_got_folder_info, context);