aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/e-composer-private.c44
-rw-r--r--composer/e-msg-composer.c39
-rw-r--r--em-format/e-mail-formatter.c12
-rw-r--r--mail/e-http-request.c7
-rw-r--r--mail/e-mail-browser.c1
-rw-r--r--mail/e-mail-paned-view.c47
-rw-r--r--mail/e-mail-reader-utils.c27
-rw-r--r--mail/e-mail-reader.c22
-rw-r--r--mail/em-composer-utils.c13
-rw-r--r--mail/em-utils.c8
-rw-r--r--mail/mail-config.ui68
-rw-r--r--mail/message-list.c1
-rw-r--r--modules/mail/Makefile.am2
-rw-r--r--modules/mail/e-mail-attachment-handler.c18
-rw-r--r--modules/mail/e-mail-shell-backend.c86
-rw-r--r--modules/mail/e-mail-shell-settings.c386
-rw-r--r--modules/mail/e-mail-shell-settings.h33
-rw-r--r--modules/mail/e-mail-shell-sidebar.c24
-rw-r--r--modules/mail/e-mail-shell-view-actions.c24
-rw-r--r--modules/mail/em-composer-prefs.c264
-rw-r--r--modules/mail/em-mailer-prefs.c407
-rw-r--r--modules/mail/em-mailer-prefs.h5
-rw-r--r--modules/mailto-handler/evolution-mailto-handler.c39
-rw-r--r--modules/settings/e-settings-mail-formatter.c77
-rw-r--r--modules/settings/e-settings-mail-reader.c23
-rw-r--r--modules/settings/e-settings-web-view-gtkhtml.c146
-rw-r--r--modules/settings/e-settings-web-view.c30
-rw-r--r--modules/text-highlight/e-mail-formatter-text-highlight.c61
-rw-r--r--shell/e-shell-window-actions.c24
29 files changed, 734 insertions, 1204 deletions
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 09b9bf139c..0475996f23 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -140,7 +140,6 @@ e_composer_private_constructed (EMsgComposer *composer)
EMsgComposerPrivate *priv = composer->priv;
EFocusTracker *focus_tracker;
EShell *shell;
- EShellSettings *shell_settings;
EWebViewGtkHTML *web_view;
ESourceRegistry *registry;
GtkhtmlEditor *editor;
@@ -150,6 +149,7 @@ e_composer_private_constructed (EMsgComposer *composer)
GtkWidget *widget;
GtkWidget *send_widget;
GtkWindow *window;
+ GSettings *settings;
const gchar *path;
gboolean small_screen_mode;
gchar *filename, *gallery_path;
@@ -159,9 +159,10 @@ e_composer_private_constructed (EMsgComposer *composer)
editor = GTKHTML_EDITOR (composer);
ui_manager = gtkhtml_editor_get_ui_manager (editor);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
shell = e_msg_composer_get_shell (composer);
registry = e_shell_get_registry (shell);
- shell_settings = e_shell_get_shell_settings (shell);
web_view = e_msg_composer_get_web_view (composer);
small_screen_mode = e_shell_get_small_screen_mode (shell);
@@ -385,8 +386,9 @@ e_composer_private_constructed (EMsgComposer *composer)
container = priv->gallery_scrolled_window;
- gallery_path = e_shell_settings_get_string (
- shell_settings, "composer-gallery-path");
+ /* FIXME This should be an EMsgComposer property. */
+ gallery_path = g_settings_get_string (
+ settings, "composer-gallery-path");
widget = e_picture_gallery_new (gallery_path);
gtk_container_add (GTK_CONTAINER (container), widget);
priv->gallery_icon_view = g_object_ref (widget);
@@ -457,6 +459,8 @@ e_composer_private_constructed (EMsgComposer *composer)
g_signal_connect (
web_view, "url-requested",
G_CALLBACK (msg_composer_url_requested_cb), composer);
+
+ g_object_unref (settings);
}
void
@@ -912,31 +916,31 @@ e_composer_selection_is_image_uris (EMsgComposer *composer,
static gboolean
add_signature_delimiter (EMsgComposer *composer)
{
- EShell *shell;
- EShellSettings *shell_settings;
-
- /* FIXME This preference should be an EMsgComposer property. */
+ GSettings *settings;
+ gboolean signature_delim;
- shell = e_msg_composer_get_shell (composer);
- shell_settings = e_shell_get_shell_settings (shell);
+ /* FIXME This should be an EMsgComposer property. */
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ signature_delim = !g_settings_get_boolean (
+ settings, "composer-no-signature-delim");
+ g_object_unref (settings);
- return !e_shell_settings_get_boolean (
- shell_settings, "composer-no-signature-delim");
+ return signature_delim;
}
static gboolean
use_top_signature (EMsgComposer *composer)
{
- EShell *shell;
- EShellSettings *shell_settings;
-
- /* FIXME This preference should be an EMsgComposer property. */
+ GSettings *settings;
+ gboolean top_signature;
- shell = e_msg_composer_get_shell (composer);
- shell_settings = e_shell_get_shell_settings (shell);
+ /* FIXME This should be an EMsgComposer property. */
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ top_signature = g_settings_get_boolean (
+ settings, "composer-top-signature");
+ g_object_unref (settings);
- return e_shell_settings_get_boolean (
- shell_settings, "composer-top-signature");
+ return top_signature;
}
static void
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 8d0252cc21..7ce38e85ff 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1456,11 +1456,11 @@ composer_build_message_finish (EMsgComposer *composer,
static gboolean
use_top_signature (EMsgComposer *composer)
{
- EShell *shell;
- EShellSettings *shell_settings;
- EMsgComposerPrivate *priv = E_MSG_COMPOSER_GET_PRIVATE (composer);
+ EMsgComposerPrivate *priv;
+ GSettings *settings;
+ gboolean top_signature;
- g_return_val_if_fail (priv != NULL, FALSE);
+ priv = E_MSG_COMPOSER_GET_PRIVATE (composer);
/* The composer had been created from a stored message, thus the
* signature placement is either there already, or pt it at the
@@ -1469,11 +1469,13 @@ use_top_signature (EMsgComposer *composer)
if (priv->is_from_message)
return FALSE;
- shell = e_msg_composer_get_shell (composer);
- shell_settings = e_shell_get_shell_settings (shell);
+ /* FIXME This should be an EMsgComposer property. */
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ top_signature = g_settings_get_boolean (
+ settings, "composer-top-signature");
+ g_object_unref (settings);
- return e_shell_settings_get_boolean (
- shell_settings, "composer-top-signature");
+ return top_signature;
}
#define NO_SIGNATURE_TEXT \
@@ -1928,7 +1930,6 @@ static void
msg_composer_constructed (GObject *object)
{
EShell *shell;
- EShellSettings *shell_settings;
GtkhtmlEditor *editor;
EMsgComposer *composer;
EAttachmentView *view;
@@ -1937,6 +1938,7 @@ msg_composer_constructed (GObject *object)
EWebViewGtkHTML *web_view;
GtkUIManager *ui_manager;
GtkToggleAction *action;
+ GSettings *settings;
const gchar *id;
gboolean active;
@@ -1944,7 +1946,6 @@ msg_composer_constructed (GObject *object)
composer = E_MSG_COMPOSER (object);
shell = e_msg_composer_get_shell (composer);
- shell_settings = e_shell_get_shell_settings (shell);
if (e_shell_get_express_mode (shell)) {
GtkWindow *parent = e_shell_get_active_window (shell);
@@ -1988,10 +1989,12 @@ msg_composer_constructed (GObject *object)
/* Honor User Preferences */
+ /* FIXME This should be an EMsgComposer property. */
+ settings = g_settings_new ("org.gnome.evolution.mail");
action = GTK_TOGGLE_ACTION (ACTION (REQUEST_READ_RECEIPT));
- active = e_shell_settings_get_boolean (
- shell_settings, "composer-request-receipt");
+ active = g_settings_get_boolean (settings, "composer-request-receipt");
gtk_toggle_action_set_active (action, active);
+ g_object_unref (settings);
/* Clipboard Support */
@@ -3413,17 +3416,21 @@ CamelSession *
e_msg_composer_get_session (EMsgComposer *composer)
{
EShell *shell;
- EShellSettings *shell_settings;
- CamelSession *session;
+ EShellBackend *shell_backend;
+ CamelSession *session = NULL;
g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
shell = e_msg_composer_get_shell (composer);
- shell_settings = e_shell_get_shell_settings (shell);
+ shell_backend = e_shell_get_backend_by_name (shell, "mail");
- session = e_shell_settings_get_pointer (shell_settings, "mail-session");
+ g_object_get (shell_backend, "session", &session, NULL);
g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+ /* FIXME Drop the new reference for backward-compatibility.
+ * Rename this function to e_msg_composer_ref_session(). */
+ g_object_unref (session);
+
return session;
}
diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c
index 2e89f698d5..ad62320eee 100644
--- a/em-format/e-mail-formatter.c
+++ b/em-format/e-mail-formatter.c
@@ -27,6 +27,8 @@
#include <gdk/gdk.h>
#include <glib/gi18n.h>
+#include "libemail-engine/e-mail-enumtypes.h"
+
#define d(x)
/* internal formatter extensions */
@@ -165,7 +167,7 @@ e_mail_formatter_set_property (GObject *object,
case PROP_IMAGE_LOADING_POLICY:
e_mail_formatter_set_image_loading_policy (
E_MAIL_FORMATTER (object),
- g_value_get_int (value));
+ g_value_get_enum (value));
return;
case PROP_MARK_CITATIONS:
@@ -263,7 +265,7 @@ e_mail_formatter_get_property (GObject *object,
return;
case PROP_IMAGE_LOADING_POLICY:
- g_value_set_int (
+ g_value_set_enum (
value,
e_mail_formatter_get_image_loading_policy (
E_MAIL_FORMATTER (object)));
@@ -620,16 +622,14 @@ e_mail_formatter_class_init (EMailFormatterClass *class)
GDK_TYPE_COLOR,
G_PARAM_READWRITE));
- /* FIXME Make this a proper enum property. */
g_object_class_install_property (
object_class,
PROP_IMAGE_LOADING_POLICY,
- g_param_spec_int (
+ g_param_spec_enum (
"image-loading-policy",
"Image Loading Policy",
NULL,
- E_MAIL_IMAGE_LOADING_POLICY_NEVER,
- E_MAIL_IMAGE_LOADING_POLICY_ALWAYS,
+ E_TYPE_MAIL_IMAGE_LOADING_POLICY,
E_MAIL_IMAGE_LOADING_POLICY_NEVER,
G_PARAM_READWRITE));
diff --git a/mail/e-http-request.c b/mail/e-http-request.c
index 0d6ccc26a1..14bfdda181 100644
--- a/mail/e-http-request.c
+++ b/mail/e-http-request.c
@@ -157,7 +157,7 @@ handle_http_request (GSimpleAsyncResult *res,
EMailImageLoadingPolicy image_policy;
gchar *uri_md5;
EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
const gchar *user_cache_dir;
CamelDataCache *cache;
CamelStream *cache_stream;
@@ -274,8 +274,9 @@ handle_http_request (GSimpleAsyncResult *res,
goto cleanup;
}
- shell_settings = e_shell_get_shell_settings (shell);
- image_policy = e_shell_settings_get_int (shell_settings, "mail-image-loading-policy");
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ image_policy = g_settings_get_enum (settings, "image-loading-policy");
+ g_object_unref (settings);
/* Item not found in cache, but image loading policy allows us to fetch
* it from the interwebs */
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index bdebf269aa..36489fbcdf 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -30,7 +30,6 @@
#include "shell/e-shell.h"
#include "shell/e-shell-utils.h"
-#include "shell/e-shell-settings.h"
#include "mail/e-mail-reader.h"
#include "mail/e-mail-reader-utils.h"
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index bf7907031c..ea654aa4c5 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -496,14 +496,14 @@ mail_paned_view_set_folder (EMailReader *reader,
EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellSettings *shell_settings;
+ GSettings *settings;
EMailReaderInterface *default_interface;
GtkWidget *message_list;
GKeyFile *key_file;
gchar *folder_uri;
gchar *group_name;
const gchar *key;
- gboolean value, global_view_settings;
+ gboolean value, global_view_setting;
GError *error = NULL;
priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader);
@@ -513,8 +513,12 @@ mail_paned_view_set_folder (EMailReader *reader,
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
- global_view_settings = e_shell_settings_get_boolean (shell_settings, "mail-global-view-setting");
+
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ /* FIXME This should be an EMailReader property. */
+ global_view_setting = g_settings_get_boolean (
+ settings, "global-view-setting");
message_list = e_mail_reader_get_message_list (reader);
@@ -547,11 +551,11 @@ mail_paned_view_set_folder (EMailReader *reader,
g_free (folder_uri);
key = STATE_KEY_GROUP_BY_THREADS;
- value = g_key_file_get_boolean (key_file, global_view_settings ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error);
+ value = g_key_file_get_boolean (key_file, global_view_setting ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error);
if (error != NULL) {
g_clear_error (&error);
- value = !global_view_settings ||
+ value = !global_view_setting ||
g_key_file_get_boolean (key_file, STATE_GROUP_GLOBAL_FOLDER, key, &error);
if (error != NULL) {
g_clear_error (&error);
@@ -562,11 +566,11 @@ mail_paned_view_set_folder (EMailReader *reader,
e_mail_reader_set_group_by_threads (reader, value);
key = STATE_KEY_PREVIEW_VISIBLE;
- value = g_key_file_get_boolean (key_file, global_view_settings ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error);
+ value = g_key_file_get_boolean (key_file, global_view_setting ? STATE_GROUP_GLOBAL_FOLDER : group_name, key, &error);
if (error != NULL) {
g_clear_error (&error);
- value = !global_view_settings ||
+ value = !global_view_setting ||
g_key_file_get_boolean (key_file, STATE_GROUP_GLOBAL_FOLDER, key, &error);
if (error != NULL) {
g_clear_error (&error);
@@ -576,11 +580,10 @@ mail_paned_view_set_folder (EMailReader *reader,
/* XXX This is a little confusing and needs rethought. The
* EShellWindow:safe-mode property blocks automatic message
- * selection, but the "mail-safe-list" shell setting blocks
- * both the preview pane and automatic message selection. */
- if (e_shell_settings_get_boolean (shell_settings, "mail-safe-list")) {
- e_shell_settings_set_boolean (
- shell_settings, "mail-safe-list", FALSE);
+ * selection, but the "safe-list" setting blocks both the
+ * preview pane and automatic message selection. */
+ if (g_settings_get_boolean (settings, "safe-list")) {
+ g_settings_set_boolean (settings, "safe-list", FALSE);
e_shell_window_set_safe_mode (shell_window, TRUE);
value = FALSE;
}
@@ -591,6 +594,8 @@ mail_paned_view_set_folder (EMailReader *reader,
exit:
message_list_thaw (MESSAGE_LIST (message_list));
+
+ g_object_unref (settings);
}
static guint
@@ -806,15 +811,16 @@ mail_paned_view_update_view_instance (EMailView *view)
EShellView *shell_view;
EShellWindow *shell_window;
EShellViewClass *shell_view_class;
- EShellSettings *shell_settings;
ESourceRegistry *registry;
GalViewCollection *view_collection;
GalViewInstance *view_instance;
CamelFolder *folder;
GtkOrientable *orientable;
GtkOrientation orientation;
+ GSettings *settings;
gboolean outgoing_folder;
gboolean show_vertical_view;
+ gboolean global_view_setting;
gchar *view_id;
priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
@@ -826,7 +832,6 @@ mail_paned_view_update_view_instance (EMailView *view)
shell_window = e_shell_view_get_shell_window (shell_view);
shell = e_shell_window_get_shell (shell_window);
registry = e_shell_get_registry (shell);
- shell_settings = e_shell_get_shell_settings (shell);
reader = E_MAIL_READER (view);
folder = e_mail_reader_get_folder (reader);
@@ -848,7 +853,12 @@ mail_paned_view_update_view_instance (EMailView *view)
em_utils_folder_is_outbox (registry, folder) ||
em_utils_folder_is_sent (registry, folder);
- if (e_shell_settings_get_boolean (shell_settings, "mail-global-view-setting"))
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ global_view_setting = g_settings_get_boolean (
+ settings, "global-view-setting");
+ g_object_unref (settings);
+
+ if (global_view_setting)
view_instance = e_shell_view_new_view_instance (
shell_view, outgoing_folder ?
"global_view_sent_setting" : "global_view_setting");
@@ -860,9 +870,8 @@ mail_paned_view_update_view_instance (EMailView *view)
orientable = GTK_ORIENTABLE (view);
orientation = gtk_orientable_get_orientation (orientable);
show_vertical_view =
- (orientation == GTK_ORIENTATION_HORIZONTAL) &&
- !e_shell_settings_get_boolean (
- shell_settings, "mail-global-view-setting");
+ !global_view_setting &&
+ (orientation == GTK_ORIENTATION_HORIZONTAL);
if (show_vertical_view) {
gchar *filename;
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index dcb3383093..74369202ba 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -115,42 +115,36 @@ mail_reader_is_special_local_folder (const gchar *name)
gboolean
e_mail_reader_confirm_delete (EMailReader *reader)
{
- EShell *shell;
- EMailBackend *backend;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
CamelFolder *folder;
CamelStore *parent_store;
GtkWidget *check_button;
GtkWidget *container;
GtkWidget *dialog;
GtkWindow *window;
+ GSettings *settings;
const gchar *label;
gboolean prompt_delete_in_vfolder;
- gint response;
+ gint response = GTK_RESPONSE_OK;
/* Remind users what deleting from a search folder does. */
g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE);
- backend = e_mail_reader_get_backend (reader);
folder = e_mail_reader_get_folder (reader);
window = e_mail_reader_get_window (reader);
- shell_backend = E_SHELL_BACKEND (backend);
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.mail");
- prompt_delete_in_vfolder = e_shell_settings_get_boolean (
- shell_settings, "mail-prompt-delete-in-vfolder");
+ prompt_delete_in_vfolder = g_settings_get_boolean (
+ settings, "prompt-on-delete-in-vfolder");
parent_store = camel_folder_get_parent_store (folder);
if (!CAMEL_IS_VEE_STORE (parent_store))
- return TRUE;
+ goto exit;
if (!prompt_delete_in_vfolder)
- return TRUE;
+ goto exit;
dialog = e_alert_dialog_new_for_args (
window, "mail:ask-delete-vfolder-msg",
@@ -166,14 +160,15 @@ e_mail_reader_confirm_delete (EMailReader *reader)
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response != GTK_RESPONSE_DELETE_EVENT)
- e_shell_settings_set_boolean (
- shell_settings,
- "mail-prompt-delete-in-vfolder",
+ g_settings_set_boolean (
+ settings,
+ "prompt-on-delete-in-vfolder",
!gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (check_button)));
gtk_widget_destroy (dialog);
+exit:
return (response == GTK_RESPONSE_OK);
}
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 64b8d78b40..69bb388d72 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2732,32 +2732,28 @@ mail_reader_message_seen_cb (EMailReaderClosure *closure)
static gboolean
schedule_timeout_mark_seen (EMailReader *reader)
{
- EShell *shell;
- EMailBackend *backend;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
MessageList *message_list;
+ GSettings *settings;
gboolean schedule_timeout;
gint timeout_interval;
const gchar *message_uid;
- backend = e_mail_reader_get_backend (reader);
+
message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader));
- shell_backend = E_SHELL_BACKEND (backend);
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
message_uid = message_list->cursor_uid;
if (message_uid == NULL ||
e_tree_is_dragging (E_TREE (message_list)))
return FALSE;
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ /* FIXME These should be EMailReader properties. */
schedule_timeout =
(message_uid != NULL) &&
- e_shell_settings_get_boolean (
- shell_settings, "mail-mark-seen");
- timeout_interval =
- e_shell_settings_get_int (
- shell_settings, "mail-mark-seen-timeout");
+ g_settings_get_boolean (settings, "mark-seen");
+ timeout_interval = g_settings_get_int (settings, "mark-seen-timeout");
+
+ g_object_unref (settings);
if (message_list->seen_id > 0) {
g_source_remove (message_list->seen_id);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index d52d04c3fb..515f27885c 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1522,20 +1522,21 @@ static void
emu_update_composers_security (EMsgComposer *composer,
guint32 validity_found)
{
- EShell *shell;
- EShellSettings *shell_settings;
GtkAction *action;
+ GSettings *settings;
gboolean sign_by_default;
g_return_if_fail (composer != NULL);
- shell = e_msg_composer_get_shell (composer);
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.mail");
sign_by_default =
(validity_found & E_MAIL_PART_VALIDITY_SIGNED) != 0 &&
- e_shell_settings_get_boolean (
- shell_settings, "composer-sign-reply-if-signed");
+ /* FIXME This should be an EMsgComposer property. */
+ g_settings_get_boolean (
+ settings, "composer-sign-reply-if-signed");
+
+ g_object_unref (settings);
/* Pre-set only for encrypted messages, not for signed */
if (sign_by_default) {
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 74a0eaca49..0da08fa324 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1519,7 +1519,7 @@ em_utils_is_re_in_subject (EShell *shell,
const gchar *subject,
gint *skip_len)
{
- EShellSettings *shell_settings;
+ GSettings *settings;
gchar *prefixes, **prefixes_strv;
gboolean res;
gint ii;
@@ -1536,8 +1536,10 @@ em_utils_is_re_in_subject (EShell *shell,
if (check_prefix (subject, "Re", skip_len))
return TRUE;
- shell_settings = e_shell_get_shell_settings (shell);
- prefixes = e_shell_settings_get_string (shell_settings, "composer-localized-re");
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ prefixes = g_settings_get_string (settings, "composer-localized-re");
+ g_object_unref (settings);
+
if (!prefixes || !*prefixes) {
g_free (prefixes);
return FALSE;
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 162cdd4dd7..2b32acb683 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -481,16 +481,14 @@
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
- <object class="GtkComboBox" id="comboboxReplyStyle">
+ <object class="GtkComboBoxText" id="comboboxReplyStyle">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">model3</property>
- <child>
- <object class="GtkCellRendererText" id="renderer3"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <items>
+ <item translatable="yes" context="ReplyForward" id="attach">Attachment</item>
+ <item translatable="yes" context="ReplyForward" id="outlook">Inline (Outlook style)</item>
+ <item translatable="yes" context="ReplyForward" id="quoted">Quoted</item>
+ <item translatable="yes" context="ReplyForward" id="do-not-quote">Do Not Quote</item>
+ </items>
</object>
</child>
</object>
@@ -506,16 +504,13 @@
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
- <object class="GtkComboBox" id="comboboxForwardStyle">
+ <object class="GtkComboBoxText" id="comboboxForwardStyle">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">model4</property>
- <child>
- <object class="GtkCellRendererText" id="renderer4"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <items>
+ <item translatable="yes" context="ReplyForward" id="attached">Attachment</item>
+ <item translatable="yes" context="ReplyForward" id="inline">Inline</item>
+ <item translatable="yes" context="ReplyForward" id="quoted">Quoted</item>
+ </items>
</object>
</child>
</object>
@@ -1065,43 +1060,6 @@
</row>
</data>
</object>
- <object class="GtkListStore" id="model3">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes" context="ReplyForward">Attachment</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="ReplyForward">Inline (Outlook style)</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="ReplyForward">Quoted</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="ReplyForward">Do not quote</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model4">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes" context="ReplyForward">Attachment</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="ReplyForward">Inline</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="ReplyForward">Quoted</col>
- </row>
- </data>
- </object>
<object class="GtkNotebook" id="network_preferences_toplevel">
<property name="visible">True</property>
<property name="can_focus">True</property>
diff --git a/mail/message-list.c b/mail/message-list.c
index cc23f99621..dcae35ffd3 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -39,7 +39,6 @@
#include <glib/gstdio.h>
#include "shell/e-shell.h"
-#include "shell/e-shell-settings.h"
#include "libemail-engine/e-mail-utils.h"
#include "libemail-engine/mail-config.h"
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am
index bbf8366cfb..a488ba292e 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -23,8 +23,6 @@ module_mail_la_SOURCES = \
e-mail-shell-backend.h \
e-mail-shell-content.c \
e-mail-shell-content.h \
- e-mail-shell-settings.c \
- e-mail-shell-settings.h \
e-mail-shell-sidebar.c \
e-mail-shell-sidebar.h \
e-mail-shell-view.c \
diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c
index 98680f8299..d6caecf556 100644
--- a/modules/mail/e-mail-attachment-handler.c
+++ b/modules/mail/e-mail-attachment-handler.c
@@ -121,19 +121,18 @@ mail_attachment_handler_forward (GtkAction *action,
EAttachmentHandler *handler)
{
EMailAttachmentHandlerPrivate *priv;
- EShellSettings *shell_settings;
+ GSettings *settings;
EMailForwardStyle style;
CamelMimeMessage *message;
- const gchar *property_name;
priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
message = mail_attachment_handler_get_selected_message (handler);
g_return_if_fail (message != NULL);
- property_name = "mail-forward-style";
- shell_settings = e_shell_get_shell_settings (priv->shell);
- style = e_shell_settings_get_int (shell_settings, property_name);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ style = g_settings_get_enum (settings, "forward-style-name");
+ g_object_unref (settings);
em_utils_forward_message (
priv->shell, CAMEL_SESSION (priv->session),
@@ -147,19 +146,18 @@ mail_attachment_handler_reply (EAttachmentHandler *handler,
EMailReplyType reply_type)
{
EMailAttachmentHandlerPrivate *priv;
- EShellSettings *shell_settings;
+ GSettings *settings;
EMailReplyStyle style;
CamelMimeMessage *message;
- const gchar *property_name;
priv = E_MAIL_ATTACHMENT_HANDLER_GET_PRIVATE (handler);
message = mail_attachment_handler_get_selected_message (handler);
g_return_if_fail (message != NULL);
- property_name = "mail-reply-style";
- shell_settings = e_shell_get_shell_settings (priv->shell);
- style = e_shell_settings_get_int (shell_settings, property_name);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ style = g_settings_get_enum (settings, "reply-style-name");
+ g_object_unref (settings);
em_utils_reply_to_message (
priv->shell, message,
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 1abcb8a136..ecb295ea10 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -53,7 +53,6 @@
#include <em-format/e-mail-formatter.h>
#include <em-format/e-mail-part-utils.h>
-#include "e-mail-shell-settings.h"
#include "e-mail-shell-sidebar.h"
#include "e-mail-shell-view.h"
#include "em-account-prefs.h"
@@ -369,7 +368,7 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
/* This applies to both the composer and signature editor. */
if (GTKHTML_IS_EDITOR (window)) {
- EShellSettings *shell_settings;
+ GSettings *settings;
GList *spell_languages;
gboolean active = TRUE;
@@ -378,12 +377,14 @@ mail_shell_backend_window_added_cb (GtkApplication *application,
GTKHTML_EDITOR (window), spell_languages);
g_list_free (spell_languages);
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.mail");
/* Express mode does not honor this setting. */
if (!e_shell_get_express_mode (shell))
- active = e_shell_settings_get_boolean (
- shell_settings, "composer-format-html");
+ active = g_settings_get_boolean (
+ settings, "composer-send-html");
+
+ g_object_unref (settings);
gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (window), active);
}
@@ -513,15 +514,14 @@ static void
mail_shell_backend_constructed (GObject *object)
{
EShell *shell;
- EShellSettings *shell_settings;
EShellBackend *shell_backend;
EMailSession *mail_session;
CamelService *vstore;
GtkWidget *preferences_window;
+ GSettings *settings;
shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mail_shell_backend_parent_class)->constructed (object);
@@ -543,8 +543,6 @@ mail_shell_backend_constructed (GObject *object)
G_CALLBACK (mail_shell_backend_window_added_cb),
shell_backend);
- e_mail_shell_settings_init (shell_backend);
-
/* Setup preference widget factories */
preferences_window = e_shell_get_preferences_window (shell);
@@ -589,10 +587,14 @@ mail_shell_backend_constructed (GObject *object)
CAMEL_SESSION (mail_session), E_MAIL_SESSION_VFOLDER_UID);
g_return_if_fail (vstore != NULL);
- g_object_bind_property (
- shell_settings, "mail-enable-unmatched-search-folder",
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ g_settings_bind (
+ settings, "enable-unmatched",
vstore, "unmatched-enabled",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_object_unref (settings);
g_object_unref (vstore);
}
@@ -630,38 +632,31 @@ mail_shell_backend_start (EShellBackend *shell_backend)
static gboolean
mail_shell_backend_delete_junk_policy_decision (EMailBackend *backend)
{
- EShell *shell;
- EShellSettings *shell_settings;
GSettings *settings;
gboolean delete_junk;
- gint empty_date;
- gint empty_days;
+ gint empty_date = 0;
+ gint empty_days = 0;
gint now;
- shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
-
settings = g_settings_new ("org.gnome.evolution.mail");
- shell_settings = e_shell_get_shell_settings (shell);
now = time (NULL) / 60 / 60 / 24;
- delete_junk = e_shell_settings_get_boolean (
- shell_settings, "mail-empty-junk-on-exit");
-
- /* XXX No EShellSettings properties for these keys. */
-
- empty_date = empty_days = 0;
+ delete_junk = g_settings_get_boolean (settings, "junk-empty-on-exit");
if (delete_junk) {
- empty_days = g_settings_get_int (settings, "junk-empty-on-exit-days");
- empty_date = g_settings_get_int (settings, "junk-empty-date");
+ empty_days = g_settings_get_int (
+ settings, "junk-empty-on-exit-days");
+ empty_date = g_settings_get_int (
+ settings, "junk-empty-date");
}
- delete_junk = delete_junk && ((empty_days == 0) || (empty_days > 0 && empty_date + empty_days <= now));
+ delete_junk = delete_junk && (
+ (empty_days == 0) ||
+ (empty_days > 0 && empty_date + empty_days <= now));
- if (delete_junk) {
+ if (delete_junk)
g_settings_set_int (settings, "junk-empty-date", now);
- }
g_object_unref (settings);
@@ -671,38 +666,31 @@ mail_shell_backend_delete_junk_policy_decision (EMailBackend *backend)
static gboolean
mail_shell_backend_empty_trash_policy_decision (EMailBackend *backend)
{
- EShell *shell;
- EShellSettings *shell_settings;
GSettings *settings;
gboolean empty_trash;
- gint empty_date;
- gint empty_days;
+ gint empty_date = 0;
+ gint empty_days = 0;
gint now;
- shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
-
settings = g_settings_new ("org.gnome.evolution.mail");
- shell_settings = e_shell_get_shell_settings (shell);
now = time (NULL) / 60 / 60 / 24;
- empty_trash = e_shell_settings_get_boolean (
- shell_settings, "mail-empty-trash-on-exit");
-
- /* XXX No EShellSettings properties for these keys. */
-
- empty_date = empty_days = 0;
+ empty_trash = g_settings_get_boolean (settings, "trash-empty-on-exit");
if (empty_trash) {
- empty_days = g_settings_get_int (settings, "trash-empty-on-exit-days");
- empty_date = g_settings_get_int (settings, "trash-empty-date");
+ empty_days = g_settings_get_int (
+ settings, "trash-empty-on-exit-days");
+ empty_date = g_settings_get_int (
+ settings, "trash-empty-date");
}
- empty_trash = empty_trash && ((empty_days == 0) || (empty_days > 0 && empty_date + empty_days <= now));
+ empty_trash = empty_trash && (
+ (empty_days == 0) ||
+ (empty_days > 0 && empty_date + empty_days <= now));
- if (empty_trash) {
+ if (empty_trash)
g_settings_set_int (settings, "trash-empty-date", now);
- }
g_object_unref (settings);
@@ -852,8 +840,6 @@ e_mail_shell_backend_edit_account (EMailShellBackend *mail_shell_backend,
/******************* Code below here belongs elsewhere. *******************/
-#include "shell/e-shell-settings.h"
-
static GSList *
mail_labels_get_filter_options (gboolean include_none)
{
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
deleted file mode 100644
index 6982345b88..0000000000
--- a/modules/mail/e-mail-shell-settings.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * e-mail-shell-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)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-mail-shell-settings.h"
-
-#include <mail/e-mail-backend.h>
-
-#include <shell/e-shell.h>
-
-#define MAIL_SCHEMA "org.gnome.evolution.mail"
-
-static gboolean
-transform_no_folder_dots_to_ellipsize (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
-{
- PangoEllipsizeMode ellipsize;
-
- if (g_value_get_boolean (source_value))
- ellipsize = PANGO_ELLIPSIZE_NONE;
- else
- ellipsize = PANGO_ELLIPSIZE_END;
-
- g_value_set_enum (target_value, ellipsize);
-
- return TRUE;
-}
-
-void
-e_mail_shell_settings_init (EShellBackend *shell_backend)
-{
- EShell *shell;
- EShellSettings *shell_settings;
- EMailBackend *backend;
- EMailSession *session;
-
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- backend = E_MAIL_BACKEND (shell_backend);
- session = e_mail_backend_get_session (backend);
-
- /*** Global Objects ***/
-
- e_shell_settings_install_property (
- g_param_spec_pointer (
- "mail-session",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- e_shell_settings_set_pointer (
- shell_settings, "mail-session",
- g_object_ref (session));
-
- /*** Mail Preferences ***/
-
- e_shell_settings_install_property_for_key (
- "mail-address-compress",
- MAIL_SCHEMA,
- "address-compress");
-
- e_shell_settings_install_property_for_key (
- "mail-address-count",
- MAIL_SCHEMA,
- "address-count");
-
- e_shell_settings_install_property_for_key (
- "mail-charset",
- MAIL_SCHEMA,
- "charset");
-
- e_shell_settings_install_property_for_key (
- "mail-check-for-junk",
- MAIL_SCHEMA,
- "junk-check-incoming");
-
- e_shell_settings_install_property_for_key (
- "mail-check-on-start",
- MAIL_SCHEMA,
- "send-recv-on-start");
-
- e_shell_settings_install_property_for_key (
- "mail-check-all-on-start",
- MAIL_SCHEMA,
- "send-recv-all-on-start");
-
- e_shell_settings_install_property_for_key (
- "mail-citation-color",
- MAIL_SCHEMA,
- "citation-color");
-
- e_shell_settings_install_property_for_key (
- "mail-confirm-expunge",
- MAIL_SCHEMA,
- "prompt-on-expunge");
-
- e_shell_settings_install_property_for_key (
- "mail-confirm-unwanted-html",
- MAIL_SCHEMA,
- "prompt-on-unwanted-html");
-
- e_shell_settings_install_property_for_key (
- "mail-empty-junk-on-exit",
- MAIL_SCHEMA,
- "junk-empty-on-exit");
-
- e_shell_settings_install_property_for_key (
- "mail-empty-trash-on-exit",
- MAIL_SCHEMA,
- "trash-empty-on-exit");
-
- e_shell_settings_install_property_for_key (
- "mail-enable-unmatched-search-folder",
- MAIL_SCHEMA,
- "enable-unmatched");
-
- e_shell_settings_install_property_for_key (
- "mail-font-monospace",
- MAIL_SCHEMA,
- "monospace-font");
-
- e_shell_settings_install_property_for_key (
- "mail-font-variable",
- MAIL_SCHEMA,
- "variable-width-font");
-
- /* This value corresponds to the EMailForwardStyle enum. */
- e_shell_settings_install_property_for_key (
- "mail-forward-style",
- MAIL_SCHEMA,
- "forward-style");
-
- /* This value corresponds to MailConfigHTTPMode enum. */
- e_shell_settings_install_property_for_key (
- "mail-image-loading-policy",
- MAIL_SCHEMA,
- "load-http-images");
-
- e_shell_settings_install_property_for_key (
- "mail-magic-spacebar",
- MAIL_SCHEMA,
- "magic-spacebar");
-
- e_shell_settings_install_property_for_key (
- "mail-global-view-setting",
- MAIL_SCHEMA,
- "global-view-setting");
-
- e_shell_settings_install_property_for_key (
- "mail-mark-citations",
- MAIL_SCHEMA,
- "mark-citations");
-
- e_shell_settings_install_property_for_key (
- "mail-mark-seen",
- MAIL_SCHEMA,
- "mark-seen");
-
- e_shell_settings_install_property_for_key (
- "mail-mark-seen-timeout",
- MAIL_SCHEMA,
- "mark-seen-timeout");
-
- /* Do not bind to this. Use "mail-sidebar-ellipsize" instead. */
- e_shell_settings_install_property_for_key (
- "mail-no-folder-dots",
- MAIL_SCHEMA,
- "no-folder-dots");
-
- e_shell_settings_install_property_for_key (
- "mail-only-local-photos",
- MAIL_SCHEMA,
- "photo-local");
-
- e_shell_settings_install_property_for_key (
- "mail-show-real-date",
- MAIL_SCHEMA,
- "show-real-date");
-
- e_shell_settings_install_property_for_key (
- "mail-sort-accounts-alpha",
- MAIL_SCHEMA,
- "sort-accounts-alpha");
-
- e_shell_settings_install_property_for_key (
- "mail-prompt-delete-in-vfolder",
- MAIL_SCHEMA,
- "prompt-on-delete-in-vfolder");
-
- /* This value corresponds to the EMailReplyStyle enum,
- * but the ordering of the combo box items in preferences
- * has changed. We use transformation functions there. */
- e_shell_settings_install_property_for_key (
- "mail-reply-style",
- MAIL_SCHEMA,
- "reply-style");
-
- e_shell_settings_install_property_for_key (
- "mail-safe-list",
- MAIL_SCHEMA,
- "safe-list");
-
- e_shell_settings_install_property_for_key (
- "mail-show-animated-images",
- MAIL_SCHEMA,
- "show-animated-images");
-
- e_shell_settings_install_property_for_key (
- "mail-show-sender-photo",
- MAIL_SCHEMA,
- "show-sender-photo");
-
- e_shell_settings_install_property_for_key (
- "mail-sidebar-search",
- MAIL_SCHEMA,
- "side-bar-search");
-
- e_shell_settings_install_property_for_key (
- "mail-thread-by-subject",
- MAIL_SCHEMA,
- "thread-subject");
-
- e_shell_settings_install_property_for_key (
- "mail-use-custom-fonts",
- MAIL_SCHEMA,
- "use-custom-font");
-
- /*** Composer Preferences ***/
-
- e_shell_settings_install_property_for_key (
- "composer-charset",
- MAIL_SCHEMA,
- "composer-charset");
-
- e_shell_settings_install_property_for_key (
- "composer-format-html",
- MAIL_SCHEMA,
- "composer-send-html");
-
- e_shell_settings_install_property_for_key (
- "composer-inline-spelling",
- MAIL_SCHEMA,
- "composer-inline-spelling");
-
- e_shell_settings_install_property_for_key (
- "composer-magic-links",
- MAIL_SCHEMA,
- "composer-magic-links");
-
- e_shell_settings_install_property_for_key (
- "composer-magic-smileys",
- MAIL_SCHEMA,
- "composer-magic-smileys");
-
- e_shell_settings_install_property_for_key (
- "composer-outlook-filenames",
- MAIL_SCHEMA,
- "composer-outlook-filenames");
-
- e_shell_settings_install_property_for_key (
- "composer-localized-re",
- MAIL_SCHEMA,
- "composer-localized-re");
-
- e_shell_settings_install_property_for_key (
- "composer-ignore-list-reply-to",
- MAIL_SCHEMA,
- "composer-ignore-list-reply-to");
-
- e_shell_settings_install_property_for_key (
- "composer-group-reply-to-list",
- MAIL_SCHEMA,
- "composer-group-reply-to-list");
-
- e_shell_settings_install_property_for_key (
- "composer-sign-reply-if-signed",
- MAIL_SCHEMA,
- "composer-sign-reply-if-signed");
-
- e_shell_settings_install_property_for_key (
- "composer-prompt-only-bcc",
- MAIL_SCHEMA,
- "prompt-on-only-bcc");
-
- e_shell_settings_install_property_for_key (
- "composer-prompt-private-list-reply",
- MAIL_SCHEMA,
- "prompt-on-private-list-reply");
-
- e_shell_settings_install_property_for_key (
- "composer-prompt-reply-many-recips",
- MAIL_SCHEMA,
- "prompt-on-reply-many-recips");
-
- e_shell_settings_install_property_for_key (
- "composer-prompt-list-reply-to",
- MAIL_SCHEMA,
- "prompt-on-list-reply-to");
-
- e_shell_settings_install_property_for_key (
- "composer-prompt-empty-subject",
- MAIL_SCHEMA,
- "prompt-on-empty-subject");
-
- e_shell_settings_install_property_for_key (
- "composer-prompt-send-invalid-recip",
- MAIL_SCHEMA,
- "prompt-on-invalid-recip");
-
- e_shell_settings_install_property_for_key (
- "composer-reply-start-bottom",
- MAIL_SCHEMA,
- "composer-reply-start-bottom");
-
- e_shell_settings_install_property_for_key (
- "composer-request-receipt",
- MAIL_SCHEMA,
- "composer-request-receipt");
-
- e_shell_settings_install_property_for_key (
- "composer-spell-color",
- MAIL_SCHEMA,
- "composer-spell-color");
-
- e_shell_settings_install_property_for_key (
- "composer-top-signature",
- MAIL_SCHEMA,
- "composer-top-signature");
-
- e_shell_settings_install_property_for_key (
- "composer-no-signature-delim",
- MAIL_SCHEMA,
- "composer-no-signature-delim");
-
- e_shell_settings_install_property_for_key (
- "composer-gallery-path",
- MAIL_SCHEMA,
- "composer-gallery-path");
-
- e_shell_settings_install_property_for_key (
- "mail-headers-collapsed",
- MAIL_SCHEMA,
- "headers-collapsed");
-
- e_shell_settings_install_property (
- g_param_spec_enum (
- "mail-sidebar-ellipsize",
- NULL,
- NULL,
- PANGO_TYPE_ELLIPSIZE_MODE,
- PANGO_ELLIPSIZE_NONE,
- G_PARAM_READWRITE));
-
- g_object_bind_property_full (
- shell_settings, "mail-no-folder-dots",
- shell_settings, "mail-sidebar-ellipsize",
- G_BINDING_SYNC_CREATE,
- transform_no_folder_dots_to_ellipsize,
- NULL,
- g_object_ref (shell_settings),
- (GDestroyNotify) g_object_unref);
-}
diff --git a/modules/mail/e-mail-shell-settings.h b/modules/mail/e-mail-shell-settings.h
deleted file mode 100644
index 1faf6c6faf..0000000000
--- a/modules/mail/e-mail-shell-settings.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * e-mail-shell-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_SETTINGS_H
-#define E_MAIL_SHELL_SETTINGS_H
-
-#include <shell/e-shell-backend.h>
-
-G_BEGIN_DECLS
-
-void e_mail_shell_settings_init (EShellBackend *shell_backend);
-
-G_END_DECLS
-
-#endif /* E_MAIL_SHELL_SETTINGS_H */
diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index 2c2cdfb4d5..7f3c569288 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -122,12 +122,9 @@ static void
mail_shell_sidebar_constructed (GObject *object)
{
EMailShellSidebar *mail_shell_sidebar;
- EShellSettings *shell_settings;
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- EShellWindow *shell_window;
EShellView *shell_view;
- EShell *shell;
EMailBackend *backend;
EMailSession *session;
EAlertSink *alert_sink;
@@ -135,6 +132,7 @@ mail_shell_sidebar_constructed (GObject *object)
GtkTreeView *tree_view;
GtkWidget *container;
GtkWidget *widget;
+ GSettings *settings;
/* Chain up to parent's constructed method. */
G_OBJECT_CLASS (e_mail_shell_sidebar_parent_class)->constructed (object);
@@ -142,10 +140,6 @@ mail_shell_sidebar_constructed (GObject *object)
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
shell_backend = e_shell_view_get_shell_backend (shell_view);
- shell_window = e_shell_view_get_shell_window (shell_view);
-
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
backend = E_MAIL_BACKEND (shell_backend);
session = e_mail_backend_get_session (backend);
@@ -179,15 +173,19 @@ mail_shell_sidebar_constructed (GObject *object)
widget, "key-file",
G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "mail-sidebar-ellipsize",
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ g_settings_bind (
+ settings, "side-bar-ellipsize-mode",
widget, "ellipsize",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "mail-sidebar-search",
+ g_settings_bind (
+ settings, "side-bar-search",
widget, "enable-search",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
+
+ g_object_unref (settings);
g_signal_connect_swapped (
widget, "key-file-changed",
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 92cb0d5814..ed5b30702c 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -953,10 +953,8 @@ static void
action_mail_smart_backward_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellSettings *shell_settings;
EMailShellContent *mail_shell_content;
EMailShellSidebar *mail_shell_sidebar;
EMFolderTree *folder_tree;
@@ -967,6 +965,7 @@ action_mail_smart_backward_cb (GtkAction *action,
GtkWidget *window;
GtkAdjustment *adj;
EMailDisplay *display;
+ GSettings *settings;
gboolean caret_mode;
gboolean magic_spacebar;
gdouble value;
@@ -975,8 +974,6 @@ action_mail_smart_backward_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
@@ -988,8 +985,9 @@ action_mail_smart_backward_cb (GtkAction *action,
display = e_mail_reader_get_mail_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- magic_spacebar = e_shell_settings_get_boolean (
- shell_settings, "mail-magic-spacebar");
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ magic_spacebar = g_settings_get_boolean (settings, "magic-spacebar");
+ g_object_unref (settings);
toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
caret_mode = gtk_toggle_action_get_active (toggle_action);
@@ -1005,7 +1003,7 @@ action_mail_smart_backward_cb (GtkAction *action,
if (caret_mode || !magic_spacebar)
return;
- /* XXX Are two separate calls really necessary? */
+ /* XXX Are two separate calls really necessary? */
if (message_list_select (
MESSAGE_LIST (message_list),
@@ -1038,10 +1036,8 @@ static void
action_mail_smart_forward_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
- EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
- EShellSettings *shell_settings;
EMailShellContent *mail_shell_content;
EMailShellSidebar *mail_shell_sidebar;
EMFolderTree *folder_tree;
@@ -1052,6 +1048,7 @@ action_mail_smart_forward_cb (GtkAction *action,
GtkAdjustment *adj;
GtkToggleAction *toggle_action;
EMailDisplay *display;
+ GSettings *settings;
gboolean caret_mode;
gboolean magic_spacebar;
gdouble value;
@@ -1061,8 +1058,6 @@ action_mail_smart_forward_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (mail_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
mail_shell_content = mail_shell_view->priv->mail_shell_content;
mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
@@ -1074,8 +1069,9 @@ action_mail_smart_forward_cb (GtkAction *action,
display = e_mail_reader_get_mail_display (reader);
message_list = e_mail_reader_get_message_list (reader);
- magic_spacebar = e_shell_settings_get_boolean (
- shell_settings, "mail-magic-spacebar");
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ magic_spacebar = g_settings_get_boolean (settings, "magic-spacebar");
+ g_object_unref (settings);
toggle_action = GTK_TOGGLE_ACTION (ACTION (MAIL_CARET_MODE));
caret_mode = gtk_toggle_action_get_active (toggle_action);
@@ -1092,7 +1088,7 @@ action_mail_smart_forward_cb (GtkAction *action,
if (caret_mode || !magic_spacebar)
return;
- /* XXX Are two separate calls really necessary? */
+ /* XXX Are two separate calls really necessary? */
if (message_list_select (
MESSAGE_LIST (message_list),
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 58066e0f0b..7d80bbcb1c 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -52,75 +52,50 @@ G_DEFINE_TYPE (
GTK_TYPE_VBOX)
static gboolean
-transform_old_to_new_reply_style (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
+composer_prefs_map_string_to_color (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
{
- gboolean success = TRUE;
-
- /* XXX This is the kind of legacy crap we wind up
- * with when we don't migrate things properly. */
-
- switch (g_value_get_int (source_value)) {
- case 0: /* Quoted: 0 -> 2 */
- g_value_set_int (target_value, 2);
- break;
-
- case 1: /* Do Not Quote: 1 -> 3 */
- g_value_set_int (target_value, 3);
- break;
-
- case 2: /* Attach: 2 -> 0 */
- g_value_set_int (target_value, 0);
- break;
-
- case 3: /* Outlook: 3 -> 1 */
- g_value_set_int (target_value, 1);
- break;
-
- default:
- success = FALSE;
- break;
+ GdkColor color;
+ const gchar *string;
+ gboolean success = FALSE;
+
+ string = g_variant_get_string (variant, NULL);
+ if (gdk_color_parse (string, &color)) {
+ g_value_set_boxed (value, &color);
+ success = TRUE;
}
return success;
}
-static gboolean
-transform_new_to_old_reply_style (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
+static GVariant *
+composer_prefs_map_color_to_string (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
{
- gboolean success = TRUE;
-
- /* XXX This is the kind of legacy crap we wind up
- * with when we don't migrate things properly. */
-
- switch (g_value_get_int (source_value)) {
- case 0: /* Attach: 0 -> 2 */
- g_value_set_int (target_value, 2);
- break;
-
- case 1: /* Outlook: 1 -> 3 */
- g_value_set_int (target_value, 3);
- break;
-
- case 2: /* Quoted: 2 -> 0 */
- g_value_set_int (target_value, 0);
- break;
-
- case 3: /* Do Not Quote: 3 -> 1 */
- g_value_set_int (target_value, 1);
- break;
-
- default:
- success = FALSE;
- break;
+ GVariant *variant;
+ const GdkColor *color;
+
+ color = g_value_get_boxed (value);
+ if (color == NULL) {
+ variant = g_variant_new_string ("");
+ } else {
+ gchar *string;
+
+ /* Encode the color manually because CSS styles expect
+ * color codes as #rrggbb, whereas gdk_color_to_string()
+ * returns color codes as #rrrrggggbbbb. */
+ string = g_strdup_printf (
+ "#%02x%02x%02x",
+ (gint) color->red * 256 / 65536,
+ (gint) color->green * 256 / 65536,
+ (gint) color->blue * 256 / 65536);
+ variant = g_variant_new_string (string);
+ g_free (string);
}
- return success;
+ return variant;
}
static void
@@ -302,7 +277,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
{
GtkWidget *toplevel, *widget, *info_pixmap;
GtkWidget *container;
- EShellSettings *shell_settings;
+ GSettings *settings;
ESourceRegistry *registry;
GtkTreeView *view;
GtkListStore *store;
@@ -314,7 +289,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
gint i;
registry = e_shell_get_registry (shell);
- shell_settings = e_shell_get_shell_settings (shell);
+
+ settings = g_settings_new ("org.gnome.evolution.mail");
/* Make sure our custom widget classes are registered with
* GType before we load the GtkBuilder definition file. */
@@ -343,129 +319,113 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
/* Express mode does not honor this setting. */
widget = e_builder_get_widget (prefs->builder, "chkSendHTML");
- if (e_shell_get_express_mode (shell))
+ if (e_shell_get_express_mode (shell)) {
gtk_widget_hide (widget);
- else
- g_object_bind_property (
- shell_settings, "composer-format-html",
+ } else {
+ g_settings_bind (
+ settings, "composer-send-html",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
+ }
widget = e_builder_get_widget (prefs->builder, "chkPromptEmptySubject");
- g_object_bind_property (
- shell_settings, "composer-prompt-empty-subject",
+ g_settings_bind (
+ settings, "prompt-on-empty-subject",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkPromptBccOnly");
- g_object_bind_property (
- shell_settings, "composer-prompt-only-bcc",
+ g_settings_bind (
+ settings, "prompt-on-only-bcc",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkPromptPrivateListReply");
- g_object_bind_property (
- shell_settings, "composer-prompt-private-list-reply",
+ g_settings_bind (
+ settings, "prompt-on-private-list-reply",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkPromptReplyManyRecips");
- g_object_bind_property (
- shell_settings, "composer-prompt-reply-many-recips",
+ g_settings_bind (
+ settings, "prompt-on-reply-many-recips",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkPromptListReplyTo");
- g_object_bind_property (
- shell_settings, "composer-prompt-list-reply-to",
+ g_settings_bind (
+ settings, "prompt-on-list-reply-to",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkPromptSendInvalidRecip");
- g_object_bind_property (
- shell_settings, "composer-prompt-send-invalid-recip",
+ g_settings_bind (
+ settings, "prompt-on-invalid-recip",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkAutoSmileys");
- g_object_bind_property (
- shell_settings, "composer-magic-smileys",
+ g_settings_bind (
+ settings, "composer-magic-smileys",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkRequestReceipt");
- g_object_bind_property (
- shell_settings, "composer-request-receipt",
+ g_settings_bind (
+ settings, "composer-request-receipt",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkReplyStartBottom");
- g_object_bind_property (
- shell_settings, "composer-reply-start-bottom",
+ g_settings_bind (
+ settings, "composer-reply-start-bottom",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkOutlookFilenames");
- g_object_bind_property (
- shell_settings, "composer-outlook-filenames",
+ g_settings_bind (
+ settings, "composer-outlook-filenames",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkIgnoreListReplyTo");
- g_object_bind_property (
- shell_settings, "composer-ignore-list-reply-to",
+ g_settings_bind (
+ settings, "composer-ignore-list-reply-to",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkGroupReplyToList");
- g_object_bind_property (
- shell_settings, "composer-group-reply-to-list",
+ g_settings_bind (
+ settings, "composer-group-reply-to-list",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkSignReplyIfSigned");
- g_object_bind_property (
- shell_settings, "composer-sign-reply-if-signed",
+ g_settings_bind (
+ settings, "composer-sign-reply-if-signed",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkTopSignature");
- g_object_bind_property (
- shell_settings, "composer-top-signature",
+ g_settings_bind (
+ settings, "composer-top-signature",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkEnableSpellChecking");
- g_object_bind_property (
- shell_settings, "composer-inline-spelling",
+ g_settings_bind (
+ settings, "composer-inline-spelling",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_charset_combo_box_new ();
container = e_builder_get_widget (prefs->builder, "hboxComposerCharset");
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
- g_object_bind_property (
- shell_settings, "composer-charset",
+ g_settings_bind (
+ settings, "composer-charset",
widget, "charset",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
container = e_builder_get_widget (prefs->builder, "lblCharset");
gtk_label_set_mnemonic_widget (GTK_LABEL (container), widget);
@@ -500,34 +460,28 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON);
widget = e_builder_get_widget (prefs->builder, "colorButtonSpellCheckColor");
- g_object_bind_property_full (
- shell_settings, "composer-spell-color",
+ g_settings_bind_with_mapping (
+ settings, "composer-spell-color",
widget, "color",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_string_to_color,
- e_binding_transform_color_to_string,
+ G_SETTINGS_BIND_DEFAULT,
+ composer_prefs_map_string_to_color,
+ composer_prefs_map_color_to_string,
NULL, (GDestroyNotify) NULL);
spell_setup (prefs);
/* Forwards and Replies */
widget = e_builder_get_widget (prefs->builder, "comboboxForwardStyle");
- g_object_bind_property (
- shell_settings, "mail-forward-style",
- widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ g_settings_bind (
+ settings, "forward-style-name",
+ widget, "active-id",
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "comboboxReplyStyle");
- g_object_bind_property_full (
- shell_settings, "mail-reply-style",
- widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- transform_old_to_new_reply_style,
- transform_new_to_old_reply_style,
- NULL, (GDestroyNotify) NULL);
+ g_settings_bind (
+ settings, "reply-style-name",
+ widget, "active-id",
+ G_SETTINGS_BIND_DEFAULT);
/* Signatures */
container = e_builder_get_widget (
@@ -544,10 +498,10 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
/* Express mode does not honor this setting. */
if (!e_shell_get_express_mode (shell))
- g_object_bind_property (
- shell_settings, "composer-format-html",
+ g_settings_bind (
+ settings, "composer-send-html",
widget, "prefer-html",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
/* Sanitize the dialog for Express mode */
e_shell_hide_widgets_for_express_mode (
@@ -561,6 +515,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
e_config_set_target ((EConfig *) ec, (EConfigTarget *) target);
toplevel = e_config_create_widget ((EConfig *) ec);
gtk_container_add (GTK_CONTAINER (prefs), toplevel);
+
+ g_object_unref (settings);
}
GtkWidget *
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 83a23ef735..469425ff41 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -117,35 +117,79 @@ em_mailer_prefs_init (EMMailerPrefs *preferences)
}
static gboolean
-mark_seen_milliseconds_to_seconds (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
+mailer_prefs_map_milliseconds_to_seconds (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
{
- gint milliseconds;
+ gint32 milliseconds;
gdouble seconds;
- milliseconds = g_value_get_int (source_value);
+ milliseconds = g_variant_get_int32 (variant);
seconds = milliseconds / 1000.0;
- g_value_set_double (target_value, seconds);
+ g_value_set_double (value, seconds);
return TRUE;
}
-static gboolean
-mark_seen_seconds_to_milliseconds (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer user_data)
+static GVariant *
+mailer_prefs_map_seconds_to_milliseconds (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
{
- gint milliseconds;
+ gint32 milliseconds;
gdouble seconds;
- seconds = g_value_get_double (source_value);
+ seconds = g_value_get_double (value);
milliseconds = seconds * 1000;
- g_value_set_int (target_value, milliseconds);
- return TRUE;
+ return g_variant_new_int32 (milliseconds);
+}
+
+static gboolean
+mailer_prefs_map_string_to_color (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GdkColor color;
+ const gchar *string;
+ gboolean success = FALSE;
+
+ string = g_variant_get_string (variant, NULL);
+ if (gdk_color_parse (string, &color)) {
+ g_value_set_boxed (value, &color);
+ success = TRUE;
+ }
+
+ return success;
+}
+
+static GVariant *
+mailer_prefs_map_color_to_string (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant;
+ const GdkColor *color;
+
+ color = g_value_get_boxed (value);
+ if (color == NULL) {
+ variant = g_variant_new_string ("");
+ } else {
+ gchar *string;
+
+ /* Encode the color manually because CSS styles expect
+ * color codes as #rrggbb, whereas gdk_color_to_string()
+ * returns color codes as #rrrrggggbbbb. */
+ string = g_strdup_printf (
+ "#%02x%02x%02x",
+ (gint) color->red * 256 / 65536,
+ (gint) color->green * 256 / 65536,
+ (gint) color->blue * 256 / 65536);
+ variant = g_variant_new_string (string);
+ g_free (string);
+ }
+
+ return variant;
}
enum {
@@ -687,19 +731,51 @@ emmp_empty_junk_init (EMMailerPrefs *prefs,
}
static void
-http_images_changed (GtkWidget *widget,
- EMMailerPrefs *prefs)
+image_loading_policy_always_cb (GtkToggleButton *toggle_button)
+{
+ if (gtk_toggle_button_get_active (toggle_button)) {
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ g_settings_set_enum (
+ settings, "image-loading-policy",
+ E_MAIL_IMAGE_LOADING_POLICY_ALWAYS);
+
+ g_object_unref (settings);
+ }
+}
+
+static void
+image_loading_policy_sometimes_cb (GtkToggleButton *toggle_button)
{
- EMailImageLoadingPolicy policy;
+ if (gtk_toggle_button_get_active (toggle_button)) {
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.evolution.mail");
- if (gtk_toggle_button_get_active (prefs->images_always))
- policy = E_MAIL_IMAGE_LOADING_POLICY_ALWAYS;
- else if (gtk_toggle_button_get_active (prefs->images_sometimes))
- policy = E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES;
- else
- policy = E_MAIL_IMAGE_LOADING_POLICY_NEVER;
+ g_settings_set_enum (
+ settings, "image-loading-policy",
+ E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES);
- g_settings_set_int (prefs->settings, "load-http-images", policy);
+ g_object_unref (settings);
+ }
+}
+
+static void
+image_loading_policy_never_cb (GtkToggleButton *toggle_button)
+{
+ if (gtk_toggle_button_get_active (toggle_button)) {
+ GSettings *settings;
+
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ g_settings_set_enum (
+ settings, "image-loading-policy",
+ E_MAIL_IMAGE_LOADING_POLICY_NEVER);
+
+ g_object_unref (settings);
+ }
}
static GtkWidget *
@@ -750,7 +826,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
{
GSList *header_add_list, *p;
gchar **headers_config;
- EShellSettings *shell_settings;
+ GSettings *settings;
GHashTable *default_header_hash;
GtkWidget *toplevel;
GtkWidget *container;
@@ -760,12 +836,13 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
GtkCellRenderer *renderer;
GtkTreeIter iter;
gboolean locked;
+ gboolean writable;
gint val, i;
EMConfig *ec;
EMConfigTargetPrefs *target;
GSList *l;
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.mail");
/* Make sure our custom widget classes are registered with
* GType before we load the GtkBuilder definition file. */
@@ -791,197 +868,187 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
/* General tab */
widget = e_builder_get_widget (prefs->builder, "chkCheckMailOnStart");
- g_object_bind_property (
- shell_settings, "mail-check-on-start",
+ g_settings_bind (
+ settings, "send-recv-on-start",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkCheckMailInAllOnStart");
- g_object_bind_property (
- shell_settings, "mail-check-all-on-start",
+ g_settings_bind (
+ settings, "send-recv-all-on-start",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "mail-check-on-start",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ settings, "send-recv-on-start",
widget, "sensitive",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
/* Message Display */
widget = e_builder_get_widget (prefs->builder, "chkMarkTimeout");
- g_object_bind_property (
- shell_settings, "mail-mark-seen",
+ g_settings_bind (
+ settings, "mark-seen",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
/* The "mark seen" timeout requires special transform functions
* because we display the timeout value to the user in seconds
* but store the settings value in milliseconds. */
widget = e_builder_get_widget (prefs->builder, "spinMarkTimeout");
- g_object_bind_property (
- shell_settings, "mail-mark-seen",
- widget, "sensitive",
- G_BINDING_SYNC_CREATE);
- g_object_bind_property_full (
- shell_settings, "mail-mark-seen-timeout",
+ g_settings_bind_with_mapping (
+ settings, "mark-seen-timeout",
widget, "value",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- mark_seen_milliseconds_to_seconds,
- mark_seen_seconds_to_milliseconds,
+ G_SETTINGS_BIND_DEFAULT,
+ mailer_prefs_map_milliseconds_to_seconds,
+ mailer_prefs_map_seconds_to_milliseconds,
NULL, (GDestroyNotify) NULL);
+ g_settings_bind (
+ settings, "mark-seen",
+ widget, "sensitive",
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "view-check");
- g_object_bind_property (
- shell_settings, "mail-global-view-setting",
+ g_settings_bind (
+ settings, "global-view-setting",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_charset_combo_box_new ();
container = e_builder_get_widget (prefs->builder, "hboxDefaultCharset");
- gtk_label_set_mnemonic_widget (GTK_LABEL (e_builder_get_widget (prefs->builder, "lblDefaultCharset")), widget);
+ gtk_label_set_mnemonic_widget (
+ GTK_LABEL (e_builder_get_widget (
+ prefs->builder, "lblDefaultCharset")), widget);
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
- g_object_bind_property (
- shell_settings, "mail-charset",
+ g_settings_bind (
+ settings, "charset",
widget, "charset",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkHighlightCitations");
- g_object_bind_property (
- shell_settings, "mail-mark-citations",
+ g_settings_bind (
+ settings, "mark-citations",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "colorButtonHighlightCitations");
- g_object_bind_property (
- shell_settings, "mail-mark-citations",
- widget, "sensitive",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property_full (
- shell_settings, "mail-citation-color",
+ g_settings_bind_with_mapping (
+ settings, "citation-color",
widget, "color",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE,
- e_binding_transform_string_to_color,
- e_binding_transform_color_to_string,
+ G_SETTINGS_BIND_DEFAULT,
+ mailer_prefs_map_string_to_color,
+ mailer_prefs_map_color_to_string,
NULL, (GDestroyNotify) NULL);
+ g_settings_bind (
+ settings, "mark-citations",
+ widget, "sensitive",
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "thread-by-subject");
- g_object_bind_property (
- shell_settings, "mail-thread-by-subject",
+ g_settings_bind (
+ settings, "thread-subject",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
/* Deleting Mail */
widget = e_builder_get_widget (prefs->builder, "chkEmptyTrashOnExit");
- g_object_bind_property (
- shell_settings, "mail-empty-trash-on-exit",
+ g_settings_bind (
+ settings, "trash-empty-on-exit",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "comboboxEmptyTrashDays");
- g_object_bind_property (
- shell_settings, "mail-empty-trash-on-exit",
+ g_settings_bind (
+ settings, "trash-empty-on-exit",
widget, "sensitive",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
emmp_empty_trash_init (prefs, GTK_COMBO_BOX (widget));
widget = e_builder_get_widget (prefs->builder, "chkConfirmExpunge");
- g_object_bind_property (
- shell_settings, "mail-confirm-expunge",
+ g_settings_bind (
+ settings, "prompt-on-expunge",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
/* Mail Fonts */
widget = e_builder_get_widget (prefs->builder, "radFontUseSame");
- g_object_bind_property (
- shell_settings, "mail-use-custom-fonts",
+ g_settings_bind (
+ settings, "use-custom-font",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE |
- G_BINDING_INVERT_BOOLEAN);
+ G_SETTINGS_BIND_DEFAULT |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
widget = e_builder_get_widget (prefs->builder, "FontFixed");
- g_object_bind_property (
- shell_settings, "mail-font-monospace",
+ g_settings_bind (
+ settings, "monospace-font",
widget, "font-name",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "mail-use-custom-fonts",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ settings, "use-custom-font",
widget, "sensitive",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "FontVariable");
- g_object_bind_property (
- shell_settings, "mail-font-variable",
+ g_settings_bind (
+ settings, "variable-width-font",
widget, "font-name",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "mail-use-custom-fonts",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ settings, "use-custom-font",
widget, "sensitive",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
/* HTML Mail tab */
/* Loading Images */
- locked = !g_settings_is_writable (prefs->settings, "load-http-images");
+ writable = g_settings_is_writable (
+ prefs->settings, "image-loading-policy");
- val = g_settings_get_int (prefs->settings, "load-http-images");
- prefs->images_never = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesNever"));
- gtk_toggle_button_set_active (prefs->images_never, val == E_MAIL_IMAGE_LOADING_POLICY_NEVER);
- if (locked)
- gtk_widget_set_sensitive ((GtkWidget *) prefs->images_never, FALSE);
+ val = g_settings_get_enum (prefs->settings, "image-loading-policy");
+ widget = e_builder_get_widget (
+ prefs->builder, "radImagesNever");
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (widget),
+ val == E_MAIL_IMAGE_LOADING_POLICY_NEVER);
+ gtk_widget_set_sensitive (widget, writable);
- prefs->images_sometimes = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesSometimes"));
- gtk_toggle_button_set_active (prefs->images_sometimes, val == E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES);
- if (locked)
- gtk_widget_set_sensitive ((GtkWidget *) prefs->images_sometimes, FALSE);
+ g_signal_connect (
+ widget, "toggled",
+ G_CALLBACK (image_loading_policy_never_cb), NULL);
- prefs->images_always = GTK_TOGGLE_BUTTON (e_builder_get_widget (prefs->builder, "radImagesAlways"));
- gtk_toggle_button_set_active (prefs->images_always, val == E_MAIL_IMAGE_LOADING_POLICY_ALWAYS);
- if (locked)
- gtk_widget_set_sensitive ((GtkWidget *) prefs->images_always, FALSE);
+ widget = e_builder_get_widget (
+ prefs->builder, "radImagesSometimes");
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (widget),
+ val == E_MAIL_IMAGE_LOADING_POLICY_SOMETIMES);
+ gtk_widget_set_sensitive (widget, writable);
g_signal_connect (
- prefs->images_never, "toggled",
- G_CALLBACK (http_images_changed), prefs);
- g_signal_connect (
- prefs->images_sometimes, "toggled",
- G_CALLBACK (http_images_changed), prefs);
+ widget, "toggled",
+ G_CALLBACK (image_loading_policy_sometimes_cb), NULL);
+
+ widget = e_builder_get_widget (
+ prefs->builder, "radImagesAlways");
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (widget),
+ val == E_MAIL_IMAGE_LOADING_POLICY_ALWAYS);
+ gtk_widget_set_sensitive (widget, FALSE);
+
g_signal_connect (
- prefs->images_always, "toggled",
- G_CALLBACK (http_images_changed), prefs);
+ widget, "toggled",
+ G_CALLBACK (image_loading_policy_always_cb), NULL);
widget = e_builder_get_widget (prefs->builder, "chkShowAnimatedImages");
- g_object_bind_property (
- shell_settings, "mail-show-animated-images",
+ g_settings_bind (
+ settings, "show-animated-images",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "chkPromptWantHTML");
- g_object_bind_property (
- shell_settings, "mail-confirm-unwanted-html",
+ g_settings_bind (
+ settings, "prompt-on-unwanted-html",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
container = e_builder_get_widget (prefs->builder, "labels-alignment");
widget = e_mail_label_manager_new ();
@@ -997,23 +1064,20 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
locked = !g_settings_is_writable (prefs->settings, "headers");
widget = e_builder_get_widget (prefs->builder, "photo_show");
- g_object_bind_property (
- shell_settings, "mail-show-sender-photo",
+ g_settings_bind (
+ settings, "show-sender-photo",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "photo_local");
- g_object_bind_property (
- shell_settings, "mail-show-sender-photo",
- widget, "sensitive",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "mail-only-local-photos",
+ g_settings_bind (
+ settings, "photo-local",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (
+ settings, "show-sender-photo",
+ widget, "sensitive",
+ G_SETTINGS_BIND_GET);
/* always de-sensitised until the user types something in the entry */
prefs->add_header = GTK_BUTTON (e_builder_get_widget (prefs->builder, "cmdHeadersAdd"));
@@ -1142,33 +1206,30 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
widget = gtk_check_button_new_with_mnemonic (_("Show _original header value"));
gtk_widget_show (widget);
gtk_table_attach ((GtkTable *) table, widget, 0, 3, 2, 3, GTK_EXPAND | GTK_FILL, 0, 12, 0);
- g_object_bind_property (
- shell_settings, "mail-show-real-date",
+ g_settings_bind (
+ settings, "show-real-date",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
/* Junk prefs */
widget = e_builder_get_widget (prefs->builder, "chkCheckIncomingMail");
- g_object_bind_property (
- shell_settings, "mail-check-for-junk",
+ g_settings_bind (
+ settings, "junk-check-incoming",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "junk_empty_check");
- g_object_bind_property (
- shell_settings, "mail-empty-junk-on-exit",
+ g_settings_bind (
+ settings, "junk-empty-on-exit",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
widget = e_builder_get_widget (prefs->builder, "junk_empty_combobox");
emmp_empty_junk_init (prefs, GTK_COMBO_BOX (widget));
- g_object_bind_property (
- shell_settings, "mail-empty-junk-on-exit",
+ g_settings_bind (
+ settings, "junk-empty-on-exit",
widget, "sensitive",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
widget = e_builder_get_widget (prefs->builder, "junk-module-options");
e_mail_junk_options_set_session (E_MAIL_JUNK_OPTIONS (widget), session);
@@ -1211,6 +1272,8 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs,
e_config_set_target ((EConfig *) ec, (EConfigTarget *) target);
toplevel = e_config_create_widget ((EConfig *) ec);
gtk_container_add (GTK_CONTAINER (prefs), toplevel);
+
+ g_object_unref (settings);
}
GtkWidget *
diff --git a/modules/mail/em-mailer-prefs.h b/modules/mail/em-mailer-prefs.h
index afd88afb1f..67cd1f64cb 100644
--- a/modules/mail/em-mailer-prefs.h
+++ b/modules/mail/em-mailer-prefs.h
@@ -67,11 +67,6 @@ struct _EMMailerPrefs {
GtkFontButton *font_fixed;
GtkToggleButton *font_share;
- /* Loading Images */
- GtkToggleButton *images_always;
- GtkToggleButton *images_sometimes;
- GtkToggleButton *images_never;
-
GtkToggleButton *autodetect_links;
/* Labels and Colours tab */
diff --git a/modules/mailto-handler/evolution-mailto-handler.c b/modules/mailto-handler/evolution-mailto-handler.c
index b6f3656863..f985562487 100644
--- a/modules/mailto-handler/evolution-mailto-handler.c
+++ b/modules/mailto-handler/evolution-mailto-handler.c
@@ -102,8 +102,7 @@ mailto_handler_is_evolution (GAppInfo *app_info)
static gboolean
mailto_handler_prompt (EMailtoHandler *extension)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
GtkWidget *container;
GtkWidget *dialog;
GtkWidget *widget;
@@ -111,9 +110,6 @@ mailto_handler_prompt (EMailtoHandler *extension)
gchar *markup;
gint response;
- shell = mailto_handler_get_shell (extension);
- shell_settings = e_shell_get_shell_settings (shell);
-
dialog = gtk_dialog_new_with_buttons (
"", NULL, 0,
GTK_STOCK_NO, GTK_RESPONSE_NO,
@@ -156,12 +152,16 @@ mailto_handler_prompt (EMailtoHandler *extension)
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 12);
gtk_widget_show (widget);
- g_object_bind_property (
- shell_settings, "mailto-handler-check",
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ g_settings_bind (
+ settings, "prompt-check-if-default-mailer",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE |
- G_BINDING_INVERT_BOOLEAN);
+ G_SETTINGS_BIND_GET |
+ G_SETTINGS_BIND_SET |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
+
+ g_object_unref (settings);
/* Direct input focus away from the checkbox. */
widget = gtk_dialog_get_widget_for_response (
@@ -178,19 +178,17 @@ mailto_handler_prompt (EMailtoHandler *extension)
static void
mailto_handler_check (EMailtoHandler *extension)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
gboolean check_mailto_handler = TRUE;
GAppInfo *app_info = NULL;
GError *error = NULL;
- shell = mailto_handler_get_shell (extension);
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.mail");
- g_object_get (
- shell_settings,
- "mailto-handler-check", &check_mailto_handler,
- NULL);
+ check_mailto_handler = g_settings_get_boolean (
+ settings, "prompt-check-if-default-mailer");
+
+ g_object_unref (settings);
/* Should we check the "mailto" URI handler? */
if (!check_mailto_handler)
@@ -245,11 +243,6 @@ mailto_handler_constructed (GObject *object)
shell = mailto_handler_get_shell (extension);
- e_shell_settings_install_property_for_key (
- "mailto-handler-check",
- "org.gnome.evolution.mail",
- "prompt-check-if-default-mailer");
-
g_signal_connect_swapped (
shell, "event::ready-to-start",
G_CALLBACK (mailto_handler_check), extension);
diff --git a/modules/settings/e-settings-mail-formatter.c b/modules/settings/e-settings-mail-formatter.c
index 1efd290690..7733c02c74 100644
--- a/modules/settings/e-settings-mail-formatter.c
+++ b/modules/settings/e-settings-mail-formatter.c
@@ -22,7 +22,6 @@
#include "e-settings-mail-formatter.h"
-#include <shell/e-shell.h>
#include <e-util/e-util.h>
#include <em-format/e-mail-formatter.h>
#include <mail/e-mail-reader-utils.h>
@@ -51,6 +50,24 @@ settings_mail_formatter_get_extensible (ESettingsMailFormatter *extension)
return E_MAIL_FORMATTER (extensible);
}
+static gboolean
+settings_mail_formatter_map_string_to_color (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GdkColor color;
+ const gchar *string;
+ gboolean success = FALSE;
+
+ string = g_variant_get_string (variant, NULL);
+ if (gdk_color_parse (string, &color)) {
+ g_value_set_boxed (value, &color);
+ success = TRUE;
+ }
+
+ return success;
+}
+
static void
settings_mail_formatter_headers_changed_cb (GSettings *settings,
const gchar *key,
@@ -91,14 +108,15 @@ settings_mail_formatter_dispose (GObject *object)
priv = E_SETTINGS_MAIL_FORMATTER_GET_PRIVATE (object);
- if (priv->settings != NULL) {
+ if (priv->headers_changed_id > 0) {
g_signal_handler_disconnect (
priv->settings,
priv->headers_changed_id);
- g_object_unref (priv->settings);
- priv->settings = NULL;
+ priv->headers_changed_id = 0;
}
+ g_clear_object (&priv->settings);
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_settings_mail_formatter_parent_class)->
dispose (object);
@@ -109,46 +127,45 @@ settings_mail_formatter_constructed (GObject *object)
{
ESettingsMailFormatter *extension;
EMailFormatter *formatter;
- EShellSettings *shell_settings;
- EShell *shell;
+ GSettings *settings;
extension = E_SETTINGS_MAIL_FORMATTER (object);
formatter = settings_mail_formatter_get_extensible (extension);
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = extension->priv->settings;
- g_object_bind_property_full (
- shell_settings, "mail-citation-color",
+ g_settings_bind_with_mapping (
+ settings, "citation-color",
formatter, "citation-color",
- G_BINDING_SYNC_CREATE,
- e_binding_transform_string_to_color,
- NULL, NULL, (GDestroyNotify) NULL);
+ G_SETTINGS_BIND_GET,
+ settings_mail_formatter_map_string_to_color,
+ (GSettingsBindSetMapping) NULL,
+ NULL, (GDestroyNotify) NULL);
- g_object_bind_property (
- shell_settings, "mail-mark-citations",
+ g_settings_bind (
+ settings, "mark-citations",
formatter, "mark-citations",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "mail-image-loading-policy",
+ g_settings_bind (
+ settings, "image-loading-policy",
formatter, "image-loading-policy",
G_BINDING_SYNC_CREATE);
- g_object_bind_property (
- shell_settings, "mail-show-sender-photo",
+ g_settings_bind (
+ settings, "show-sender-photo",
formatter, "show-sender-photo",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "mail-show-real-date",
+ g_settings_bind (
+ settings, "show-real-date",
formatter, "show-real-date",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "mail-show-animated-images",
+ g_settings_bind (
+ settings, "show-animated-images",
formatter, "animate-images",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
extension->priv->headers_changed_id = g_signal_connect (
extension->priv->settings, "changed::headers",
@@ -189,10 +206,12 @@ e_settings_mail_formatter_class_finalize (ESettingsMailFormatterClass *class)
static void
e_settings_mail_formatter_init (ESettingsMailFormatter *extension)
{
+ GSettings *settings;
+
extension->priv = E_SETTINGS_MAIL_FORMATTER_GET_PRIVATE (extension);
- extension->priv->settings =
- g_settings_new ("org.gnome.evolution.mail");
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ extension->priv->settings = settings;
}
void
diff --git a/modules/settings/e-settings-mail-reader.c b/modules/settings/e-settings-mail-reader.c
index 17ab57b3b8..d333c81bf0 100644
--- a/modules/settings/e-settings-mail-reader.c
+++ b/modules/settings/e-settings-mail-reader.c
@@ -43,31 +43,34 @@ settings_mail_reader_idle_cb (EExtension *extension)
{
EExtensible *extensible;
GtkActionGroup *action_group;
- EShellSettings *shell_settings;
ESourceRegistry *registry;
+ GSettings *settings;
ESource *source;
EShell *shell;
extensible = e_extension_get_extensible (extension);
- shell = e_shell_get_default ();
- registry = e_shell_get_registry (shell);
- shell_settings = e_shell_get_shell_settings (shell);
+ settings = g_settings_new ("org.gnome.evolution.mail");
- g_object_bind_property (
- shell_settings, "mail-forward-style",
+ g_settings_bind (
+ settings, "forward-style-name",
extensible, "forward-style",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "mail-reply-style",
+ g_settings_bind (
+ settings, "reply-style-name",
extensible, "reply-style",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
+
+ g_object_unref (settings);
action_group = e_mail_reader_get_action_group (
E_MAIL_READER (extensible),
E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS);
+ shell = e_shell_get_default ();
+ registry = e_shell_get_registry (shell);
+
source = e_source_registry_ref_source (registry, "vfolder");
g_object_bind_property (
diff --git a/modules/settings/e-settings-web-view-gtkhtml.c b/modules/settings/e-settings-web-view-gtkhtml.c
index 49e8112601..297e88f508 100644
--- a/modules/settings/e-settings-web-view-gtkhtml.c
+++ b/modules/settings/e-settings-web-view-gtkhtml.c
@@ -25,7 +25,7 @@
#include "e-settings-web-view-gtkhtml.h"
-#include <shell/e-shell.h>
+#include <e-util/e-util.h>
#define E_SETTINGS_WEB_VIEW_GTKHTML_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -33,7 +33,7 @@
struct _ESettingsWebViewGtkHTMLPrivate {
GtkCssProvider *css_provider;
- EShellSettings *shell_settings;
+ GSettings *settings;
};
G_DEFINE_DYNAMIC_TYPE (
@@ -74,33 +74,28 @@ settings_web_view_gtkhtml_load_style (ESettingsWebViewGtkHTML *extension)
gboolean custom_fonts;
gboolean mark_citations;
EExtensible *extensible;
- EShellSettings *shell_settings;
GtkStyleContext *style_context;
+ GSettings *settings;
GError *error = NULL;
/* Some of our mail and composer preferences are passed down to
* GtkHtml through style properties, unfortunately. This builds
* a style sheet for the EWebView using values from GSettings. */
- shell_settings = extension->priv->shell_settings;
-
- custom_fonts = e_shell_settings_get_boolean (
- shell_settings, "mail-use-custom-fonts");
-
- monospace_font = e_shell_settings_get_string (
- shell_settings, "mail-font-monospace");
-
- variable_font = e_shell_settings_get_string (
- shell_settings, "mail-font-variable");
-
- mark_citations = e_shell_settings_get_boolean (
- shell_settings, "mail-mark-citations");
-
- citation_color = e_shell_settings_get_string (
- shell_settings, "mail-citation-color");
-
- spell_color = e_shell_settings_get_string (
- shell_settings, "composer-spell-color");
+ settings = extension->priv->settings;
+
+ custom_fonts =
+ g_settings_get_boolean (settings, "use-custom-font");
+ monospace_font =
+ g_settings_get_string (settings, "monospace-font");
+ variable_font =
+ g_settings_get_string (settings, "variable-width-font");
+ mark_citations =
+ g_settings_get_boolean (settings, "mark-citations");
+ citation_color =
+ g_settings_get_string (settings, "citation-color");
+ spell_color =
+ g_settings_get_string (settings, "composer-spell-color");
buffer = g_string_new ("EWebViewGtkHTML {\n");
@@ -150,27 +145,35 @@ settings_web_view_gtkhtml_load_style (ESettingsWebViewGtkHTML *extension)
}
static void
+settings_web_view_gtkhtml_changed_cb (GSettings *settings,
+ const gchar *key,
+ ESettingsWebViewGtkHTML *extension)
+{
+ settings_web_view_gtkhtml_load_style (extension);
+}
+
+static void
settings_web_view_gtkhtml_realize (GtkWidget *widget,
ESettingsWebViewGtkHTML *extension)
{
- EShellSettings *shell_settings;
+ GSettings *settings;
- shell_settings = extension->priv->shell_settings;
+ settings = extension->priv->settings;
- g_object_bind_property (
- shell_settings, "composer-inline-spelling",
+ g_settings_bind (
+ settings, "composer-inline-spelling",
widget, "inline-spelling",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "composer-magic-links",
+ g_settings_bind (
+ settings, "composer-magic-links",
widget, "magic-links",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "composer-magic-smileys",
+ g_settings_bind (
+ settings, "composer-magic-smileys",
widget, "magic-smileys",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
gtk_style_context_add_provider (
gtk_widget_get_style_context (widget),
@@ -181,34 +184,34 @@ settings_web_view_gtkhtml_realize (GtkWidget *widget,
/* Reload the style sheet when certain settings change. */
- g_signal_connect_swapped (
- shell_settings, "notify::mail-use-custom-fonts",
- G_CALLBACK (settings_web_view_gtkhtml_load_style),
+ g_signal_connect (
+ settings, "changed::use-custom-font",
+ G_CALLBACK (settings_web_view_gtkhtml_changed_cb),
extension);
- g_signal_connect_swapped (
- shell_settings, "notify::mail-font-monospace",
- G_CALLBACK (settings_web_view_gtkhtml_load_style),
+ g_signal_connect (
+ settings, "changed::monospace-font",
+ G_CALLBACK (settings_web_view_gtkhtml_changed_cb),
extension);
- g_signal_connect_swapped (
- shell_settings, "notify::mail-font-variable",
- G_CALLBACK (settings_web_view_gtkhtml_load_style),
+ g_signal_connect (
+ settings, "changed::variable-width-font",
+ G_CALLBACK (settings_web_view_gtkhtml_changed_cb),
extension);
- g_signal_connect_swapped (
- shell_settings, "notify::mail-mark-citations",
- G_CALLBACK (settings_web_view_gtkhtml_load_style),
+ g_signal_connect (
+ settings, "changed::mark-citations",
+ G_CALLBACK (settings_web_view_gtkhtml_changed_cb),
extension);
- g_signal_connect_swapped (
- shell_settings, "notify::mail-citation-color",
- G_CALLBACK (settings_web_view_gtkhtml_load_style),
+ g_signal_connect (
+ settings, "changed::citation-color",
+ G_CALLBACK (settings_web_view_gtkhtml_changed_cb),
extension);
- g_signal_connect_swapped (
- shell_settings, "notify::composer-spell-color",
- G_CALLBACK (settings_web_view_gtkhtml_load_style),
+ g_signal_connect (
+ settings, "changed::composer-spell-color",
+ G_CALLBACK (settings_web_view_gtkhtml_changed_cb),
extension);
}
@@ -219,19 +222,15 @@ settings_web_view_gtkhtml_dispose (GObject *object)
priv = E_SETTINGS_WEB_VIEW_GTKHTML_GET_PRIVATE (object);
- if (priv->css_provider != NULL) {
- g_object_unref (priv->css_provider);
- priv->css_provider = NULL;
- }
-
- if (priv->shell_settings != NULL) {
+ if (priv->settings != NULL) {
g_signal_handlers_disconnect_by_func (
- priv->shell_settings,
- settings_web_view_gtkhtml_load_style, object);
- g_object_unref (priv->shell_settings);
- priv->shell_settings = NULL;
+ priv->settings,
+ settings_web_view_gtkhtml_changed_cb, object);
}
+ g_clear_object (&priv->css_provider);
+ g_clear_object (&priv->settings);
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_settings_web_view_gtkhtml_parent_class)->
dispose (object);
@@ -240,27 +239,17 @@ settings_web_view_gtkhtml_dispose (GObject *object)
static void
settings_web_view_gtkhtml_constructed (GObject *object)
{
- EShell *shell;
- EShellSettings *shell_settings;
- ESettingsWebViewGtkHTML *extension;
EExtensible *extensible;
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
- extension = (ESettingsWebViewGtkHTML *) object;
- extensible = e_extension_get_extensible (E_EXTENSION (extension));
-
- extension->priv->css_provider = gtk_css_provider_new ();
- extension->priv->shell_settings = g_object_ref (shell_settings);
+ extensible = e_extension_get_extensible (E_EXTENSION (object));
- /* Wait to bind shell settings until the EWebView is realized
- * so GtkhtmlEditor has a chance to install a GtkHTMLEditorAPI.
+ /* Wait to bind settings until the EWebView is realized so
+ * GtkhtmlEditor has a chance to install a GtkHTMLEditorAPI.
* Otherwise our settings will have no effect. */
g_signal_connect (
extensible, "realize",
- G_CALLBACK (settings_web_view_gtkhtml_realize), extension);
+ G_CALLBACK (settings_web_view_gtkhtml_realize), object);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_web_view_gtkhtml_parent_class)->
@@ -292,8 +281,15 @@ e_settings_web_view_gtkhtml_class_finalize (ESettingsWebViewGtkHTMLClass *class)
static void
e_settings_web_view_gtkhtml_init (ESettingsWebViewGtkHTML *extension)
{
+ GSettings *settings;
+
extension->priv =
E_SETTINGS_WEB_VIEW_GTKHTML_GET_PRIVATE (extension);
+
+ extension->priv->css_provider = gtk_css_provider_new ();
+
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ extension->priv->settings = settings;
}
void
diff --git a/modules/settings/e-settings-web-view.c b/modules/settings/e-settings-web-view.c
index c8da19f377..843a75070c 100644
--- a/modules/settings/e-settings-web-view.c
+++ b/modules/settings/e-settings-web-view.c
@@ -25,7 +25,7 @@
#include "e-settings-web-view.h"
-#include <shell/e-shell.h>
+#include <e-util/e-util.h>
#define E_SETTINGS_WEB_VIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -43,29 +43,29 @@ G_DEFINE_DYNAMIC_TYPE (
static void
settings_web_view_constructed (GObject *object)
{
- EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
EExtensible *extensible;
- shell = e_shell_get_default ();
- shell_settings = e_shell_get_shell_settings (shell);
-
extensible = e_extension_get_extensible (E_EXTENSION (object));
- g_object_bind_property (
- shell_settings, "composer-inline-spelling",
+ settings = g_settings_new ("org.gnome.evolution.mail");
+
+ g_settings_bind (
+ settings, "composer-inline-spelling",
extensible, "inline-spelling",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "composer-magic-links",
+ g_settings_bind (
+ settings, "composer-magic-links",
extensible, "magic-links",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
- g_object_bind_property (
- shell_settings, "composer-magic-smileys",
+ g_settings_bind (
+ settings, "composer-magic-smileys",
extensible, "magic-smileys",
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_GET);
+
+ g_object_unref (settings);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_settings_web_view_parent_class)->
diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c
index aec403c29c..f1a97b34a9 100644
--- a/modules/text-highlight/e-mail-formatter-text-highlight.c
+++ b/modules/text-highlight/e-mail-formatter-text-highlight.c
@@ -28,9 +28,6 @@
#include <em-format/e-mail-part-utils.h>
#include <e-util/e-util.h>
-#include <shell/e-shell-settings.h>
-#include <shell/e-shell.h>
-
#include <libebackend/libebackend.h>
#include <libedataserver/libedataserver.h>
@@ -52,21 +49,6 @@ G_DEFINE_DYNAMIC_TYPE (
E_TYPE_MAIL_FORMATTER_EXTENSION)
static gchar *
-get_default_font (void)
-{
- gchar *font;
- GSettings *settings;
-
- settings = g_settings_new ("org.gnome.desktop.interface");
-
- font = g_settings_get_string (settings, "monospace-font-name");
-
- g_object_unref (settings);
-
- return font ? font : g_strdup ("monospace 10");
-}
-
-static gchar *
get_syntax (EMailPart *part,
const gchar *uri)
{
@@ -177,10 +159,9 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
GPid pid;
CamelDataWrapper *dw;
gchar *font_family, *font_size, *syntax;
- gboolean use_custom_font;
- EShell *shell;
- EShellSettings *settings;
PangoFontDescription *fd;
+ GSettings *settings;
+ gchar *font = NULL;
gboolean success;
const gchar *argv[] = { HIGHLIGHT_COMMAND,
@@ -207,30 +188,26 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
return FALSE;
}
- shell = e_shell_get_default ();
- settings = e_shell_get_shell_settings (shell);
-
- fd = NULL;
- use_custom_font = e_shell_settings_get_boolean (
- settings, "mail-use-custom-fonts");
- if (!use_custom_font) {
- gchar *font;
-
- font = get_default_font ();
- fd = pango_font_description_from_string (font);
- g_free (font);
+ settings = g_settings_new ("org.gnome.evolution.mail");
+ if (g_settings_get_boolean (settings, "use-custom-font"))
+ font = g_settings_get_string (
+ settings, "monospace-font");
+ g_object_unref (settings);
+
+ if (font == NULL) {
+ settings = g_settings_new (
+ "org.gnome.desktop.interface");
+ font = g_settings_get_string (
+ settings, "monospace-font-name");
+ g_object_unref (settings);
+ }
- } else {
- gchar *font;
+ if (font == NULL)
+ font = g_strdup ("monospace 10");
- font = e_shell_settings_get_string (
- settings, "mail-font-monospace");
- if (!font)
- font = get_default_font ();
+ fd = pango_font_description_from_string (font);
- fd = pango_font_description_from_string (font);
- g_free (font);
- }
+ g_free (font);
font_family = g_strdup_printf (
"--font='%s'",
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 335e939d84..2b70a5eea2 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -763,17 +763,17 @@ action_work_offline_cb (GtkAction *action,
EShellWindow *shell_window)
{
EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
e_shell_set_online (shell, FALSE);
- /* XXX The sense of the setting is reversed. Would be more
- * intuitive and less error-prone as "start-online". */
- e_shell_settings_set_boolean (
- shell_settings, "start-offline", TRUE);
+ /* XXX The boolean sense of the setting is backwards. Would
+ * be more intuitive and less error-prone as "start-online". */
+ settings = g_settings_new ("org.gnome.evolution.shell");
+ g_settings_set_boolean (settings, "start-offline", TRUE);
+ g_object_unref (settings);
}
/**
@@ -789,17 +789,17 @@ action_work_online_cb (GtkAction *action,
EShellWindow *shell_window)
{
EShell *shell;
- EShellSettings *shell_settings;
+ GSettings *settings;
shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
e_shell_set_online (shell, TRUE);
- /* XXX The sense of the setting is reversed. Would be more
- * intuitive and less error-prone as "start-online". */
- e_shell_settings_set_boolean (
- shell_settings, "start-offline", FALSE);
+ /* XXX The boolean sense of the setting is backwards. Would
+ * be more intuitive and less error-prone as "start-online". */
+ settings = g_settings_new ("org.gnome.evolution.shell");
+ g_settings_set_boolean (settings, "start-offline", FALSE);
+ g_object_unref (settings);
}
/**