diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-07 11:38:52 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-13 01:58:59 +0800 |
commit | a06e4484b8df804124b5bcf88d94dec5acfba270 (patch) | |
tree | 4fa42793d7dc461f2b3767296d76592182c48222 /modules/mail/em-mailer-prefs.c | |
parent | 5e0758bb6934a7859b1d8a247c8fb21c156772cf (diff) | |
download | gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.gz gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.bz2 gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.lz gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.xz gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.tar.zst gsoc2013-evolution-a06e4484b8df804124b5bcf88d94dec5acfba270.zip |
Give MailSession a permanent home.
Global variables in shared libraries are a bad idea. EMailBackend now
owns the MailSession instance, which is actually now EMailSession.
Move the blocking utility functions in mail-tools.c to e-mail-session.c
and add asynchronous variants. Same approach as Camel.
Replace EMailReader.get_shell_backend() with EMailReader.get_backend(),
which returns an EMailBackend. Easier access to the EMailSession.
Diffstat (limited to 'modules/mail/em-mailer-prefs.c')
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index 570da0ebff..60a8795a63 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -44,13 +44,13 @@ #include "widgets/misc/e-charset-combo-box.h" #include "shell/e-shell-utils.h" +#include "e-mail-backend.h" #include "e-mail-label-manager.h" #include "e-mail-reader-utils.h" #include "mail-config.h" #include "em-folder-selection-button.h" #include "em-junk.h" #include "em-config.h" -#include "mail-session.h" enum { HEADER_LIST_NAME_COLUMN, /* displayable name of the header (may be a translation) */ @@ -104,6 +104,7 @@ em_mailer_prefs_finalize (GObject *object) { EMMailerPrefs *prefs = (EMMailerPrefs *) object; + g_object_unref (prefs->session); g_object_unref (prefs->builder); if (prefs->labels_change_notify_id) { @@ -660,7 +661,7 @@ static void junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs) { gchar *def_plugin = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo)); - const GList *plugins = mail_session_get_junk_plugins (); + const GList *plugins = mail_session_get_junk_plugins (prefs->session); gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", def_plugin, NULL); while (plugins) { @@ -669,7 +670,8 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs) if (iface->plugin_name && def_plugin && !strcmp (iface->plugin_name, def_plugin)) { gboolean status; - session->junk_plugin = CAMEL_JUNK_PLUGIN (&iface->camel); + CAMEL_SESSION (prefs->session)->junk_plugin = + CAMEL_JUNK_PLUGIN (&iface->camel); status = e_plugin_invoke (iface->hook->plugin, iface->validate_binary, NULL) != NULL; if ((gboolean)status == TRUE) { gchar *text, *html; @@ -701,7 +703,7 @@ junk_plugin_setup (GtkComboBox *combo_box, EMMailerPrefs *prefs) GtkCellRenderer *cell; gint index = 0; gboolean def_set = FALSE; - const GList *plugins = mail_session_get_junk_plugins (); + const GList *plugins = mail_session_get_junk_plugins (prefs->session); gchar *pdefault = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", NULL); store = gtk_list_store_new (1, G_TYPE_STRING); @@ -1127,12 +1129,23 @@ GtkWidget * em_mailer_prefs_new (EPreferencesWindow *window) { EMMailerPrefs *new; - EShell *shell = e_preferences_window_get_shell (window); + EShell *shell; + EShellBackend *shell_backend; + EMailBackend *backend; + EMailSession *session; - g_return_val_if_fail (E_IS_SHELL (shell), NULL); + /* XXX Figure out a better way to get the EMailSession. */ + shell = e_preferences_window_get_shell (window); + shell_backend = e_shell_get_backend_by_name (shell, "mail"); + + backend = E_MAIL_BACKEND (shell_backend); + session = e_mail_backend_get_session (backend); new = g_object_new (EM_TYPE_MAILER_PREFS, NULL); + /* FIXME This should be a constructor property. */ + new->session = g_object_ref (session); + /* FIXME Kill this function. */ em_mailer_prefs_construct (new, shell); |