evolution r36875 - in branches/kill-bonobo: calendar/gui composer mail shell



Author: mbarnes
Date: Sun Dec 14 02:14:41 2008
New Revision: 36875
URL: http://svn.gnome.org/viewvc/evolution?rev=36875&view=rev

Log:
- Fix NetworkManager connection tracking.

- Implement offline preparation as an EActivity that gets broadcast in
  a signal to shell modules.  Offline preparations are complete when the
  last EActivity reference is dropped.

- Bind some of the composer preferences to EShellSettings properties.


Added:
   branches/kill-bonobo/mail/e-mail-shell-module-settings.c
   branches/kill-bonobo/mail/e-mail-shell-module-settings.h
Modified:
   branches/kill-bonobo/calendar/gui/e-week-view.c
   branches/kill-bonobo/composer/e-composer-private.h
   branches/kill-bonobo/composer/e-msg-composer.c
   branches/kill-bonobo/mail/Makefile.am
   branches/kill-bonobo/mail/e-mail-shell-module.c
   branches/kill-bonobo/mail/em-account-editor.c
   branches/kill-bonobo/mail/em-composer-prefs.c
   branches/kill-bonobo/mail/em-composer-prefs.h
   branches/kill-bonobo/mail/mail-component.c
   branches/kill-bonobo/mail/mail-send-recv.c
   branches/kill-bonobo/mail/mail-send-recv.h
   branches/kill-bonobo/shell/e-shell-nm.c
   branches/kill-bonobo/shell/e-shell-window-actions.c
   branches/kill-bonobo/shell/e-shell.c
   branches/kill-bonobo/shell/e-shell.h

Modified: branches/kill-bonobo/calendar/gui/e-week-view.c
==============================================================================
--- branches/kill-bonobo/calendar/gui/e-week-view.c	(original)
+++ branches/kill-bonobo/calendar/gui/e-week-view.c	Sun Dec 14 02:14:41 2008
@@ -4159,6 +4159,7 @@
 static gboolean
 e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
 {
+#if 0  /* KILL-BONOBO */
 	gboolean handled = FALSE;
 	handled = e_week_view_do_key_press (widget, event);
 
@@ -4166,6 +4167,7 @@
 	if (!handled)
 		handled = GTK_WIDGET_CLASS (e_week_view_parent_class)->key_press_event (widget, event);
 	return handled;
+#endif
 }
 
 static void

Modified: branches/kill-bonobo/composer/e-composer-private.h
==============================================================================
--- branches/kill-bonobo/composer/e-composer-private.h	(original)
+++ branches/kill-bonobo/composer/e-composer-private.h	Sun Dec 14 02:14:41 2008
@@ -29,6 +29,7 @@
 #include "e-composer-actions.h"
 #include "e-composer-autosave.h"
 #include "e-composer-header-table.h"
+#include "e-util/e-binding.h"
 #include "e-util/gconf-bridge.h"
 
 #define E_MSG_COMPOSER_GET_PRIVATE(obj) \
@@ -124,8 +125,6 @@
 
 	CamelMimeMessage *redirect;
 
-	guint notify_id;
-
 	gboolean send_invoked;
 };
 

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	Sun Dec 14 02:14:41 2008
@@ -1353,14 +1353,16 @@
                  const gchar *text,
                  gboolean set_signature)
 {
+	EShell *shell;
+	EShellSettings *shell_settings;
 	gboolean reply_signature_on_top;
 	gchar *body = NULL, *html = NULL;
-	GConfClient *gconf;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 	g_return_if_fail (text != NULL);
 
-	gconf = gconf_client_get_default ();
+	shell = e_shell_get_default ();
+	shell_settings = e_shell_get_settings (shell);
 
 	/*
 
@@ -1376,9 +1378,9 @@
 
 	 */
 
-	reply_signature_on_top = gconf_client_get_bool (gconf, COMPOSER_GCONF_TOP_SIGNATURE_KEY, NULL);
-
-	g_object_unref (gconf);
+	g_object_get (
+		shell_settings, "composer-top-signature",
+		&reply_signature_on_top, NULL);
 
 	if (set_signature && reply_signature_on_top) {
 		gchar *tmp = NULL;
@@ -1778,46 +1780,6 @@
 	camel_object_unref (mime_part);
 }
 
-static void
-msg_composer_update_preferences (GConfClient *client,
-                                 guint cnxn_id,
-                                 GConfEntry *entry,
-                                 EMsgComposer *composer)
-{
-	GtkhtmlEditor *editor;
-	gboolean enable;
-	GError *error = NULL;
-
-	editor = GTKHTML_EDITOR (composer);
-
-	enable = gconf_client_get_bool (
-		client, COMPOSER_GCONF_INLINE_SPELLING_KEY, &error);
-	if (error == NULL)
-		gtkhtml_editor_set_inline_spelling (editor, enable);
-	else {
-		g_warning ("%s", error->message);
-		g_clear_error (&error);
-	}
-
-	enable = gconf_client_get_bool (
-		client, COMPOSER_GCONF_MAGIC_LINKS_KEY, &error);
-	if (error == NULL)
-		gtkhtml_editor_set_magic_links (editor, enable);
-	else {
-		g_warning ("%s", error->message);
-		g_clear_error (&error);
-	}
-
-	enable = gconf_client_get_bool (
-		client, COMPOSER_GCONF_MAGIC_SMILEYS_KEY, &error);
-	if (error == NULL)
-		gtkhtml_editor_set_magic_smileys (editor, enable);
-	else {
-		g_warning ("%s", error->message);
-		g_clear_error (&error);
-	}
-}
-
 struct _drop_data {
 	EMsgComposer *composer;
 
@@ -2082,11 +2044,12 @@
                           guint n_construct_properties,
                           GObjectConstructParam *construct_properties)
 {
+	EShell *shell;
+	EShellSettings *shell_settings;
 	GObject *object;
 	EMsgComposer *composer;
 	GtkToggleAction *action;
 	GList *spell_languages;
-	GConfClient *client;
 	GArray *array;
 	gboolean active;
 	guint binding_id;
@@ -2096,9 +2059,11 @@
 		type, n_construct_properties, construct_properties);
 
 	composer = E_MSG_COMPOSER (object);
-	client = gconf_client_get_default ();
 	array = composer->priv->gconf_bridge_binding_ids;
 
+	shell = e_shell_get_default ();
+	shell_settings = e_shell_get_settings (shell);
+
 	/* Restore Persistent State */
 
 	binding_id = gconf_bridge_bind_property (
@@ -2145,13 +2110,12 @@
 
 	/* Honor User Preferences */
 
-	active = gconf_client_get_bool (
-		client, COMPOSER_GCONF_SEND_HTML_KEY, NULL);
+	g_object_get (shell_settings, "composer-format-html", &active, NULL);
 	gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (composer), active);
 
 	action = GTK_TOGGLE_ACTION (ACTION (REQUEST_READ_RECEIPT));
-	active = gconf_client_get_bool (
-		client, COMPOSER_GCONF_REQUEST_RECEIPT_KEY, NULL);
+	g_object_get (
+		shell_settings, "composer-request-receipt", &active, NULL);
 	gtk_toggle_action_set_active (action, active);
 
 	spell_languages = e_load_spell_languages ();
@@ -2159,15 +2123,17 @@
 		GTKHTML_EDITOR (composer), spell_languages);
 	g_list_free (spell_languages);
 
-	gconf_client_add_dir (
-		client, COMPOSER_GCONF_PREFIX,
-		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-	composer->priv->notify_id = gconf_client_notify_add (
-		client, COMPOSER_GCONF_PREFIX, (GConfClientNotifyFunc)
-		msg_composer_update_preferences, composer, NULL, NULL);
-	msg_composer_update_preferences (client, 0, NULL, composer);
-
-	g_object_unref (client);
+	e_binding_new (
+		G_OBJECT (shell_settings), "composer-inline-spelling",
+		G_OBJECT (composer), "inline-spelling");
+
+	e_binding_new (
+		G_OBJECT (shell_settings), "composer-magic-links",
+		G_OBJECT (composer), "magic-links");
+
+	e_binding_new (
+		G_OBJECT (shell_settings), "composer-magic-smileys",
+		G_OBJECT (composer), "magic-smileys");
 
 	return object;
 }
@@ -2214,15 +2180,6 @@
 		composer->priv->address_dialog = NULL;
 	}
 
-	if (composer->priv->notify_id) {
-		GConfClient *client;
-
-		client = gconf_client_get_default ();
-		gconf_client_notify_remove (client, composer->priv->notify_id);
-		composer->priv->notify_id = 0;
-		g_object_unref (client);
-	}
-
 	/* Chain up to parent's destroy() method. */
 	GTK_OBJECT_CLASS (parent_class)->destroy (object);
 }

Modified: branches/kill-bonobo/mail/Makefile.am
==============================================================================
--- branches/kill-bonobo/mail/Makefile.am	(original)
+++ branches/kill-bonobo/mail/Makefile.am	Sun Dec 14 02:14:41 2008
@@ -39,6 +39,8 @@
 	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-content.c				\
 	e-mail-shell-content.h				\
 	e-mail-shell-sidebar.c				\

Added: branches/kill-bonobo/mail/e-mail-shell-module-settings.c
==============================================================================
--- (empty file)
+++ branches/kill-bonobo/mail/e-mail-shell-module-settings.c	Sun Dec 14 02:14:41 2008
@@ -0,0 +1,416 @@
+/*
+ * e-mail-shell-module-settings.c
+ *
+ * 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)
+ *
+ */
+
+#include "e-mail-shell-module-settings.h"
+
+void
+e_mail_shell_module_init_settings (EShell *shell)
+{
+	EShellSettings *shell_settings;
+
+	shell_settings = e_shell_get_settings (shell);
+
+	/* XXX Default values should match the GConf schema.
+	 *     Yes it's redundant, but we're stuck with GConf. */
+
+	/*** Mail Preferences ***/
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-address-compress",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-address-compress",
+		"/apps/evolution/mail/display/address_compress");
+
+	e_shell_settings_install_property (
+		g_param_spec_int (
+			"mail-address-count",
+			NULL,
+			NULL,
+			G_MININT,
+			G_MAXINT,
+			0,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-address-count",
+		"/apps/evolution/mail/display/address_count");
+
+	e_shell_settings_install_property (
+		g_param_spec_string (
+			"mail-citation-color",
+			NULL,
+			NULL,
+			"#737373",
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-citation-color",
+		"/apps/evolution/mail/display/citation_colour");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-check-for-junk",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-check-for-junk",
+		"/apps/evolution/mail/junk/check_incoming");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-confirm-expunge",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-confirm-expunge",
+		"/apps/evolution/mail/prompts/expunge");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-confirm-unwanted-html",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-confirm-unwanted-html",
+		"/apps/evolution/mail/prompts/unwanted_html");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-empty-trash-on-exit",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-empty-trash-on-exit",
+		"/apps/evolution/mail/trash/empty_on_exit");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-enable-search-folders",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-enable-search-folders",
+		"/apps/evolution/mail/display/enable_vfolders");
+
+	e_shell_settings_install_property (
+		g_param_spec_string (
+			"mail-font-monospace",
+			NULL,
+			NULL,
+			"",
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-font-monospace",
+		"/apps/evolution/mail/display/fonts/monospace");
+
+	e_shell_settings_install_property (
+		g_param_spec_string (
+			"mail-font-variable",
+			NULL,
+			NULL,
+			"",
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-font-variable",
+		"/apps/evolution/mail/display/fonts/variable");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-force-message-limit",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-force-message-limit",
+		"/apps/evolution/mail/display/force_message_limit");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-magic-spacebar",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-magic-spacebar",
+		"/apps/evolution/mail/display/magic_spacebar");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-mark-citations",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-mark-citations",
+		"/apps/evolution/mail/display/mark_citations");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-mark-seen",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-mark-seen",
+		"/apps/evolution/mail/display/mark_seen");
+
+	e_shell_settings_install_property (
+		g_param_spec_int (
+			"mail-mark-seen-timeout",
+			NULL,
+			NULL,
+			G_MININT,
+			G_MAXINT,
+			0,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-mark-seen-timeout",
+		"/apps/evolution/mail/display/mark_seen_timeout");
+
+	e_shell_settings_install_property (
+		g_param_spec_int (
+			"mail-message-text-part-limit",
+			NULL,
+			NULL,
+			G_MININT,
+			G_MAXINT,
+			0,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-message-text-part-limit",
+		"/apps/evolution/mail/display/message_text_part_limit");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-only-local-photos",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-only-local-photos",
+		"/apps/evolution/mail/display/photo_local");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-show-animated-images",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-show-animated-images",
+		"/apps/evolution/mail/display/animated_images");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-show-sender-photo",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-show-sender-photo",
+		"/apps/evolution/mail/display/sender_photo");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"mail-use-custom-fonts",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "mail-use-custom-fonts",
+		"/apps/evolution/mail/display/fonts/use_custom");
+
+
+	/*** Composer Preferences ***/
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-format-html",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-format-html",
+		"/apps/evolution/mail/composer/send_html");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-inline-spelling",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-inline-spelling",
+		"/apps/evolution/mail/composer/inline_spelling");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-magic-links",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-magic-links",
+		"/apps/evolution/mail/composer/magic_links");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-magic-smileys",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-magic-smileys",
+		"/apps/evolution/mail/composer/magic_smileys");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-outlook-filenames",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-outlook-filenames",
+		"/apps/evolution/mail/composer/outlook_filenames");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-prompt-only-bcc",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-prompt-only-bcc",
+		"/apps/evolution/mail/prompts/only_bcc");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-prompt-empty-subject",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-prompt-empty-subject",
+		"/apps/evolution/mail/prompts/empty_subject");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-reply-start-bottom",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-reply-start-bottom",
+		"/apps/evolution/mail/composer/reply_start_bottom");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-request-receipt",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-request-receipt",
+		"/apps/evolution/mail/composer/request_receipt");
+
+	e_shell_settings_install_property (
+		g_param_spec_string (
+			"composer-spell-color",
+			NULL,
+			NULL,
+			"#ff0000",
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-spell-color",
+		"/apps/evolution/mail/composer/spell_color");
+
+	e_shell_settings_install_property (
+		g_param_spec_boolean (
+			"composer-top-signature",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	e_shell_settings_bind_to_gconf (
+		shell_settings, "composer-top-signature",
+		"/apps/evolution/mail/composer/top_signature");
+}

Added: branches/kill-bonobo/mail/e-mail-shell-module-settings.h
==============================================================================
--- (empty file)
+++ branches/kill-bonobo/mail/e-mail-shell-module-settings.h	Sun Dec 14 02:14:41 2008
@@ -0,0 +1,33 @@
+/*
+ * e-mail-shell-module-settings.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_SETTINGS_H
+#define E_MAIL_SHELL_MODULE_SETTINGS_H
+
+#include <shell/e-shell.h>
+
+G_BEGIN_DECLS
+
+void		e_mail_shell_module_init_settings	(EShell *shell);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SHELL_MODULE_SETTINGS_H */

Modified: branches/kill-bonobo/mail/e-mail-shell-module.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-module.c	Sun Dec 14 02:14:41 2008
@@ -32,6 +32,7 @@
 #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 "em-account-prefs.h"
 #include "em-composer-prefs.h"
@@ -43,10 +44,13 @@
 #include "em-junk-hook.h"
 #include "em-mailer-prefs.h"
 #include "em-network-prefs.h"
+#include "em-utils.h"
 #include "mail-config.h"
 #include "mail-folder-cache.h"
 #include "mail-mt.h"
+#include "mail-send-recv.h"
 #include "mail-session.h"
+#include "mail-vfolder.h"
 #include "importers/mail-importer.h"
 
 #define MODULE_NAME		"mail"
@@ -445,7 +449,7 @@
 		"composer",
 		"preferences-composer",
 		_("Composer Preferences"),
-		em_composer_prefs_new (),
+		em_composer_prefs_new (shell),
 		400);
 
 	e_preferences_window_add_page (
@@ -457,267 +461,6 @@
 		500);
 }
 
-static void
-mail_shell_module_init_settings (EShell *shell)
-{
-	EShellSettings *shell_settings;
-
-	shell_settings = e_shell_get_settings (shell);
-
-	/* XXX Default values should match the GConf schema.
-	 *     Yes it's redundant, but we're stuck with GConf. */
-
-	/*** Mail Preferences ***/
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-address-compress",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_int (
-			"mail-address-count",
-			NULL,
-			NULL,
-			G_MININT,
-			G_MAXINT,
-			0,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_string (
-			"mail-citation-color",
-			NULL,
-			NULL,
-			"#737373",
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-check-for-junk",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-confirm-expunge",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-confirm-unwanted-html",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-empty-trash-on-exit",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-enable-search-folders",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_string (
-			"mail-font-monospace",
-			NULL,
-			NULL,
-			"",
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_string (
-			"mail-font-variable",
-			NULL,
-			NULL,
-			"",
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-force-message-limit",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-magic-spacebar",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-mark-citations",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-mark-seen",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_int (
-			"mail-mark-seen-timeout",
-			NULL,
-			NULL,
-			G_MININT,
-			G_MAXINT,
-			0,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_int (
-			"mail-message-text-part-limit",
-			NULL,
-			NULL,
-			G_MININT,
-			G_MAXINT,
-			0,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-only-local-photos",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-show-animated-images",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-show-sender-photo",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	e_shell_settings_install_property (
-		g_param_spec_boolean (
-			"mail-use-custom-fonts",
-			NULL,
-			NULL,
-			FALSE,
-			G_PARAM_READWRITE));
-
-	/* Bind shell settings to GConf keys. */
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-address-compress",
-		"/apps/evolution/mail/display/address_compress");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-address-count",
-		"/apps/evolution/mail/display/address_count");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-citation-color",
-		"/apps/evolution/mail/display/citation_colour");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-check-for-junk",
-		"/apps/evolution/mail/junk/check_incoming");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-confirm-expunge",
-		"/apps/evolution/mail/prompts/expunge");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-confirm-unwanted-html",
-		"/apps/evolution/mail/prompts/unwanted_html");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-empty-trash-on-exit",
-		"/apps/evolution/mail/trash/empty_on_exit");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-enable-search-folders",
-		"/apps/evolution/mail/display/enable_vfolders");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-font-monospace",
-		"/apps/evolution/mail/display/fonts/monospace");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-font-variable",
-		"/apps/evolution/mail/display/fonts/variable");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-force-message-limit",
-		"/apps/evolution/mail/display/force_message_limit");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-magic-spacebar",
-		"/apps/evolution/mail/display/magic_spacebar");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-mark-citations",
-		"/apps/evolution/mail/display/mark_citations");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-mark-seen",
-		"/apps/evolution/mail/display/mark_seen");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-mark-seen-timeout",
-		"/apps/evolution/mail/display/mark_seen_timeout");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-message-text-part-limit",
-		"/apps/evolution/mail/display/message_text_part_limit");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-only-local-photos",
-		"/apps/evolution/mail/display/photo_local");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-show-animated-images",
-		"/apps/evolution/mail/display/animated_images");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-show-sender-photo",
-		"/apps/evolution/mail/display/sender_photo");
-
-	e_shell_settings_bind_to_gconf (
-		shell_settings, "mail-use-custom-fonts",
-		"/apps/evolution/mail/display/fonts/use_custom");
-}
-
 static gboolean
 mail_shell_module_handle_uri_cb (EShell *shell,
                                  const gchar *uri,
@@ -728,6 +471,15 @@
 }
 
 static void
+mail_shell_module_send_receive_cb (EShell *shell,
+                                   GtkWindow *parent,
+                                   EShellModule *shell_module)
+{
+	em_utils_clear_get_password_canceled_accounts_flag ();
+	mail_send_receive (parent);
+}
+
+static void
 mail_shell_module_window_weak_notify_cb (EShell *shell,
                                          GObject *where_the_object_was)
 {
@@ -779,6 +531,7 @@
 {
 	EShell *shell;
 	EShellModule *shell_module;
+	gboolean enable_search_folders;
 
 	shell_module = E_SHELL_MODULE (type_module);
 	shell = e_shell_module_get_shell (shell_module);
@@ -811,6 +564,11 @@
 		shell_module);
 
 	g_signal_connect (
+		shell, "send-receive",
+		G_CALLBACK (mail_shell_module_send_receive_cb),
+		shell_module);
+
+	g_signal_connect (
 		shell, "window-created",
 		G_CALLBACK (mail_shell_module_window_created_cb),
 		shell_module);
@@ -823,8 +581,15 @@
 
 	/* Initialize settings before initializing preferences,
 	 * since the preferences bind to the shell settings. */
-	mail_shell_module_init_settings (shell);
+	e_mail_shell_module_init_settings (shell);
 	mail_shell_module_init_preferences (shell);
+
+	g_object_get (
+		e_shell_get_settings (shell),
+		"mail-enable-search-folders",
+		&enable_search_folders, NULL);
+	if (enable_search_folders)
+		vfolder_load_storage ();
 }
 
 /******************************** Public API *********************************/

Modified: branches/kill-bonobo/mail/em-account-editor.c
==============================================================================
--- branches/kill-bonobo/mail/em-account-editor.c	(original)
+++ branches/kill-bonobo/mail/em-account-editor.c	Sun Dec 14 02:14:41 2008
@@ -661,10 +661,19 @@
 static void
 emae_signature_new(GtkWidget *w, EMAccountEditor *emae)
 {
-	/* TODO: why is this in composer prefs? apart from it being somewhere to put it? */
-	em_composer_prefs_new_signature((GtkWindow *)gtk_widget_get_toplevel(w),
-					gconf_client_get_bool(mail_config_get_gconf_client(),
-							      "/apps/evolution/mail/composer/send_html", NULL));
+	EShell *shell;
+	EShellSettings *shell_settings;
+	GtkWidget *parent;
+	gboolean html_mode;
+
+	shell = e_shell_get_default ();
+	shell_settings = e_shell_get_settings (shell);
+	parent = gtk_widget_get_toplevel (w);
+
+	g_object_get (
+		shell_settings, "composer-format-html", &html_mode, NULL);
+
+	em_composer_prefs_new_signature (GTK_WINDOW (parent), html_mode);
 }
 
 static GtkWidget *

Modified: branches/kill-bonobo/mail/em-composer-prefs.c
==============================================================================
--- branches/kill-bonobo/mail/em-composer-prefs.c	(original)
+++ branches/kill-bonobo/mail/em-composer-prefs.c	Sun Dec 14 02:14:41 2008
@@ -30,6 +30,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#include "e-util/e-binding.h"
 #include "e-util/e-signature.h"
 #include "e-util/e-signature-list.h"
 #include "e-util/gconf-bridge.h"
@@ -37,12 +38,11 @@
 #include "em-composer-prefs.h"
 #include "composer/e-msg-composer.h"
 
-#include <bonobo/bonobo-generic-factory.h>
-
 #include <camel/camel-iconv.h>
 
 #include <misc/e-gui-utils.h>
 
+#include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <gdk/gdkkeysyms.h>
 
@@ -59,6 +59,38 @@
 
 static gpointer parent_class;
 
+static gboolean
+transform_color_to_string (const GValue *src_value,
+                           GValue *dst_value,
+                           gpointer user_data)
+{
+	const GdkColor *color;
+	gchar *string;
+
+	color = g_value_get_boxed (src_value);
+	string = gdk_color_to_string (color);
+	g_value_set_string (dst_value, string);
+	g_free (string);
+
+	return TRUE;
+}
+
+static gboolean
+transform_string_to_color (const GValue *src_value,
+                           GValue *dst_value,
+                           gpointer user_data)
+{
+	GdkColor color;
+	const gchar *string;
+	gboolean success;
+
+	string = g_value_get_string (src_value);
+	if (gdk_color_parse (string, &color))
+		g_value_set_boxed (dst_value, &color);
+
+	return success;
+}
+
 static void
 composer_prefs_dispose (GObject *object)
 {
@@ -539,25 +571,6 @@
 }
 
 static void
-spell_color_set (GtkColorButton *color_button,
-                 EMComposerPrefs *prefs)
-{
-	GConfClient *client;
-	const gchar *key;
-	GdkColor color;
-	gchar *string;
-
-	gtk_color_button_get_color (color_button, &color);
-	string = gdk_color_to_string (&color);
-
-	client = mail_config_get_gconf_client ();
-	key = "/apps/evolution/mail/composer/spell_color";
-	gconf_client_set_string (client, key, string, NULL);
-
-	g_free (string);
-}
-
-static void
 spell_language_toggled_cb (GtkCellRendererToggle *renderer,
                            const gchar *path_string,
                            EMComposerPrefs *prefs)
@@ -621,9 +634,6 @@
 	GList *active_languages;
 	GConfClient *client;
 	GtkListStore *store;
-	GdkColor color;
-	const gchar *key;
-	gchar *string;
 
 	client = mail_config_get_gconf_client ();
 	store = GTK_LIST_STORE (prefs->language_model);
@@ -652,16 +662,6 @@
 	}
 
 	g_list_free (active_languages);
-
-	key = "/apps/evolution/mail/composer/spell_color";
-	string = gconf_client_get_string (client, key, NULL);
-	if (string == NULL || !gdk_color_parse (string, &color))
-		gdk_color_parse ("Red", &color);
-	gtk_color_button_set_color (GTK_COLOR_BUTTON (prefs->color), &color);
-
-	g_signal_connect (
-		prefs->color, "color_set",
-		G_CALLBACK (spell_color_set), prefs);
 }
 
 static gint
@@ -832,9 +832,11 @@
 }
 
 static void
-em_composer_prefs_construct (EMComposerPrefs *prefs)
+em_composer_prefs_construct (EMComposerPrefs *prefs,
+                             EShell *shell)
 {
 	GtkWidget *toplevel, *widget, *menu, *info_pixmap;
+	EShellSettings *shell_settings;
 	GtkDialog *dialog;
 	GladeXML *gui;
 	GtkTreeView *view;
@@ -855,6 +857,7 @@
 
 	bridge = gconf_bridge_get ();
 	client = mail_config_get_gconf_client ();
+	shell_settings = e_shell_get_settings (shell);
 
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",
@@ -881,57 +884,50 @@
 	/* General tab */
 
 	/* Default Behavior */
-	key = "/apps/evolution/mail/composer/send_html";
 	widget = glade_xml_get_widget (gui, "chkSendHTML");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-format-html",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/prompts/empty_subject";
 	widget = glade_xml_get_widget (gui, "chkPromptEmptySubject");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-prompt-empty-subject",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/prompts/only_bcc";
 	widget = glade_xml_get_widget (gui, "chkPromptBccOnly");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-prompt-only-bcc",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/composer/magic_smileys";
 	widget = glade_xml_get_widget (gui, "chkAutoSmileys");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-magic-smileys",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/composer/request_receipt";
 	widget = glade_xml_get_widget (gui, "chkRequestReceipt");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-request-receipt",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/composer/reply_start_bottom";
 	widget = glade_xml_get_widget (gui, "chkReplyStartBottom");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-reply-start-bottom",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/composer/outlook_filenames";
 	widget = glade_xml_get_widget (gui, "chkOutlookFilenames");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-outlook-filenames",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/composer/top_signature";
 	widget = glade_xml_get_widget (gui, "chkTopSignature");
-	if (!gconf_client_key_is_writable (client, key, NULL))
-		gtk_widget_set_sensitive (widget, FALSE);
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-top-signature",
+		G_OBJECT (widget), "active");
 
-	key = "/apps/evolution/mail/composer/inline_spelling";
 	widget = glade_xml_get_widget (gui, "chkEnableSpellChecking");
-	gconf_bridge_bind_property (bridge, key, G_OBJECT (widget), "active");
+	e_mutual_binding_new (
+		G_OBJECT (shell_settings), "composer-inline-spelling",
+		G_OBJECT (widget), "active");
 
 	prefs->charset = GTK_OPTION_MENU (
 		glade_xml_get_widget (gui, "omenuCharset1"));
@@ -947,8 +943,6 @@
 	g_free (buf);
 
 	/* Spell Checking */
-	widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor");
-	prefs->color = GTK_COLOR_BUTTON (widget);
 	widget = glade_xml_get_widget (gui, "listSpellCheckLanguage");
 	view = GTK_TREE_VIEW (widget);
 	store = gtk_list_store_new (
@@ -976,6 +970,15 @@
 	gtk_image_set_from_stock (
 		GTK_IMAGE (info_pixmap),
 		GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON);
+
+	widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor");
+	e_mutual_binding_new_full (
+		G_OBJECT (shell_settings), "composer-spell-color",
+		G_OBJECT (widget), "color",
+		transform_string_to_color,
+		transform_color_to_string,
+		NULL, NULL);
+
 	spell_setup (prefs);
 
 	/* Forwards and Replies */
@@ -1094,12 +1097,14 @@
 }
 
 GtkWidget *
-em_composer_prefs_new (void)
+em_composer_prefs_new (EShell *shell)
 {
 	EMComposerPrefs *prefs;
 
+	g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
 	prefs = g_object_new (EM_TYPE_COMPOSER_PREFS, NULL);
-	em_composer_prefs_construct (prefs);
+	em_composer_prefs_construct (prefs, shell);
 
 	return GTK_WIDGET (prefs);
 }

Modified: branches/kill-bonobo/mail/em-composer-prefs.h
==============================================================================
--- branches/kill-bonobo/mail/em-composer-prefs.h	(original)
+++ branches/kill-bonobo/mail/em-composer-prefs.h	Sun Dec 14 02:14:41 2008
@@ -20,10 +20,12 @@
  *
  */
 
-#ifndef __EM_COMPOSER_PREFS_H__
-#define __EM_COMPOSER_PREFS_H__
+#ifndef EM_COMPOSER_PREFS_H
+#define EM_COMPOSER_PREFS_H
 
 #include <gtk/gtk.h>
+#include <glade/glade.h>
+#include <shell/e-shell.h>
 
 /* Standard GObject macros */
 #define EM_TYPE_COMPOSER_PREFS \
@@ -50,19 +52,17 @@
 typedef struct _EMComposerPrefsClass EMComposerPrefsClass;
 
 struct _ESignature;
-struct _GladeXML;
 
 struct _EMComposerPrefs {
 	GtkVBox parent;
 
-	struct _GladeXML *gui;
+	GladeXML *gui;
 
 	/* General tab */
 
 	/* Default Behavior */
 	GtkOptionMenu *charset;
 
-	GtkColorButton *color;
 	GtkTreeModel *language_model;
 
 	/* Forwards and Replies */
@@ -81,7 +81,7 @@
 	GtkButton *sig_delete;
 	struct _GtkHTML *sig_preview;
 
-	struct _GladeXML *sig_script_gui;
+	GladeXML *sig_script_gui;
 	GtkWidget *sig_script_dialog;
 
 	guint sig_added_id;
@@ -94,7 +94,7 @@
 };
 
 GType		em_composer_prefs_get_type	(void);
-GtkWidget *	em_composer_prefs_new		(void);
+GtkWidget *	em_composer_prefs_new		(EShell *shell);
 void		em_composer_prefs_new_signature (GtkWindow *parent,
 						 gboolean html_mode);
 
@@ -104,4 +104,4 @@
 
 G_END_DECLS
 
-#endif /* __EM_COMPOSER_PREFS_H__ */
+#endif /* EM_COMPOSER_PREFS_H */

Modified: branches/kill-bonobo/mail/mail-component.c
==============================================================================
--- branches/kill-bonobo/mail/mail-component.c	(original)
+++ branches/kill-bonobo/mail/mail-component.c	Sun Dec 14 02:14:41 2008
@@ -375,40 +375,40 @@
 //	}
 //}
 
-static void
-mc_startup(MailComponent *mc)
-{
-	static int started = 0;
-	GConfClient *gconf;
-
-	if (started)
-		return;
-	started = 1;
-
-	mc_setup_local_store(mc);
-	load_accounts(mc, mail_config_get_accounts());
-
-	gconf = mail_config_get_gconf_client();
-
-	if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL))
-		vfolder_load_storage();
-}
-
-static void
-folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, guint32 flags, EMFolderView *view)
-{
-	EMFolderTreeModel *model;
-
-	if ((flags & CAMEL_FOLDER_NOSELECT) || !path) {
-		em_folder_view_set_folder (view, NULL, NULL);
-	} else {
-		model = em_folder_tree_get_model (emft);
-		em_folder_tree_model_set_selected (model, uri);
-		em_folder_tree_model_save_state (model);
+//static void
+//mc_startup(MailComponent *mc)
+//{
+//	static int started = 0;
+//	GConfClient *gconf;
+//
+//	if (started)
+//		return;
+//	started = 1;
+//
+//	mc_setup_local_store(mc);
+//	load_accounts(mc, mail_config_get_accounts());
+//
+//	gconf = mail_config_get_gconf_client();
+//
+//	if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL))
+//		vfolder_load_storage();
+//}
 
-		em_folder_view_set_folder_uri (view, uri);
-	}
-}
+//static void
+//folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, guint32 flags, EMFolderView *view)
+//{
+//	EMFolderTreeModel *model;
+//
+//	if ((flags & CAMEL_FOLDER_NOSELECT) || !path) {
+//		em_folder_view_set_folder (view, NULL, NULL);
+//	} else {
+//		model = em_folder_tree_get_model (emft);
+//		em_folder_tree_model_set_selected (model, uri);
+//		em_folder_tree_model_save_state (model);
+//
+//		em_folder_view_set_folder_uri (view, uri);
+//	}
+//}
 
 static int
 check_autosave(void *data)
@@ -1061,12 +1061,12 @@
 	}
 }
 
-static void
-impl_sendAndReceive (PortableServer_Servant servant, CORBA_Environment *ev)
-{
-	em_utils_clear_get_password_canceled_accounts_flag ();
-	mail_send_receive ();
-}
+//static void
+//impl_sendAndReceive (PortableServer_Servant servant, CORBA_Environment *ev)
+//{
+//	em_utils_clear_get_password_canceled_accounts_flag ();
+//	mail_send_receive ();
+//}
 
 //static void
 //impl_upgradeFromVersion (PortableServer_Servant servant, const short major, const short minor, const short revision, CORBA_Environment *ev)

Modified: branches/kill-bonobo/mail/mail-send-recv.c
==============================================================================
--- branches/kill-bonobo/mail/mail-send-recv.c	(original)
+++ branches/kill-bonobo/mail/mail-send-recv.c	Sun Dec 14 02:14:41 2008
@@ -362,7 +362,10 @@
 }
 
 static struct _send_data *
-build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destination)
+build_dialog (GtkWindow *parent,
+              EAccountList *accounts,
+              CamelFolder *outbox,
+              const gchar *destination)
 {
 	GtkDialog *gd;
 	GtkWidget *table;
@@ -382,7 +385,10 @@
 	EIterator *iter;
 	EMEventTargetSendReceive *target;
 
-	gd = (GtkDialog *)(send_recv_dialog = gtk_dialog_new_with_buttons(_("Send & Receive Mail"), NULL, GTK_DIALOG_NO_SEPARATOR, NULL));
+	send_recv_dialog = gtk_dialog_new_with_buttons (
+		_("Send & Receive Mail"), parent,
+		GTK_DIALOG_NO_SEPARATOR, NULL);
+	gd = GTK_DIALOG (send_recv_dialog);
 	gtk_window_set_modal ((GtkWindow *) gd, FALSE);
 
 	gconf_bridge_bind_window_size (
@@ -904,7 +910,7 @@
 }
 
 GtkWidget *
-mail_send_receive (void)
+mail_send_receive (GtkWindow *parent)
 {
 	CamelFolder *outbox_folder;
 	struct _send_data *data;
@@ -931,7 +937,8 @@
 
 	outbox_folder = e_mail_shell_module_get_folder (
 		mail_shell_module, E_MAIL_FOLDER_OUTBOX);
-	data = build_dialog (accounts, outbox_folder, account->transport->url);
+	data = build_dialog (
+		parent, accounts, outbox_folder, account->transport->url);
 	scan = data->infos;
 	while (scan) {
 		struct _send_info *info = scan->data;

Modified: branches/kill-bonobo/mail/mail-send-recv.h
==============================================================================
--- branches/kill-bonobo/mail/mail-send-recv.h	(original)
+++ branches/kill-bonobo/mail/mail-send-recv.h	Sun Dec 14 02:14:41 2008
@@ -29,7 +29,7 @@
 G_BEGIN_DECLS
 
 /* send/receive all uri's */
-GtkWidget *     mail_send_receive               (void);
+GtkWidget *     mail_send_receive               (GtkWindow *parent);
 
 /* receive a single uri */
 void            mail_receive_uri                (const gchar *uri,

Modified: branches/kill-bonobo/shell/e-shell-nm.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-nm.c	(original)
+++ branches/kill-bonobo/shell/e-shell-nm.c	Sun Dec 14 02:14:41 2008
@@ -52,15 +52,14 @@
                          gpointer user_data)
 {
 	DBusError error = DBUS_ERROR_INIT;
-	const gchar *object;
 	EShell *shell = user_data;
-	EShellLineStatus line_status;
-	gboolean device_active;
+	const gchar *path;
+	guint32 state;
 
-	object = dbus_message_get_path (message);
+	path = dbus_message_get_path (message);
 
 	if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") &&
-		object != NULL && strcmp (object, DBUS_PATH_LOCAL) == 0) {
+		path != NULL && strcmp (path, DBUS_PATH_LOCAL) == 0) {
 		dbus_connection_unref (dbus_connection);
 		dbus_connection = NULL;
 
@@ -69,23 +68,29 @@
 		return DBUS_HANDLER_RESULT_HANDLED;
 	}
 
-	if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
-		device_active = FALSE;
-	else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
-		device_active = TRUE;
-	else
+	if (!dbus_message_is_signal (message, NM_DBUS_INTERFACE, "StateChanged"))
 		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
-	if (!dbus_message_get_args (message, &error, DBUS_TYPE_OBJECT_PATH,
-				    &object, DBUS_TYPE_INVALID))
-		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+	dbus_message_get_args (
+		message, &error,
+		DBUS_TYPE_UINT32, &state,
+		DBUS_TYPE_INVALID);
 
-	line_status = e_shell_get_line_status (shell);
+	if (dbus_error_is_set (&error)) {
+		g_warning ("%s", error.message);
+		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+	}
 
-	if (line_status == E_SHELL_LINE_STATUS_ONLINE && !device_active)
-		e_shell_set_line_status (shell, E_SHELL_LINE_STATUS_FORCED_OFFLINE);
-	else if (line_status == E_SHELL_LINE_STATUS_FORCED_OFFLINE && device_active)
-		e_shell_set_line_status (shell, E_SHELL_LINE_STATUS_ONLINE);
+	switch (state) {
+		case NM_STATE_CONNECTED:
+			e_shell_set_network_available (shell, TRUE);
+			break;
+		case NM_STATE_DISCONNECTED:
+			e_shell_set_network_available (shell, FALSE);
+			break;
+		default:
+			break;
+	}
 
 	return DBUS_HANDLER_RESULT_HANDLED;
 }

Modified: branches/kill-bonobo/shell/e-shell-window-actions.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.c	Sun Dec 14 02:14:41 2008
@@ -1365,7 +1365,7 @@
 	EShell *shell;
 
 	shell = e_shell_window_get_shell (shell_window);
-	e_shell_set_line_status (shell, E_SHELL_LINE_STATUS_OFFLINE);
+	e_shell_set_online_mode (shell, FALSE);
 }
 
 /**
@@ -1383,7 +1383,7 @@
 	EShell *shell;
 
 	shell = e_shell_window_get_shell (shell_window);
-	e_shell_set_line_status (shell, E_SHELL_LINE_STATUS_ONLINE);
+	e_shell_set_online_mode (shell, TRUE);
 }
 
 /**

Modified: branches/kill-bonobo/shell/e-shell.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell.c	(original)
+++ branches/kill-bonobo/shell/e-shell.c	Sun Dec 14 02:14:41 2008
@@ -22,12 +22,14 @@
 #include "e-shell.h"
 
 #include <glib/gi18n.h>
-#include <e-preferences-window.h>
-#include <e-util/e-util.h>
+#include <libedataserverui/e-passwords.h>
 
-#include <e-shell-migrate.h>
-#include <e-shell-module.h>
-#include <e-shell-window.h>
+#include "e-util/e-util.h"
+#include "widgets/misc/e-preferences-window.h"
+
+#include "e-shell-migrate.h"
+#include "e-shell-module.h"
+#include "e-shell-window.h"
 
 #define SHUTDOWN_TIMEOUT	500  /* milliseconds */
 
@@ -38,19 +40,23 @@
 struct _EShellPrivate {
 	GList *active_windows;
 	EShellSettings *settings;
-	EShellLineStatus line_status;
 
 	/* Shell Modules */
 	GList *loaded_modules;
 	GHashTable *modules_by_name;
 	GHashTable *modules_by_scheme;
 
-	guint online_mode : 1;
-	guint safe_mode   : 1;
+	gpointer preparing_for_offline;  /* weak pointer */
+
+	guint auto_reconnect	: 1;
+	guint network_available	: 1;
+	guint online_mode	: 1;
+	guint safe_mode		: 1;
 };
 
 enum {
 	PROP_0,
+	PROP_NETWORK_AVAILABLE,
 	PROP_ONLINE_MODE,
 	PROP_SETTINGS
 };
@@ -58,6 +64,7 @@
 enum {
 	EVENT,
 	HANDLE_URI,
+	PREPARE_FOR_OFFLINE,
 	SEND_RECEIVE,
 	WINDOW_CREATED,
 	WINDOW_DESTROYED,
@@ -110,6 +117,15 @@
 }
 
 static void
+shell_notify_online_mode_cb (EShell *shell)
+{
+	gboolean online;
+
+	online = e_shell_get_online_mode (shell);
+	e_passwords_set_online (online);
+}
+
+static void
 shell_window_weak_notify_cb (EShell *shell,
                              GObject *where_the_object_was)
 {
@@ -124,6 +140,53 @@
 	g_signal_emit (shell, signals[WINDOW_DESTROYED], 0, last_window);
 }
 
+static void
+shell_ready_for_offline (EShell *shell,
+                         EActivity *activity,
+                         gboolean is_last_ref)
+{
+	if (!is_last_ref)
+		return;
+
+	e_activity_complete (activity);
+
+	g_object_remove_toggle_ref (
+		G_OBJECT (activity), (GToggleNotify)
+		shell_ready_for_offline, shell);
+
+	shell->priv->online_mode = FALSE;
+	g_object_notify (G_OBJECT (shell), "online-mode");
+
+	g_message ("Offline preparations complete.");
+}
+
+static void
+shell_prepare_for_offline (EShell *shell)
+{
+	/* Are preparations already in progress? */
+	if (shell->priv->preparing_for_offline != NULL)
+		return;
+
+	g_message ("Preparing for offline mode...");
+
+	shell->priv->preparing_for_offline =
+		e_activity_new (_("Preparing to go offline..."));
+
+	g_object_add_toggle_ref (
+		G_OBJECT (shell->priv->preparing_for_offline),
+		(GToggleNotify) shell_ready_for_offline, shell);
+
+	g_object_add_weak_pointer (
+		G_OBJECT (shell->priv->preparing_for_offline),
+		&shell->priv->preparing_for_offline);
+
+	g_signal_emit (
+		shell, signals[PREPARE_FOR_OFFLINE], 0,
+		shell->priv->preparing_for_offline);
+
+	g_object_unref (shell->priv->preparing_for_offline);
+}
+
 /* Helper for shell_query_module() */
 static void
 shell_split_and_insert_items (GHashTable *hash_table,
@@ -241,6 +304,12 @@
                     GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_NETWORK_AVAILABLE:
+			e_shell_set_network_available (
+				E_SHELL (object),
+				g_value_get_boolean (value));
+			return;
+
 		case PROP_ONLINE_MODE:
 			e_shell_set_online_mode (
 				E_SHELL (object),
@@ -258,6 +327,12 @@
                     GParamSpec *pspec)
 {
 	switch (property_id) {
+		case PROP_NETWORK_AVAILABLE:
+			g_value_set_boolean (
+				value, e_shell_get_network_available (
+				E_SHELL (object)));
+			return;
+
 		case PROP_ONLINE_MODE:
 			g_value_set_boolean (
 				value, e_shell_get_online_mode (
@@ -361,6 +436,22 @@
 	object_class->constructed = shell_constructed;
 
 	/**
+	 * EShell:network-available
+	 *
+	 * Whether the network is available.
+	 **/
+	g_object_class_install_property (
+		object_class,
+		PROP_NETWORK_AVAILABLE,
+		g_param_spec_boolean (
+			"network-available",
+			_("Network Available"),
+			_("Whether the network is available"),
+			TRUE,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT));
+
+	/**
 	 * EShell:online-mode
 	 *
 	 * Whether the shell is online.
@@ -431,6 +522,31 @@
 		G_TYPE_STRING);
 
 	/**
+	 * EShell:prepare-for-offline
+	 * @shell: the #EShell which emitted the signal
+	 * @activity: the #EActivity for offline preparations
+	 *
+	 * Emitted when the user elects to work offline.  An #EShellModule
+	 * should listen for this signal and make preparations for working
+	 * in offline mode.
+	 *
+	 * If preparations for working offline cannot immediately be
+	 * completed (such as when synchronizing with a remote server),
+	 * the #EShellModule should reference the @activity until
+	 * preparations are complete, and then unreference the @activity.
+	 * This will delay Evolution from actually going to offline mode
+	 * until the all modules have unreferenced @activity.
+	 */
+	signals[PREPARE_FOR_OFFLINE] = g_signal_new (
+		"prepare-for-offline",
+		G_OBJECT_CLASS_TYPE (object_class),
+		G_SIGNAL_RUN_FIRST,
+		0, NULL, NULL,
+		g_cclosure_marshal_VOID__OBJECT,
+		G_TYPE_NONE, 1,
+		E_TYPE_ACTIVITY);
+
+	/**
 	 * EShell:send-receive
 	 * @shell: the #EShell which emitted the signal
 	 * @parent: a parent #GtkWindow
@@ -501,6 +617,10 @@
 #endif
 
 	e_file_lock_create ();
+
+	g_signal_connect (
+		shell, "notify::online-mode",
+		G_CALLBACK (shell_notify_online_mode_cb), NULL);
 }
 
 GType
@@ -762,37 +882,106 @@
 	g_signal_emit (shell, signals[SEND_RECEIVE], 0, parent);
 }
 
+/**
+ * e_shell_get_network_available:
+ * @shell: an #EShell
+ *
+ * Returns %TRUE if a network is available.
+ *
+ * Returns: %TRUE if a network is available
+ **/
 gboolean
-e_shell_get_online_mode (EShell *shell)
+e_shell_get_network_available (EShell *shell)
 {
 	g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
 
-	return shell->priv->online_mode;
+	return shell->priv->network_available;
 }
 
+/**
+ * e_shell_set_network_available:
+ * @shell: an #EShell
+ * @network_available: whether a network is available
+ *
+ * Sets whether a network is available.  This is usually called in
+ * response to a status change signal from NetworkManager.  If the
+ * network becomes unavailable while #EShell:online-mode is %TRUE,
+ * the @shell will force #EShell:online-mode to %FALSE until the
+ * network becomes available again.
+ **/
 void
-e_shell_set_online_mode (EShell *shell,
-                         gboolean online_mode)
+e_shell_set_network_available (EShell *shell,
+                               gboolean network_available)
 {
 	g_return_if_fail (E_IS_SHELL (shell));
 
-	shell->priv->online_mode = online_mode;
+	if (network_available == shell->priv->network_available)
+		return;
+
+	shell->priv->network_available = network_available;
+	g_object_notify (G_OBJECT (shell), "network-available");
 
-	g_object_notify (G_OBJECT (shell), "online-mode");
+	/* If we're being forced offline, perhaps due to a network outage,
+	 * reconnect automatically when the network becomes available. */
+	if (!network_available && shell->priv->online_mode) {
+		g_message ("Network disconnected.  Forced offline.");
+		e_shell_set_online_mode (shell, FALSE);
+		shell->priv->auto_reconnect = TRUE;
+	} else if (network_available && shell->priv->auto_reconnect) {
+		g_message ("Connection established.  Going online.");
+		e_shell_set_online_mode (shell, TRUE);
+		shell->priv->auto_reconnect = FALSE;
+	}
 }
 
-EShellLineStatus
-e_shell_get_line_status (EShell *shell)
+/**
+ * e_shell_get_online_mode:
+ * @shell: an #EShell
+ *
+ * Returns %TRUE if Evolution is in online mode, %FALSE if Evolution is
+ * offline.  Evolution may be offline because the user elected to work
+ * offline, or because the network has become unavailable.
+ *
+ * Returns: %TRUE if Evolution is in online mode
+ **/
+gboolean
+e_shell_get_online_mode (EShell *shell)
 {
-	g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_LINE_STATUS_OFFLINE);
+	g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
 
-	return shell->priv->line_status;
+	return shell->priv->online_mode;
 }
 
+/**
+ * e_shell_set_online_mode:
+ * @shell: an #EShell
+ * @online_mode: whether to put Evolution in online mode
+ *
+ * Puts Evolution in online or offline mode.
+ **/
 void
-e_shell_set_line_status (EShell *shell,
-                         EShellLineStatus status)
+e_shell_set_online_mode (EShell *shell,
+                         gboolean online_mode)
 {
+	g_return_if_fail (E_IS_SHELL (shell));
+
+	if (online_mode == shell->priv->online_mode)
+		return;
+
+	if (!online_mode && e_shell_get_network_available (shell))
+		shell_prepare_for_offline (shell);
+	else {
+		EActivity *activity;
+
+		shell->priv->online_mode = online_mode;
+		g_object_notify (G_OBJECT (shell), "online-mode");
+
+		/* If we're being forced offline and we've already started
+		 * preparing for offline mode, cancel the preparations. */
+		activity = shell->priv->preparing_for_offline;
+		if (!online_mode && activity != NULL)
+			e_activity_cancel (activity);
+	}
 }
 
 GtkWidget *

Modified: branches/kill-bonobo/shell/e-shell.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell.h	(original)
+++ branches/kill-bonobo/shell/e-shell.h	Sun Dec 14 02:14:41 2008
@@ -74,13 +74,6 @@
 	GObjectClass parent_class;
 };
 
-enum _EShellLineStatus {
-	E_SHELL_LINE_STATUS_ONLINE,
-	E_SHELL_LINE_STATUS_GOING_OFFLINE, /* NB: really means changing state in either direction */
-	E_SHELL_LINE_STATUS_OFFLINE,
-	E_SHELL_LINE_STATUS_FORCED_OFFLINE
-};
-
 GType		e_shell_get_type		(void);
 EShell *	e_shell_get_default		(void);
 GList *		e_shell_list_modules		(EShell *shell);
@@ -97,13 +90,12 @@
                                                  const gchar *uri);
 void		e_shell_send_receive		(EShell *shell,
 						 GtkWindow *parent);
+gboolean	e_shell_get_network_available	(EShell *shell);
+void		e_shell_set_network_available	(EShell *shell,
+						 gboolean network_available);
 gboolean	e_shell_get_online_mode		(EShell *shell);
 void		e_shell_set_online_mode		(EShell *shell,
 						 gboolean online_mode);
-EShellLineStatus
-		e_shell_get_line_status		(EShell *shell);
-void		e_shell_set_line_status		(EShell *shell,
-                                                 EShellLineStatus status);
 GtkWidget *	e_shell_get_preferences_window	(void);
 void		e_shell_event			(EShell *shell,
 						 const gchar *event_name,



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