diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/dbx-import/dbx-importer.c | 15 | ||||
-rw-r--r-- | plugins/groupwise-features/install-shared.c | 10 | ||||
-rw-r--r-- | plugins/groupwise-features/proxy-login.c | 19 | ||||
-rw-r--r-- | plugins/groupwise-features/proxy.c | 13 | ||||
-rw-r--r-- | plugins/groupwise-features/share-folder-common.c | 22 | ||||
-rw-r--r-- | plugins/mailing-list-actions/mailing-list-actions.c | 7 | ||||
-rw-r--r-- | plugins/mark-all-read/mark-all-read.c | 6 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 51 | ||||
-rw-r--r-- | plugins/templates/templates.c | 2 |
9 files changed, 119 insertions, 26 deletions
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c index c4f1d462c1..3079442ad6 100644 --- a/plugins/dbx-import/dbx-importer.c +++ b/plugins/dbx-import/dbx-importer.c @@ -65,6 +65,7 @@ #include <libedataserver/e-data-server-util.h> #include <libedataserverui/e-source-selector-dialog.h> +#include <mail/e-mail-backend.h> #include <mail/e-mail-local.h> #include <mail/mail-mt.h> #include <mail/mail-tools.h> @@ -542,6 +543,9 @@ dbx_read_email (DbxImporter *m, guint32 offset, gint bodyfd, gint *flags) static void dbx_import_file (DbxImporter *m) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; gchar *filename; CamelFolder *folder; gint tmpfile; @@ -551,9 +555,16 @@ dbx_import_file (DbxImporter *m) filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL); m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */ + /* XXX Dig up the EMailSession from the default EShell. + * Since the EImport framework doesn't allow for user + * data, I don't see how else to get to it. */ + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + camel_operation_push_message (NULL, _("Importing '%s'"), filename); - folder = mail_tool_uri_to_folder ( - m->parent_uri, CAMEL_STORE_FOLDER_CREATE, + folder = e_mail_session_uri_to_folder_sync ( + session, m->parent_uri, CAMEL_STORE_FOLDER_CREATE, m->base.cancellable, &m->base.error); if (!folder) return; diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c index 92d5ae6aab..b216d49085 100644 --- a/plugins/groupwise-features/install-shared.c +++ b/plugins/groupwise-features/install-shared.c @@ -31,6 +31,7 @@ #include <gconf/gconf-client.h> #include <e-util/e-config.h> #include <shell/e-shell.h> +#include <mail/e-mail-backend.h> #include <mail/em-config.h> #include <mail/em-event.h> #include <mail/em-folder-tree.h> @@ -155,17 +156,24 @@ accept_free (gpointer data) static void apply_clicked (GtkAssistant *assistant, CamelMimeMessage *msg) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; EMFolderTree *folder_tree; GtkWidget *dialog; struct AcceptData *accept_data; gchar *uri; gpointer parent; + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + parent = gtk_widget_get_toplevel (GTK_WIDGET (assistant)); parent = gtk_widget_is_toplevel (parent) ? parent : NULL; accept_data = g_new0 (struct AcceptData, 1); - folder_tree = (EMFolderTree *) em_folder_tree_new (); + folder_tree = (EMFolderTree *) em_folder_tree_new (session); dialog = em_folder_selector_create_new (parent, folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); uri = em_folder_tree_get_selected_uri (folder_tree); diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index 12d095bb31..74b67f0ef5 100644 --- a/plugins/groupwise-features/proxy-login.c +++ b/plugins/groupwise-features/proxy-login.c @@ -30,6 +30,7 @@ #include <libedataserverui/e-passwords.h> #include <mail/em-folder-tree.h> +#include <mail/e-mail-backend.h> #include <mail/e-mail-store.h> #include <mail/mail-config.h> #include <mail/em-folder-selector.h> @@ -307,6 +308,9 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) EAccountList *accounts = e_get_account_list (); EAccount *srcAccount; EAccount *dstAccount; + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; EGwConnection *proxy_cnc, *cnc; CamelURL *uri = NULL, *parent = NULL; gchar *password = NULL, *user_name = NULL; @@ -315,6 +319,10 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) gint i; gint permissions = 0; + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + for (i=0; email[i]!='\0' && email[i]!='@' ; i++); if (email[i]=='@') name = g_strndup (email, i); @@ -360,7 +368,7 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) e_account_list_change (accounts, srcAccount); e_account_list_save (accounts); g_object_set_data ((GObject *)dstAccount, "permissions", GINT_TO_POINTER(permissions)); - mail_get_store (e_account_get_string (dstAccount, E_ACCOUNT_SOURCE_URL), NULL, proxy_login_add_new_store, dstAccount); + mail_get_store (session, e_account_get_string (dstAccount, E_ACCOUNT_SOURCE_URL), NULL, proxy_login_add_new_store, dstAccount); g_free (proxy_source_url); g_free (parent_source_url); @@ -381,9 +389,16 @@ proxy_soap_login (gchar *email, GtkWindow *error_parent) static void proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; EAccount *account = user_data; gint permissions = GPOINTER_TO_INT(g_object_get_data ((GObject *)account, "permissions")); + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + if (store == NULL) return; @@ -391,7 +406,7 @@ proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data) store->mode &= !CAMEL_STORE_WRITE; store->flags |= CAMEL_STORE_PROXY; - e_mail_store_add (store, account->name); + e_mail_store_add (session, store, account->name); } static void diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c index beb1c94b30..3d350232db 100644 --- a/plugins/groupwise-features/proxy.c +++ b/plugins/groupwise-features/proxy.c @@ -40,7 +40,8 @@ #include <mail/em-account-editor.h> #include <mail/em-config.h> #include <mail/mail-ops.h> -#include <mail/mail-session.h> +#include <mail/e-mail-backend.h> +#include <shell/e-shell.h> #include <libedataserver/e-account.h> #include <libedataserver/e-account-list.h> #include <e-util/e-icon-factory.h> @@ -637,6 +638,9 @@ GtkWidget* org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data) { EMConfigTargetAccount *target_account; + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; EAccount *account; GtkButton *addProxy, *removeProxy, *editProxy; proxyDialog *prd; @@ -644,13 +648,18 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data) CamelOfflineStore *store; gint pag_num; + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + target_account = (EMConfigTargetAccount *)data->config->target; account = target_account->account; /* We are using some g_object_set on this. We shuold also avoid double-free later. So reffing */ g_object_ref (account); store = (CamelOfflineStore *) camel_session_get_service ( - session, e_account_get_string (account, E_ACCOUNT_SOURCE_URL), + CAMEL_SESSION (session), + e_account_get_string (account, E_ACCOUNT_SOURCE_URL), CAMEL_PROVIDER_STORE, NULL); if (store == NULL) return NULL; diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index 387c960b27..adb373d6c6 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -29,6 +29,7 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <e-util/e-config.h> +#include <mail/e-mail-backend.h> #include <mail/em-config.h> #include <mail/em-folder-properties.h> #include <mail/em-folder-tree.h> @@ -243,6 +244,7 @@ users_dialog_response (GtkWidget *dialog, gint response, struct ShareInfo *ssi) struct _EMFolderTreeModelStoreInfo *si; EMFolderSelector *emfs = ssi->emfs; const gchar *uri, *path; + EMailSession *session; CamelStore *store; if (response != GTK_RESPONSE_OK) { @@ -253,11 +255,12 @@ users_dialog_response (GtkWidget *dialog, gint response, struct ShareInfo *ssi) uri = em_folder_selector_get_selected_uri (emfs); path = em_folder_selector_get_selected_path (emfs); + session = em_folder_tree_get_session (emfs->emft); d(printf ("Creating new folder: %s (%s)\n", path, uri)); store = (CamelStore *) camel_session_get_service ( - session, uri, CAMEL_PROVIDER_STORE, NULL); + CAMEL_SESSION (session), uri, CAMEL_PROVIDER_STORE, NULL); if (store == NULL) return; @@ -268,14 +271,14 @@ users_dialog_response (GtkWidget *dialog, gint response, struct ShareInfo *ssi) } if (CAMEL_IS_VEE_STORE (store)) { - EMVFolderRule *rule; + EFilterRule *rule; /* ensures vfolder is running */ - vfolder_load_storage (); + vfolder_load_storage (session); - rule = em_vfolder_rule_new (); - e_filter_rule_set_name ((EFilterRule *)rule, path); - vfolder_gui_add_rule (rule); + rule = em_vfolder_rule_new (session); + e_filter_rule_set_name (rule, path); + vfolder_gui_add_rule (EM_VFOLDER_RULE (rule)); gtk_widget_destroy ((GtkWidget *)emfs); } else { g_object_ref (emfs); @@ -336,12 +339,17 @@ void gw_new_shared_folder_cb (GtkAction *action, EShellView *shell_view) { EMFolderTree *folder_tree; + EShellBackend *shell_backend; + EMailSession *session; GtkWidget *dialog; gchar *uri; gpointer parent; parent = e_shell_view_get_shell_window (shell_view); - folder_tree = (EMFolderTree *) em_folder_tree_new (); + shell_backend = e_shell_view_get_shell_backend (shell_view); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + + folder_tree = (EMFolderTree *) em_folder_tree_new (session); emu_restore_folder_tree_state (folder_tree); dialog = em_folder_selector_create_new (parent, folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c index 254451ce7d..8b123e7d02 100644 --- a/plugins/mailing-list-actions/mailing-list-actions.c +++ b/plugins/mailing-list-actions/mailing-list-actions.c @@ -116,15 +116,18 @@ emla_list_action_do (CamelFolder *folder, gint t; EMsgComposer *composer; gint send_message_response; - EShellBackend *shell_backend; EShell *shell; + EMailBackend *backend; + EShellBackend *shell_backend; EAccount *account; GtkWindow *window; if (msg == NULL) return; - shell_backend = e_mail_reader_get_shell_backend (action_data->reader); + backend = e_mail_reader_get_backend (action_data->reader); + + shell_backend = E_SHELL_BACKEND (backend); shell = e_shell_backend_get_shell (shell_backend); window = e_mail_reader_get_window (action_data->reader); diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index ffbbbccb2e..62b8102d9d 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -421,15 +421,19 @@ action_mail_mark_read_recursive_cb (GtkAction *action, { EShellSidebar *shell_sidebar; EMFolderTree *folder_tree; + EMailSession *session; gchar *folder_uri; shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); + + session = em_folder_tree_get_session (folder_tree); + folder_uri = em_folder_tree_get_selected_uri (folder_tree); g_return_if_fail (folder_uri != NULL); mail_get_folder ( - folder_uri, 0, mar_got_folder, + session, folder_uri, 0, mar_got_folder, NULL, mail_msg_unordered_push); g_object_unref (folder_tree); diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index 8a42d0d5ef..e9203d1dd7 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -52,10 +52,12 @@ #include <libedataserver/e-data-server-util.h> #include <libedataserverui/e-source-selector-dialog.h> +#include <mail/e-mail-backend.h> #include <mail/e-mail-local.h> #include <mail/mail-mt.h> #include <mail/mail-tools.h> #include <mail/em-utils.h> +#include <shell/e-shell.h> #include <libpst/libpst.h> #include <libpst/timeconv.h> @@ -214,12 +216,22 @@ folder_selected (EMFolderSelectionButton *button, EImportTargetURI *target) static gchar * get_suggested_foldername (EImportTargetURI *target) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; const gchar *inbox; gchar *delim, *filename; gchar *rootname = NULL; GString *foldername; pst_file pst; + /* XXX Dig up the EMailSession from the default EShell. + * Since the EImport framework doesn't allow for user + * data, I don't see how else to get to it. */ + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + /* Suggest a folder that is in the same mail storage as the users' inbox, with a name derived from the .PST file */ inbox = e_mail_local_get_folder_uri (E_MAIL_FOLDER_INBOX); @@ -251,8 +263,10 @@ get_suggested_foldername (EImportTargetURI *target) g_string_append (foldername, "outlook_data"); } + /* FIXME Leaking a CamelFolder reference here. */ /* FIXME Not passing a GCancellable or GError here. */ - if (mail_tool_uri_to_folder (foldername->str, 0, NULL, NULL) != NULL) { + if (e_mail_session_uri_to_folder_sync ( + session, foldername->str, 0, NULL, NULL) != NULL) { CamelFolder *folder; /* Folder exists - add a number */ @@ -263,7 +277,8 @@ get_suggested_foldername (EImportTargetURI *target) g_string_truncate (foldername, len); g_string_append_printf (foldername, "_%d", i); /* FIXME Not passing a GCancellable or GError here. */ - if ((folder=mail_tool_uri_to_folder (foldername->str, 0, NULL, NULL)) == NULL) { + if ((folder = e_mail_session_uri_to_folder_sync ( + session, foldername->str, 0, NULL, NULL)) == NULL) { /* Folder does not exist */ break; } @@ -438,19 +453,29 @@ pst_import_import (PstImporter *m) static void pst_import_file (PstImporter *m) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; gint ret; gchar *filename; pst_item *item = NULL; pst_desc_tree *d_ptr; + /* XXX Dig up the EMailSession from the default EShell. + * Since the EImport framework doesn't allow for user + * data, I don't see how else to get to it. */ + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + filename = g_filename_from_uri (((EImportTargetURI *)m->target)->uri_src, NULL, NULL); m->parent_uri = g_strdup (((EImportTargetURI *)m->target)->uri_dest); /* Destination folder, was set in our widget */ camel_operation_push_message (NULL, _("Importing '%s'"), filename); if (GPOINTER_TO_INT (g_datalist_get_data (&m->target->data, "pst-do-mail"))) { - mail_tool_uri_to_folder ( - m->parent_uri, CAMEL_STORE_FOLDER_CREATE, + e_mail_session_uri_to_folder_sync ( + session, m->parent_uri, CAMEL_STORE_FOLDER_CREATE, m->base.cancellable, &m->base.error); } @@ -682,10 +707,20 @@ pst_process_folder (PstImporter *m, pst_item *item) static void pst_create_folder (PstImporter *m) { + EShell *shell; + EShellBackend *shell_backend; + EMailSession *session; const gchar *parent; gchar *dest, *dest_end, *pos; gint dest_len; + /* XXX Dig up the EMailSession from the default EShell. + * Since the EImport framework doesn't allow for user + * data, I don't see how else to get to it. */ + shell = e_shell_get_default (); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); + parent = ((EImportTargetURI *)m->target)->uri_dest; dest = g_strdup (m->folder_uri); @@ -703,8 +738,8 @@ pst_create_folder (PstImporter *m) *pos = '\0'; - folder = mail_tool_uri_to_folder ( - dest, CAMEL_STORE_FOLDER_CREATE, + folder = e_mail_session_uri_to_folder_sync ( + session, dest, CAMEL_STORE_FOLDER_CREATE, m->base.cancellable, &m->base.error); g_object_unref (folder); *pos = '/'; @@ -717,8 +752,8 @@ pst_create_folder (PstImporter *m) g_object_unref (m->folder); } - m->folder = mail_tool_uri_to_folder ( - m->folder_uri, CAMEL_STORE_FOLDER_CREATE, + m->folder = e_mail_session_uri_to_folder_sync ( + session, m->folder_uri, CAMEL_STORE_FOLDER_CREATE, m->base.cancellable, &m->base.error); } diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 7f62240370..901f902ae9 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -33,9 +33,9 @@ #include <mail/e-mail-local.h> #include <mail/e-mail-reader.h> +#include <mail/e-mail-session.h> #include <mail/em-composer-utils.h> #include <mail/em-utils.h> -#include <mail/mail-session.h> #include <mail/mail-ops.h> #include <mail/message-list.h> #include <e-util/e-alert-dialog.h> |