evolution r37257 - in branches/kill-bonobo: composer doc/reference/shell mail shell



Author: mbarnes
Date: Thu Feb 12 19:01:33 2009
New Revision: 37257
URL: http://svn.gnome.org/viewvc/evolution?rev=37257&view=rev

Log:
Make MailSession available through EShellSettings so composer can use it.


Modified:
   branches/kill-bonobo/composer/e-msg-composer.c
   branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
   branches/kill-bonobo/mail/e-mail-shell-module-settings.c
   branches/kill-bonobo/shell/e-shell-settings.c
   branches/kill-bonobo/shell/e-shell-settings.h

Modified: branches/kill-bonobo/composer/e-msg-composer.c
==============================================================================
--- branches/kill-bonobo/composer/e-msg-composer.c	(original)
+++ branches/kill-bonobo/composer/e-msg-composer.c	Thu Feb 12 19:01:33 2009
@@ -3631,15 +3631,18 @@
 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;

Modified: branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/eshell-sections.txt	(original)
+++ branches/kill-bonobo/doc/reference/shell/eshell-sections.txt	Thu Feb 12 19:01:33 2009
@@ -133,6 +133,8 @@
 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

Modified: branches/kill-bonobo/mail/e-mail-shell-module-settings.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module-settings.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-module-settings.c	Thu Feb 12 19:01:33 2009
@@ -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 @@
 		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 (

Modified: branches/kill-bonobo/shell/e-shell-settings.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-settings.c	(original)
+++ branches/kill-bonobo/shell/e-shell-settings.c	Thu Feb 12 19:01:33 2009
@@ -500,3 +500,60 @@
 	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);
+}

Modified: branches/kill-bonobo/shell/e-shell-settings.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-settings.h	(original)
+++ branches/kill-bonobo/shell/e-shell-settings.h	Thu Feb 12 19:01:33 2009
@@ -103,6 +103,11 @@
 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
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]