aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-02-13 03:01:33 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-02-13 03:01:33 +0800
commitf4d9a26f99304d0fed83289bb6411e3a14a01ef7 (patch)
tree0671bd5d51968fd9c49e927053947123bf1234c8
parent6bffa31112ca78585f3528bbd2ad52b84231e3f4 (diff)
downloadgsoc2013-evolution-f4d9a26f99304d0fed83289bb6411e3a14a01ef7.tar
gsoc2013-evolution-f4d9a26f99304d0fed83289bb6411e3a14a01ef7.tar.gz
gsoc2013-evolution-f4d9a26f99304d0fed83289bb6411e3a14a01ef7.tar.bz2
gsoc2013-evolution-f4d9a26f99304d0fed83289bb6411e3a14a01ef7.tar.lz
gsoc2013-evolution-f4d9a26f99304d0fed83289bb6411e3a14a01ef7.tar.xz
gsoc2013-evolution-f4d9a26f99304d0fed83289bb6411e3a14a01ef7.tar.zst
gsoc2013-evolution-f4d9a26f99304d0fed83289bb6411e3a14a01ef7.zip
Make MailSession available through EShellSettings so composer can use it.
svn path=/branches/kill-bonobo/; revision=37257
-rw-r--r--composer/e-msg-composer.c11
-rw-r--r--doc/reference/shell/eshell-sections.txt2
-rw-r--r--mail/e-mail-shell-module-settings.c12
-rw-r--r--shell/e-shell-settings.c57
-rw-r--r--shell/e-shell-settings.h5
5 files changed, 83 insertions, 4 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 0f91a34907..288a9c6868 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -3631,15 +3631,18 @@ e_msg_composer_new_redirect (CamelMimeMessage *message,
CamelSession *
e_msg_composer_get_session (EMsgComposer *composer)
{
- EShellModule *shell_module;
- CamelSession *session;
EShell *shell;
+ EShellSettings *shell_settings;
+ CamelSession *session;
+
+ /* FIXME EMsgComposer should own a reference to EShell. */
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
shell = e_shell_get_default ();
- shell_module = e_shell_get_module_by_name (shell, "mail");
- session = g_object_get_data (G_OBJECT (shell_module), "session");
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ session = e_shell_settings_get_pointer (shell_settings, "mail-session");
g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
return session;
diff --git a/doc/reference/shell/eshell-sections.txt b/doc/reference/shell/eshell-sections.txt
index b4db220d8d..bbf4654b83 100644
--- a/doc/reference/shell/eshell-sections.txt
+++ b/doc/reference/shell/eshell-sections.txt
@@ -133,6 +133,8 @@ e_shell_settings_get_string
e_shell_settings_set_string
e_shell_settings_get_object
e_shell_settings_set_object
+e_shell_settings_get_pointer
+e_shell_settings_set_pointer
<SUBSECTION Standard>
E_SHELL_SETTINGS
E_IS_SHELL_SETTINGS
diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-module-settings.c
index e3d77e6a82..e657296de3 100644
--- a/mail/e-mail-shell-module-settings.c
+++ b/mail/e-mail-shell-module-settings.c
@@ -26,6 +26,7 @@
#include "e-util/e-signature-list.h"
#include "mail/e-mail-label-list-store.h"
+#include "mail/mail-session.h"
void
e_mail_shell_module_init_settings (EShell *shell)
@@ -53,6 +54,17 @@ e_mail_shell_module_init_settings (EShell *shell)
shell_settings, "mail-label-list-store", object);
g_object_unref (object);
+ e_shell_settings_install_property (
+ g_param_spec_pointer (
+ "mail-session",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ camel_object_ref (session);
+ e_shell_settings_set_pointer (
+ shell_settings, "mail-session", session);
+
/*** Mail Preferences ***/
e_shell_settings_install_property (
diff --git a/shell/e-shell-settings.c b/shell/e-shell-settings.c
index d887f39e6a..23dd866bf8 100644
--- a/shell/e-shell-settings.c
+++ b/shell/e-shell-settings.c
@@ -500,3 +500,60 @@ e_shell_settings_set_object (EShellSettings *shell_settings,
g_object_set_property (object, property_name, &value);
g_value_unset (&value);
}
+
+/**
+ * e_shell_settings_get_pointer:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ *
+ * Returns the contents of an #EShellSettings property of type
+ * #G_TYPE_POINTER.
+ *
+ * Returns: pointer contents of @property_name
+ **/
+gpointer
+e_shell_settings_get_pointer (EShellSettings *shell_settings,
+ const gchar *property_name)
+{
+ GObject *object;
+ GValue value = { 0, };
+ gpointer v_pointer;
+
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
+ g_return_val_if_fail (property_name != NULL, NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_POINTER);
+ g_object_get_property (object, property_name, &value);
+ v_pointer = g_value_get_pointer (&value);
+ g_value_unset (&value);
+
+ return v_pointer;
+}
+
+/**
+ * e_shell_settings_set_pointer:
+ * @shell_settings: an #EShellSettings
+ * @property_name: an installed property name
+ * @v_pointer: pointer to be set
+ *
+ * Sets the contents of an #EShellSettings property of type #G_TYPE_POINTER
+ * to @v_pointer.
+ **/
+void
+e_shell_settings_set_pointer (EShellSettings *shell_settings,
+ const gchar *property_name,
+ gpointer v_pointer)
+{
+ GObject *object;
+ GValue value = { 0, };
+
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (property_name != NULL);
+
+ object = G_OBJECT (shell_settings);
+ g_value_init (&value, G_TYPE_POINTER);
+ g_value_set_pointer (&value, v_pointer);
+ g_object_set_property (object, property_name, &value);
+ g_value_unset (&value);
+}
diff --git a/shell/e-shell-settings.h b/shell/e-shell-settings.h
index fb53d800d4..a9f6a20f93 100644
--- a/shell/e-shell-settings.h
+++ b/shell/e-shell-settings.h
@@ -103,6 +103,11 @@ gpointer e_shell_settings_get_object (EShellSettings *shell_settings,
void e_shell_settings_set_object (EShellSettings *shell_settings,
const gchar *property_name,
gpointer v_object);
+gpointer e_shell_settings_get_pointer (EShellSettings *shell_setting,
+ const gchar *property_name);
+void e_shell_settings_set_pointer (EShellSettings *shell_setting,
+ const gchar *property_name,
+ gpointer v_pointer);
G_END_DECLS