diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-05-08 04:38:32 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-05-08 04:38:32 +0800 |
commit | 16e2beab9e4d412399f495f6165d27da80cb3675 (patch) | |
tree | 61946c02feb6e8187ef5368a9ddbcf15770cfe06 /mail | |
parent | 84080821d62db3358fcaee4adfc24782ed7d4318 (diff) | |
download | gsoc2013-evolution-16e2beab9e4d412399f495f6165d27da80cb3675.tar gsoc2013-evolution-16e2beab9e4d412399f495f6165d27da80cb3675.tar.gz gsoc2013-evolution-16e2beab9e4d412399f495f6165d27da80cb3675.tar.bz2 gsoc2013-evolution-16e2beab9e4d412399f495f6165d27da80cb3675.tar.lz gsoc2013-evolution-16e2beab9e4d412399f495f6165d27da80cb3675.tar.xz gsoc2013-evolution-16e2beab9e4d412399f495f6165d27da80cb3675.tar.zst gsoc2013-evolution-16e2beab9e4d412399f495f6165d27da80cb3675.zip |
Adapt mail to EShellBackend changes.
Again, builds but not tested. Lots of compiler warnings to clean up,
but I don't have the energy for it. This was pretty grueling.
Diffstat (limited to 'mail')
49 files changed, 908 insertions, 669 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index 5e8a7bc708..e290e4cb5d 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -57,14 +57,14 @@ libevolution_module_mail_la_SOURCES = \ e-mail-reader-utils.h \ e-mail-search-bar.c \ e-mail-search-bar.h \ - e-mail-shell-module.c \ - e-mail-shell-module.h \ - e-mail-shell-module-migrate.c \ - e-mail-shell-module-migrate.h \ - e-mail-shell-module-settings.c \ - e-mail-shell-module-settings.h \ + e-mail-shell-backend.c \ + e-mail-shell-backend.h \ e-mail-shell-content.c \ e-mail-shell-content.h \ + e-mail-shell-migrate.c \ + e-mail-shell-migrate.h \ + e-mail-shell-settings.c \ + e-mail-shell-settings.h \ e-mail-shell-sidebar.c \ e-mail-shell-sidebar.h \ e-mail-shell-view.c \ diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index 69ccc54f44..152821b32a 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -32,7 +32,7 @@ #include "mail/e-mail-reader.h" #include "mail/e-mail-reader-utils.h" #include "mail/e-mail-search-bar.h" -#include "mail/e-mail-shell-module.h" +#include "mail/e-mail-shell-backend.h" #include "mail/em-folder-tree-model.h" #include "mail/em-format-html-display.h" #include "mail/message-list.h" @@ -45,7 +45,7 @@ struct _EMailBrowserPrivate { GtkUIManager *ui_manager; - EShellModule *shell_module; + EShellBackend *shell_backend; GtkActionGroup *action_group; EMFormatHTMLDisplay *html_display; @@ -60,7 +60,7 @@ struct _EMailBrowserPrivate { enum { PROP_0, - PROP_SHELL_MODULE, + PROP_SHELL_BACKEND, PROP_SHOW_DELETED, PROP_UI_MANAGER }; @@ -240,12 +240,12 @@ mail_browser_status_message_cb (EMailBrowser *browser, } static void -mail_browser_set_shell_module (EMailBrowser *browser, - EShellModule *shell_module) +mail_browser_set_shell_backend (EMailBrowser *browser, + EShellBackend *shell_backend) { - g_return_if_fail (browser->priv->shell_module == NULL); + g_return_if_fail (browser->priv->shell_backend == NULL); - browser->priv->shell_module = g_object_ref (shell_module); + browser->priv->shell_backend = g_object_ref (shell_backend); } static void @@ -255,8 +255,8 @@ mail_browser_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SHELL_MODULE: - mail_browser_set_shell_module ( + case PROP_SHELL_BACKEND: + mail_browser_set_shell_backend ( E_MAIL_BROWSER (object), g_value_get_object (value)); return; @@ -278,9 +278,9 @@ mail_browser_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SHELL_MODULE: + case PROP_SHELL_BACKEND: g_value_set_object ( - value, e_mail_reader_get_shell_module ( + value, e_mail_reader_get_shell_backend ( E_MAIL_READER (object))); return; @@ -312,9 +312,9 @@ mail_browser_dispose (GObject *object) priv->ui_manager = NULL; } - if (priv->shell_module != NULL) { - g_object_unref (priv->shell_module); - priv->shell_module = NULL; + if (priv->shell_backend != NULL) { + g_object_unref (priv->shell_backend); + priv->shell_backend = NULL; } if (priv->action_group != NULL) { @@ -362,7 +362,7 @@ mail_browser_constructed (GObject *object) EMFormatHTMLDisplay *html_display; EMailBrowserPrivate *priv; EMailReader *reader; - EShellModule *shell_module; + EShellBackend *shell_backend; EShell *shell; GConfBridge *bridge; GtkAccelGroup *accel_group; @@ -382,9 +382,9 @@ mail_browser_constructed (GObject *object) domain = GETTEXT_PACKAGE; html_display = e_mail_reader_get_html_display (reader); - shell_module = e_mail_reader_get_shell_module (reader); + shell_backend = e_mail_reader_get_shell_backend (reader); - shell = e_shell_module_get_shell (shell_module); + shell = e_shell_backend_get_shell (shell_backend); e_shell_watch_window (shell, GTK_WINDOW (object)); html = EM_FORMAT_HTML (html_display)->html; @@ -392,7 +392,7 @@ mail_browser_constructed (GObject *object) /* The message list is a widget, but it is not shown in the browser. * Unfortunately, the widget is inseparable from its model, and the * model is all we need. */ - priv->message_list = message_list_new (shell_module); + priv->message_list = message_list_new (shell_backend); g_object_ref_sink (priv->message_list); g_signal_connect_swapped ( @@ -536,14 +536,14 @@ mail_browser_get_message_list (EMailReader *reader) return MESSAGE_LIST (priv->message_list); } -static EShellModule * -mail_browser_get_shell_module (EMailReader *reader) +static EShellBackend * +mail_browser_get_shell_backend (EMailReader *reader) { EMailBrowserPrivate *priv; priv = E_MAIL_BROWSER_GET_PRIVATE (reader); - return priv->shell_module; + return priv->shell_backend; } static GtkWindow * @@ -617,12 +617,12 @@ mail_browser_class_init (EMailBrowserClass *class) g_object_class_install_property ( object_class, - PROP_SHELL_MODULE, + PROP_SHELL_BACKEND, g_param_spec_object ( - "shell-module", + "shell-backend", _("Shell Module"), - _("The mail shell module"), - E_TYPE_SHELL_MODULE, + _("The mail shell backend"), + E_TYPE_SHELL_BACKEND, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); @@ -644,7 +644,7 @@ mail_browser_iface_init (EMailReaderIface *iface) iface->get_hide_deleted = mail_browser_get_hide_deleted; iface->get_html_display = mail_browser_get_html_display; iface->get_message_list = mail_browser_get_message_list; - iface->get_shell_module = mail_browser_get_shell_module; + iface->get_shell_backend = mail_browser_get_shell_backend; iface->get_window = mail_browser_get_window; iface->set_message = mail_browser_set_message; iface->show_search_bar = mail_browser_show_search_bar; @@ -705,13 +705,14 @@ e_mail_browser_get_type (void) } GtkWidget * -e_mail_browser_new (EShellModule *shell_module) +e_mail_browser_new (EMailShellBackend *mail_shell_backend) { - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); return g_object_new ( E_TYPE_MAIL_BROWSER, - "shell-module", shell_module, NULL); + "shell-backend", mail_shell_backend, NULL); } void diff --git a/mail/e-mail-browser.h b/mail/e-mail-browser.h index bcc8870478..b67ea9a797 100644 --- a/mail/e-mail-browser.h +++ b/mail/e-mail-browser.h @@ -23,7 +23,7 @@ #define E_MAIL_BROWSER_H #include <gtk/gtk.h> -#include <shell/e-shell-module.h> +#include <mail/e-mail-shell-backend.h> /* Standard GObject macros */ #define E_TYPE_MAIL_BROWSER \ @@ -60,7 +60,7 @@ struct _EMailBrowserClass { }; GType e_mail_browser_get_type (void); -GtkWidget * e_mail_browser_new (EShellModule *shell_module); +GtkWidget * e_mail_browser_new (EMailShellBackend *mail_shell_backend); void e_mail_browser_close (EMailBrowser *browser); gboolean e_mail_browser_get_show_deleted (EMailBrowser *browser); void e_mail_browser_set_show_deleted (EMailBrowser *browser, diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index b0c3edff2d..3e069bac06 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -62,7 +62,7 @@ gboolean e_mail_reader_confirm_delete (EMailReader *reader) { EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellSettings *shell_settings; MessageList *message_list; CamelFolder *folder; @@ -81,8 +81,8 @@ e_mail_reader_confirm_delete (EMailReader *reader) message_list = e_mail_reader_get_message_list (reader); window = e_mail_reader_get_window (reader); - shell_module = e_mail_reader_get_shell_module (reader); - shell = e_shell_module_get_shell (shell_module); + shell_backend = e_mail_reader_get_shell_backend (reader); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); folder = message_list->folder; @@ -189,7 +189,7 @@ e_mail_reader_mark_selected (EMailReader *reader, guint e_mail_reader_open_selected (EMailReader *reader) { - EShellModule *shell_module; + EShellBackend *shell_backend; MessageList *message_list; CamelFolder *folder; GtkWindow *window; @@ -201,7 +201,7 @@ e_mail_reader_open_selected (EMailReader *reader) g_return_val_if_fail (E_IS_MAIL_READER (reader), 0); message_list = e_mail_reader_get_message_list (reader); - shell_module = e_mail_reader_get_shell_module (reader); + shell_backend = e_mail_reader_get_shell_backend (reader); window = e_mail_reader_get_window (reader); folder = message_list->folder; @@ -276,7 +276,7 @@ e_mail_reader_open_selected (EMailReader *reader) const gchar *uid = views->pdata[ii]; GtkWidget *browser; - browser = e_mail_browser_new (shell_module); + browser = e_mail_browser_new (shell_backend); e_mail_reader_set_folder ( E_MAIL_READER (browser), folder, folder_uri); e_mail_reader_set_message ( diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index c5db73c4f9..c65feaae2d 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -39,7 +39,7 @@ #include "mail/e-mail-browser.h" #include "mail/e-mail-reader-utils.h" -#include "mail/e-mail-shell-module.h" +#include "mail/e-mail-shell-backend.h" #include "mail/em-composer-utils.h" #include "mail/em-event.h" #include "mail/em-folder-selector.h" @@ -146,7 +146,7 @@ static void action_mail_copy_cb (GtkAction *action, EMailReader *reader) { - EShellModule *shell_module; + EShellBackend *shell_backend; MessageList *message_list; EMFolderTreeModel *model; CamelFolder *folder; @@ -156,8 +156,8 @@ action_mail_copy_cb (GtkAction *action, const gchar *uri; message_list = e_mail_reader_get_message_list (reader); - shell_module = e_mail_reader_get_shell_module (reader); - model = e_mail_shell_module_get_folder_tree_model (shell_module); + shell_backend = e_mail_reader_get_shell_backend (reader); + model = e_mail_shell_backend_get_folder_tree_model (shell_backend); folder_tree = em_folder_tree_new_with_model (model); selected = message_list_get_selected (message_list); @@ -566,7 +566,7 @@ static void action_mail_move_cb (GtkAction *action, EMailReader *reader) { - EShellModule *shell_module; + EShellBackend *shell_backend; MessageList *message_list; EMFolderTreeModel *model; CamelFolder *folder; @@ -576,8 +576,8 @@ action_mail_move_cb (GtkAction *action, const gchar *uri; message_list = e_mail_reader_get_message_list (reader); - shell_module = e_mail_reader_get_shell_module (reader); - model = e_mail_shell_module_get_folder_tree_model (shell_module); + shell_backend = e_mail_reader_get_shell_backend (reader); + model = e_mail_shell_backend_get_folder_tree_model (shell_backend); folder_tree = em_folder_tree_new_with_model (model); selected = message_list_get_selected (message_list); @@ -900,7 +900,7 @@ action_mail_show_source_cb (GtkAction *action, EMailReader *reader) { EMFormatHTMLDisplay *html_display; - EShellModule *shell_module; + EShellBackend *shell_backend; MessageList *message_list; CamelFolder *folder; GtkWidget *browser; @@ -908,14 +908,14 @@ action_mail_show_source_cb (GtkAction *action, const gchar *folder_uri; message_list = e_mail_reader_get_message_list (reader); - shell_module = e_mail_reader_get_shell_module (reader); + shell_backend = e_mail_reader_get_shell_backend (reader); folder = message_list->folder; folder_uri = message_list->folder_uri; uids = message_list_get_selected (message_list); g_return_if_fail (uids->len > 0); - browser = e_mail_browser_new (shell_module); + browser = e_mail_browser_new (shell_backend); reader = E_MAIL_READER (browser); html_display = e_mail_reader_get_html_display (reader); em_format_set_mode (EM_FORMAT (html_display), EM_FORMAT_SOURCE); @@ -1767,7 +1767,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder, EMailReader *reader = user_data; EMFormatHTMLDisplay *html_display; MessageList *message_list; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellSettings *shell_settings; EShell *shell; EMEvent *event; @@ -1778,8 +1778,8 @@ mail_reader_message_loaded_cb (CamelFolder *folder, html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); - shell_module = e_mail_reader_get_shell_module (reader); - shell = e_shell_module_get_shell (shell_module); + shell_backend = e_mail_reader_get_shell_backend (reader); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); /* If the user picked a different message in the time it took @@ -2039,7 +2039,7 @@ void e_mail_reader_init (EMailReader *reader) { EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellSettings *shell_settings; EMFormatHTMLDisplay *html_display; GtkActionGroup *action_group; @@ -2055,9 +2055,9 @@ e_mail_reader_init (EMailReader *reader) action_group = e_mail_reader_get_action_group (reader); html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); - shell_module = e_mail_reader_get_shell_module (reader); + shell_backend = e_mail_reader_get_shell_backend (reader); - shell = e_shell_module_get_shell (shell_module); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); html = EM_FORMAT_HTML (html_display)->html; @@ -2343,7 +2343,7 @@ void e_mail_reader_update_actions (EMailReader *reader) { EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellSettings *shell_settings; GtkAction *action; GtkActionGroup *action_group; @@ -2374,8 +2374,8 @@ e_mail_reader_update_actions (EMailReader *reader) action_group = e_mail_reader_get_action_group (reader); state = e_mail_reader_check_state (reader); - shell_module = e_mail_reader_get_shell_module (reader); - shell = e_shell_module_get_shell (shell_module); + shell_backend = e_mail_reader_get_shell_backend (reader); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); disable_printing = e_shell_settings_get_boolean ( @@ -2673,17 +2673,17 @@ e_mail_reader_get_message_list (EMailReader *reader) return iface->get_message_list (reader); } -EShellModule * -e_mail_reader_get_shell_module (EMailReader *reader) +EShellBackend * +e_mail_reader_get_shell_backend (EMailReader *reader) { EMailReaderIface *iface; g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); iface = E_MAIL_READER_GET_IFACE (reader); - g_return_val_if_fail (iface->get_shell_module != NULL, NULL); + g_return_val_if_fail (iface->get_shell_backend != NULL, NULL); - return iface->get_shell_module (reader); + return iface->get_shell_backend (reader); } GtkWindow * diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index 6499eaf07b..13a9ba8080 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -26,7 +26,7 @@ #include <camel/camel-folder.h> #include <mail/em-format-html-display.h> #include <mail/message-list.h> -#include <shell/e-shell-module.h> +#include <shell/e-shell-backend.h> /* Standard GObject macros */ #define E_TYPE_MAIL_READER \ @@ -86,7 +86,7 @@ struct _EMailReaderIface { EMFormatHTMLDisplay * (*get_html_display) (EMailReader *reader); MessageList * (*get_message_list) (EMailReader *reader); - EShellModule * (*get_shell_module) (EMailReader *reader); + EShellBackend * (*get_shell_backend) (EMailReader *reader); GtkWindow * (*get_window) (EMailReader *reader); void (*set_folder) (EMailReader *reader, @@ -113,7 +113,7 @@ gboolean e_mail_reader_get_hide_deleted (EMailReader *reader); EMFormatHTMLDisplay * e_mail_reader_get_html_display (EMailReader *reader); MessageList * e_mail_reader_get_message_list (EMailReader *reader); -EShellModule * e_mail_reader_get_shell_module (EMailReader *reader); +EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader); GtkWindow * e_mail_reader_get_window (EMailReader *reader); void e_mail_reader_set_folder (EMailReader *reader, CamelFolder *folder, diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-backend.c index 4a0fcf0b38..56f7422f5c 100644 --- a/mail/e-mail-shell-module.c +++ b/mail/e-mail-shell-backend.c @@ -1,5 +1,5 @@ /* - * e-mail-shell-module.c + * e-mail-shell-backend.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,6 +19,8 @@ * */ +#include "e-mail-shell-backend.h" + #include <glib/gi18n.h> #include <camel/camel-disco-store.h> #include <camel/camel-offline-store.h> @@ -34,10 +36,9 @@ #include "composer/e-msg-composer.h" #include "widgets/misc/e-preferences-window.h" +#include "e-mail-shell-migrate.h" +#include "e-mail-shell-settings.h" #include "e-mail-shell-view.h" -#include "e-mail-shell-module.h" -#include "e-mail-shell-module-migrate.h" -#include "e-mail-shell-module-settings.h" #include "e-attachment-handler-mail.h" #include "e-mail-browser.h" @@ -64,10 +65,11 @@ #include "mail-vfolder.h" #include "importers/mail-importer.h" -#define MODULE_NAME "mail" -#define MODULE_ALIASES "" -#define MODULE_SCHEMES "mailto:email" -#define MODULE_SORT_ORDER 200 +#define E_MAIL_SHELL_BACKEND_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendPrivate)) + +#define BACKEND_NAME "mail" typedef struct _StoreInfo StoreInfo; @@ -92,8 +94,22 @@ struct _StoreInfo { guint removed : 1; }; -/* Module Entry Point */ -void e_shell_module_init (GTypeModule *type_module); +struct _EMailShellBackendPrivate { + GHashTable *store_hash; + MailAsyncEvent *async_event; + EMFolderTreeModel *folder_tree_model; + CamelStore *local_store; + + gint mail_sync_in_progress; + guint mail_sync_timeout_source_id; +}; + +/* Module Entry Points */ +void e_module_load (GTypeModule *type_module); +void e_module_unload (GTypeModule *type_module); + +GType e_mail_shell_backend_type = 0; +static gpointer parent_class; /* The array elements correspond to EMailFolderType. */ static struct { @@ -109,18 +125,10 @@ static struct { { "Inbox" } /* "always local" inbox */ }; -/* XXX So many things need the shell module that it's +/* XXX So many things need the shell backend that it's * just easier for now to make it globally available. * We should fix this, though. */ -EShellModule *mail_shell_module = NULL; - -static GHashTable *store_hash; -static MailAsyncEvent *async_event; -static EMFolderTreeModel *folder_tree_model; -static CamelStore *local_store; - -static gint mail_sync_in_progress; -static guint mail_sync_timeout_source_id; +EMailShellBackend *global_mail_shell_backend = NULL; extern gint camel_application_is_exiting; @@ -194,9 +202,9 @@ store_hash_free (StoreInfo *si) } static gboolean -mail_shell_module_add_store_done (CamelStore *store, - CamelFolderInfo *info, - gpointer user_data) +mail_shell_backend_add_store_done (CamelStore *store, + CamelFolderInfo *info, + gpointer user_data) { StoreInfo *si = user_data; @@ -218,15 +226,20 @@ mail_shell_module_add_store_done (CamelStore *store, } static void -mail_shell_module_add_store (EShellModule *shell_module, - CamelStore *store, - const gchar *name, - void (*done) (CamelStore *store, - CamelFolderInfo *info, - gpointer user_data)) +mail_shell_backend_add_store (EMailShellBackend *mail_shell_backend, + CamelStore *store, + const gchar *name, + void (*done) (CamelStore *store, + CamelFolderInfo *info, + gpointer user_data)) { + EMFolderTreeModel *folder_tree_model; + GHashTable *store_hash; StoreInfo *si; + store_hash = mail_shell_backend->priv->store_hash; + folder_tree_model = mail_shell_backend->priv->folder_tree_model; + si = store_info_new (store, name); si->done = done; g_hash_table_insert (store_hash, store, si); @@ -234,14 +247,14 @@ mail_shell_module_add_store (EShellModule *shell_module, em_folder_tree_model_add_store (folder_tree_model, store, si->name); mail_note_store ( - shell_module, store, NULL, - mail_shell_module_add_store_done, store_info_ref (si)); + mail_shell_backend, store, NULL, + mail_shell_backend_add_store_done, store_info_ref (si)); } static void -mail_shell_module_add_local_store_done (CamelStore *store, - CamelFolderInfo *info, - gpointer unused) +mail_shell_backend_add_local_store_done (CamelStore *store, + CamelFolderInfo *info, + gpointer unused) { gint ii; @@ -252,17 +265,17 @@ mail_shell_module_add_local_store_done (CamelStore *store, } static void -mail_shell_module_add_local_store (EShellModule *shell_module, - CamelStore *local_store, - const gchar *name) +mail_shell_backend_add_local_store (EMailShellBackend *mail_shell_backend, + CamelStore *local_store, + const gchar *name) { - mail_shell_module_add_store ( - shell_module, local_store, name, - mail_shell_module_add_local_store_done); + mail_shell_backend_add_store ( + mail_shell_backend, local_store, name, + mail_shell_backend_add_local_store_done); } static void -mail_shell_module_init_hooks (void) +mail_shell_backend_init_hooks (void) { e_plugin_hook_register_type (em_config_hook_get_type ()); e_plugin_hook_register_type (em_event_hook_get_type ()); @@ -278,7 +291,7 @@ mail_shell_module_init_hooks (void) } static void -mail_shell_module_init_importers (void) +mail_shell_backend_init_importers (void) { EImportClass *import_class; EImportImporter *importer; @@ -296,19 +309,25 @@ mail_shell_module_init_importers (void) } static void -mail_shell_module_init_local_store (EShellModule *shell_module) +mail_shell_backend_init_local_store (EShellBackend *shell_backend) { + EMailShellBackendPrivate *priv; CamelException ex; CamelService *service; CamelURL *url; + MailAsyncEvent *async_event; const gchar *data_dir; gchar *temp; gint ii; + priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend); + camel_exception_init (&ex); + async_event = priv->async_event; + data_dir = e_shell_backend_get_data_dir (shell_backend); + url = camel_url_new ("mbox:", NULL); - data_dir = e_shell_module_get_data_dir (shell_module); temp = g_build_filename (data_dir, "local", NULL); camel_url_set_path (url, temp); g_free (temp); @@ -334,14 +353,14 @@ mail_shell_module_init_local_store (EShellModule *shell_module) camel_url_free (url); camel_object_ref (service); - g_object_ref (shell_module); + g_object_ref (shell_backend); mail_async_event_emit ( async_event, MAIL_ASYNC_GUI, - (MailAsyncFunc) mail_shell_module_add_local_store, - shell_module, service, _("On This Computer")); + (MailAsyncFunc) mail_shell_backend_add_local_store, + shell_backend, service, _("On This Computer")); - local_store = CAMEL_STORE (service); + priv->local_store = CAMEL_STORE (service); return; @@ -353,7 +372,7 @@ fail: } static void -mail_shell_module_load_accounts (EShellModule *shell_module) +mail_shell_backend_load_accounts (EShellBackend *shell_backend) { EAccountList *account_list; EIterator *iter; @@ -385,21 +404,21 @@ mail_shell_module_load_accounts (EShellModule *shell_module) if (g_str_has_prefix (url, "mbox:")) continue; - e_mail_shell_module_load_store_by_uri ( - shell_module, url, name); + e_mail_shell_backend_load_store_by_uri ( + E_MAIL_SHELL_BACKEND (shell_backend), url, name); } g_object_unref (iter); } static void -mail_shell_module_mail_icon_cb (EShellWindow *shell_window, +mail_shell_backend_mail_icon_cb (EShellWindow *shell_window, const gchar *icon_name) { GtkAction *action; action = e_shell_window_get_shell_view_action ( - shell_window, MODULE_NAME); + shell_window, BACKEND_NAME); g_object_set (action, "icon-name", icon_name, NULL); } @@ -415,7 +434,7 @@ action_mail_folder_new_cb (GtkAction *action, /* Take care not to unnecessarily load the mail shell view. */ view_name = e_shell_window_get_active_view (shell_window); - if (g_strcmp0 (view_name, MODULE_NAME) != 0) + if (g_strcmp0 (view_name, BACKEND_NAME) != 0) goto exit; shell_view = e_shell_window_get_shell_view (shell_window, view_name); @@ -446,7 +465,7 @@ action_mail_message_new_cb (GtkAction *action, /* Take care not to unnecessarily load the mail shell view. */ view_name = e_shell_window_get_active_view (shell_window); - if (g_strcmp0 (view_name, MODULE_NAME) != 0) + if (g_strcmp0 (view_name, BACKEND_NAME) != 0) goto exit; shell_view = e_shell_window_get_shell_view (shell_window, view_name); @@ -483,7 +502,7 @@ static GtkActionEntry source_entries[] = { }; static void -mail_shell_module_init_preferences (EShell *shell) +mail_shell_backend_init_preferences (EShell *shell) { GtkWidget *preferences_window; @@ -523,47 +542,52 @@ mail_shell_module_init_preferences (EShell *shell) } static void -mail_shell_module_sync_store_done_cb (CamelStore *store, - gpointer user_data) +mail_shell_backend_sync_store_done_cb (CamelStore *store, + gpointer user_data) { - mail_sync_in_progress--; + EMailShellBackend *mail_shell_backend = user_data; + + mail_shell_backend->priv->mail_sync_in_progress--; } static void -mail_shell_module_sync_store_cb (CamelStore *store) +mail_shell_backend_sync_store_cb (CamelStore *store, + EMailShellBackend *mail_shell_backend) { if (!camel_application_is_exiting) { - mail_sync_in_progress++; + mail_shell_backend->priv->mail_sync_in_progress++; mail_sync_store ( store, FALSE, - mail_shell_module_sync_store_done_cb, NULL); + mail_shell_backend_sync_store_done_cb, + mail_shell_backend); } } static gboolean -mail_shell_module_mail_sync (EShellModule *shell_module) +mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend) { if (camel_application_is_exiting) return FALSE; - if (mail_sync_in_progress) + if (mail_shell_backend->priv->mail_sync_in_progress) goto exit; if (session == NULL || !camel_session_is_online (session)) goto exit; - e_mail_shell_module_stores_foreach ( - shell_module, (GHFunc) - mail_shell_module_sync_store_cb, NULL); + e_mail_shell_backend_stores_foreach ( + mail_shell_backend, (GHFunc) + mail_shell_backend_sync_store_cb, + mail_shell_backend); exit: return !camel_application_is_exiting; } static void -mail_shell_module_notify_online_cb (EShell *shell, +mail_shell_backend_notify_online_cb (EShell *shell, GParamSpec *pspec, - EShellModule *shell_module) + EShellBackend *shell_backend) { gboolean online; @@ -572,10 +596,11 @@ mail_shell_module_notify_online_cb (EShell *shell, } static void -mail_shell_module_handle_email_uri_cb (gchar *folder_uri, - CamelFolder *folder, - gpointer user_data) +mail_shell_backend_handle_email_uri_cb (gchar *folder_uri, + CamelFolder *folder, + gpointer user_data) { + EMailShellBackend *mail_shell_backend = user_data; CamelURL *url = user_data; const gchar *forward; const gchar *reply; @@ -621,7 +646,7 @@ mail_shell_module_handle_email_uri_cb (gchar *folder_uri, GtkWidget *browser; /* FIXME Should pass in the shell module. */ - browser = e_mail_browser_new (mail_shell_module); + browser = e_mail_browser_new (mail_shell_backend); e_mail_reader_set_folder ( E_MAIL_READER (browser), folder, folder_uri); e_mail_reader_set_message ( @@ -634,9 +659,9 @@ exit: } static gboolean -mail_shell_module_handle_uri_cb (EShell *shell, - const gchar *uri, - EShellModule *shell_module) +mail_shell_backend_handle_uri_cb (EShell *shell, + const gchar *uri, + EMailShellBackend *mail_shell_backend) { gboolean handled = TRUE; @@ -653,8 +678,8 @@ mail_shell_module_handle_uri_cb (EShell *shell, mail_get_folder ( curi, 0, - mail_shell_module_handle_email_uri_cb, - url, mail_msg_unordered_push); + mail_shell_backend_handle_email_uri_cb, + mail_shell_backend, mail_msg_unordered_push); g_free (curi); } else { @@ -667,7 +692,7 @@ mail_shell_module_handle_uri_cb (EShell *shell, return TRUE; } -/* Helper for mail_shell_module_prepare_for_[off|on]line_cb() */ +/* Helper for mail_shell_backend_prepare_for_[off|on]line_cb() */ static void mail_shell_store_line_transition_done_cb (CamelStore *store, gpointer user_data) @@ -677,7 +702,7 @@ mail_shell_store_line_transition_done_cb (CamelStore *store, g_object_unref (activity); } -/* Helper for mail_shell_module_prepare_for_offline_cb() */ +/* Helper for mail_shell_backend_prepare_for_offline_cb() */ static void mail_shell_store_prepare_for_offline_cb (CamelService *service, gpointer unused, @@ -691,9 +716,9 @@ mail_shell_store_prepare_for_offline_cb (CamelService *service, } static void -mail_shell_module_prepare_for_offline_cb (EShell *shell, - EActivity *activity, - EShellModule *shell_module) +mail_shell_backend_prepare_for_offline_cb (EShell *shell, + EActivity *activity, + EMailShellBackend *mail_shell_backend) { GList *watched_windows; GtkWidget *parent = NULL; @@ -714,12 +739,12 @@ mail_shell_module_prepare_for_offline_cb (EShell *shell, camel_session_set_network_state (session, FALSE); } - e_mail_shell_module_stores_foreach ( - shell_module, (GHFunc) + e_mail_shell_backend_stores_foreach ( + mail_shell_backend, (GHFunc) mail_shell_store_prepare_for_offline_cb, activity); } -/* Helper for mail_shell_module_prepare_for_online_cb() */ +/* Helper for mail_shell_backend_prepare_for_online_cb() */ static void mail_shell_store_prepare_for_online_cb (CamelService *service, gpointer unused, @@ -733,43 +758,43 @@ mail_shell_store_prepare_for_online_cb (CamelService *service, } static void -mail_shell_module_prepare_for_online_cb (EShell *shell, - EActivity *activity, - EShellModule *shell_module) +mail_shell_backend_prepare_for_online_cb (EShell *shell, + EActivity *activity, + EMailShellBackend *mail_shell_backend) { camel_session_set_online (session, TRUE); - e_mail_shell_module_stores_foreach ( - shell_module, (GHFunc) + e_mail_shell_backend_stores_foreach ( + mail_shell_backend, (GHFunc) mail_shell_store_prepare_for_online_cb, activity); } static void -mail_shell_module_send_receive_cb (EShell *shell, +mail_shell_backend_send_receive_cb (EShell *shell, GtkWindow *parent, - EShellModule *shell_module) + EShellBackend *shell_backend) { em_utils_clear_get_password_canceled_accounts_flag (); mail_send_receive (parent); } static void -mail_shell_module_window_weak_notify_cb (EShell *shell, +mail_shell_backend_window_weak_notify_cb (EShell *shell, GObject *where_the_object_was) { g_signal_handlers_disconnect_by_func ( - shell, mail_shell_module_mail_icon_cb, + shell, mail_shell_backend_mail_icon_cb, where_the_object_was); } static void -mail_shell_module_window_created_cb (EShell *shell, +mail_shell_backend_window_created_cb (EShell *shell, GtkWindow *window, - EShellModule *shell_module) + EShellBackend *shell_backend) { EShellSettings *shell_settings; static gboolean first_time = TRUE; - const gchar *module_name; + const gchar *backend_name; shell_settings = e_shell_get_shell_settings (shell); @@ -804,23 +829,23 @@ mail_shell_module_window_created_cb (EShell *shell, if (!E_IS_SHELL_WINDOW (window)) return; - module_name = G_TYPE_MODULE (shell_module)->name; + backend_name = G_TYPE_MODULE (shell_backend)->name; e_shell_window_register_new_item_actions ( - E_SHELL_WINDOW (window), module_name, + E_SHELL_WINDOW (window), backend_name, item_entries, G_N_ELEMENTS (item_entries)); e_shell_window_register_new_source_actions ( - E_SHELL_WINDOW (window), module_name, + E_SHELL_WINDOW (window), backend_name, source_entries, G_N_ELEMENTS (source_entries)); g_signal_connect_swapped ( shell, "event::mail-icon", - G_CALLBACK (mail_shell_module_mail_icon_cb), window); + G_CALLBACK (mail_shell_backend_mail_icon_cb), window); g_object_weak_ref ( G_OBJECT (window), (GWeakNotify) - mail_shell_module_window_weak_notify_cb, shell); + mail_shell_backend_window_weak_notify_cb, shell); if (first_time) { g_signal_connect ( @@ -831,180 +856,281 @@ mail_shell_module_window_created_cb (EShell *shell, } static void -mail_shell_module_start (EShellModule *shell_module) +mail_shell_backend_dispose (GObject *object) { - EShell *shell; - EShellSettings *shell_settings; - gboolean enable_search_folders; + EMailShellBackendPrivate *priv; - shell = e_shell_module_get_shell (shell_module); - shell_settings = e_shell_get_shell_settings (shell); + priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object); - /* XXX Do we really still need this flag? */ - mail_session_set_interactive (TRUE); + g_hash_table_remove_all (priv->store_hash); - enable_search_folders = e_shell_settings_get_boolean ( - shell_settings, "mail-enable-search-folders"); - if (enable_search_folders) - vfolder_load_storage (); + if (priv->folder_tree_model != NULL) { + g_object_unref (priv->folder_tree_model); + priv->folder_tree_model = NULL; + } - mail_autoreceive_init (shell_module, session); + if (priv->local_store != NULL) { + camel_object_unref (priv->local_store); + priv->local_store = NULL; + } - if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL) - mail_sync_timeout_source_id = g_timeout_add_seconds ( - mail_config_get_sync_timeout (), - (GSourceFunc) mail_shell_module_mail_sync, - shell_module); + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); } -static EShellModuleInfo module_info = { +static void +mail_shell_backend_finalize (GObject *object) +{ + EMailShellBackendPrivate *priv; + + priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object); - MODULE_NAME, - MODULE_ALIASES, - MODULE_SCHEMES, - MODULE_SORT_ORDER, + g_hash_table_destroy (priv->store_hash); + mail_async_event_destroy (priv->async_event); - mail_shell_module_start, - /* is_busy */ NULL, - /* shutdown */ NULL, - e_mail_shell_module_migrate -}; + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (parent_class)->finalize (object); +} -void -e_shell_module_init (GTypeModule *type_module) +static void +mail_shell_backend_constructed (GObject *object) { + EMailShellBackendPrivate *priv; EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; - shell_module = E_SHELL_MODULE (type_module); - shell = e_shell_module_get_shell (shell_module); + priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (object); - e_shell_module_set_info ( - shell_module, &module_info, - e_mail_shell_view_get_type (type_module)); + shell_backend = E_SHELL_BACKEND (object); + shell = e_shell_backend_get_shell (shell_backend); /* This also initializes Camel, so it needs to happen early. */ - mail_session_init (shell_module); + mail_session_init (E_MAIL_SHELL_BACKEND (shell_backend)); - mail_shell_module_init_hooks (); - mail_shell_module_init_importers (); + mail_shell_backend_init_hooks (); + mail_shell_backend_init_importers (); e_attachment_handler_mail_get_type (); /* XXX This never gets unreffed. */ - mail_shell_module = g_object_ref (shell_module); + global_mail_shell_backend = g_object_ref (shell_backend); - store_hash = g_hash_table_new_full ( + priv->store_hash = g_hash_table_new_full ( g_direct_hash, g_direct_equal, (GDestroyNotify) NULL, (GDestroyNotify) store_hash_free); - async_event = mail_async_event_new (); + priv->async_event = mail_async_event_new (); - folder_tree_model = em_folder_tree_model_new (shell_module); + priv->folder_tree_model = em_folder_tree_model_new ( + E_MAIL_SHELL_BACKEND (shell_backend)); g_signal_connect ( shell, "notify::online", - G_CALLBACK (mail_shell_module_notify_online_cb), - shell_module); + G_CALLBACK (mail_shell_backend_notify_online_cb), + shell_backend); g_signal_connect ( shell, "handle-uri", - G_CALLBACK (mail_shell_module_handle_uri_cb), - shell_module); + G_CALLBACK (mail_shell_backend_handle_uri_cb), + shell_backend); g_signal_connect ( shell, "prepare-for-offline", - G_CALLBACK (mail_shell_module_prepare_for_offline_cb), - shell_module); + G_CALLBACK (mail_shell_backend_prepare_for_offline_cb), + shell_backend); g_signal_connect ( shell, "prepare-for-online", - G_CALLBACK (mail_shell_module_prepare_for_online_cb), - shell_module); + G_CALLBACK (mail_shell_backend_prepare_for_online_cb), + shell_backend); g_signal_connect ( shell, "send-receive", - G_CALLBACK (mail_shell_module_send_receive_cb), - shell_module); + G_CALLBACK (mail_shell_backend_send_receive_cb), + shell_backend); g_signal_connect ( shell, "window-created", - G_CALLBACK (mail_shell_module_window_created_cb), - shell_module); + G_CALLBACK (mail_shell_backend_window_created_cb), + shell_backend); mail_config_init (); mail_msg_init (); - mail_shell_module_init_local_store (shell_module); - mail_shell_module_load_accounts (shell_module); + mail_shell_backend_init_local_store (shell_backend); + mail_shell_backend_load_accounts (shell_backend); /* Initialize settings before initializing preferences, * since the preferences bind to the shell settings. */ - e_mail_shell_module_init_settings (shell); - mail_shell_module_init_preferences (shell); + e_mail_shell_settings_init (shell); + mail_shell_backend_init_preferences (shell); +} + +static void +mail_shell_backend_start (EShellBackend *shell_backend) +{ + EMailShellBackendPrivate *priv; + EShell *shell; + EShellSettings *shell_settings; + gboolean enable_search_folders; + + priv = E_MAIL_SHELL_BACKEND_GET_PRIVATE (shell_backend); + + shell = e_shell_backend_get_shell (shell_backend); + shell_settings = e_shell_get_shell_settings (shell); + + /* XXX Do we really still need this flag? */ + mail_session_set_interactive (TRUE); + + enable_search_folders = e_shell_settings_get_boolean ( + shell_settings, "mail-enable-search-folders"); + if (enable_search_folders) + vfolder_load_storage (); + + mail_autoreceive_init (shell_backend, session); + + if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL) + priv->mail_sync_timeout_source_id = g_timeout_add_seconds ( + mail_config_get_sync_timeout (), + (GSourceFunc) mail_shell_backend_mail_sync, + shell_backend); +} + +static void +mail_shell_backend_class_init (EMailShellBackendClass *class) +{ + GObjectClass *object_class; + EShellBackendClass *shell_backend_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailShellBackendPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->dispose = mail_shell_backend_dispose; + object_class->finalize = mail_shell_backend_finalize; + object_class->constructed = mail_shell_backend_constructed; + + shell_backend_class = E_SHELL_BACKEND_CLASS (class); + shell_backend_class->name = BACKEND_NAME; + shell_backend_class->aliases = ""; + shell_backend_class->schemes = "mailto:email"; + shell_backend_class->sort_order = 200; + shell_backend_class->view_type = E_TYPE_MAIL_SHELL_VIEW; + shell_backend_class->start = mail_shell_backend_start; + shell_backend_class->is_busy = NULL; + shell_backend_class->shutdown = NULL; + shell_backend_class->migrate = e_mail_shell_migrate; +} + +static void +mail_shell_backend_init (EMailShellBackend *mail_shell_backend) +{ + mail_shell_backend->priv = + E_MAIL_SHELL_BACKEND_GET_PRIVATE (mail_shell_backend); +} + +GType +e_mail_shell_backend_get_type (GTypeModule *type_module) +{ + if (e_mail_shell_backend_type == 0) { + const GTypeInfo type_info = { + sizeof (EMailShellBackendClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_shell_backend_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMailShellBackend), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_shell_backend_init, + NULL /* value_table */ + }; + + e_mail_shell_backend_type = + g_type_module_register_type ( + type_module, E_TYPE_SHELL_BACKEND, + "EMailShellBackend", &type_info, 0); + } + + return e_mail_shell_backend_type; +} + +void +e_module_load (GTypeModule *type_module) +{ + e_mail_shell_backend_get_type (type_module); + e_mail_shell_view_get_type (type_module); +} + +void +e_module_unload (GTypeModule *type_module) +{ } /******************************** Public API *********************************/ CamelFolder * -e_mail_shell_module_get_folder (EShellModule *shell_module, - EMailFolderType folder_type) +e_mail_shell_backend_get_folder (EMailShellBackend *mail_shell_backend, + EMailFolderType folder_type) { - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); return default_local_folders[folder_type].folder; } const gchar * -e_mail_shell_module_get_folder_uri (EShellModule *shell_module, - EMailFolderType folder_type) +e_mail_shell_backend_get_folder_uri (EMailShellBackend *mail_shell_backend, + EMailFolderType folder_type) { - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); return default_local_folders[folder_type].uri; } EMFolderTreeModel * -e_mail_shell_module_get_folder_tree_model (EShellModule *shell_module) +e_mail_shell_backend_get_folder_tree_model (EMailShellBackend *mail_shell_backend) { - /* Require a shell module in case we need it in the future. */ - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); - return folder_tree_model; + return mail_shell_backend->priv->folder_tree_model; } void -e_mail_shell_module_add_store (EShellModule *shell_module, - CamelStore *store, - const gchar *name) +e_mail_shell_backend_add_store (EMailShellBackend *mail_shell_backend, + CamelStore *store, + const gchar *name) { - g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend)); g_return_if_fail (CAMEL_IS_STORE (store)); g_return_if_fail (name != NULL); - mail_shell_module_add_store (shell_module, store, name, NULL); + mail_shell_backend_add_store (mail_shell_backend, store, name, NULL); } CamelStore * -e_mail_shell_module_get_local_store (EShellModule *shell_module) +e_mail_shell_backend_get_local_store (EMailShellBackend *mail_shell_backend) { - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); - g_return_val_if_fail (local_store != NULL, NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); - return local_store; + return mail_shell_backend->priv->local_store; } CamelStore * -e_mail_shell_module_load_store_by_uri (EShellModule *shell_module, - const gchar *uri, - const gchar *name) +e_mail_shell_backend_load_store_by_uri (EMailShellBackend *mail_shell_backend, + const gchar *uri, + const gchar *name) { CamelStore *store; CamelProvider *provider; CamelException ex; - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (name != NULL, NULL); @@ -1025,7 +1151,7 @@ e_mail_shell_module_load_store_by_uri (EShellModule *shell_module, if (store == NULL) goto fail; - e_mail_shell_module_add_store (shell_module, store, name); + e_mail_shell_backend_add_store (mail_shell_backend, store, name); camel_object_unref (store); @@ -1041,23 +1167,31 @@ fail: return NULL; } -/* Helper for e_mail_shell_module_remove_store() */ +/* Helper for e_mail_shell_backend_remove_store() */ static void -mail_shell_module_remove_store_cb (CamelStore *store, - gpointer event_data, - gpointer user_data) +mail_shell_backend_remove_store_cb (CamelStore *store, + gpointer event_data, + gpointer user_data) { camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); camel_object_unref (store); } void -e_mail_shell_module_remove_store (EShellModule *shell_module, - CamelStore *store) +e_mail_shell_backend_remove_store (EMailShellBackend *mail_shell_backend, + CamelStore *store) { - g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + GHashTable *store_hash; + MailAsyncEvent *async_event; + EMFolderTreeModel *folder_tree_model; + + g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend)); g_return_if_fail (CAMEL_IS_STORE (store)); + store_hash = mail_shell_backend->priv->store_hash; + async_event = mail_shell_backend->priv->async_event; + folder_tree_model = mail_shell_backend->priv->folder_tree_model; + /* Because the store hash holds a reference to each store used * as a key in it, none of them will ever be gc'ed, meaning any * call to camel_session_get_{service,store} with the same URL @@ -1073,18 +1207,18 @@ e_mail_shell_module_remove_store (EShellModule *shell_module, mail_async_event_emit ( async_event, MAIL_ASYNC_THREAD, - (MailAsyncFunc) mail_shell_module_remove_store_cb, + (MailAsyncFunc) mail_shell_backend_remove_store_cb, store, NULL, NULL); } void -e_mail_shell_module_remove_store_by_uri (EShellModule *shell_module, - const gchar *uri) +e_mail_shell_backend_remove_store_by_uri (EMailShellBackend *mail_shell_backend, + const gchar *uri) { CamelStore *store; CamelProvider *provider; - g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend)); g_return_if_fail (uri != NULL); provider = camel_provider_get (uri, NULL); @@ -1097,22 +1231,25 @@ e_mail_shell_module_remove_store_by_uri (EShellModule *shell_module, store = (CamelStore *) camel_session_get_service ( session, uri, CAMEL_PROVIDER_STORE, NULL); if (store != NULL) { - e_mail_shell_module_remove_store (shell_module, store); + e_mail_shell_backend_remove_store (mail_shell_backend, store); camel_object_unref (store); } } void -e_mail_shell_module_stores_foreach (EShellModule *shell_module, - GHFunc func, - gpointer user_data) +e_mail_shell_backend_stores_foreach (EMailShellBackend *mail_shell_backend, + GHFunc func, + gpointer user_data) { + GHashTable *store_hash; GHashTableIter iter; gpointer key, value; - g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend)); g_return_if_fail (func != NULL); + store_hash = mail_shell_backend->priv->store_hash; + g_hash_table_iter_init (&iter, store_hash); while (g_hash_table_iter_next (&iter, &key, &value)) diff --git a/mail/e-mail-shell-backend.h b/mail/e-mail-shell-backend.h new file mode 100644 index 0000000000..fdf8ec6f76 --- /dev/null +++ b/mail/e-mail-shell-backend.h @@ -0,0 +1,123 @@ +/* + * e-mail-shell-backend.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_BACKEND_H +#define E_MAIL_SHELL_BACKEND_H + +#include <shell/e-shell-backend.h> + +#include <camel/camel-folder.h> +#include <camel/camel-store.h> +#include <e-util/e-signature-list.h> +#include <libedataserver/e-account-list.h> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_SHELL_BACKEND \ + (e_mail_shell_backend_type) +#define E_MAIL_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackend)) +#define E_MAIL_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendClass)) +#define E_IS_MAIL_SHELL_BACKEND(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_SHELL_BACKEND)) +#define E_IS_MAIL_SHELL_BACKEND_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_SHELL_BACKEND)) +#define E_MAIL_SHELL_BACKEND_GET_CLASS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_SHELL_BACKEND, EMailShellBackendClass)) + +G_BEGIN_DECLS + +extern GType e_mail_shell_backend_type; + +typedef struct _EMailShellBackend EMailShellBackend; +typedef struct _EMailShellBackendClass EMailShellBackendClass; +typedef struct _EMailShellBackendPrivate EMailShellBackendPrivate; + +struct _EMailShellBackend { + EShellBackend parent; + EMailShellBackendPrivate *priv; +}; + +struct _EMailShellBackendClass { + EShellBackendClass parent_class; +}; + +typedef enum { + E_MAIL_FOLDER_INBOX, + E_MAIL_FOLDER_DRAFTS, + E_MAIL_FOLDER_OUTBOX, + E_MAIL_FOLDER_SENT, + E_MAIL_FOLDER_TEMPLATES, + E_MAIL_FOLDER_LOCAL_INBOX +} EMailFolderType; + +struct _EMFolderTreeModel; + +/* Globally available shell backend. + * + * XXX I don't like having this globally available but passing it around + * to all the various utilities that need to access the backend's data + * directory and local folders is too much of a pain for now. */ +extern EMailShellBackend *global_mail_shell_backend; + +GType e_mail_shell_backend_get_type + (GTypeModule *type_module); +CamelFolder * e_mail_shell_backend_get_folder + (EMailShellBackend *mail_shell_backend, + EMailFolderType folder_type); +const gchar * e_mail_shell_backend_get_folder_uri + (EMailShellBackend *mail_shell_backend, + EMailFolderType folder_type); +struct _EMFolderTreeModel * + e_mail_shell_backend_get_folder_tree_model + (EMailShellBackend *mail_shell_backend); +void e_mail_shell_backend_add_store + (EMailShellBackend *mail_shell_backend, + CamelStore *store, + const gchar *name); +CamelStore * e_mail_shell_backend_get_local_store + (EMailShellBackend *mail_shell_backend); +CamelStore * e_mail_shell_backend_load_store_by_uri + (EMailShellBackend *mail_shell_backend, + const gchar *uri, + const gchar *name); +void e_mail_shell_backend_remove_store + (EMailShellBackend *mail_shell_backend, + CamelStore *store); +void e_mail_shell_backend_remove_store_by_uri + (EMailShellBackend *mail_shell_backend, + const gchar *uri); +void e_mail_shell_backend_stores_foreach + (EMailShellBackend *mail_shell_backend, + GHFunc func, + gpointer user_data); + +/* XXX Find a better place for this function. */ +GSList * e_mail_labels_get_filter_options(void); + +G_END_DECLS + +#endif /* E_MAIL_SHELL_BACKEND_H */ diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index f7bb17592e..50bf0471bb 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -37,7 +37,7 @@ #include "e-mail-reader.h" #include "e-mail-search-bar.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #include "e-mail-shell-view-actions.h" #define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \ @@ -361,7 +361,7 @@ mail_shell_content_constructed (GObject *object) { EMailShellContentPrivate *priv; EShellContent *shell_content; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellView *shell_view; EShellViewClass *shell_view_class; EMailReader *reader; @@ -382,7 +382,7 @@ mail_shell_content_constructed (GObject *object) shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); view_collection = shell_view_class->view_collection; html = EM_FORMAT_HTML (priv->html_display)->html; @@ -398,7 +398,7 @@ mail_shell_content_constructed (GObject *object) container = widget; - widget = message_list_new (shell_module); + widget = message_list_new (shell_backend); gtk_paned_add1 (GTK_PANED (container), widget); priv->message_list = g_object_ref (widget); gtk_widget_show (widget); @@ -507,8 +507,8 @@ mail_shell_content_get_message_list (EMailReader *reader) return MESSAGE_LIST (priv->message_list); } -static EShellModule * -mail_shell_content_get_shell_module (EMailReader *reader) +static EShellBackend * +mail_shell_content_get_shell_backend (EMailReader *reader) { EShellContent *shell_content; EShellView *shell_view; @@ -516,7 +516,7 @@ mail_shell_content_get_shell_module (EMailReader *reader) shell_content = E_SHELL_CONTENT (reader); shell_view = e_shell_content_get_shell_view (shell_content); - return e_shell_view_get_shell_module (shell_view); + return e_shell_view_get_shell_backend (shell_view); } static GtkWindow * @@ -657,7 +657,7 @@ mail_shell_content_iface_init (EMailReaderIface *iface) iface->get_hide_deleted = mail_shell_content_get_hide_deleted; iface->get_html_display = mail_shell_content_get_html_display; iface->get_message_list = mail_shell_content_get_message_list; - iface->get_shell_module = mail_shell_content_get_shell_module; + iface->get_shell_backend = mail_shell_content_get_shell_backend; iface->get_window = mail_shell_content_get_window; iface->set_folder = mail_shell_content_set_folder; iface->show_search_bar = mail_shell_content_show_search_bar; diff --git a/mail/e-mail-shell-module-migrate.c b/mail/e-mail-shell-migrate.c index ac09eec42f..99469b1d6d 100644 --- a/mail/e-mail-shell-module-migrate.c +++ b/mail/e-mail-shell-migrate.c @@ -1,5 +1,5 @@ /* - * e-mail-shell-module-migrate.c + * e-mail-shell-migrate.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,7 @@ * */ -#include "e-mail-shell-module-migrate.h" +#include "e-mail-shell-migrate.h" #include <stdio.h> #include <stdlib.h> @@ -62,7 +62,7 @@ #include "e-util/e-plugin.h" #include "e-util/e-signature-utils.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #include "shell/e-shell-migrate.h" #include "mail-config.h" @@ -2781,7 +2781,7 @@ migrate_folders(CamelStore *store, CamelFolderInfo *fi, const char *acc, CamelEx } static CamelStore * -setup_local_store (EShellModule *shell_module, +setup_local_store (EShellBackend *shell_backend, EMMigrateSession *session) { CamelURL *url; @@ -2790,7 +2790,7 @@ setup_local_store (EShellModule *shell_module, CamelStore *store; url = camel_url_new("mbox:", NULL); - data_dir = e_shell_module_get_data_dir (shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); tmp = g_build_filename (data_dir, "local", NULL); camel_url_set_path(url, tmp); g_free(tmp); @@ -2802,7 +2802,7 @@ setup_local_store (EShellModule *shell_module, } static void -migrate_to_db (EShellModule *shell_module) +migrate_to_db (EShellBackend *shell_backend) { EMMigrateSession *session; EAccountList *accounts; @@ -2818,7 +2818,7 @@ migrate_to_db (EShellModule *shell_module) iter = e_list_get_iterator ((EList *) accounts); len = e_list_length ((EList *) accounts); - data_dir = e_shell_module_get_data_dir (shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); session = (EMMigrateSession *) em_migrate_session_new (data_dir); camel_session_set_online ((CamelSession *) session, FALSE); em_migrate_setup_progress_dialog (_("The summary format of the Evolution mailbox " @@ -2826,7 +2826,7 @@ migrate_to_db (EShellModule *shell_module) "patient while Evolution migrates your folders...")); em_migrate_set_progress ( (double)i/(len+1)); - store = setup_local_store (shell_module, session); + store = setup_local_store (shell_backend, session); info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL); if (info) { migrate_folders(store, info, _("On This Computer"), NULL); @@ -2852,8 +2852,8 @@ migrate_to_db (EShellModule *shell_module) CamelException ex; camel_exception_init (&ex); - e_mail_shell_module_load_store_by_uri ( - shell_module, service->url, name); + e_mail_shell_backend_load_store_by_uri ( + shell_backend, service->url, name); store = (CamelStore *) camel_session_get_service (CAMEL_SESSION (session), service->url, CAMEL_PROVIDER_STORE, &ex); info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &ex); @@ -2879,18 +2879,18 @@ migrate_to_db (EShellModule *shell_module) } gboolean -e_mail_shell_module_migrate (EShellModule *shell_module, - gint major, - gint minor, - gint micro, - GError **error) +e_mail_shell_backend_migrate (EShellBackend *shell_backend, + gint major, + gint minor, + gint micro, + GError **error) { struct stat st; const gchar *data_dir; gchar *path; /* make sure ~/.evolution/mail exists */ - data_dir = e_shell_module_get_data_dir (shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); if (g_stat (data_dir, &st) == -1) { if (errno != ENOENT || g_mkdir_with_parents (data_dir, 0777) == -1) { g_set_error ( @@ -2981,7 +2981,7 @@ e_mail_shell_module_migrate (EShellModule *shell_module, if (major < 2 || (major == 2 && minor < 24)) { em_update_sa_junk_setting_2_23 (); - migrate_to_db (shell_module); + migrate_to_db (shell_backend); } return TRUE; diff --git a/mail/e-mail-shell-module-migrate.h b/mail/e-mail-shell-migrate.h index e9ec2115c0..498f60cf8d 100644 --- a/mail/e-mail-shell-module-migrate.h +++ b/mail/e-mail-shell-migrate.h @@ -1,5 +1,5 @@ /* - * e-mail-shell-module-migrate.h + * e-mail-shell-migrate.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,11 +23,11 @@ #define E_MAIL_SHELL_MODULE_MIGRATE_H #include <glib.h> -#include <shell/e-shell-module.h> +#include <shell/e-shell-backend.h> G_BEGIN_DECLS -gboolean e_mail_shell_module_migrate (EShellModule *shell_module, +gboolean e_mail_shell_migrate (EShellBackend *shell_backend, gint major, gint minor, gint micro, diff --git a/mail/e-mail-shell-module.h b/mail/e-mail-shell-module.h deleted file mode 100644 index d72df698a5..0000000000 --- a/mail/e-mail-shell-module.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * e-mail-shell-module.h - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef E_MAIL_SHELL_MODULE_H -#define E_MAIL_SHELL_MODULE_H - -#include <shell/e-shell-module.h> - -#include <camel/camel-folder.h> -#include <camel/camel-store.h> -#include <e-util/e-signature-list.h> -#include <libedataserver/e-account-list.h> - -G_BEGIN_DECLS - -/* Globally available shell module. - * - * XXX I don't like having this globally available but passing it around - * to all the various utilities that need to access the module's data - * directory and local folders is too much of a pain for now. */ -extern EShellModule *mail_shell_module; - -typedef enum { - E_MAIL_FOLDER_INBOX, - E_MAIL_FOLDER_DRAFTS, - E_MAIL_FOLDER_OUTBOX, - E_MAIL_FOLDER_SENT, - E_MAIL_FOLDER_TEMPLATES, - E_MAIL_FOLDER_LOCAL_INBOX -} EMailFolderType; - -struct _EMFolderTreeModel; - -CamelFolder * e_mail_shell_module_get_folder (EShellModule *shell_module, - EMailFolderType folder_type); -const gchar * e_mail_shell_module_get_folder_uri - (EShellModule *shell_module, - EMailFolderType folder_type); -struct _EMFolderTreeModel * - e_mail_shell_module_get_folder_tree_model - (EShellModule *shell_module); -void e_mail_shell_module_add_store (EShellModule *shell_module, - CamelStore *store, - const gchar *name); -CamelStore * e_mail_shell_module_get_local_store - (EShellModule *shell_module); -CamelStore * e_mail_shell_module_load_store_by_uri - (EShellModule *shell_module, - const gchar *uri, - const gchar *name); -void e_mail_shell_module_remove_store(EShellModule *shell_module, - CamelStore *store); -void e_mail_shell_module_remove_store_by_uri - (EShellModule *shell_module, - const gchar *uri); -void e_mail_shell_module_stores_foreach - (EShellModule *shell_module, - GHFunc func, - gpointer user_data); - -/* XXX Find a better place for this function. */ -GSList * e_mail_labels_get_filter_options(void); - -G_END_DECLS - -#endif /* E_MAIL_SHELL_MODULE_H */ diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-settings.c index 94bfd1ac11..8237924e3c 100644 --- a/mail/e-mail-shell-module-settings.c +++ b/mail/e-mail-shell-settings.c @@ -1,5 +1,5 @@ /* - * e-mail-shell-module-settings.c + * e-mail-shell-settings.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,7 @@ * */ -#include "e-mail-shell-module-settings.h" +#include "e-mail-shell-settings.h" #include <gconf/gconf-client.h> #include <libedataserver/e-account-list.h> @@ -29,7 +29,7 @@ #include "mail/mail-session.h" void -e_mail_shell_module_init_settings (EShell *shell) +e_mail_shell_settings_init (EShell *shell) { EShellSettings *shell_settings; gpointer object; diff --git a/mail/e-mail-shell-module-settings.h b/mail/e-mail-shell-settings.h index a5528463c7..4267fd8a60 100644 --- a/mail/e-mail-shell-module-settings.h +++ b/mail/e-mail-shell-settings.h @@ -1,5 +1,5 @@ /* - * e-mail-shell-module-settings.h + * e-mail-shell-settings.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,15 @@ * */ -#ifndef E_MAIL_SHELL_MODULE_SETTINGS_H -#define E_MAIL_SHELL_MODULE_SETTINGS_H +#ifndef E_MAIL_SHELL_SETTINGS_H +#define E_MAIL_SHELL_SETTINGS_H #include <shell/e-shell.h> G_BEGIN_DECLS -void e_mail_shell_module_init_settings (EShell *shell); +void e_mail_shell_settings_init (EShell *shell); G_END_DECLS -#endif /* E_MAIL_SHELL_MODULE_SETTINGS_H */ +#endif /* E_MAIL_SHELL_SETTINGS_H */ diff --git a/mail/e-mail-shell-sidebar.c b/mail/e-mail-shell-sidebar.c index c448be9782..e71fe4d6b2 100644 --- a/mail/e-mail-shell-sidebar.c +++ b/mail/e-mail-shell-sidebar.c @@ -27,7 +27,7 @@ #include "em-utils.h" #include "em-folder-utils.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define E_MAIL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -129,7 +129,7 @@ mail_shell_sidebar_constructed (GObject *object) { EMailShellSidebarPrivate *priv; EShellSidebar *shell_sidebar; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellView *shell_view; GtkTreeSelection *selection; GtkTreeView *tree_view; @@ -143,7 +143,7 @@ mail_shell_sidebar_constructed (GObject *object) shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); /* Build sidebar widgets. */ @@ -160,7 +160,7 @@ mail_shell_sidebar_constructed (GObject *object) container = widget; - widget = em_folder_tree_new (shell_module); + widget = em_folder_tree_new (shell_backend); em_folder_tree_set_excluded (EM_FOLDER_TREE (widget), 0); em_folder_tree_enable_drag_and_drop (EM_FOLDER_TREE (widget)); gtk_container_add (GTK_CONTAINER (container), widget); @@ -180,7 +180,7 @@ static guint32 mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar) { EMailShellSidebar *mail_shell_sidebar; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellView *shell_view; EMFolderTree *folder_tree; GtkTreeSelection *selection; @@ -202,8 +202,8 @@ mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar) guint32 state = 0; shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); - shell_module = e_shell_view_get_shell_module (shell_view); - local_store = e_mail_shell_module_get_local_store (shell_module); + shell_backend = e_shell_view_get_shell_backend (shell_view); + local_store = e_mail_shell_backend_get_local_store (shell_backend); mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index 600d8e847c..2491e41a46 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -46,7 +46,7 @@ action_mail_account_disable_cb (GtkAction *action, EMailShellView *mail_shell_view) { EMailShellSidebar *mail_shell_sidebar; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellView *shell_view; EMFolderTree *folder_tree; EAccountList *account_list; @@ -54,7 +54,7 @@ action_mail_account_disable_cb (GtkAction *action, gchar *folder_uri; shell_view = E_SHELL_VIEW (mail_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); @@ -70,7 +70,7 @@ action_mail_account_disable_cb (GtkAction *action, account->enabled = !account->enabled; e_account_list_change (account_list, account); - e_mail_shell_module_remove_store_by_uri (shell_module, folder_uri); + e_mail_shell_backend_remove_store_by_uri (shell_backend, folder_uri); if (account->parent_uid != NULL) e_account_list_remove (account_list, account); @@ -101,13 +101,13 @@ action_mail_download_cb (GtkAction *action, EMailShellView *mail_shell_view) { EShellView *shell_view; - EShellModule *shell_module; + EShellBackend *shell_backend; shell_view = E_SHELL_VIEW (mail_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); - e_mail_shell_module_stores_foreach ( - shell_module, (GHFunc) action_mail_download_foreach_cb, NULL); + e_mail_shell_backend_stores_foreach ( + shell_backend, (GHFunc) action_mail_download_foreach_cb, NULL); } static void diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c index 5974cc7386..e31292ed65 100644 --- a/mail/e-mail-shell-view-private.c +++ b/mail/e-mail-shell-view-private.c @@ -743,7 +743,7 @@ void e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) { EShellSidebar *shell_sidebar; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellView *shell_view; EMailReader *reader; MessageList *message_list; @@ -764,9 +764,9 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); shell_view = E_SHELL_VIEW (mail_shell_view); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); - local_store = e_mail_shell_module_get_local_store (shell_module); + local_store = e_mail_shell_backend_get_local_store (shell_backend); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); message_list = e_mail_reader_get_message_list (reader); diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h index 97bb638b3b..6034dbcc66 100644 --- a/mail/e-mail-shell-view-private.h +++ b/mail/e-mail-shell-view-private.h @@ -54,8 +54,8 @@ #include "mail-send-recv.h" #include "mail-vfolder.h" +#include "e-mail-shell-backend.h" #include "e-mail-shell-content.h" -#include "e-mail-shell-module.h" #include "e-mail-shell-sidebar.h" #include "e-mail-shell-view-actions.h" diff --git a/mail/e-mail-shell-view.c b/mail/e-mail-shell-view.c index ab0e7d92d5..6f4e6f9b88 100644 --- a/mail/e-mail-shell-view.c +++ b/mail/e-mail-shell-view.c @@ -216,7 +216,6 @@ mail_shell_view_class_init (EMailShellViewClass *class, shell_view_class->ui_manager_id = "org.gnome.evolution.mail"; shell_view_class->search_options = "/mail-search-options"; shell_view_class->search_rules = "searchtypes.xml"; - shell_view_class->type_module = type_module; shell_view_class->new_shell_content = e_mail_shell_content_new; shell_view_class->new_shell_sidebar = e_mail_shell_sidebar_new; shell_view_class->toggled = mail_shell_view_toggled; @@ -243,11 +242,11 @@ e_mail_shell_view_get_type (GTypeModule *type_module) (GBaseFinalizeFunc) NULL, (GClassInitFunc) mail_shell_view_class_init, (GClassFinalizeFunc) NULL, - type_module, + NULL, /* class_data */ sizeof (EMailShellView), - 0, /* n_preallocs */ + 0, /* n_preallocs */ (GInstanceInitFunc) mail_shell_view_init, - NULL /* value_table */ + NULL /* value_table */ }; e_mail_shell_view_type = diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index a5c5d59fd8..72e8881863 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -70,7 +70,7 @@ #include "mail-ops.h" #include "mail-mt.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #if defined (HAVE_NSS) #include "smime/gui/e-cert-selector.h" @@ -449,13 +449,13 @@ default_folders_clicked (GtkButton *button, gpointer user_data) EMAccountEditor *emae = user_data; const char *uri; - uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_DRAFTS); + uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS); em_folder_selection_button_set_selection((EMFolderSelectionButton *)emae->priv->drafts_folder_button, uri); emae_account_folder_changed((EMFolderSelectionButton *)emae->priv->drafts_folder_button, emae); - uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_SENT); + uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); em_folder_selection_button_set_selection((EMFolderSelectionButton *)emae->priv->sent_folder_button, uri); emae_account_folder_changed((EMFolderSelectionButton *)emae->priv->sent_folder_button, emae); } @@ -468,7 +468,7 @@ em_account_editor_folder_selector_button_new (char *widget_name, char *string1, { EMFolderTreeModel *model; - model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); + model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend); return (GtkWidget *)em_folder_selection_button_new(model, string1 ? string1 : _("Select Folder"), NULL); } @@ -907,8 +907,8 @@ emae_account_folder(EMAccountEditor *emae, const char *name, int item, int deffo } else { const gchar *uri; - uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, deffolder); + uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, deffolder); em_folder_selection_button_set_selection(folder, uri); } @@ -2868,13 +2868,13 @@ em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account emae->account = e_account_new(); emae->account->enabled = TRUE; - uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_DRAFTS); + uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS); e_account_set_string ( emae->account, E_ACCOUNT_DRAFTS_FOLDER_URI, uri); - uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_SENT); + uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); e_account_set_string ( emae->account, E_ACCOUNT_SENT_FOLDER_URI, uri); } diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c index 2b6e3343f6..bd72edd91a 100644 --- a/mail/em-account-prefs.c +++ b/mail/em-account-prefs.c @@ -38,7 +38,7 @@ #include "em-account-prefs.h" #include "em-account-editor.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" static void em_account_prefs_class_init (EMAccountPrefsClass *class); static void em_account_prefs_init (EMAccountPrefs *prefs); @@ -243,8 +243,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) - e_mail_shell_module_remove_store_by_uri ( - mail_shell_module, account->source->url); + e_mail_shell_backend_remove_store_by_uri ( + global_mail_shell_backend, account->source->url); /* remove all the proxies account has created*/ if (has_proxies) @@ -300,12 +300,12 @@ account_able_changed(EAccount *account) if (account->source->url) { if (account->enabled) - e_mail_shell_module_load_store_by_uri ( - mail_shell_module, + e_mail_shell_backend_load_store_by_uri ( + global_mail_shell_backend, account->source->url, account->name); else - e_mail_shell_module_remove_store_by_uri ( - mail_shell_module, account->source->url); + e_mail_shell_backend_remove_store_by_uri ( + global_mail_shell_backend, account->source->url); } mail_config_write (); diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index dbc174340e..fde3297321 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -570,7 +570,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, gtk_container_add (GTK_CONTAINER (container), widget); gtk_widget_show (widget); - /* The mail shell module responds to the "window-created" signal + /* The mail shell backend responds to the "window-created" signal * that this triggers and configures it with composer preferences. */ g_signal_connect_swapped ( widget, "editor-created", diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index f503f2d7ed..66863faf64 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -60,7 +60,7 @@ #include <camel/camel-nntp-address.h> #include <camel/camel-vee-folder.h> -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #ifdef G_OS_WIN32 /* Undef the similar macro from pthread.h, it doesn't check if @@ -467,8 +467,8 @@ em_utils_composer_send_cb (EMsgComposer *composer) if ((message = composer_get_message (composer, FALSE)) == NULL) return; - mail_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); + mail_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); camel_object_ref (mail_folder); /* mail the message */ @@ -598,11 +598,11 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer) * get destroyed while we're in mail_msg_wait() a little lower * down, waiting for the folder to open */ - local_drafts_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_DRAFTS); + local_drafts_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS); - local_drafts_folder_uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_DRAFTS); + local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS); g_object_ref (composer); msg = e_msg_composer_get_message_draft (composer); @@ -1569,8 +1569,8 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) } /* Send the receipt */ - out_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); + out_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); info = camel_message_info_new (NULL); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); mail_append_mail (out_folder, receipt, info, em_utils_receipt_done, NULL); @@ -1666,7 +1666,8 @@ em_utils_forward_message_raw (CamelFolder *folder, CamelMimeMessage *message, co g_free (subject); /* and send it */ - out_folder = e_mail_shell_module_get_folder (mail_shell_module, E_MAIL_FOLDER_OUTBOX); + out_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); info = camel_message_info_new (NULL); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); mail_append_mail (out_folder, forward, info, emu_forward_raw_done, NULL); @@ -2537,14 +2538,14 @@ em_utils_post_reply_to_message_by_uid (CamelFolder *folder, const char *uid) static void post_header_clicked_cb (EComposerPostHeader *header, - EShellModule *shell_module) + EShellBackend *shell_backend) { EMFolderTreeModel *model; GtkWidget *folder_tree; GtkWidget *dialog; GList *list; - model = e_mail_shell_module_get_folder_tree_model (shell_module); + model = e_mail_shell_backend_get_folder_tree_model (shell_backend); folder_tree = em_folder_tree_new_with_model (model); em_folder_tree_set_multiselect ( @@ -2589,8 +2590,8 @@ exit: * em_configure_new_composer: * @composer: a newly created #EMsgComposer * - * Integrates a newly created #EMsgComposer into the mail module. The - * composer can't link directly to the mail module without introducing + * Integrates a newly created #EMsgComposer into the mail backend. The + * composer can't link directly to the mail backend without introducing * circular library dependencies, so this function finishes configuring * things the #EMsgComposer instance can't do itself. **/ @@ -2635,5 +2636,6 @@ em_configure_new_composer (EMsgComposer *composer) * the folder selector dialog. See the handler function. */ g_signal_connect ( header, "clicked", - G_CALLBACK (post_header_clicked_cb), mail_shell_module); + G_CALLBACK (post_header_clicked_cb), + global_mail_shell_backend); } diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index b4b098b4b6..61051106d1 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -37,7 +37,7 @@ #include "libedataserver/e-sexp.h" #include "e-util/e-error.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define d(x) @@ -257,7 +257,7 @@ get_widget(FilterElement *fe) uri = ff->uri; else uri = em_uri_to_camel (ff->uri); - model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); + model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend); button = em_folder_selection_button_new (model, _("Select Folder"), NULL); em_folder_selection_button_set_selection(EM_FOLDER_SELECTION_BUTTON(button), uri); diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index 0eed463144..e346aa3fab 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -44,7 +44,7 @@ #include "mail-vfolder.h" #include "mail-config.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" struct _prop_data { void *object; @@ -299,7 +299,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, gint32 count, i,deleted; EMConfig *ec; EMConfigTargetFolder *target; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellWindow *shell_window; EShellView *shell_view; CamelArgGetV *arggetv; @@ -315,9 +315,9 @@ emfp_dialog_got_folder_quota (CamelFolder *folder, store = folder->parent_store; shell_view = E_SHELL_VIEW (data); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - local_store = e_mail_shell_module_get_local_store (shell_module); + local_store = e_mail_shell_backend_get_local_store (shell_backend); prop_data = g_malloc0 (sizeof (*prop_data)); prop_data->object = folder; diff --git a/mail/em-folder-selection.c b/mail/em-folder-selection.c index 3a457407f7..ba63d19082 100644 --- a/mail/em-folder-selection.c +++ b/mail/em-folder-selection.c @@ -33,7 +33,7 @@ #include "em-folder-selector.h" #include "em-folder-selection.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" /* TODO: rmeove this file, it could just go on em-folder-selection or em-utils */ @@ -64,7 +64,7 @@ em_select_folder (GtkWindow *parent_window, const char *title, const char *oklab GtkWidget *dialog; EMFolderTree *emft; - model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); + model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend); emft = (EMFolderTree *) em_folder_tree_new_with_model (model); if (exclude) em_folder_tree_set_excluded_func(emft, exclude, user_data); diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index e774760ee3..289df103fd 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -57,7 +57,7 @@ #include <camel/camel-folder.h> #include <camel/camel-vee-store.h> -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define u(x) /* unread count debug */ #define d(x) @@ -67,7 +67,7 @@ ((obj), EM_TYPE_FOLDER_TREE_MODEL, EMFolderTreeModelPrivate)) struct _EMFolderTreeModelPrivate { - gpointer shell_module; /* weak pointer */ + gpointer shell_backend; /* weak pointer */ }; static GType col_types[] = { @@ -88,7 +88,7 @@ static void account_removed (EAccountList *accounts, EAccount *account, gpointer enum { PROP_0, - PROP_SHELL_MODULE + PROP_SHELL_BACKEND }; enum { @@ -215,16 +215,16 @@ folder_tree_model_sort (GtkTreeModel *model, } static void -folder_tree_model_set_shell_module (EMFolderTreeModel *model, - EShellModule *shell_module) +folder_tree_model_set_shell_backend (EMFolderTreeModel *model, + EShellBackend *shell_backend) { - g_return_if_fail (model->priv->shell_module == NULL); + g_return_if_fail (model->priv->shell_backend == NULL); - model->priv->shell_module = shell_module; + model->priv->shell_backend = shell_backend; g_object_add_weak_pointer ( - G_OBJECT (shell_module), - &model->priv->shell_module); + G_OBJECT (shell_backend), + &model->priv->shell_backend); } static void @@ -234,8 +234,8 @@ folder_tree_model_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SHELL_MODULE: - folder_tree_model_set_shell_module ( + case PROP_SHELL_BACKEND: + folder_tree_model_set_shell_backend ( EM_FOLDER_TREE_MODEL (object), g_value_get_object (value)); return; @@ -251,9 +251,10 @@ folder_tree_model_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_SHELL_MODULE: + case PROP_SHELL_BACKEND: g_value_set_object ( - value, em_folder_tree_model_get_shell_module ( + value, + em_folder_tree_model_get_mail_shell_backend ( EM_FOLDER_TREE_MODEL (object))); return; } @@ -285,12 +286,12 @@ static void folder_tree_model_constructed (GObject *object) { EMFolderTreeModel *model = EM_FOLDER_TREE_MODEL (object); - EShellModule *shell_module; + EShellBackend *shell_backend; const gchar *config_dir; gchar *filename; - shell_module = model->priv->shell_module; - config_dir = e_shell_module_get_config_dir (shell_module); + shell_backend = model->priv->shell_backend; + config_dir = e_shell_backend_get_config_dir (shell_backend); filename = g_build_filename ( config_dir, "folder-tree-expand-state.xml", NULL); @@ -314,12 +315,12 @@ folder_tree_model_class_init (EMFolderTreeModelClass *class) g_object_class_install_property ( object_class, - PROP_SHELL_MODULE, + PROP_SHELL_BACKEND, g_param_spec_object ( - "shell-module", - _("Shell Module"), + "shell-backend", + _("Shell Backend"), NULL, - E_TYPE_SHELL_MODULE, + E_TYPE_SHELL_BACKEND, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); @@ -485,21 +486,22 @@ emft_model_unread_count_changed (GtkTreeModel *model, GtkTreeIter *iter) EMFolderTreeModel * -em_folder_tree_model_new (EShellModule *shell_module) +em_folder_tree_model_new (EMailShellBackend *mail_shell_backend) { - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); return g_object_new ( EM_TYPE_FOLDER_TREE_MODEL, - "shell-module", shell_module, NULL); + "shell-backend", mail_shell_backend, NULL); } -EShellModule * -em_folder_tree_model_get_shell_module (EMFolderTreeModel *model) +EShellBackend * +em_folder_tree_model_get_shell_backend (EMFolderTreeModel *model) { g_return_val_if_fail (EM_IS_FOLDER_TREE_MODEL (model), NULL); - return model->priv->shell_module; + return model->priv->shell_backend; } static void @@ -557,7 +559,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite struct _EMFolderTreeModelStoreInfo *si, CamelFolderInfo *fi, int fully_loaded) { - EShellModule *shell_module; + EShellBackend *shell_backend; GtkTreeRowReference *uri_row, *path_row; GtkTreeStore *tree_store; unsigned int unread; @@ -575,7 +577,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite return; tree_store = GTK_TREE_STORE (model); - shell_module = model->priv->shell_module; + shell_backend = model->priv->shell_backend; if (!fully_loaded) load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS)); @@ -596,10 +598,10 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite CamelFolder *local_drafts; CamelFolder *local_outbox; - local_drafts = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_DRAFTS); - local_outbox = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_OUTBOX); + local_drafts = e_mail_shell_backend_get_folder ( + shell_backend, E_MAIL_FOLDER_DRAFTS); + local_outbox = e_mail_shell_backend_get_folder ( + shell_backend, E_MAIL_FOLDER_OUTBOX); if (folder == local_outbox) { int total; @@ -632,7 +634,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite /* TODO: maybe this should be handled by mail_get_folderinfo (except em-folder-tree doesn't use it, duh) */ flags = fi->flags; name = fi->name; - if (si->store == e_mail_shell_module_get_local_store (shell_module)) { + if (si->store == e_mail_shell_backend_get_local_store (shell_backend)) { if (!strcmp(fi->full_name, "Drafts")) { name = _("Drafts"); } else if (!strcmp(fi->full_name, "Templates")) { diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index 8236f3c303..733c940951 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -27,8 +27,7 @@ #include <libxml/tree.h> #include <camel/camel-store.h> #include <libedataserver/e-account-list.h> - -#include <shell/e-shell-module.h> +#include <mail/e-mail-shell-backend.h> /* Standard GObject macros */ #define EM_TYPE_FOLDER_TREE_MODEL \ @@ -128,8 +127,9 @@ struct _EMFolderTreeModelClass { GType em_folder_tree_model_get_type (void); EMFolderTreeModel * - em_folder_tree_model_new (EShellModule *shell_module); -EShellModule * em_folder_tree_model_get_shell_module + em_folder_tree_model_new (EMailShellBackend *mail_shell_backend); +EMailShellBackend * + em_folder_tree_model_get_mail_shell_backend (EMFolderTreeModel *model); void em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *iter, diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index d87db9c181..128e2fe164 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -73,7 +73,7 @@ #include "em-folder-properties.h" #include "em-event.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define d(x) @@ -502,14 +502,15 @@ em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model) } GtkWidget * -em_folder_tree_new (EShellModule *shell_module) +em_folder_tree_new (EMailShellBackend *mail_shell_backend) { EMFolderTreeModel *model; EMFolderTree *emft; - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail ( + E_IS_MAIL_SHELL_BACKEND (mail_shell_backend), NULL); - model = e_mail_shell_module_get_folder_tree_model (shell_module); + model = e_mail_shell_backend_get_folder_tree_model (mail_shell_backend); emft = (EMFolderTree *) em_folder_tree_new_with_model (model); g_object_unref (model); @@ -543,7 +544,7 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft) struct _EMFolderTreePrivate *priv = emft->priv; struct _EMFolderTreeModelStoreInfo *si; extern CamelStore *vfolder_store; - EShellModule *shell_module; + EMailShellBackend *mail_shell_backend; GtkTreeRowReference *row; GtkTreeView *tree_view; GtkTreePath *path; @@ -564,7 +565,7 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft) uid[n] = '\0'; tree_view = GTK_TREE_VIEW (emft); - shell_module = em_folder_tree_model_get_shell_module (model); + mail_shell_backend = em_folder_tree_model_get_mail_shell_backend (model); if ((account = e_get_account_by_uid (uid)) && account->enabled) { CamelException ex; @@ -581,7 +582,7 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft) camel_object_ref (store); } else if (!strcmp (uid, "local")) { - if (!(store = e_mail_shell_module_get_local_store (shell_module))) + if (!(store = e_mail_shell_backend_get_local_store (mail_shell_backend))) return; camel_object_ref (store); @@ -1052,7 +1053,7 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) struct _EMFolderTreePrivate *p = emft->priv; char *full_name = NULL, *uri = NULL, *src_uri = NULL; CamelStore *local, *sstore, *dstore; - EShellModule *shell_module; + EMailShellBackend *mail_shell_backend; GdkAtom atom = GDK_NONE; gboolean is_store; GtkTreeIter iter; @@ -1070,8 +1071,8 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) COL_POINTER_CAMEL_STORE, &dstore, COL_STRING_URI, &uri, -1); - shell_module = em_folder_tree_model_get_shell_module (p->model); - local = e_mail_shell_module_get_local_store (shell_module); + mail_shell_backend = em_folder_tree_model_get_mail_shell_backend (p->model); + local = e_mail_shell_backend_get_local_store (mail_shell_backend); targets = context->targets; diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index f0dfe72d10..d84b173db5 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -26,7 +26,7 @@ #include <gtk/gtk.h> #include <camel/camel-store.h> -#include <shell/e-shell-module.h> +#include <mail/e-mail-shell-backend.h> #include <mail/em-folder-tree-model.h> /* Standard GObject macros */ @@ -84,7 +84,7 @@ struct _EMFolderTreeClass { GType em_folder_tree_get_type (void); -GtkWidget *em_folder_tree_new (EShellModule *shell_module); +GtkWidget *em_folder_tree_new (EMailShellBackend *mail_shell_backend); GtkWidget *em_folder_tree_new_with_model (EMFolderTreeModel *model); void em_folder_tree_enable_drag_and_drop (EMFolderTree *emft); diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index ff93c9b5a9..510bcf782e 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -69,7 +69,7 @@ #include "em-folder-selection.h" #include "em-folder-properties.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define d(x) @@ -281,7 +281,7 @@ emfu_copy_folder_selected (const char *uri, void *data) camel_exception_init (&ex); - local_store = e_mail_shell_module_get_local_store (mail_shell_module); + local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend); if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) { e_error_run(NULL, @@ -405,7 +405,7 @@ em_folder_utils_delete_folder (CamelFolder *folder) GtkWidget *dialog; int flags = 0; - local_store = e_mail_shell_module_get_local_store (mail_shell_module); + local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend); if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) { dialog = e_error_new (NULL, "mail:no-delete-special-folder", folder->full_name, NULL); @@ -440,7 +440,7 @@ em_folder_utils_rename_folder (CamelFolder *folder) gboolean done = FALSE; size_t base_len; - local_store = e_mail_shell_module_get_local_store (mail_shell_module); + local_store = e_mail_shell_backend_get_local_store (global_mail_shell_backend); /* don't allow user to rename one of the special local folders */ if (folder->parent_store == local_store && emfu_is_special_local_folder (folder->full_name)) { @@ -694,7 +694,7 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft, EMFolderTreeModel *model; GtkWidget *dialog; - model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); + model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend); folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); dialog = em_folder_selector_create_new (folder_tree, 0, _("Create Folder"), _("Specify where to create the folder:")); diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 5b97f2dcb8..01c2d3dcdf 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -92,7 +92,7 @@ #include "em-composer-utils.h" #include "em-menu.h" #include "em-event.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #include "mail-mt.h" #include "mail-ops.h" @@ -603,7 +603,7 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM e_profile_event_emit("goto.loaded", emfv->displayed_uid, 0); - shell = e_shell_module_get_shell (mail_shell_module); + shell = e_shell_backend_get_shell (mail_shell_backend); e_shell_event (shell, "mail-icon", "evolution-mail"); /** @Event: message.reading diff --git a/mail/em-utils.c b/mail/em-utils.c index 2da8efaad2..db7f99afe8 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -80,7 +80,7 @@ #include "em-account-editor.h" #include "e-attachment.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" static void emu_save_part_done (CamelMimePart *part, char *name, int done, void *data); @@ -261,7 +261,7 @@ em_filter_editor_response (GtkWidget *dialog, int button, gpointer user_data) const gchar *data_dir; char *user; - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (global_mail_shell_backend); fc = g_object_get_data ((GObject *) dialog, "context"); user = g_strdup_printf ("%s/filters.xml", data_dir); rule_context_save ((RuleContext *) fc, user); @@ -299,7 +299,7 @@ em_utils_edit_filters (GtkWidget *parent) return; } - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (global_mail_shell_backend); fc = em_filter_context_new (); user = g_build_filename (data_dir, "filters.xml", NULL); @@ -1396,8 +1396,8 @@ em_utils_folder_is_templates (CamelFolder *folder, const char *uri) int is = FALSE; char *templates_uri; - local_templates_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_TEMPLATES); + local_templates_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_TEMPLATES); if (folder == local_templates_folder) return TRUE; @@ -1447,8 +1447,8 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri) int is = FALSE; char *drafts_uri; - local_drafts_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_DRAFTS); + local_drafts_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS); if (folder == local_drafts_folder) return TRUE; @@ -1498,8 +1498,8 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri) int is = FALSE; char *sent_uri; - local_sent_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_SENT); + local_sent_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); if (folder == local_sent_folder) return TRUE; @@ -1544,8 +1544,8 @@ em_utils_folder_is_outbox(CamelFolder *folder, const char *uri) { CamelFolder *local_outbox_folder; - local_outbox_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); + local_outbox_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); /* <Highlander>There can be only one.</Highlander> */ return folder == local_outbox_folder; @@ -2437,7 +2437,7 @@ em_utils_show_error_silent (GtkWidget *widget) EActivity *activity; activity = e_alert_activity_new_warning (widget); - e_shell_module_add_activity (mail_shell_module, activity); + e_shell_backend_add_activity (global_mail_shell_backend, activity); g_object_unref (activity); if (g_object_get_data (G_OBJECT (widget), "response-handled") == NULL) @@ -2452,7 +2452,7 @@ em_utils_show_info_silent (GtkWidget *widget) EActivity *activity; activity = e_alert_activity_new_info (widget); - e_shell_module_add_activity (mail_shell_module, activity); + e_shell_backend_add_activity (global_mail_shell_backend, activity); g_object_unref (activity); if (g_object_get_data (G_OBJECT (widget), "response-handled") == NULL) diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index 128b63b744..d75af50050 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -40,7 +40,7 @@ #include "e-util/e-error.h" #include "e-util/e-util-private.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define d(x) @@ -509,7 +509,7 @@ source_add(GtkWidget *widget, struct _source_data *data) EMFolderTreeModel *model; GtkWidget *dialog; - model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); + model = e_mail_shell_backend_get_folder_tree_model (global_mail_shell_backend); emft =(EMFolderTree *)em_folder_tree_new_with_model (model); em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOSELECT); diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index 36cf8768ff..964741f28a 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -40,7 +40,7 @@ #include <camel/camel-exception.h> -#include "mail/e-mail-shell-module.h" +#include "mail/e-mail-shell-backend.h" #include "mail/em-folder-selection-button.h" #include "mail/mail-mt.h" @@ -75,9 +75,10 @@ mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) EMFolderTreeModel *model; const gchar *local_inbox_folder_uri; - local_inbox_folder_uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_INBOX); - model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); + local_inbox_folder_uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_INBOX); + model = e_mail_shell_backend_get_folder_tree_model ( + global_mail_shell_backend); hbox = gtk_hbox_new(FALSE, 0); diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index fde63dfdae..dbae51dfcb 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -36,7 +36,6 @@ #include <glib.h> #include <glib/gstdio.h> -#include <gmodule.h> #include <glib/gi18n.h> #include <camel/camel-folder.h> #include <camel/camel-store.h> @@ -49,7 +48,7 @@ #include "mail/mail-mt.h" #include "mail/mail-tools.h" -#include "mail/e-mail-shell-module.h" +#include "mail/e-mail-shell-backend.h" #include "mail-importer.h" @@ -203,8 +202,8 @@ import_mbox_exec (struct _import_mbox_msg *m) } if (m->uri == NULL || m->uri[0] == 0) - folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_INBOX); + folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_INBOX); else folder = mail_tool_uri_to_folder(m->uri, CAMEL_STORE_FOLDER_CREATE, &m->base.ex); @@ -369,7 +368,7 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c if (dir == NULL) return; - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (global_mail_shell_backend); utf8_filename = g_filename_to_utf8 (filepath, -1, NULL, NULL, NULL); camel_operation_start(NULL, _("Scanning %s"), utf8_filename); diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index f73c44be42..b437fda1c6 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -48,7 +48,7 @@ #include <camel/camel-internet-address.h> #include <camel/camel-mime-message.h> -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define d(x) @@ -346,6 +346,7 @@ filter_rule_from_message (EMFilterContext *context, CamelMimeMessage *msg, int f void filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flags) { + EShellBackend *shell_backend; EMFilterContext *fc; const gchar *data_dir; char *user, *system; @@ -353,8 +354,10 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag g_return_if_fail (msg != NULL); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + fc = em_filter_context_new (); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "filters.xml", NULL); system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); rule_context_load ((RuleContext *)fc, system, user); @@ -372,6 +375,7 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag void mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri) { + EShellBackend *shell_backend; EMFilterContext *fc; const gchar *data_dir; char *user, *system; @@ -381,8 +385,10 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri eolduri = em_uri_from_camel(olduri); enewuri = em_uri_from_camel(newuri); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + fc = em_filter_context_new (); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "filters.xml", NULL); system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); rule_context_load ((RuleContext *)fc, system, user); @@ -406,6 +412,7 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri void mail_filter_delete_uri(CamelStore *store, const char *uri) { + EShellBackend *shell_backend; EMFilterContext *fc; const gchar *data_dir; char *user, *system; @@ -414,8 +421,10 @@ mail_filter_delete_uri(CamelStore *store, const char *uri) euri = em_uri_from_camel(uri); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + fc = em_filter_context_new (); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "filters.xml", NULL); system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); rule_context_load ((RuleContext *)fc, system, user); diff --git a/mail/mail-config.c b/mail/mail-config.c index be5b0164ee..45fc8f9b40 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -64,7 +64,7 @@ #include "mail-mt.h" #include "mail-tools.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" typedef struct { GConfClient *gconf; @@ -773,11 +773,13 @@ mail_config_get_default_transport (void) static char * uri_to_evname (const char *uri, const char *prefix) { + EShellBackend *shell_backend; const gchar *data_dir; char *safe; char *tmp; - data_dir = e_shell_module_get_data_dir (mail_shell_module); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + data_dir = e_shell_backend_get_data_dir (shell_backend); safe = g_strdup (uri); e_filename_make_safe (safe); @@ -855,10 +857,10 @@ mail_config_uri_deleted (GCompareFunc uri_cmp, const char *uri) const gchar *local_sent_folder_uri; /* assumes these can't be removed ... */ - local_drafts_folder_uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_DRAFTS); - local_sent_folder_uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_SENT); + local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS); + local_sent_folder_uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); account_list = e_get_account_list (); iter = e_list_get_iterator ((EList *) account_list); @@ -905,10 +907,12 @@ mail_config_folder_to_safe_url (CamelFolder *folder) char * mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix) { + EShellBackend *shell_backend; char *url, *basename, *filename; const gchar *config_dir; - config_dir = e_shell_module_get_config_dir (mail_shell_module); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + config_dir = e_shell_backend_get_config_dir (shell_backend); url = mail_config_folder_to_safe_url (folder); basename = g_strdup_printf ("%s%s", prefix, url); diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index f4e07f289c..097b9bf9b4 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -56,7 +56,6 @@ #include "mail-ops.h" #include "mail-session.h" #include "mail-tools.h" -#include "e-mail-shell-module.h" /* For notifications of changes */ #include "mail-vfolder.h" @@ -110,7 +109,7 @@ struct _folder_update { }; struct _store_info { - EShellModule *shell_module; + EMailShellBackend *mail_shell_backend; GHashTable *folders; /* by full_name */ GHashTable *folders_uri; /* by uri */ @@ -152,14 +151,14 @@ free_update(struct _folder_update *up) } static void -real_flush_updates (EShellModule *shell_module) +real_flush_updates (EMailShellBackend *mail_shell_backend) { EShell *shell; struct _EMFolderTreeModel *model; struct _folder_update *up; - shell = e_shell_module_get_shell (shell_module); - model = e_mail_shell_module_get_folder_tree_model (shell_module); + shell = e_shell_backend_get_shell (E_SHELL_BACKEND (mail_shell_backend)); + model = e_mail_shell_backend_get_folder_tree_model (mail_shell_backend); LOCK(info_lock); while ((up = (struct _folder_update *)e_dlist_remhead(&updates))) { @@ -233,13 +232,13 @@ real_flush_updates (EShellModule *shell_module) } static void -flush_updates (EShellModule *shell_module) +flush_updates (EMailShellBackend *shell_backend) { if (update_id == -1 && !e_dlist_empty(&updates)) update_id = mail_async_event_emit ( mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) real_flush_updates, - shell_module, NULL, NULL); + shell_backend, NULL, NULL); } static void @@ -252,7 +251,7 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub) if (mfi->folder) { CamelFolder *folder = mfi->folder; - camel_object_unhook_event(folder, "folder_changed", folder_changed, mfi->store_info->shell_module); + camel_object_unhook_event(folder, "folder_changed", folder_changed, mfi->store_info->mail_shell_backend); camel_object_unhook_event(folder, "renamed", folder_renamed, NULL); camel_object_unhook_event(folder, "finalize", folder_finalised, NULL); } @@ -269,7 +268,7 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub) up->uri = g_strdup(mfi->uri); e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(mfi->store_info->shell_module); + flush_updates(mfi->store_info->mail_shell_backend); } } @@ -307,7 +306,7 @@ static void update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) { struct _folder_update *up; - EShellModule *shell_module; + EMailShellBackend *mail_shell_backend; CamelFolder *folder; CamelFolder *local_drafts; CamelFolder *local_outbox; @@ -315,13 +314,13 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) int unread = -1; int deleted; - shell_module = mfi->store_info->shell_module; - local_drafts = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_DRAFTS); - local_outbox = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_OUTBOX); - local_sent = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_SENT); + mail_shell_backend = mfi->store_info->mail_shell_backend; + local_drafts = e_mail_shell_backend_get_folder ( + mail_shell_backend, E_MAIL_FOLDER_DRAFTS); + local_outbox = e_mail_shell_backend_get_folder ( + mail_shell_backend, E_MAIL_FOLDER_OUTBOX); + local_sent = e_mail_shell_backend_get_folder ( + mail_shell_backend, E_MAIL_FOLDER_SENT); folder = mfi->folder; if (folder) { @@ -366,7 +365,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) up->uri = g_strdup(mfi->uri); camel_object_ref(up->store); e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(shell_module); + flush_updates(mail_shell_backend); } static void @@ -400,7 +399,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) up->add = TRUE; e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(si->shell_module); + flush_updates(si->mail_shell_backend); } } @@ -423,7 +422,7 @@ static void folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) { static time_t last_newmail = 0; - EShellModule *shell_module = user_data; + EMailShellBackend *mail_shell_backend = user_data; CamelFolderChangeInfo *changes = event_data; CamelFolder *folder = (CamelFolder *)o; CamelFolder *local_drafts; @@ -439,12 +438,12 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) d(printf("folder '%s' changed\n", folder->full_name)); - local_drafts = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_DRAFTS); - local_outbox = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_OUTBOX); - local_sent = e_mail_shell_module_get_folder ( - shell_module, E_MAIL_FOLDER_SENT); + local_drafts = e_mail_shell_backend_get_folder ( + mail_shell_backend, E_MAIL_FOLDER_DRAFTS); + local_outbox = e_mail_shell_backend_get_folder ( + mail_shell_backend, E_MAIL_FOLDER_OUTBOX); + local_sent = e_mail_shell_backend_get_folder ( + mail_shell_backend, E_MAIL_FOLDER_SENT); if (!CAMEL_IS_VEE_FOLDER(folder) && folder != local_drafts @@ -541,7 +540,7 @@ void mail_note_folder(CamelFolder *folder) UNLOCK(info_lock); - camel_object_hook_event(folder, "folder_changed", folder_changed, si->shell_module); + camel_object_hook_event(folder, "folder_changed", folder_changed, si->mail_shell_backend); camel_object_hook_event(folder, "renamed", folder_renamed, NULL); camel_object_hook_event(folder, "finalize", folder_finalised, NULL); } @@ -634,6 +633,7 @@ folder_to_url(CamelStore *store, const char *full_name) static void rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, CamelFolderInfo *fi) { + EShellBackend *shell_backend; char *old, *olduri, *oldfile, *newuri, *newfile; struct _folder_info *mfi; struct _folder_update *up; @@ -684,7 +684,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, up->add = TRUE; e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(si->shell_module); + flush_updates(si->mail_shell_backend); #if 0 if (fi->sibling) rename_folders(si, oldbase, newbase, fi->sibling, folders); @@ -693,7 +693,8 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, #endif /* rename the meta-data we maintain ourselves */ - config_dir = e_shell_module_get_config_dir (si->shell_module); + shell_backend = E_SHELL_BACKEND (si->mail_shell_backend); + config_dir = e_shell_backend_get_config_dir (shell_backend); olduri = folder_to_url(si->store, old); e_filename_make_safe(olduri); newuri = folder_to_url(si->store, fi->full_name); @@ -808,7 +809,7 @@ mail_note_store_remove(CamelStore *store) if (si) { g_hash_table_remove(stores, store); - g_object_unref(si->shell_module); + g_object_unref(si->mail_shell_backend); camel_object_unhook_event(store, "folder_opened", store_folder_opened, NULL); camel_object_unhook_event(store, "folder_created", store_folder_created, NULL); @@ -962,7 +963,7 @@ store_online_cb (CamelStore *store, void *data) } void -mail_note_store(EShellModule *shell_module, CamelStore *store, CamelOperation *op, +mail_note_store(EMailShellBackend *mail_shell_backend, CamelStore *store, CamelOperation *op, gboolean (*done)(CamelStore *store, CamelFolderInfo *info, void *data), void *data) { struct _store_info *si; @@ -971,7 +972,7 @@ mail_note_store(EShellModule *shell_module, CamelStore *store, CamelOperation *o guint timeout; int hook = 0; - g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + g_return_if_fail (E_IS_MAIL_SHELL_BACKEND (mail_shell_backend)); g_return_if_fail (CAMEL_IS_STORE(store)); g_return_if_fail (mail_in_main_thread()); @@ -991,7 +992,7 @@ mail_note_store(EShellModule *shell_module, CamelStore *store, CamelOperation *o d(printf("Noting a new store: %p: %s\n", store, camel_url_to_string(((CamelService *)store)->url, 0))); si = g_malloc0(sizeof(*si)); - si->shell_module = g_object_ref (shell_module); + si->mail_shell_backend = g_object_ref (mail_shell_backend); si->folders = g_hash_table_new(g_str_hash, g_str_equal); si->folders_uri = g_hash_table_new(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->hash_folder_name, CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name); diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h index d685e5a5ad..fe893af84f 100644 --- a/mail/mail-folder-cache.h +++ b/mail/mail-folder-cache.h @@ -27,14 +27,15 @@ #define _MAIL_FOLDER_CACHE_H #include <camel/camel-store.h> -#include <shell/e-shell-module.h> + +#include "e-mail-shell-backend.h" /* Add a store whose folders should appear in the shell The folders are scanned from the store, and/or added at runtime via the folder_created event. The 'done' function returns if we can free folder info. */ void -mail_note_store (EShellModule *shell_module, CamelStore *store, CamelOperation *op, +mail_note_store (EMailShellBackend *mail_shell_backend, CamelStore *store, CamelOperation *op, gboolean (*done) (CamelStore *store, CamelFolderInfo *info, void *data), void *data); diff --git a/mail/mail-mt.c b/mail/mail-mt.c index 566d5ecd6f..dbdfe3b690 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -43,7 +43,7 @@ #include "mail-session.h" #include "mail-mt.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" /*#define MALLOC_CHECK*/ #define LOG_OPS @@ -142,6 +142,10 @@ mail_msg_new (MailMsgInfo *info) static void end_event_callback (CamelObject *o, EActivity *activity, void *error) { + EShellBackend *shell_backend; + + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + if (error == NULL) { e_activity_complete (activity); g_object_unref (activity); @@ -149,7 +153,7 @@ end_event_callback (CamelObject *o, EActivity *activity, void *error) if (activity != NULL) g_object_unref (activity); activity = e_alert_activity_new_warning (error); - e_shell_module_add_activity (mail_shell_module, activity); + e_shell_backend_add_activity (shell_backend, activity); g_object_unref (activity); } } @@ -937,6 +941,7 @@ struct _op_status_msg { static void op_status_exec (struct _op_status_msg *m) { + EShellBackend *shell_backend; MailMsg *msg; MailMsgPrivate *data; char *out, *p, *o, c; @@ -944,6 +949,8 @@ op_status_exec (struct _op_status_msg *m) g_return_if_fail (mail_in_main_thread ()); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + MAIL_MT_LOCK (mail_msg_lock); msg = g_hash_table_lookup (mail_msg_active_table, m->data); @@ -990,7 +997,7 @@ op_status_exec (struct _op_status_msg *m) data->activity = e_activity_new (what); e_activity_set_allow_cancel (data->activity, TRUE); e_activity_set_percent (data->activity, 0.0); - e_shell_module_add_activity (mail_shell_module, data->activity); + e_shell_backend_add_activity (shell_backend, data->activity); g_signal_connect_swapped ( data->activity, "cancelled", diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 97df0ed9bd..63175d73d6 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -69,7 +69,7 @@ #include "mail-tools.h" #include "mail-vfolder.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define w(x) #define d(x) @@ -244,16 +244,19 @@ static char * uid_cachename_hack (CamelStore *store) { CamelURL *url = CAMEL_SERVICE (store)->url; + EShellBackend *shell_backend; char *encoded_url, *filename; const gchar *data_dir; + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + encoded_url = g_strdup_printf ("%s%s%s@%s", url->user, url->authmech ? ";auth=" : "", url->authmech ? url->authmech : "", url->host); e_filename_make_safe (encoded_url); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); filename = g_build_filename (data_dir, "pop", encoded_url, "uid-cache", NULL); g_free (encoded_url); @@ -275,8 +278,8 @@ fetch_mail_exec (struct _fetch_mail_msg *m) if (m->cancel) camel_operation_register (m->cancel); - fm->destination = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_LOCAL_INBOX); + fm->destination = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_LOCAL_INBOX); if (fm->destination == NULL) goto fail; camel_object_ref (fm->destination); @@ -581,8 +584,8 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination, } if (!folder) { - folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_SENT); + folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); camel_object_ref(folder); } @@ -595,8 +598,8 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination, if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) goto exit; - sent_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_SENT); + sent_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); if (folder != sent_folder) { const char *name; @@ -698,8 +701,8 @@ send_queue_exec (struct _send_queue_msg *m) d(printf("sending queue\n")); - sent_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_SENT); + sent_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); if (!(uids = camel_folder_get_uids (m->queue))) return; @@ -1761,14 +1764,17 @@ empty_trash_desc (struct _empty_trash_msg *m) static void empty_trash_exec (struct _empty_trash_msg *m) { + EShellBackend *shell_backend; const gchar *data_dir; CamelFolder *trash; char *uri; + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + if (m->account) { trash = mail_tool_get_trash (m->account->source->url, FALSE, &m->base.ex); } else { - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); uri = g_strdup_printf ("mbox:%s/local", data_dir); trash = mail_tool_get_trash (uri, TRUE, &m->base.ex); g_free (uri); diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 3ffc9b46a6..7b6326338e 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -50,7 +50,7 @@ #include "e-util/e-account-utils.h" #include "e-util/gconf-bridge.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define d(x) @@ -164,8 +164,8 @@ setup_send_data(void) g_str_hash, g_str_equal, (GDestroyNotify) NULL, (GDestroyNotify) free_folder_info); - data->inbox = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_LOCAL_INBOX); + data->inbox = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_LOCAL_INBOX); camel_object_ref(data->inbox); data->active = g_hash_table_new_full ( g_str_hash, g_str_equal, @@ -692,8 +692,8 @@ receive_done (char *uri, void *data) if (info->type == SEND_SEND && info->state == SEND_ACTIVE && info->again) { CamelFolder *local_outbox_folder; - local_outbox_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); + local_outbox_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); info->again = 0; mail_send_queue (local_outbox_folder, @@ -908,7 +908,7 @@ receive_update_got_store (char *uri, CamelStore *store, void *data) struct _send_info *info = data; if (store) { - mail_note_store(mail_shell_module, store, info->cancel, receive_update_got_folderinfo, info); + mail_note_store(global_mail_shell_backend, store, info->cancel, receive_update_got_folderinfo, info); } else { receive_done("", info); } @@ -940,8 +940,8 @@ mail_send_receive (GtkWindow *parent) accounts = e_get_account_list (); - outbox_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); + outbox_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); data = build_dialog ( parent, accounts, outbox_folder, account->transport->url); scan = data->infos; @@ -1090,14 +1090,14 @@ auto_online (EShell *shell) /* call to setup initial, and after changes are made to the config */ /* FIXME: Need a cleanup funciton for when object is deactivated */ void -mail_autoreceive_init (EShellModule *shell_module, +mail_autoreceive_init (EShellBackend *shell_backend, CamelSession *session) { EAccountList *accounts; EIterator *iter; EShell *shell; - g_return_if_fail (E_IS_SHELL_MODULE (shell_module)); + g_return_if_fail (E_IS_SHELL_BACKEND (shell_backend)); g_return_if_fail (CAMEL_IS_SESSION (session)); if (auto_active) @@ -1113,7 +1113,7 @@ mail_autoreceive_init (EShellModule *shell_module, for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) auto_account_added(accounts, (EAccount *)e_iterator_get(iter), NULL); - shell = e_shell_module_get_shell (shell_module); + shell = e_shell_backend_get_shell (shell_backend); auto_online (shell); @@ -1174,8 +1174,8 @@ mail_receive_uri (const gchar *uri, gboolean keep_on_server) break; case SEND_SEND: /* todo, store the folder in info? */ - outbox_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); + outbox_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); mail_send_queue (outbox_folder, info->uri, FILTER_SOURCE_OUTGOING, info->cancel, @@ -1237,8 +1237,8 @@ mail_send (void) g_hash_table_insert (data->active, SEND_URI_KEY, info); /* todo, store the folder in info? */ - outbox_folder = e_mail_shell_module_get_folder ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); + outbox_folder = e_mail_shell_backend_get_folder ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); mail_send_queue (outbox_folder, info->uri, FILTER_SOURCE_OUTGOING, info->cancel, diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h index d602e63bd7..a9f18f6a0b 100644 --- a/mail/mail-send-recv.h +++ b/mail/mail-send-recv.h @@ -25,7 +25,7 @@ #include <gtk/gtk.h> #include <camel/camel-session.h> -#include <shell/e-shell-module.h> +#include <shell/e-shell-backend.h> G_BEGIN_DECLS @@ -39,7 +39,7 @@ void mail_receive_uri (const gchar *uri, void mail_send (void); /* setup auto receive stuff */ -void mail_autoreceive_init (EShellModule *shell_module, +void mail_autoreceive_init (EShellBackend *shell_backend, CamelSession *session); G_END_DECLS diff --git a/mail/mail-session.c b/mail/mail-session.c index df5d35c179..5cb61e9f71 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -83,7 +83,7 @@ typedef struct _MailSessionClass { } MailSessionClass; -static EShellModule *mail_shell_module; +static EMailShellBackend *session_mail_shell_backend; static CamelSessionClass *ms_parent_class; static char *get_password(CamelSession *session, CamelService *service, const char *domain, const char *prompt, const char *item, guint32 flags, CamelException *ex); @@ -512,7 +512,7 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException gconf = mail_config_get_gconf_client (); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (session_mail_shell_backend); user = g_build_filename (data_dir, "filters.xml", NULL); system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); fc = (RuleContext *) em_filter_context_new (); @@ -706,16 +706,18 @@ mail_session_check_junk_notify (GConfClient *gconf, guint id, GConfEntry *entry, } void -mail_session_init (EShellModule *shell_module) +mail_session_init (EMailShellBackend *mail_shell_backend) { EShell *shell; + EShellBackend *shell_backend; GConfClient *gconf; gboolean online; const gchar *data_dir; - mail_shell_module = shell_module; + session_mail_shell_backend = mail_shell_backend; - shell = e_shell_module_get_shell (shell_module); + shell_backend = E_SHELL_BACKEND (mail_shell_backend); + shell = e_shell_backend_get_shell (shell_backend); online = e_shell_get_online (shell); data_dir = e_get_user_data_dir (); @@ -728,7 +730,7 @@ mail_session_init (EShellModule *shell_module) e_account_combo_box_set_session (session); /* XXX Don't ask... */ e_account_writable(NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); /* Init the EAccount Setup */ - data_dir = e_shell_module_get_data_dir (shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); camel_session_construct (session, data_dir); gconf = mail_config_get_gconf_client (); diff --git a/mail/mail-session.h b/mail/mail-session.h index e98a4bd604..135898e8b2 100644 --- a/mail/mail-session.h +++ b/mail/mail-session.h @@ -25,11 +25,11 @@ #include <glib.h> #include <camel/camel-session.h> -#include <shell/e-shell-module.h> +#include <mail/e-mail-shell-backend.h> G_BEGIN_DECLS -void mail_session_init (EShellModule *shell_module); +void mail_session_init (EMailShellBackend *mail_shell_backend); void mail_session_shutdown (void); gboolean mail_session_get_interactive (void); void mail_session_set_interactive (gboolean interactive); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 4c7131dacc..d5f90b0d35 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -58,7 +58,7 @@ #include "mail-tools.h" #include "mail-vfolder.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" /* **************************************** */ @@ -107,6 +107,7 @@ mail_tool_get_trash (const gchar *url, int connect, CamelException *ex) static char * mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex) { + EShellBackend *shell_backend; unsigned char *safe_uri, *c; const gchar *data_dir; char *path, *full; @@ -117,7 +118,8 @@ mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex) if (strchr("/:;=|%&#!*^()\\, ", *c) || !isprint((int) *c)) *c = '_'; - data_dir = e_shell_module_get_data_dir (mail_shell_module); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + data_dir = e_shell_backend_get_data_dir (shell_backend); path = g_build_filename (data_dir, "spool", NULL); if (g_stat(path, &st) == -1 && g_mkdir_with_parents(path, 0777) == -1) { diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 2afcafdd6a..dc0f64e6fd 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -50,7 +50,7 @@ #include "mail-tools.h" #include "mail-vfolder.h" -#include "e-mail-shell-module.h" +#include "e-mail-shell-backend.h" #define d(x) /* (printf("%s:%s: ", G_STRLOC, G_STRFUNC), (x))*/ @@ -344,12 +344,12 @@ uri_is_ignore(CamelStore *store, const char *uri) const gchar *local_sent_folder_uri; int found = FALSE; - local_drafts_folder_uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_DRAFTS); - local_outbox_folder_uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_OUTBOX); - local_sent_folder_uri = e_mail_shell_module_get_folder_uri ( - mail_shell_module, E_MAIL_FOLDER_SENT); + local_drafts_folder_uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_DRAFTS); + local_outbox_folder_uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_OUTBOX); + local_sent_folder_uri = e_mail_shell_backend_get_folder_uri ( + global_mail_shell_backend, E_MAIL_FOLDER_SENT); d(printf("checking '%s' against:\n %s\n %s\n %s\n", uri, local_outbox_folder_uri, @@ -534,6 +534,7 @@ done: void mail_vfolder_delete_uri(CamelStore *store, const char *curi) { + EShellBackend *shell_backend; FilterRule *rule; const char *source; CamelVeeFolder *vf; @@ -550,6 +551,8 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi) g_return_if_fail (mail_in_main_thread()); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + changed = g_string_new (""); LOCK(); @@ -610,7 +613,7 @@ done: dialog = e_error_new(NULL, "mail:vfolder-updated", changed->str, uri, NULL); em_utils_show_info_silent (dialog); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "vfolders.xml", NULL); rule_context_save ((RuleContext *) context, user); g_free (user); @@ -625,6 +628,7 @@ done: void mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto) { + EShellBackend *shell_backend; FilterRule *rule; const char *source; CamelVeeFolder *vf; @@ -638,6 +642,8 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto) g_return_if_fail (mail_in_main_thread()); + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + from = em_uri_from_camel(cfrom); to = em_uri_from_camel(cto); @@ -678,7 +684,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto) char *user; d(printf("Vfolders updated from renamed folder\n")); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "vfolders.xml", NULL); rule_context_save((RuleContext *)context, user); g_free(user); @@ -832,6 +838,7 @@ store_folder_created(CamelObject *o, void *event_data, void *data) static void store_folder_deleted(CamelObject *o, void *event_data, void *data) { + EShellBackend *shell_backend; CamelStore *store = (CamelStore *)o; CamelFolderInfo *info = event_data; FilterRule *rule; @@ -840,6 +847,8 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data) d(printf("Folder deleted: %s\n", info->name)); store = store; + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + /* Warning not thread safe, but might be enough */ LOCK(); @@ -856,7 +865,7 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data) g_object_unref(rule); g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "vfolders.xml", NULL); rule_context_save((RuleContext *)context, user); g_free(user); @@ -870,12 +879,15 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data) static void store_folder_renamed(CamelObject *o, void *event_data, void *data) { + EShellBackend *shell_backend; CamelRenameInfo *info = event_data; FilterRule *rule; char *user; gpointer key, folder; + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + /* This should be more-or-less thread-safe */ d(printf("Folder renamed to '%s' from '%s'\n", info->new->full_name, info->old_base)); @@ -902,7 +914,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) filter_rule_set_name(rule, info->new->full_name); g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "vfolders.xml", NULL); rule_context_save((RuleContext *)context, user); g_free(user); @@ -920,12 +932,15 @@ vfolder_load_storage(void) /* lock for loading storage, it is safe to call it more than once */ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + EShellBackend *shell_backend; const gchar *data_dir; char *user, *storeuri; FilterRule *rule; char *xmlfile; GConfClient *gconf; + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + pthread_mutex_lock (&lock); if (vfolder_hash) { @@ -939,7 +954,7 @@ vfolder_load_storage(void) pthread_mutex_unlock (&lock); /* first, create the vfolder store, and set it up */ - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); storeuri = g_strdup_printf("vfolder:%s/vfolder", data_dir); vfolder_store = camel_session_get_store(session, storeuri, NULL); if (vfolder_store == NULL) { @@ -972,8 +987,8 @@ vfolder_load_storage(void) g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); /* load store to mail component */ - e_mail_shell_module_load_store_by_uri ( - mail_shell_module, storeuri, _("Search Folders")); + e_mail_shell_backend_load_store_by_uri ( + global_mail_shell_backend, storeuri, _("Search Folders")); /* and setup the rules we have */ rule = NULL; @@ -996,11 +1011,14 @@ vfolder_load_storage(void) void vfolder_revert(void) { + EShellBackend *shell_backend; const gchar *data_dir; char *user; + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + d(printf("vfolder_revert\n")); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "vfolders.xml", NULL); rule_context_revert((RuleContext *)context, user); g_free(user); @@ -1009,7 +1027,7 @@ vfolder_revert(void) void vfolder_edit (EShellView *shell_view) { - EShellModule *shell_module; + EShellBackend *shell_backend; EShellWindow *shell_window; GtkWidget *dialog; const gchar *data_dir; @@ -1017,10 +1035,10 @@ vfolder_edit (EShellView *shell_view) g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - shell_module = e_shell_view_get_shell_module (shell_view); + shell_backend = e_shell_view_get_shell_backend (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); - data_dir = e_shell_module_get_data_dir (shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); filename = g_build_filename (data_dir, "vfolders.xml", NULL); /* ensures vfolder is running */ @@ -1047,6 +1065,10 @@ vfolder_edit (EShellView *shell_view) static void edit_rule_response(GtkWidget *w, int button, void *data) { + EShellBackend *shell_backend; + + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + if (button == GTK_RESPONSE_OK) { const gchar *data_dir; char *user; @@ -1054,7 +1076,7 @@ edit_rule_response(GtkWidget *w, int button, void *data) FilterRule *orig = g_object_get_data (G_OBJECT (w), "orig"); filter_rule_copy(orig, rule); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "vfolders.xml", NULL); rule_context_save((RuleContext *)context, user); g_free(user); @@ -1111,6 +1133,10 @@ vfolder_edit_rule(const char *uri) static void new_rule_clicked(GtkWidget *w, int button, void *data) { + EShellBackend *shell_backend; + + shell_backend = E_SHELL_BACKEND (global_mail_shell_backend); + if (button == GTK_RESPONSE_OK) { const gchar *data_dir; char *user; @@ -1129,7 +1155,7 @@ new_rule_clicked(GtkWidget *w, int button, void *data) g_object_ref(rule); rule_context_add_rule((RuleContext *)context, rule); - data_dir = e_shell_module_get_data_dir (mail_shell_module); + data_dir = e_shell_backend_get_data_dir (shell_backend); user = g_build_filename (data_dir, "vfolders.xml", NULL); rule_context_save((RuleContext *)context, user); g_free(user); diff --git a/mail/message-list.c b/mail/message-list.c index 39784acfcc..d425ae0494 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -113,7 +113,7 @@ struct _MLSelection { struct _MessageListPrivate { GtkWidget *invisible; /* 4 selection */ - EShellModule *shell_module; + EShellBackend *shell_backend; struct _MLSelection clipboard; gboolean destroyed; @@ -1242,7 +1242,7 @@ get_all_labels (MessageList *message_list, gboolean get_tags) { EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellSettings *shell_settings; EMailLabelListStore *store; GtkTreeIter iter; @@ -1253,8 +1253,8 @@ get_all_labels (MessageList *message_list, int count = 0; const CamelFlag *flag; - shell_module = message_list_get_shell_module (message_list); - shell = e_shell_module_get_shell (shell_module); + shell_backend = message_list_get_shell_backend (message_list); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); property_name = "mail-label-list-store"; @@ -1318,7 +1318,7 @@ get_label_color (MessageList *message_list, const gchar *tag) { EShell *shell; - EShellModule *shell_module; + EShellBackend *shell_backend; EShellSettings *shell_settings; EMailLabelListStore *store; GtkTreeIter iter; @@ -1330,8 +1330,8 @@ get_label_color (MessageList *message_list, /* FIXME get_all_labels() should return an array of tree iterators, * not strings. Now we just have to lookup the tag again. */ - shell_module = message_list_get_shell_module (message_list); - shell = e_shell_module_get_shell (shell_module); + shell_backend = message_list_get_shell_backend (message_list); + shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); property_name = "mail-label-list-store"; @@ -2327,12 +2327,12 @@ on_model_row_changed (ETableModel *model, int row, MessageList *ml) */ static void -message_list_set_shell_module (MessageList *message_list, - EShellModule *shell_module) +message_list_set_shell_backend (MessageList *message_list, + EShellBackend *shell_backend) { - g_return_if_fail (message_list->priv->shell_module == NULL); + g_return_if_fail (message_list->priv->shell_backend == NULL); - message_list->priv->shell_module = g_object_ref (shell_module); + message_list->priv->shell_backend = g_object_ref (shell_backend); } static void @@ -2457,7 +2457,7 @@ message_list_set_property (GObject *object, { switch (property_id) { case PROP_SHELL_MODULE: - message_list_set_shell_module ( + message_list_set_shell_backend ( MESSAGE_LIST (object), g_value_get_object (value)); return; @@ -2475,7 +2475,7 @@ message_list_get_property (GObject *object, switch (property_id) { case PROP_SHELL_MODULE: g_value_set_object ( - value, message_list_get_shell_module ( + value, message_list_get_shell_backend ( MESSAGE_LIST (object))); return; } @@ -2490,9 +2490,9 @@ message_list_dispose (GObject *object) priv = MESSAGE_LIST_GET_PRIVATE (object); - if (priv->shell_module != NULL) { - g_object_unref (priv->shell_module); - priv->shell_module = NULL; + if (priv->shell_backend != NULL) { + g_object_unref (priv->shell_backend); + priv->shell_backend = NULL; } /* Chain up to parent's dispose() method. */ @@ -2567,10 +2567,10 @@ message_list_class_init (MessageListClass *class) object_class, PROP_SHELL_MODULE, g_param_spec_object ( - "shell-module", - _("Shell Module"), - _("The mail shell module"), - E_TYPE_SHELL_MODULE, + "shell-backend", + _("Shell Backend"), + _("The mail shell backend"), + E_TYPE_SHELL_BACKEND, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); @@ -2725,28 +2725,28 @@ message_list_construct (MessageList *message_list) * Returns a new message-list widget. **/ GtkWidget * -message_list_new (EShellModule *shell_module) +message_list_new (EShellBackend *shell_backend) { MessageList *message_list; - g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), NULL); + g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), NULL); message_list = MESSAGE_LIST (g_object_new(message_list_get_type (), "hadjustment", NULL, "vadjustment", NULL, - "shell-module", shell_module, + "shell-backend", shell_backend, NULL)); message_list_construct (message_list); return GTK_WIDGET (message_list); } -EShellModule * -message_list_get_shell_module (MessageList *message_list) +EShellBackend * +message_list_get_shell_backend (MessageList *message_list) { g_return_val_if_fail (IS_MESSAGE_LIST (message_list), NULL); - return message_list->priv->shell_module; + return message_list->priv->shell_backend; } static void |