aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-12-14 10:14:41 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-12-14 10:14:41 +0800
commitb7333387e8bd19299794e6485e3407d03c2eb73f (patch)
treeeb849e5f839738b0acdce5b4ba519eac521cf1d6
parentd158af8cdfa6e4bf85c1e74769e8d61bc469494c (diff)
downloadgsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.gz
gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.tar.zst
gsoc2013-evolution-b7333387e8bd19299794e6485e3407d03c2eb73f.zip
- 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. svn path=/branches/kill-bonobo/; revision=36875
-rw-r--r--calendar/gui/e-week-view.c2
-rw-r--r--composer/e-composer-private.h3
-rw-r--r--composer/e-msg-composer.c93
-rw-r--r--mail/Makefile.am2
-rw-r--r--mail/e-mail-shell-module-settings.c416
-rw-r--r--mail/e-mail-shell-module-settings.h33
-rw-r--r--mail/e-mail-shell-module.c291
-rw-r--r--mail/em-account-editor.c17
-rw-r--r--mail/em-composer-prefs.c151
-rw-r--r--mail/em-composer-prefs.h16
-rw-r--r--mail/mail-component.c78
-rw-r--r--mail/mail-send-recv.c15
-rw-r--r--mail/mail-send-recv.h2
-rw-r--r--shell/e-shell-nm.c41
-rw-r--r--shell/e-shell-window-actions.c4
-rw-r--r--shell/e-shell.c229
-rw-r--r--shell/e-shell.h14
17 files changed, 894 insertions, 513 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 427511b044..eeddc93ce4 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -4159,6 +4159,7 @@ e_week_view_get_adjust_days_for_move_right (EWeekView *week_view,gint current_da
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 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
if (!handled)
handled = GTK_WIDGET_CLASS (e_week_view_parent_class)->key_press_event (widget, event);
return handled;
+#endif
}
static void
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index 2dc9ddb6cd..f43f2c7eb2 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -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 @@ struct _EMsgComposerPrivate {
CamelMimeMessage *redirect;
- guint notify_id;
-
gboolean send_invoked;
};
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index f6929710ef..87dcabda17 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1353,14 +1353,16 @@ set_editor_text (EMsgComposer *composer,
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 @@ set_editor_text (EMsgComposer *composer,
*/
- 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 @@ msg_composer_attach_message (EMsgComposer *composer,
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 @@ msg_composer_constructor (GType type,
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 @@ msg_composer_constructor (GType type,
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 @@ msg_composer_constructor (GType type,
/* 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 @@ msg_composer_constructor (GType type,
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);
+ e_binding_new (
+ G_OBJECT (shell_settings), "composer-inline-spelling",
+ G_OBJECT (composer), "inline-spelling");
- g_object_unref (client);
+ 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 @@ msg_composer_destroy (GtkObject *object)
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);
}
diff --git a/mail/Makefile.am b/mail/Makefile.am
index d3ed2750f8..5db45237cc 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -39,6 +39,8 @@ libevolution_module_mail_la_SOURCES = \
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 \
diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-module-settings.c
new file mode 100644
index 0000000000..05754ac854
--- /dev/null
+++ b/mail/e-mail-shell-module-settings.c
@@ -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");
+}
diff --git a/mail/e-mail-shell-module-settings.h b/mail/e-mail-shell-module-settings.h
new file mode 100644
index 0000000000..a5528463c7
--- /dev/null
+++ b/mail/e-mail-shell-module-settings.h
@@ -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 */
diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c
index 51d109e1e1..04446b1e73 100644
--- a/mail/e-mail-shell-module.c
+++ b/mail/e-mail-shell-module.c
@@ -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 @@ mail_shell_module_init_preferences (EShell *shell)
"composer",
"preferences-composer",
_("Composer Preferences"),
- em_composer_prefs_new (),
+ em_composer_prefs_new (shell),
400);
e_preferences_window_add_page (
@@ -457,267 +461,6 @@ mail_shell_module_init_preferences (EShell *shell)
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 @@ mail_shell_module_handle_uri_cb (EShell *shell,
}
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 @@ e_shell_module_init (GTypeModule *type_module)
{
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 @@ e_shell_module_init (GTypeModule *type_module)
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 @@ e_shell_module_init (GTypeModule *type_module)
/* 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 *********************************/
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 62f1b89d6b..866d503292 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -661,10 +661,19 @@ emae_signaturetype_changed(GtkComboBox *dropdown, EMAccountEditor *emae)
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 *
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c
index 0b19cc24bf..dfc50edf0e 100644
--- a/mail/em-composer-prefs.c
+++ b/mail/em-composer-prefs.c
@@ -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 @@ url_requested (GtkHTML *html,
}
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 @@ spell_setup (EMComposerPrefs *prefs)
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 @@ spell_setup (EMComposerPrefs *prefs)
}
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 @@ sig_tree_event_cb (GtkTreeView *tree_view,
}
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 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
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 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
/* 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 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
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 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
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 @@ em_composer_prefs_construct (EMComposerPrefs *prefs)
}
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);
}
diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h
index 6fcab979f4..0906253af6 100644
--- a/mail/em-composer-prefs.h
+++ b/mail/em-composer-prefs.h
@@ -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 _EMComposerPrefs EMComposerPrefs;
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 @@ struct _EMComposerPrefs {
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 @@ struct _EMComposerPrefsClass {
};
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 @@ void em_composer_prefs_new_signature (GtkWindow *parent,
G_END_DECLS
-#endif /* __EM_COMPOSER_PREFS_H__ */
+#endif /* EM_COMPOSER_PREFS_H */
diff --git a/mail/mail-component.c b/mail/mail-component.c
index e9c7de3173..890046e48c 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -375,40 +375,40 @@ struct _MailComponentPrivate {
// }
//}
-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 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme
}
}
-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)
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 87948fdf53..70b69f0c97 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -362,7 +362,10 @@ get_receive_type(const char *url)
}
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 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
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 @@ receive_update_got_store (char *uri, CamelStore *store, void *data)
}
GtkWidget *
-mail_send_receive (void)
+mail_send_receive (GtkWindow *parent)
{
CamelFolder *outbox_folder;
struct _send_data *data;
@@ -931,7 +937,8 @@ mail_send_receive (void)
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;
diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h
index 4fc4e991ec..92daaa5cd7 100644
--- a/mail/mail-send-recv.h
+++ b/mail/mail-send-recv.h
@@ -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,
diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c
index c0cae505dc..48652501da 100644
--- a/shell/e-shell-nm.c
+++ b/shell/e-shell-nm.c
@@ -52,15 +52,14 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
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 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
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;
}
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 38f33d99e9..707edd8439 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1365,7 +1365,7 @@ action_work_offline_cb (GtkAction *action,
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 @@ action_work_online_cb (GtkAction *action,
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);
}
/**
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 6e92750eb9..57118a4e14 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -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 {
enum {
EVENT,
HANDLE_URI,
+ PREPARE_FOR_OFFLINE,
SEND_RECEIVE,
WINDOW_CREATED,
WINDOW_DESTROYED,
@@ -110,6 +117,15 @@ shell_window_focus_in_event_cb (EShell *shell,
}
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 @@ shell_window_weak_notify_cb (EShell *shell,
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 @@ shell_set_property (GObject *object,
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 @@ shell_get_property (GObject *object,
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 @@ shell_class_init (EShellClass *class)
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 @@ shell_class_init (EShellClass *class)
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 @@ shell_init (EShell *shell)
#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 @@ e_shell_send_receive (EShell *shell,
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;
- g_object_notify (G_OBJECT (shell), "online-mode");
+ shell->priv->network_available = network_available;
+ g_object_notify (G_OBJECT (shell), "network-available");
+
+ /* 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 *
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 79ff9c1783..e482f93960 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -74,13 +74,6 @@ struct _EShellClass {
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 @@ gboolean e_shell_handle_uri (EShell *shell,
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,