diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-11-14 06:33:02 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-11-14 06:33:02 +0800 |
commit | f3fe0dd7a31616426fc41fc41954c7b40ee8f20f (patch) | |
tree | 43873596c2c3b7fd60125ed3b21ad3d01e9d27be /mail | |
parent | 5c8d360c983f9362cd96c59089b9f2b8fc415847 (diff) | |
download | gsoc2013-evolution-f3fe0dd7a31616426fc41fc41954c7b40ee8f20f.tar.gz gsoc2013-evolution-f3fe0dd7a31616426fc41fc41954c7b40ee8f20f.tar.zst gsoc2013-evolution-f3fe0dd7a31616426fc41fc41954c7b40ee8f20f.zip |
Updated for function name changes in mail-component.c
2003-11-13 Jeffrey Stedfast <fejj@ximian.com>
* mail-vfolder.c (vfolder_load_storage): Updated for function name
changes in mail-component.c
* mail-offline-handler.c: Updated for function name changes in
mail-component.c
* mail-account-gui.c (add_new_store): Fixed to not use EStorage.
(mail_account_gui_save): Updated for function name changes.
* em-account-prefs.c (account_delete_clicked): Updated for
function name changes.
(account_able_clicked): Same.
(account_able_toggled): Same.
* mail-component.c: Renamed mail_component_*storage*() functions
to mail_component_*store*() since we are no longer dealing with
storages, but instead with CamelStore's.
(create_view_widget): If the user selects a store node, don't try
to open it as a folder.
svn path=/trunk/; revision=23340
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 21 | ||||
-rw-r--r-- | mail/em-account-prefs.c | 18 | ||||
-rw-r--r-- | mail/em-folder-selection-button.c | 2 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 25 | ||||
-rw-r--r-- | mail/mail-component.c | 98 | ||||
-rw-r--r-- | mail/mail-component.h | 37 | ||||
-rw-r--r-- | mail/mail-offline-handler.c | 28 |
7 files changed, 114 insertions, 115 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index ab1bbb6378..a2a8528963 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,7 +1,24 @@ 2003-11-13 Jeffrey Stedfast <fejj@ximian.com> - * mail-component.c (create_view_widget): If the user selects a - store node, don't try to open it as a folder. + * mail-vfolder.c (vfolder_load_storage): Updated for function name + changes in mail-component.c + + * mail-offline-handler.c: Updated for function name changes in + mail-component.c + + * mail-account-gui.c (add_new_store): Fixed to not use EStorage. + (mail_account_gui_save): Updated for function name changes. + + * em-account-prefs.c (account_delete_clicked): Updated for + function name changes. + (account_able_clicked): Same. + (account_able_toggled): Same. + + * mail-component.c: Renamed mail_component_*storage*() functions + to mail_component_*store*() since we are no longer dealing with + storages, but instead with CamelStore's. + (create_view_widget): If the user selects a store node, don't try + to open it as a folder. 2003-11-13 Ettore Perazzoli <ettore@ximian.com> diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c index 4e5008f3ef..e4b3844b2b 100644 --- a/mail/em-account-prefs.c +++ b/mail/em-account-prefs.c @@ -250,8 +250,8 @@ account_delete_clicked (GtkButton *button, gpointer user_data) /* remove it from the folder-tree in the shell */ if (account->enabled && account->source && account->source->url) - mail_component_remove_storage_by_uri (mail_component_peek (), account->source->url); - + mail_component_remove_store_by_uri (mail_component_peek (), account->source->url); + /* remove it from the config file */ mail_config_remove_account (account); accounts = mail_config_get_accounts (); @@ -320,11 +320,11 @@ account_able_clicked (GtkButton *button, gpointer user_data) folder-tree, otherwise add it to the folder-tree */ if (account->source->url) { if (account->enabled) - mail_component_load_storage_by_uri (component, - account->source->url, - account->name); + mail_component_load_store_by_uri (component, + account->source->url, + account->name); else - mail_component_remove_storage_by_uri (component, account->source->url); + mail_component_remove_store_by_uri (component, account->source->url); } mail_autoreceive_setup (); @@ -360,14 +360,14 @@ account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user if (account) { MailComponent *component = mail_component_peek (); - + /* if the account got disabled, remove it from the folder-tree, otherwise add it to the folder-tree */ if (account->source->url) { if (account->enabled) - mail_component_load_storage_by_uri (component, account->source->url, account->name); + mail_component_load_store_by_uri (component, account->source->url, account->name); else - mail_component_remove_storage_by_uri (component, account->source->url); + mail_component_remove_store_by_uri (component, account->source->url); } mail_autoreceive_setup (); diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c index 42964a10b2..a903514452 100644 --- a/mail/em-folder-selection-button.c +++ b/mail/em-folder-selection-button.c @@ -216,7 +216,7 @@ em_folder_selection_button_clicked (GtkButton *button) (* GTK_BUTTON_CLASS (parent_class)->clicked) (button); model = mail_component_get_tree_model (mail_component_peek ()); - emft = em_folder_tree_new_with_model (model); + emft = (EMFolderTree *) em_folder_tree_new_with_model (model); dialog = em_folder_selector_new (emft, EM_FOLDER_SELECTOR_CAN_CREATE, priv->title, priv->caption); em_folder_selector_set_selected ((EMFolderSelector *) dialog, priv->uri); diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 10d8c8f1ff..40858ec792 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -48,8 +48,6 @@ #include "mail-mt.h" #include "mail.h" -#include "e-storage.h" - #if defined (HAVE_NSS) #include "smime/gui/e-cert-selector.h" #endif @@ -57,7 +55,6 @@ #define d(x) extern char *default_drafts_folder_uri, *default_sent_folder_uri; -extern EvolutionShellClient *global_shell_client; static void save_service (MailAccountGuiService *gsvc, GHashTable *extra_conf, EAccountService *service); static void service_changed (GtkEntry *entry, gpointer user_data); @@ -1935,23 +1932,13 @@ save_service (MailAccountGuiService *gsvc, GHashTable *extra_config, EAccountSer static void add_new_store (char *uri, CamelStore *store, void *user_data) { - EAccount *account = user_data; MailComponent *component = mail_component_peek (); - EStorage *storage; + EAccount *account = user_data; if (store == NULL) return; - - /* EPFIXME: Strange refcounting semantics here?! */ - storage = mail_component_lookup_storage (component, store); - if (storage) { - /* store is already in the folder tree, so do nothing */ - g_object_unref (storage); - } else { - /* store is *not* in the folder tree, so lets add it. */ - mail_component_add_store (component, store, account->name); - } + mail_component_add_store (component, store, account->name); } gboolean @@ -2064,11 +2051,11 @@ mail_account_gui_save (MailAccountGui *gui) } else if (account->source->url) { /* this means the account was edited - if the old and new source urls are not identical, replace the old - storage with the new storage */ + store with the new store */ #define sources_equal(old,new) (new->url && !strcmp (old->url, new->url)) if (!sources_equal (account->source, new->source)) { - /* Remove the old storage from the folder-tree */ - mail_component_remove_storage_by_uri (mail_component_peek (), account->source->url); + /* Remove the old store from the folder-tree */ + mail_component_remove_store_by_uri (mail_component_peek (), account->source->url); } } @@ -2085,7 +2072,7 @@ mail_account_gui_save (MailAccountGui *gui) /* if the account provider is something we can stick in the folder-tree and not added by some other component, then get the CamelStore and add it to - the shell storages */ + the folder-tree */ if (is_storage && account->enabled) mail_get_store (account->source->url, NULL, add_new_store, account); diff --git a/mail/mail-component.c b/mail/mail-component.c index 8d6abf07bf..1e78894e86 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -92,12 +92,12 @@ struct _MailComponentPrivate { /* Utility functions. */ static void -add_storage (MailComponent *component, const char *name, CamelService *store, CamelException *ex) +add_store (MailComponent *component, const char *name, CamelStore *store, CamelException *ex) { camel_object_ref (store); g_hash_table_insert (component->priv->store_hash, store, g_strdup (name)); - em_folder_tree_add_store (component->priv->emft, (CamelStore *) store, name); - mail_note_store ((CamelStore *) store, NULL, NULL, NULL); + em_folder_tree_add_store (component->priv->emft, store, name); + mail_note_store (store, NULL, NULL, NULL); } static void @@ -121,7 +121,7 @@ load_accounts (MailComponent *component, EAccountList *accounts) name = account->name; if (account->enabled && service->url != NULL) - mail_component_load_storage_by_uri (component, service->url, name); + mail_component_load_store_by_uri (component, service->url, name); e_iterator_next (iter); } @@ -130,7 +130,7 @@ load_accounts (MailComponent *component, EAccountList *accounts) } static void -storage_go_online (gpointer key, gpointer value, gpointer data) +store_go_online (gpointer key, gpointer value, gpointer data) { CamelStore *store = key; CamelService *service = CAMEL_SERVICE (store); @@ -150,9 +150,9 @@ storage_go_online (gpointer key, gpointer value, gpointer data) static void go_online (MailComponent *component) { - camel_session_set_online(session, TRUE); - mail_session_set_interactive(TRUE); - mail_component_storages_foreach(component, storage_go_online, NULL); + camel_session_set_online (session, TRUE); + mail_session_set_interactive (TRUE); + mail_component_stores_foreach (component, store_go_online, NULL); } static void @@ -207,9 +207,9 @@ setup_local_store(MailComponent *component) g_assert(p->local_store == NULL); /* EPFIXME It should use base_directory once we have moved it. */ - store_uri = g_strconcat("mbox:", g_get_home_dir(), "/.evolution/mail/local", NULL); - p->local_store = mail_component_load_storage_by_uri(component, store_uri, _("On this Computer")); - camel_object_ref(p->local_store); + store_uri = g_strconcat("mbox:", g_get_home_dir (), "/.evolution/mail/local", NULL); + p->local_store = mail_component_load_store_by_uri (component, store_uri, _("On this Computer")); + camel_object_ref (p->local_store); camel_exception_init (&ex); for (i=0;i<sizeof(default_folders)/sizeof(default_folders[0]);i++) { @@ -503,7 +503,7 @@ mail_component_peek (void) /* FIXME: this should all be initialised in a starutp routine, not from the peek function, this covers much of the ::init method's content too */ - vfolder_load_storage(); + vfolder_load_storage (); } return component; @@ -524,22 +524,20 @@ mail_component_peek_search_context (MailComponent *component) void -mail_component_add_store (MailComponent *component, - CamelStore *store, - const char *name) +mail_component_add_store (MailComponent *component, CamelStore *store, const char *name) { CamelException ex; - + camel_exception_init (&ex); if (name == NULL) { char *service_name; service_name = camel_service_get_name ((CamelService *) store, TRUE); - add_storage (component, service_name, (CamelService *) store, &ex); + add_store (component, service_name, store, &ex); g_free (service_name); } else { - add_storage (component, name, (CamelService *) store, &ex); + add_store (component, name, store, &ex); } camel_exception_clear (&ex); @@ -547,23 +545,19 @@ mail_component_add_store (MailComponent *component, /** - * mail_component_load_storage_by_uri: - * @component: - * @uri: - * @name: - * - * + * mail_component_load_store_by_uri: + * @component: mail component + * @uri: uri of store + * @name: name of store (used for display purposes) * * Return value: Pointer to the newly added CamelStore. The caller is supposed * to ref the object if it wants to store it. **/ CamelStore * -mail_component_load_storage_by_uri (MailComponent *component, - const char *uri, - const char *name) +mail_component_load_store_by_uri (MailComponent *component, const char *uri, const char *name) { CamelException ex; - CamelService *store; + CamelStore *store; CamelProvider *prov; camel_exception_init (&ex); @@ -586,7 +580,7 @@ mail_component_load_storage_by_uri (MailComponent *component, (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL)) return NULL; - store = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex); + store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex); if (store == NULL) { /* EPFIXME: real error dialog */ g_warning ("couldn't get service %s: %s\n", uri, @@ -596,38 +590,37 @@ mail_component_load_storage_by_uri (MailComponent *component, } if (name != NULL) { - add_storage (component, name, store, &ex); + add_store (component, name, store, &ex); } else { char *service_name; - service_name = camel_service_get_name (store, TRUE); - add_storage (component, service_name, store, &ex); + service_name = camel_service_get_name ((CamelService *) store, TRUE); + add_store (component, service_name, store, &ex); g_free (service_name); } if (camel_exception_is_set (&ex)) { /* EPFIXME: real error dialog */ - g_warning ("Cannot load storage: %s", + g_warning ("Cannot load store: %s", camel_exception_get_description (&ex)); camel_exception_clear (&ex); } - camel_object_unref (CAMEL_OBJECT (store)); - return CAMEL_STORE (store); /* (Still has one ref in the hash.) */ + camel_object_unref (store); + + return store; } static void -store_disconnect (CamelStore *store, - void *event_data, - void *data) +store_disconnect (CamelStore *store, void *event_data, void *user_data) { camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); camel_object_unref (store); } void -mail_component_remove_storage (MailComponent *component, CamelStore *store) +mail_component_remove_store (MailComponent *component, CamelStore *store) { MailComponentPrivate *priv = component->priv; char *name; @@ -655,36 +648,35 @@ mail_component_remove_storage (MailComponent *component, CamelStore *store) void -mail_component_remove_storage_by_uri (MailComponent *component, - const char *uri) +mail_component_remove_store_by_uri (MailComponent *component, const char *uri) { CamelProvider *prov; - CamelService *store; - - prov = camel_session_get_provider (session, uri, NULL); - if (!prov) + CamelStore *store; + + if (!(prov = camel_session_get_provider (session, uri, NULL))) return; + if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE) || (prov->flags & CAMEL_PROVIDER_IS_EXTERNAL)) return; - - store = camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL); + + store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL); if (store != NULL) { - mail_component_remove_storage (component, CAMEL_STORE (store)); - camel_object_unref (CAMEL_OBJECT (store)); + mail_component_remove_store (component, store); + camel_object_unref (store); } } int -mail_component_get_storage_count (MailComponent *component) +mail_component_get_store_count (MailComponent *component) { return g_hash_table_size (component->priv->store_hash); } void -mail_component_storages_foreach (MailComponent *component, GHFunc func, void *user_data) +mail_component_stores_foreach (MailComponent *component, GHFunc func, void *user_data) { g_hash_table_foreach (component->priv->store_hash, func, user_data); } @@ -693,9 +685,10 @@ mail_component_storages_foreach (MailComponent *component, GHFunc func, void *us void mail_component_remove_folder (MailComponent *component, CamelStore *store, const char *path) { - /* FIXME: implement me */ + /* FIXME: implement me. but first, am I really even needed? */ } + EMFolderTreeModel * mail_component_get_tree_model (MailComponent *component) { @@ -707,6 +700,7 @@ mail_component_get_tree_model (MailComponent *component) return model; } + extern struct _CamelSession *session; char *em_uri_from_camel(const char *curi) diff --git a/mail/mail-component.h b/mail/mail-component.h index aab2dab4b3..1d31a22da5 100644 --- a/mail/mail-component.h +++ b/mail/mail-component.h @@ -63,24 +63,25 @@ GType mail_component_get_type (void); MailComponent *mail_component_peek (void); -const char *mail_component_peek_base_directory (MailComponent *component); -RuleContext *mail_component_peek_search_context (MailComponent *component); - -void mail_component_add_store (MailComponent *component, - CamelStore *store, - const char *name); -CamelStore *mail_component_load_storage_by_uri (MailComponent *component, - const char *uri, - const char *name); -void mail_component_remove_storage (MailComponent *component, - CamelStore *store); -void mail_component_remove_storage_by_uri (MailComponent *component, - const char *uri); - -int mail_component_get_storage_count (MailComponent *component); -void mail_component_storages_foreach (MailComponent *component, - GHFunc func, - void *data); +const char *mail_component_peek_base_directory (MailComponent *component); +RuleContext *mail_component_peek_search_context (MailComponent *component); + +void mail_component_add_store (MailComponent *component, + CamelStore *store, + const char *name); +CamelStore *mail_component_load_store_by_uri (MailComponent *component, + const char *uri, + const char *name); + +void mail_component_remove_store (MailComponent *component, + CamelStore *store); +void mail_component_remove_store_by_uri (MailComponent *component, + const char *uri); + +int mail_component_get_store_count (MailComponent *component); +void mail_component_stores_foreach (MailComponent *component, + GHFunc func, + void *data); void mail_component_remove_folder (MailComponent *component, CamelStore *store, const char *path); diff --git a/mail/mail-offline-handler.c b/mail/mail-offline-handler.c index 5a39249765..6a44b05712 100644 --- a/mail/mail-offline-handler.c +++ b/mail/mail-offline-handler.c @@ -58,7 +58,7 @@ service_is_relevant (CamelService *service, gboolean going_offline) } static void -add_connection (gpointer key, gpointer data, gpointer user_data) +add_connection (gpointer key, gpointer value, gpointer user_data) { CamelService *service = key; GNOME_Evolution_ConnectionList *list = user_data; @@ -78,11 +78,11 @@ create_connection_list (void) list = GNOME_Evolution_ConnectionList__alloc (); list->_length = 0; - list->_maximum = mail_component_get_storage_count (mail_component_peek ()); + list->_maximum = mail_component_get_store_count (mail_component_peek ()); list->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (list->_maximum); - - mail_component_storages_foreach (mail_component_peek (), add_connection, list); - + + mail_component_stores_foreach (mail_component_peek (), add_connection, list); + return list; } @@ -234,12 +234,12 @@ went_offline (CamelStore *store, void *data) } static void -storage_go_offline (gpointer key, gpointer value, gpointer data) +store_go_offline (gpointer key, gpointer value, gpointer data) { CamelStore *store = key; GNOME_Evolution_OfflineProgressListener listener = data; CORBA_Environment ev; - + CORBA_exception_init(&ev); if (service_is_relevant (CAMEL_SERVICE (store), TRUE)) { mail_store_set_offline (store, TRUE, went_offline, CORBA_Object_duplicate(listener, &ev)); @@ -261,14 +261,14 @@ impl_goOffline (PortableServer_Servant servant, /* FIXME: If send/receive active, wait for it to finish */ - mail_component_storages_foreach (mail_component_peek (), storage_go_offline, progress_listener); + mail_component_stores_foreach (mail_component_peek (), store_go_offline, progress_listener); } static void -storage_go_online (gpointer key, gpointer value, gpointer data) +store_go_online (gpointer key, gpointer value, gpointer data) { CamelStore *store = key; - + if (service_is_relevant (CAMEL_SERVICE (store), FALSE)) { mail_store_set_offline (store, FALSE, NULL, NULL); mail_note_store (store, NULL, NULL, NULL); @@ -281,14 +281,14 @@ impl_goOnline (PortableServer_Servant servant, { MailOfflineHandler *offline_handler; MailOfflineHandlerPrivate *priv; - + offline_handler = MAIL_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); priv = offline_handler->priv; - + /* Enable auto-mail-checking */ camel_session_set_online (session, TRUE); - - mail_component_storages_foreach (mail_component_peek (), storage_go_online, NULL); + + mail_component_stores_foreach (mail_component_peek (), store_go_online, NULL); } /* GObject methods. */ |