[evolution/wip/gsettings] Bug 656720 - Exclude NNTP stores from Create Folder dialog
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/gsettings] Bug 656720 - Exclude NNTP stores from Create Folder dialog
- Date: Wed, 14 Sep 2011 12:28:52 +0000 (UTC)
commit 40875ac66f4ef93be31318425e89a6642d5cf0db
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Aug 17 23:10:41 2011 -0400
Bug 656720 - Exclude NNTP stores from Create Folder dialog
mail/e-mail-store.c | 6 ------
mail/em-folder-tree-model.c | 28 +++++++++++++++++-----------
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 3a7c27e..873c47d 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 295d9d0..1b79ca9 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 1ac8b33..346bd97 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]