aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-08-18 11:10:41 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-09-14 20:08:51 +0800
commit40875ac66f4ef93be31318425e89a6642d5cf0db (patch)
tree2ee2169299c8fc781b578bfa807ace36407a6e21
parent34be64ac5286f0a3e4c02a74ff0ef8c4062bb966 (diff)
downloadgsoc2013-evolution-40875ac66f4ef93be31318425e89a6642d5cf0db.tar
gsoc2013-evolution-40875ac66f4ef93be31318425e89a6642d5cf0db.tar.gz
gsoc2013-evolution-40875ac66f4ef93be31318425e89a6642d5cf0db.tar.bz2
gsoc2013-evolution-40875ac66f4ef93be31318425e89a6642d5cf0db.tar.lz
gsoc2013-evolution-40875ac66f4ef93be31318425e89a6642d5cf0db.tar.xz
gsoc2013-evolution-40875ac66f4ef93be31318425e89a6642d5cf0db.tar.zst
gsoc2013-evolution-40875ac66f4ef93be31318425e89a6642d5cf0db.zip
Bug 656720 - Exclude NNTP stores from Create Folder dialog
-rw-r--r--mail/e-mail-store.c6
-rw-r--r--mail/em-folder-tree-model.c28
-rw-r--r--mail/em-folder-utils.c26
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);