diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-08-18 11:10:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-08-18 11:31:01 +0800 |
commit | 31a00721343016518b458aae5c2045b32785256f (patch) | |
tree | b9d07aafab9819cfca12596cce30148ff377e642 /mail | |
parent | ef929f26973d8d5712a6962c804b1dc0b439d0a9 (diff) | |
download | gsoc2013-evolution-31a00721343016518b458aae5c2045b32785256f.tar.gz gsoc2013-evolution-31a00721343016518b458aae5c2045b32785256f.tar.zst gsoc2013-evolution-31a00721343016518b458aae5c2045b32785256f.zip |
Bug 656720 - Exclude NNTP stores from Create Folder dialog
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-store.c | 6 | ||||
-rw-r--r-- | mail/em-folder-tree-model.c | 28 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 26 |
3 files changed, 42 insertions, 18 deletions
diff --git a/mail/e-mail-store.c b/mail/e-mail-store.c index 3a7c27e71c..873c47d33e 100644 --- a/mail/e-mail-store.c +++ b/mail/e-mail-store.c @@ -159,18 +159,12 @@ mail_store_add (EMailSession *session, { EMFolderTreeModel *default_model; MailFolderCache *folder_cache; - CamelProvider *provider; StoreInfo *store_info; g_return_if_fail (store_table != NULL); g_return_if_fail (store != NULL); g_return_if_fail (CAMEL_IS_STORE (store)); - provider = camel_service_get_provider (CAMEL_SERVICE (store)); - - g_return_if_fail ( - (provider->flags & CAMEL_PROVIDER_IS_STORAGE) != 0); - default_model = em_folder_tree_model_get_default (); folder_cache = e_mail_session_get_folder_cache (session); diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 295d9d0865..1b79ca9ac6 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -205,7 +205,6 @@ account_changed_cb (EAccountList *accounts, EMFolderTreeModel *model) { EMailSession *session; - CamelProvider *provider; CamelService *service; session = em_folder_tree_model_get_session (model); @@ -222,12 +221,6 @@ account_changed_cb (EAccountList *accounts, if (!account->enabled) return; - /* make sure the new store belongs in the tree */ - provider = camel_service_get_provider (service); - if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE) || - em_utils_is_local_delivery_mbox_file (camel_service_get_camel_url (service))) - return; - em_folder_tree_model_add_store (model, CAMEL_STORE (service)); } @@ -1012,6 +1005,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, GtkTreeIter root, iter; GtkTreePath *path; CamelService *service; + CamelProvider *provider; CamelURL *service_url; const gchar *display_name; gchar *uri; @@ -1021,14 +1015,26 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, tree_store = GTK_TREE_STORE (model); - si = em_folder_tree_model_lookup_store_info (model, store); - if (si != NULL) - em_folder_tree_model_remove_store (model, store); - service = CAMEL_SERVICE (store); + provider = camel_service_get_provider (service); service_url = camel_service_get_camel_url (service); display_name = camel_service_get_display_name (service); + /* Ignore stores that should not be added to the tree model. */ + + if (provider == NULL) + return; + + if ((provider->flags & CAMEL_PROVIDER_IS_STORAGE) == 0) + return; + + if (em_utils_is_local_delivery_mbox_file (service_url)) + return; + + si = em_folder_tree_model_lookup_store_info (model, store); + if (si != NULL) + em_folder_tree_model_remove_store (model, store); + uri = camel_url_to_string (service_url, CAMEL_URL_HIDE_ALL); /* Add the store to the tree. */ diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 1ac8b33fd2..346bd978a1 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -553,20 +553,44 @@ em_folder_utils_create_folder (GtkWindow *parent, CamelStore *store = NULL; gchar *folder_name = NULL; GtkWidget *dialog; + GList *list, *link; GError *error = NULL; g_return_if_fail (GTK_IS_WINDOW (parent)); g_return_if_fail (E_IS_MAIL_BACKEND (backend)); + model = em_folder_tree_model_new (); session = e_mail_backend_get_session (backend); + em_folder_tree_model_set_session (model, session); - model = em_folder_tree_model_get_default (); + list = camel_session_list_services (CAMEL_SESSION (session)); + + for (link = list; link != NULL; link = g_list_next (link)) { + CamelService *service; + CamelStore *store; + + service = CAMEL_SERVICE (link->data); + + if (!CAMEL_IS_STORE (service)) + continue; + + store = CAMEL_STORE (service); + + if ((store->flags & CAMEL_STORE_CAN_EDIT_FOLDERS) == 0) + continue; + + em_folder_tree_model_add_store (model, store); + } + + g_list_free (list); dialog = em_folder_selector_create_new ( parent, backend, model, 0, _("Create Folder"), _("Specify where to create the folder:")); + g_object_unref (model); + selector = EM_FOLDER_SELECTOR (dialog); folder_tree = em_folder_selector_get_folder_tree (selector); |