diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-attachment-bar.c | 14 | ||||
-rw-r--r-- | mail/e-mail-browser.c | 10 | ||||
-rw-r--r-- | mail/e-mail-folder-pane.c | 1 | ||||
-rw-r--r-- | mail/e-mail-label-list-store.c | 105 | ||||
-rw-r--r-- | mail/e-mail-message-pane.c | 2 | ||||
-rw-r--r-- | mail/e-mail-paned-view.c | 16 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 94 | ||||
-rw-r--r-- | mail/e-mail-session.c | 88 | ||||
-rw-r--r-- | mail/em-account-editor.c | 1 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 79 | ||||
-rw-r--r-- | mail/em-folder-properties.c | 11 | ||||
-rw-r--r-- | mail/em-utils.c | 34 | ||||
-rw-r--r-- | mail/mail-config.c | 192 | ||||
-rw-r--r-- | mail/mail-config.ui | 1 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 12 | ||||
-rw-r--r-- | mail/message-list.c | 69 |
16 files changed, 321 insertions, 408 deletions
diff --git a/mail/e-mail-attachment-bar.c b/mail/e-mail-attachment-bar.c index 17a7ae1421..f3567f2887 100644 --- a/mail/e-mail-attachment-bar.c +++ b/mail/e-mail-attachment-bar.c @@ -27,8 +27,6 @@ #include <glib/gi18n.h> -#include "e-util/gconf-bridge.h" - #include "e-attachment-store.h" #include "e-attachment-icon-view.h" #include "e-attachment-tree-view.h" @@ -257,13 +255,11 @@ static void mail_attachment_bar_constructed (GObject *object) { EMailAttachmentBarPrivate *priv; - GConfBridge *bridge; + GSettings *settings; const gchar *key; priv = E_MAIL_ATTACHMENT_BAR (object)->priv; - bridge = gconf_bridge_get (); - /* Set up property-to-property bindings. */ g_object_bind_property ( @@ -314,10 +310,10 @@ mail_attachment_bar_constructed (GObject *object) G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); - /* Set up property-to-GConf bindings. */ - - key = "/apps/evolution/shell/attachment_view"; - gconf_bridge_bind_property (bridge, key, object, "active-view"); + /* Set up property-to-GSettings bindings. */ + settings = g_settings_new ("org.gnome.evolution.shell"); + g_settings_bind (settings, "attachment-view", object, "active-view", G_SETTINGS_BIND_DEFAULT); + g_object_unref (settings); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index fe8b8984f3..aaa12b1d14 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -550,7 +550,7 @@ mail_browser_constructed (GObject *object) EShell *shell; EFocusTracker *focus_tracker; ESearchBar *search_bar; - GConfBridge *bridge; + GSettings *settings; GtkAccelGroup *accel_group; GtkActionGroup *action_group; GtkAction *action; @@ -710,13 +710,13 @@ mail_browser_constructed (GObject *object) search_bar, "changed", G_CALLBACK (em_format_queue_redraw), priv->formatter); - /* Bind GObject properties to GConf keys. */ + /* Bind GObject properties to GSettings keys. */ - bridge = gconf_bridge_get (); + settings = g_settings_new ("org.gnome.evolution.mail"); object = G_OBJECT (reader); - key = "/apps/evolution/mail/display/show_deleted"; - gconf_bridge_bind_property (bridge, key, object, "show-deleted"); + g_settings_bind (settings, "show-deleted", object, "show-deleted", G_SETTINGS_BIND_DEFAULT); + g_object_unref (settings); id = "org.gnome.evolution.mail.browser"; e_plugin_ui_register_manager (ui_manager, id, object); diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c index e9aa02928d..4642bd71b1 100644 --- a/mail/e-mail-folder-pane.c +++ b/mail/e-mail-folder-pane.c @@ -30,7 +30,6 @@ #include "e-util/e-util.h" #include "e-util/e-plugin-ui.h" -#include "e-util/gconf-bridge.h" #include "shell/e-shell.h" #include "shell/e-shell-utils.h" #include "widgets/misc/e-popup-action.h" diff --git a/mail/e-mail-label-list-store.c b/mail/e-mail-label-list-store.c index f604893bb3..5ceacb02e7 100644 --- a/mail/e-mail-label-list-store.c +++ b/mail/e-mail-label-list-store.c @@ -27,10 +27,10 @@ #include <glib/gi18n.h> #include <camel/camel.h> -#include "e-util/gconf-bridge.h" struct _EMailLabelListStorePrivate { GHashTable *tag_index; + GSettings *mail_settings; }; static struct { @@ -160,24 +160,107 @@ mail_label_list_store_finalize (GObject *object) priv = E_MAIL_LABEL_LIST_STORE (object)->priv; g_hash_table_destroy (priv->tag_index); + if (priv->mail_settings != NULL) { + g_object_unref (priv->mail_settings); + priv->mail_settings = NULL; + } /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); } + +static void labels_settings_changed_cb (GSettings *settings, const gchar *key, gpointer user_data); + +static void +labels_model_changed_cb (GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) +{ + EMailLabelListStore *store; + GPtrArray *array; + GtkTreeIter tmp_iter; + gboolean res; + + store = E_MAIL_LABEL_LIST_STORE (user_data); + + /* Make sure we don't enter an infinite synchronizing loop */ + g_signal_handlers_block_by_func (store->priv->mail_settings, labels_settings_changed_cb, store); + + /* Build list to store in GSettings */ + array = g_ptr_array_new (); + res = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &tmp_iter); + while (res) { + gchar *string; + + gtk_tree_model_get (GTK_TREE_MODEL (store), &tmp_iter, + 0, &string, -1); + g_ptr_array_add (array, string); + + res = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &tmp_iter); + } + + g_ptr_array_add (array, NULL); + g_settings_set_strv (store->priv->mail_settings, "labels", array->pdata); + + g_ptr_array_free (array, TRUE); + g_signal_handlers_unblock_by_func (store->priv->mail_settings, labels_settings_changed_cb, store); +} + +static void +labels_settings_changed_cb (GSettings *settings, + const gchar *key, + gpointer user_data) +{ + EMailLabelListStore *store; + gchar **strv; + gint i; + + store = E_MAIL_LABEL_LIST_STORE (user_data); + + /* Make sure we don't enter an infinite synchronizing loop */ + g_signal_handlers_block_by_func (store, labels_model_changed_cb, store); + + gtk_list_store_clear (GTK_LIST_STORE (store)); + + strv = g_settings_get_strv (store->priv->mail_settings, "labels"); + for (i = 0; strv[i] != NULL; i++) { + GtkTreeIter iter; + + gtk_list_store_insert_with_values (GTK_LIST_STORE (store), + &iter, -1, + 0, strv[i], + -1); + } + + g_strfreev (strv); + + g_signal_handlers_unblock_by_func (store, labels_model_changed_cb, store); +} + static void mail_label_list_store_constructed (GObject *object) { EMailLabelListStore *store; - GConfBridge *bridge; - const gchar *key; store = E_MAIL_LABEL_LIST_STORE (object); - bridge = gconf_bridge_get (); - key = "/apps/evolution/mail/labels"; - gconf_bridge_bind_string_list_store ( - bridge, key, GTK_LIST_STORE (store)); + /* Connect to GSettings' change notifications */ + store->priv->mail_settings = g_settings_new ("org.gnome.evolution.mail"); + g_signal_connect (store->priv->mail_settings, "changed::labels", + G_CALLBACK (labels_settings_changed_cb), store); + labels_settings_changed_cb (store->priv->mail_settings, "labels", store); + + /* Connect to ListStore change notifications */ + g_signal_connect (store, "row-inserted", + G_CALLBACK (labels_model_changed_cb), store); + g_signal_connect (store, "row-changed", + G_CALLBACK (labels_model_changed_cb), store); + g_signal_connect (store, "row-deleted", + G_CALLBACK (labels_model_changed_cb), store); + g_signal_connect (store, "rows-reordered", + G_CALLBACK (labels_model_changed_cb), store); mail_label_list_store_ensure_defaults (store); @@ -245,10 +328,10 @@ mail_label_list_store_init (EMailLabelListStore *store) /* XXX While it may seem awkward to cram the label name and color * into a single string column, we do it for the benefit of - * letting GConfBridge keep the model in sync with GConf. + * letting GSettings keep the model in sync. * * XXX There's a valid argument to be made that this information - * doesn't belong in GConf in the first place. A key file + * doesn't belong in GSettings in the first place. A key file * under $(user_data_dir)/mail would work better. */ gtk_list_store_set_column_types (GTK_LIST_STORE (store), 1, &type); } @@ -404,7 +487,7 @@ e_mail_label_list_store_get_tag (EMailLabelListStore *store, strv = g_strsplit_set (encoded, ":|", 3); /* XXX I guess for historical reasons the default label tags have - * a "$Label" prefix, but the default list in GConf doesn't + * a "$Label" prefix, but the default list in GSettings doesn't * include tags. That's why the <tag> part is optional. * So if we're missing the <tag> part, look it up in the * hard-coded default list above. @@ -431,7 +514,7 @@ e_mail_label_list_store_get_tag (EMailLabelListStore *store, } } - /* XXX Still no luck? The label list in GConf must be screwed up. + /* XXX Still no luck? The label list in GSettings must be screwed up. * We must not return NULL because the tag is used as a key in * the index hash table, so generate a tag from the name. */ if (result == NULL) diff --git a/mail/e-mail-message-pane.c b/mail/e-mail-message-pane.c index e77974b8eb..ed2e3a3337 100644 --- a/mail/e-mail-message-pane.c +++ b/mail/e-mail-message-pane.c @@ -28,8 +28,6 @@ #include <string.h> #include <glib/gi18n.h> -#include "e-util/gconf-bridge.h" - #include "mail/e-mail-reader.h" struct _EMailMessagePanePrivate { diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c index c9ebb8a050..63d0c2ea0a 100644 --- a/mail/e-mail-paned-view.c +++ b/mail/e-mail-paned-view.c @@ -30,7 +30,6 @@ #include <libedataserver/e-data-server-util.h> #include "e-util/e-util-private.h" -#include "e-util/gconf-bridge.h" #include "widgets/menus/gal-view-etable.h" #include "widgets/menus/gal-view-instance.h" #include "widgets/misc/e-paned.h" @@ -215,23 +214,22 @@ mail_paned_view_restore_state_cb (EShellWindow *shell_window, EMailPanedView *view) { EMailPanedViewPrivate *priv; - GConfBridge *bridge; + GSettings *settings; GObject *object; - const gchar *key; priv = E_MAIL_PANED_VIEW (view)->priv; - /* Bind GObject properties to GConf keys. */ + /* Bind GObject properties to GSettings keys. */ - bridge = gconf_bridge_get (); + settings = g_settings_new ("org.gnome.evolution.mail"); object = G_OBJECT (priv->paned); - key = "/apps/evolution/mail/display/hpaned_size"; - gconf_bridge_bind_property (bridge, key, object, "hposition"); + g_settings_bind (settings, "hpaned-size", object, "hposition", G_SETTINGS_BIND_DEFAULT); object = G_OBJECT (priv->paned); - key = "/apps/evolution/mail/display/paned_size"; - gconf_bridge_bind_property (bridge, key, object, "vposition"); + g_settings_bind (settings, "paned-size", object, "vposition", G_SETTINGS_BIND_DEFAULT); + + g_object_unref (settings); } static void diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 8b7c80349a..0a48f3d455 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -36,7 +36,6 @@ #include "e-util/e-charset.h" #include "e-util/e-util.h" #include "e-util/e-alert-dialog.h" -#include "e-util/gconf-bridge.h" #include "shell/e-shell-utils.h" #include "widgets/misc/e-popup-action.h" #include "widgets/misc/e-menu-tool-action.h" @@ -483,7 +482,7 @@ action_mail_flag_for_followup_cb (GtkAction *action, static gboolean get_close_browser_reader (EMailReader *reader) { - GConfClient *client; + GSettings *settings; const gchar *key; gchar *value; gboolean close_it = FALSE; @@ -492,10 +491,10 @@ get_close_browser_reader (EMailReader *reader) if (!E_IS_MAIL_BROWSER (reader)) return FALSE; - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); - key = "/apps/evolution/mail/prompts/reply_close_browser"; - value = gconf_client_get_string (client, key, NULL); + key = "prompt-on-reply-close-browser"; + value = g_settings_get_string (settings, key); if (value && g_str_equal (value, "always")) { close_it = TRUE; @@ -524,13 +523,13 @@ get_close_browser_reader (EMailReader *reader) close_it = response == GTK_RESPONSE_YES || response == GTK_RESPONSE_OK; if (response == GTK_RESPONSE_OK) - gconf_client_set_string (client, key, "always", NULL); + g_settings_set_string (settings, key, "always"); else if (response == GTK_RESPONSE_CANCEL) - gconf_client_set_string (client, key, "never", NULL); + g_settings_set_string (settings, key, "never"); } g_free (value); - g_object_unref (client); + g_object_unref (settings); return close_it; } @@ -1190,13 +1189,11 @@ action_mail_reply_all_check (CamelFolder *folder, response = gtk_dialog_run (GTK_DIALOG (dialog)); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) { - GConfClient *client; - const gchar *key; + GSettings *settings; - client = gconf_client_get_default (); - key = "/apps/evolution/mail/prompts/reply_many_recips"; - gconf_client_set_bool (client, key, FALSE, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + g_settings_set_boolean (settings, "prompt-on-reply-many-recips", FALSE); + g_object_unref (settings); } gtk_widget_destroy (dialog); @@ -1226,17 +1223,17 @@ static void action_mail_reply_all_cb (GtkAction *action, EMailReader *reader) { - GConfClient *client; + GSettings *settings; const gchar *key; guint32 state; gboolean ask; state = e_mail_reader_check_state (reader); - client = gconf_client_get_default (); - key = "/apps/evolution/mail/prompts/reply_many_recips"; - ask = gconf_client_get_bool (client, key, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + key = "prompt-on-reply-many-recips"; + ask = g_settings_get_boolean (settings, key); + g_object_unref (settings); if (ask && !(state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) { EActivity *activity; @@ -1276,17 +1273,15 @@ static void action_mail_reply_group_cb (GtkAction *action, EMailReader *reader) { - GConfClient *client; + GSettings *settings; gboolean reply_list; - const gchar *key; guint32 state; state = e_mail_reader_check_state (reader); - client = gconf_client_get_default (); - key = "/apps/evolution/mail/composer/group_reply_to_list"; - reply_list = gconf_client_get_bool (client, key, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + reply_list = g_settings_get_boolean (settings, "composer-group-reply-to-list"); + g_object_unref (settings); if (reply_list && (state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) { e_mail_reader_reply_to_message ( @@ -1312,8 +1307,7 @@ action_mail_reply_sender_check (CamelFolder *folder, EAlertSink *alert_sink; CamelMimeMessage *message; EMailReplyType type = E_MAIL_REPLY_TO_SENDER; - GConfClient *client; - const gchar *key; + GSettings *settings; gboolean ask_ignore_list_reply_to; gboolean ask_list_reply_to; gboolean munged_list_message; @@ -1342,13 +1336,10 @@ action_mail_reply_sender_check (CamelFolder *folder, g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - client = gconf_client_get_default (); - - key = "/apps/evolution/mail/composer/ignore_list_reply_to"; - ask_ignore_list_reply_to = gconf_client_get_bool (client, key, NULL); + settings = g_settings_new ("org.gnome.evolution.mail"); - key = "/apps/evolution/mail/prompts/list_reply_to"; - ask_list_reply_to = gconf_client_get_bool (client, key, NULL); + ask_ignore_list_reply_to = g_settings_get_boolean (settings, "composer-ignore-list-reply-to"); + ask_list_reply_to = g_settings_get_boolean (settings, "prompt-on-list-reply-to"); munged_list_message = em_utils_is_munged_list_message (message); @@ -1380,8 +1371,7 @@ action_mail_reply_sender_check (CamelFolder *folder, active = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (check)); if (active) { - key = "/apps/evolution/mail/prompts/private_list_reply"; - gconf_client_set_bool (client, key, FALSE, NULL); + g_settings_set_boolean (settings, "prompt-on-private-list-reply", FALSE); } gtk_widget_destroy (dialog); @@ -1427,14 +1417,12 @@ action_mail_reply_sender_check (CamelFolder *folder, active = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (check_again)); if (active) { - key = "/apps/evolution/mail/prompts/list_reply_to"; - gconf_client_set_bool (client, key, FALSE, NULL); + g_settings_set_boolean (settings, "prompt-on-list-reply-to", FALSE); } - key = "/apps/evolution/mail/composer/ignore_list_reply_to"; active = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (check_always_ignore)); - gconf_client_set_bool (client, key, active, NULL); + g_settings_set_boolean (settings, "composer-ignore-list-reply-to", active); gtk_widget_destroy (dialog); @@ -1457,7 +1445,7 @@ action_mail_reply_sender_check (CamelFolder *folder, check_close_browser_reader (closure->reader); exit: - g_object_unref (client); + g_object_unref (settings); g_object_unref (message); mail_reader_closure_free (closure); @@ -1467,21 +1455,18 @@ static void action_mail_reply_sender_cb (GtkAction *action, EMailReader *reader) { - GConfClient *client; + GSettings *settings; gboolean ask_list_reply_to; gboolean ask_private_list_reply; gboolean ask; - const gchar *key; guint32 state; state = e_mail_reader_check_state (reader); - client = gconf_client_get_default (); - key = "/apps/evolution/mail/prompts/list_reply_to"; - ask_list_reply_to = gconf_client_get_bool (client, key, NULL); - key = "/apps/evolution/mail/prompts/private_list_reply"; - ask_private_list_reply = gconf_client_get_bool (client, key, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + ask_list_reply_to = g_settings_get_boolean (settings, "prompt-on-list-reply-to"); + ask_private_list_reply = g_settings_get_boolean (settings, "prompt-on-private-list-reply"); + g_object_unref (settings); ask = (ask_private_list_reply || ask_list_reply_to); @@ -3439,7 +3424,6 @@ e_mail_reader_init (EMailReader *reader, EWebView *web_view; GtkActionGroup *action_group; GtkWidget *message_list; - GConfBridge *bridge; GtkAction *action; gboolean sensitive; const gchar *action_name; @@ -3524,19 +3508,19 @@ e_mail_reader_init (EMailReader *reader, action_group, mail_reader_search_folder_entries, G_N_ELEMENTS (mail_reader_search_folder_entries), reader); - /* Bind GObject properties to GConf keys. */ + /* Bind GObject properties to GSettings keys. */ - bridge = gconf_bridge_get (); + settings = g_settings_new ("org.gnome.evolution.mail"); action_name = "mail-caret-mode"; - key = "/apps/evolution/mail/display/caret_mode"; action = e_mail_reader_get_action (reader, action_name); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (settings, "caret-mode", G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); action_name = "mail-show-all-headers"; - key = "/apps/evolution/mail/display/show_all_headers"; action = e_mail_reader_get_action (reader, action_name); - gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + g_settings_bind (settings, "show-all-headers", G_OBJECT (action), "active", G_SETTINGS_BIND_DEFAULT); + + g_object_unref (settings); /* Fine tuning. */ diff --git a/mail/e-mail-session.c b/mail/e-mail-session.c index 39ccbbba80..af861f575f 100644 --- a/mail/e-mail-session.c +++ b/mail/e-mail-session.c @@ -38,8 +38,6 @@ #include <gtk/gtk.h> -#include <gconf/gconf-client.h> - #ifdef HAVE_CANBERRA #include <canberra-gtk.h> #endif @@ -53,7 +51,6 @@ #include "e-util/e-account-utils.h" #include "e-util/e-alert-dialog.h" #include "e-util/e-util-private.h" -#include "e-util/gconf-bridge.h" #include "e-mail-folder-utils.h" #include "e-mail-junk-filter.h" @@ -304,14 +301,14 @@ main_get_filter_driver (CamelSession *session, EFilterRule *rule = NULL; const gchar *config_dir; gchar *user, *system; - GConfClient *client; + GSettings *settings; ERuleContext *fc; shell = e_shell_get_default (); shell_backend = e_shell_get_backend_by_name (shell, "mail"); g_return_val_if_fail (E_IS_MAIL_BACKEND (shell_backend), NULL); - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); config_dir = mail_session_get_config_dir (); user = g_build_filename (config_dir, "filters.xml", NULL); @@ -325,12 +322,11 @@ main_get_filter_driver (CamelSession *session, driver = camel_filter_driver_new (session); camel_filter_driver_set_folder_func (driver, get_folder, session); - if (gconf_client_get_bool (client, "/apps/evolution/mail/filters/log", NULL)) { + if (g_settings_get_boolean (settings, "filters-log-actions")) { if (ms->priv->filter_logfile == NULL) { gchar *filename; - filename = gconf_client_get_string ( - client, "/apps/evolution/mail/filters/logfile", NULL); + filename = g_settings_get_string (settings, "filters-log-file"); if (filename) { ms->priv->filter_logfile = g_fopen (filename, "a+"); g_free (filename); @@ -387,7 +383,7 @@ main_get_filter_driver (CamelSession *session, g_object_unref (fc); - g_object_unref (client); + g_object_unref (settings); return driver; } @@ -419,17 +415,17 @@ ms_forward_to_cb (CamelFolder *folder, GAsyncResult *result, EMailSession *session) { - GConfClient *client; + GSettings *settings; /* FIXME Poor error handling. */ if (!e_mail_folder_append_message_finish (folder, result, NULL, NULL)) return; - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); /* do not call mail send immediately, just pile them all in the outbox */ - if (preparing_flush || gconf_client_get_bool ( - client, "/apps/evolution/mail/filters/flush-outbox", NULL)) { + if (preparing_flush || g_settings_get_boolean ( + settings, "flush-outbox")) { if (preparing_flush) g_source_remove (preparing_flush); @@ -438,7 +434,7 @@ ms_forward_to_cb (CamelFolder *folder, forward_to_flush_outbox_cb, session); } - g_object_unref (client); + g_object_unref (settings); } static void @@ -472,24 +468,13 @@ mail_session_make_key (CamelService *service, } static void -mail_session_check_junk_notify (GConfClient *gconf, - guint id, - GConfEntry *entry, +mail_session_check_junk_notify (GSettings *settings, + const gchar *key, CamelSession *session) { - gchar *key; - - g_return_if_fail (gconf_entry_get_key (entry) != NULL); - g_return_if_fail (gconf_entry_get_value (entry) != NULL); - - key = strrchr (gconf_entry_get_key (entry), '/'); - if (key) { - key++; - if (strcmp (key, "check_incoming") == 0) - camel_session_set_check_junk ( - session, gconf_value_get_bool ( - gconf_entry_get_value (entry))); - } + if (strcmp (key, "junk-check-incoming") == 0) + camel_session_set_check_junk ( + session, g_settings_get_boolean (settings, key)); } static const gchar * @@ -517,7 +502,7 @@ mail_session_get_junk_filter_name (EMailSession *session) "unknown to Evolution of type %s", G_OBJECT_TYPE_NAME (junk_filter)); - return ""; /* GConfBridge doesn't like NULL strings */ + return ""; } static void @@ -544,7 +529,7 @@ mail_session_set_junk_filter_name (EMailSession *session, } else { g_warning ( "Unrecognized junk filter name " - "'%s' in GConf", junk_filter_name); + "'%s' in GSettings", junk_filter_name); } } @@ -615,22 +600,12 @@ static void mail_session_finalize (GObject *object) { EMailSessionPrivate *priv; - GConfClient *client; priv = E_MAIL_SESSION_GET_PRIVATE (object); g_hash_table_destroy (priv->junk_filters); g_object_unref (priv->proxy); - client = gconf_client_get_default (); - - if (session_check_junk_notify_id != 0) { - gconf_client_notify_remove (client, session_check_junk_notify_id); - session_check_junk_notify_id = 0; - } - - g_object_unref (client); - g_free (mail_data_dir); g_free (mail_config_dir); @@ -657,6 +632,7 @@ mail_session_constructed (GObject *object) EExtensible *extensible; GType extension_type; GList *list, *iter; + GSettings *settings; priv = E_MAIL_SESSION_GET_PRIVATE (object); @@ -710,13 +686,11 @@ mail_session_constructed (GObject *object) g_list_free (list); - /* Bind the "/apps/evolution/mail/junk/default_plugin" - * GConf key to our "junk-filter-name" property. */ + /* Bind the "junk-default-plugin" GSettings key to our "junk-filter-name" property. */ - gconf_bridge_bind_property ( - gconf_bridge_get (), - "/apps/evolution/mail/junk/default_plugin", - object, "junk-filter-name"); + settings = g_settings_new ("org.gnome.evolution.mail"); + g_settings_bind (settings, "junk-default-plugin", object, "junk-filter-name", G_SETTINGS_BIND_DEFAULT); + g_object_unref (settings); } static CamelService * @@ -1313,7 +1287,7 @@ e_mail_session_class_init (EMailSessionClass *class) static void e_mail_session_init (EMailSession *session) { - GConfClient *client; + GSettings *settings; session->priv = E_MAIL_SESSION_GET_PRIVATE (session); session->priv->folder_cache = mail_folder_cache_new (); @@ -1324,24 +1298,18 @@ e_mail_session_init (EMailSession *session) /* Initialize the EAccount setup. */ e_account_writable (NULL, E_ACCOUNT_SOURCE_SAVE_PASSWD); - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); - gconf_client_add_dir ( - client, "/apps/evolution/mail/junk", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); camel_session_set_check_junk ( - CAMEL_SESSION (session), gconf_client_get_bool ( - client, "/apps/evolution/mail/junk/check_incoming", NULL)); - session_check_junk_notify_id = gconf_client_notify_add ( - client, "/apps/evolution/mail/junk", - (GConfClientNotifyFunc) mail_session_check_junk_notify, - session, NULL, NULL); + CAMEL_SESSION (session), g_settings_get_boolean ( + settings, "junk-check-incoming")); + g_signal_connect (settings, "changed", G_CALLBACK (mail_session_check_junk_notify), session); mail_config_reload_junk_headers (session); e_proxy_setup_proxy (session->priv->proxy); - g_object_unref (client); + g_object_unref (settings); } EMailSession * diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index ca90654faf..2bc3bf3d81 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -43,7 +43,6 @@ #include <string.h> #include <stdarg.h> -#include <gconf/gconf-client.h> #include <libedataserverui/e-passwords.h> #include "shell/e-shell.h" diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index b09d3cd4e2..06db108b8e 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -69,9 +69,6 @@ #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) #endif -#define GCONF_KEY_TEMPLATE_PLACEHOLDERS \ - "/apps/evolution/mail/template_placeholders" - typedef struct _AsyncContext AsyncContext; typedef struct _ForwardData ForwardData; @@ -159,7 +156,7 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, if (str->len) res = em_utils_prompt_user ( GTK_WINDOW (composer), - "/apps/evolution/mail/prompts/unwanted_html", + "prompt-on-unwanted-html", "mail:ask-send-html", str->str, NULL); else res = TRUE; @@ -174,7 +171,7 @@ ask_confirm_for_empty_subject (EMsgComposer *composer) { return em_utils_prompt_user ( GTK_WINDOW (composer), - "/apps/evolution/mail/prompts/empty_subject", + "prompt-on-empty-subject", "mail:ask-send-no-subject", NULL); } @@ -190,7 +187,7 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, return em_utils_prompt_user ( GTK_WINDOW (composer), - "/apps/evolution/mail/prompts/only_bcc", + "prompt-on-only-bcc", hidden_list_case ? "mail:ask-send-only-bcc-contact" : "mail:ask-send-only-bcc", NULL); @@ -333,7 +330,7 @@ composer_presend_check_recipients (EMsgComposer *composer) if (invalid_addrs) { if (!em_utils_prompt_user ( GTK_WINDOW (composer), - "/apps/evolution/mail/prompts/send_invalid_recip", + "prompt-on-invalid-recip", strstr (invalid_addrs->str, ", ") ? "mail:ask-send-invalid-recip-multi" : "mail:ask-send-invalid-recip-one", @@ -453,23 +450,21 @@ composer_presend_check_unwanted_html (EMsgComposer *composer) { EDestination **recipients; EComposerHeaderTable *table; - GConfClient *client; + GSettings *settings; gboolean check_passed = TRUE; gboolean html_mode; gboolean send_html; gboolean confirm_html; gint ii; - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); table = e_msg_composer_get_header_table (composer); recipients = e_composer_header_table_get_destinations (table); html_mode = gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (composer)); - send_html = gconf_client_get_bool ( - client, "/apps/evolution/mail/composer/send_html", NULL); - confirm_html = gconf_client_get_bool ( - client, "/apps/evolution/mail/prompts/unwanted_html", NULL); + send_html = g_settings_get_boolean (settings, "composer-send-html"); + confirm_html = g_settings_get_boolean (settings, "prompt-on-unwanted-html"); /* Only show this warning if our default is to send html. If it * isn't, we've manually switched into html mode in the composer @@ -493,7 +488,7 @@ composer_presend_check_unwanted_html (EMsgComposer *composer) if (recipients != NULL) e_destination_freev (recipients); - g_object_unref (client); + g_object_unref (settings); return check_passed; } @@ -1189,11 +1184,11 @@ typedef enum { } QuotingTextEnum; static struct { - const gchar * gconf_key; + const gchar * conf_key; const gchar * message; } conf_messages[] = { [QUOTING_ATTRIBUTION] = - { "/apps/evolution/mail/composer/message_attribution", + { "composer-message-attribution", /* Note to translators: this is the attribution string used * when quoting messages. Each ${Variable} gets replaced * with a value. To see a full list of available variables, @@ -1203,12 +1198,12 @@ static struct { }, [QUOTING_FORWARD] = - { "/apps/evolution/mail/composer/message_forward", + { "composer-message-forward", N_("-------- Forwarded Message --------") }, [QUOTING_ORIGINAL] = - { "/apps/evolution/mail/composer/message_original", + { "composer-message-original", N_("-----Original Message-----") } }; @@ -1216,12 +1211,12 @@ static struct { static gchar * quoting_text (QuotingTextEnum type) { - GConfClient *client; + GSettings *settings; gchar *text; - client = gconf_client_get_default (); - text = gconf_client_get_string (client, conf_messages[type].gconf_key, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + text = g_settings_get_string (settings, conf_messages[type].conf_key); + g_object_unref (settings); if (text && *text) return text; @@ -1263,15 +1258,19 @@ em_utils_edit_message (EShell *shell, /* Template specific code follows. */ if (folder_is_templates) { CamelDataWrapper *content; - GConfClient *gconf; + GSettings *settings; + gchar **strv; + gint i; GSList *clue_list = NULL; - gconf = gconf_client_get_default (); - /* Get the list from gconf */ - clue_list = gconf_client_get_list ( - gconf, GCONF_KEY_TEMPLATE_PLACEHOLDERS, - GCONF_VALUE_STRING, NULL ); - g_object_unref (gconf); + settings = g_settings_new ("org.gnome.evolution.eplugin.templates"); + + /* Get the list from GSettings */ + strv = g_settings_get_strv (settings, "template-placeholders"); + for (i = 0; strv[i] != NULL; i++) + clue_list = g_slist_append (clue_list, g_strdup (strv[i])); + g_object_unref (settings); + g_strfreev (strv); content = camel_medium_get_content (CAMEL_MEDIUM (message)); traverse_parts (clue_list, message, content); @@ -2342,14 +2341,12 @@ get_reply_to (CamelMimeMessage *message) reply_to = camel_mime_message_get_reply_to (message); if (reply_to) { - GConfClient *client; - const gchar *key; + GSettings *settings; gboolean ignore_list_reply_to; - client = gconf_client_get_default (); - key = "/apps/evolution/mail/composer/ignore_list_reply_to"; - ignore_list_reply_to = gconf_client_get_bool (client, key, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + ignore_list_reply_to = g_settings_get_boolean (settings, "composer-ignore-list-reply-to"); + g_object_unref (settings); if (ignore_list_reply_to && em_utils_is_munged_list_message (message)) reply_to = NULL; @@ -2786,15 +2783,14 @@ composer_set_body (EMsgComposer *composer, { gchar *text, *credits, *original; CamelMimePart *part; - GConfClient *client; + GSettings *settings; gboolean start_bottom, has_body_text = FALSE; guint32 validity_found = 0; const gchar *key; - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); - key = "/apps/evolution/mail/composer/reply_start_bottom"; - start_bottom = gconf_client_get_bool (client, key, NULL); + start_bottom = g_settings_get_boolean (settings, "composer-reply-start-bottom"); switch (style) { case E_MAIL_REPLY_STYLE_DO_NOT_QUOTE: @@ -2845,8 +2841,7 @@ composer_set_body (EMsgComposer *composer, gtkhtml_editor_run_command (editor, "block-selection"); gtkhtml_editor_run_command (editor, "cursor-bod"); - key = "/apps/evolution/mail/composer/top_signature"; - top_signature = gconf_client_get_bool (client, key, NULL); + top_signature = g_settings_get_boolean (settings, "composer-top-signature"); move_cursor_to_end = top_signature || !gtkhtml_editor_search_by_data ( @@ -2859,7 +2854,7 @@ composer_set_body (EMsgComposer *composer, gtkhtml_editor_run_command (editor, "unblock-selection"); } - g_object_unref (client); + g_object_unref (settings); } gchar * diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index 6e8e04c26f..6c8b97aa32 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -29,8 +29,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <gconf/gconf-client.h> - #include "em-folder-properties.h" #include "em-config.h" @@ -254,7 +252,7 @@ emfp_dialog_run (AsyncContext *context) CamelStore *local_store; CamelStore *parent_store; gboolean hide_deleted; - GConfClient *client; + GSettings *settings; const gchar *name; const gchar *key; @@ -272,10 +270,9 @@ emfp_dialog_run (AsyncContext *context) context->unread = camel_folder_summary_get_unread_count (context->folder->summary); deleted = camel_folder_summary_get_deleted_count (context->folder->summary); - client = gconf_client_get_default (); - key = "/apps/evolution/mail/display/show_deleted"; - hide_deleted = !gconf_client_get_bool (client, key, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + hide_deleted = !g_settings_get_boolean (settings, "show-deleted"); + g_object_unref (settings); /* * Do the calculation only for those accounts that support VTRASHes diff --git a/mail/em-utils.c b/mail/em-utils.c index 1423130772..a3be92d4c0 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -105,7 +105,7 @@ em_utils_ask_open_many (GtkWindow *parent, "Are you sure you want to open %d messages at once?", how_many), how_many); proceed = em_utils_prompt_user ( - parent, "/apps/evolution/mail/prompts/open_many", + parent, "prompt-on-open-many", "mail:ask-open-many", string, NULL); g_free (string); @@ -115,7 +115,7 @@ em_utils_ask_open_many (GtkWindow *parent, /** * em_utils_prompt_user: * @parent: parent window - * @promptkey: gconf key to check if we should prompt the user or not. + * @promptkey: settings key to check if we should prompt the user or not. * @tag: e_alert tag. * * Convenience function to query the user with a Yes/No dialog and a @@ -136,13 +136,13 @@ em_utils_prompt_user (GtkWindow *parent, GtkWidget *container; va_list ap; gint button; - GConfClient *client; + GSettings *settings; EAlert *alert = NULL; - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); - if (promptkey && !gconf_client_get_bool (client, promptkey, NULL)) { - g_object_unref (client); + if (promptkey && !g_settings_get_boolean (settings, promptkey)) { + g_object_unref (settings); return TRUE; } @@ -165,14 +165,13 @@ em_utils_prompt_user (GtkWindow *parent, button = gtk_dialog_run (GTK_DIALOG (dialog)); if (promptkey) - gconf_client_set_bool ( - client, promptkey, - !gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON (check)), NULL); + g_settings_set_boolean (settings, promptkey, + !gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON (check))); gtk_widget_destroy (dialog); - g_object_unref (client); + g_object_unref (settings); return button == GTK_RESPONSE_YES; } @@ -1229,16 +1228,15 @@ em_utils_message_to_html (CamelMimeMessage *message, ((EMFormat *) emfq)->composer = TRUE; if (!source) { - GConfClient *gconf; + GSettings *settings; gchar *charset; /* FIXME We should be getting this from the * current view, not the global setting. */ - gconf = gconf_client_get_default (); - charset = gconf_client_get_string ( - gconf, "/apps/evolution/mail/display/charset", NULL); + settings = g_settings_new ("org.gnome.evolution.mail"); + charset = g_settings_get_string (settings, "charset"); em_format_set_default_charset ((EMFormat *) emfq, charset); - g_object_unref (gconf); + g_object_unref (settings); g_free (charset); } @@ -1279,7 +1277,7 @@ em_utils_expunge_folder (GtkWidget *parent, if (!em_utils_prompt_user ( GTK_WINDOW (parent), - "/apps/evolution/mail/prompts/expunge", + "prompt-on-expunge", "mail:ask-expunge", description, NULL)) return; @@ -1303,7 +1301,7 @@ em_utils_empty_trash (GtkWidget *parent, g_return_if_fail (E_IS_MAIL_BACKEND (backend)); if (!em_utils_prompt_user ((GtkWindow *) parent, - "/apps/evolution/mail/prompts/empty_trash", + "prompt-on-empty-trash", "mail:ask-empty-trash", NULL)) return; diff --git a/mail/mail-config.c b/mail/mail-config.c index 7356772e99..1e628035a1 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -34,8 +34,6 @@ #include "e-util/e-account-utils.h" #include "e-util/e-signature-utils.h" -#include <gconf/gconf-client.h> - #include "e-mail-local.h" #include "e-mail-folder-utils.h" #include "mail-config.h" @@ -56,41 +54,38 @@ typedef struct { extern gint camel_header_param_encode_filenames_in_rfc_2047; static MailConfig *config = NULL; +static GSettings *mail_settings = NULL; static void -gconf_outlook_filenames_changed (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gpointer user_data) +settings_outlook_filenames_changed (GSettings *settings, + const gchar *key, + gpointer user_data) { - const gchar *key; - - g_return_if_fail (client != NULL); - - key = "/apps/evolution/mail/composer/outlook_filenames"; - /* pass option to the camel */ - if (gconf_client_get_bool (client, key, NULL)) + if (g_settings_get_boolean (settings, key)) camel_header_param_encode_filenames_in_rfc_2047 = 1; else camel_header_param_encode_filenames_in_rfc_2047 = 0; } static void -gconf_jh_headers_changed (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - EMailSession *session) +settings_jh_headers_changed (GSettings *settings, + const gchar *key, + EMailSession *session) { GSList *node; GPtrArray *name, *value; + gchar **strv; + gint i; g_slist_foreach (config->jh_header, (GFunc) g_free, NULL); g_slist_free (config->jh_header); + config->jh_header = NULL; - config->jh_header = gconf_client_get_list ( - client, "/apps/evolution/mail/junk/custom_header", - GCONF_VALUE_STRING, NULL); + strv = g_settings_get_strv (settings, "junk-custom-header"); + for (i = 0; strv[i] != NULL; i++) + config->jh_header = g_slist_append (config->jh_header, g_strdup (strv[i])); + g_strfreev (strv); node = config->jh_header; name = g_ptr_array_new (); @@ -114,55 +109,38 @@ gconf_jh_headers_changed (GConfClient *client, } static void -gconf_jh_check_changed (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - EMailSession *session) +settings_jh_check_changed (GSettings *settings, + const gchar *key, + EMailSession *session) { - config->jh_check = gconf_client_get_bool ( - client, "/apps/evolution/mail/junk/check_custom_header", NULL); + config->jh_check = g_settings_get_boolean (settings, "junk-check-custom-header"); if (!config->jh_check) { camel_session_set_junk_headers ( CAMEL_SESSION (session), NULL, NULL, 0); } else { - gconf_jh_headers_changed (client, 0, NULL, session); + settings_jh_headers_changed (settings, NULL, session); } } static void -gconf_bool_value_changed (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gboolean *save_location) +settings_bool_value_changed (GSettings *settings, + const gchar *key, + gboolean *save_location) { - GError *error = NULL; - - *save_location = gconf_client_get_bool (client, entry->key, &error); - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + *save_location = g_settings_get_boolean (settings, key); } static void -gconf_int_value_changed (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gint *save_location) +settings_int_value_changed (GSettings *settings, + const gchar *key, + gint *save_location) { - GError *error = NULL; - - *save_location = gconf_client_get_int (client, entry->key, &error); - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + *save_location = g_settings_get_int (settings, key); } void mail_config_write (void) { - GConfClient *client; EAccountList *account_list; ESignatureList *signature_list; @@ -175,9 +153,7 @@ mail_config_write (void) e_account_list_save (account_list); e_signature_list_save (signature_list); - client = gconf_client_get_default (); - gconf_client_suggest_sync (client, NULL); - g_object_unref (client); + g_settings_sync (); } gint @@ -193,24 +169,16 @@ mail_config_get_address_count (void) gint mail_config_get_sync_timeout (void) { - GConfClient *client; gint res = 60; - GError *error = NULL; - - client = gconf_client_get_default (); - res = gconf_client_get_int ( - client, "/apps/evolution/mail/sync_interval", &error); + res = g_settings_get_int (mail_settings, "sync-interval"); /* do not allow recheck sooner than every 30 seconds */ - if (error || res == 0) + if (res == 0) res = 60; else if (res < 30) res = 30; - if (error) - g_error_free (error); - return res; } @@ -249,11 +217,7 @@ mail_config_reload_junk_headers (EMailSession *session) if (config == NULL) mail_config_init (session); else { - GConfClient *client; - - client = gconf_client_get_default (); - gconf_jh_check_changed (client, 0, NULL, session); - g_object_unref (client); + settings_jh_check_changed (mail_settings, NULL, session); } } @@ -277,10 +241,6 @@ mail_config_get_lookup_book_local_only (void) void mail_config_init (EMailSession *session) { - GConfClient *client; - GConfClientNotifyFunc func; - const gchar *key; - g_return_if_fail (E_IS_MAIL_SESSION (session)); if (config) @@ -288,80 +248,40 @@ mail_config_init (EMailSession *session) config = g_new0 (MailConfig, 1); - client = gconf_client_get_default (); - - gconf_client_add_dir ( - client, "/apps/evolution/mail/prompts", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + mail_settings = g_settings_new ("org.gnome.evolution.mail"); /* Composer Configuration */ - gconf_client_add_dir ( - client, "/apps/evolution/mail/composer", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - - key = "/apps/evolution/mail/composer/outlook_filenames"; - func = (GConfClientNotifyFunc) gconf_outlook_filenames_changed; - gconf_outlook_filenames_changed (client, 0, NULL, NULL); - gconf_client_notify_add (client, key, func, NULL, NULL, NULL); + settings_outlook_filenames_changed (mail_settings, NULL, NULL); + g_signal_connect (mail_settings, "changed::composer-outlook-filenames", + G_CALLBACK (settings_outlook_filenames_changed), NULL); /* Display Configuration */ - gconf_client_add_dir ( - client, "/apps/evolution/mail/display", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + g_signal_connect (mail_settings, "changed::address-compress", + G_CALLBACK (settings_bool_value_changed), &config->address_compress); + config->address_compress = g_settings_get_boolean (mail_settings, "address-compress"); + + g_signal_connect (mail_settings, "changed::address-count", + G_CALLBACK (settings_int_value_changed), &config->address_count); + config->address_count = g_settings_get_int (mail_settings, "address-count"); - key = "/apps/evolution/mail/display/address_compress"; - func = (GConfClientNotifyFunc) gconf_bool_value_changed; - gconf_client_notify_add ( - client, key, func, - &config->address_compress, NULL, NULL); - config->address_compress = gconf_client_get_bool (client, key, NULL); + /* Junk Configuration */ - key = "/apps/evolution/mail/display/address_count"; - func = (GConfClientNotifyFunc) gconf_int_value_changed; - gconf_client_notify_add ( - client, key, func, - &config->address_count, NULL, NULL); - config->address_count = gconf_client_get_int (client, key, NULL); + g_signal_connect (mail_settings, "changed::junk-check-custom-header", + G_CALLBACK (settings_jh_check_changed), session); + config->jh_check = g_settings_get_boolean (mail_settings, "junk-check-custom-header"); - /* Font Configuration */ + g_signal_connect (mail_settings, "changed::junk-custom-header", + G_CALLBACK (settings_jh_headers_changed), session); - gconf_client_add_dir ( - client, "/apps/evolution/mail/display/fonts", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + g_signal_connect (mail_settings, "changed::junk-lookup-addressbook", + G_CALLBACK (settings_bool_value_changed), &config->book_lookup); + config->book_lookup = g_settings_get_boolean (mail_settings, "junk-lookup-addressbook"); - /* Junk Configuration */ + g_signal_connect (mail_settings, "changed::junk-lookup-addressbook-local-only", + G_CALLBACK (settings_bool_value_changed), &config->book_lookup_local_only); + config->book_lookup_local_only = g_settings_get_boolean (mail_settings, "junk-lookup-addressbook-local-only"); - gconf_client_add_dir ( - client, "/apps/evolution/mail/junk", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - - key = "/apps/evolution/mail/junk/check_custom_header"; - func = (GConfClientNotifyFunc) gconf_jh_check_changed; - gconf_client_notify_add (client, key, func, session, NULL, NULL); - config->jh_check = gconf_client_get_bool (client, key, NULL); - - key = "/apps/evolution/mail/junk/custom_header"; - func = (GConfClientNotifyFunc) gconf_jh_headers_changed; - gconf_client_notify_add (client, key, func, session, NULL, NULL); - - key = "/apps/evolution/mail/junk/lookup_addressbook"; - func = (GConfClientNotifyFunc) gconf_bool_value_changed; - gconf_client_notify_add ( - client, key, func, - &config->book_lookup, NULL, NULL); - config->book_lookup = gconf_client_get_bool (client, key, NULL); - - key = "/apps/evolution/mail/junk/lookup_addressbook_local_only"; - func = (GConfClientNotifyFunc) gconf_bool_value_changed; - gconf_client_notify_add ( - client, key, func, - &config->book_lookup_local_only, NULL, NULL); - config->book_lookup_local_only = - gconf_client_get_bool (client, key, NULL); - - gconf_jh_check_changed (client, 0, NULL, session); - - g_object_unref (client); + settings_jh_check_changed (mail_settings, NULL, session); } diff --git a/mail/mail-config.ui b/mail/mail-config.ui index 4fc87677a8..02bf640a3a 100644 --- a/mail/mail-config.ui +++ b/mail/mail-config.ui @@ -4334,6 +4334,7 @@ For example: "Work" or "Personal"</property> <property name="receives_default">False</property> <property name="use_action_appearance">False</property> <property name="use_underline">True</property> + <property name="active">True</property> <property name="draw_indicator">True</property> </object> <packing> diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 639e75bfe9..80d6f1ec0c 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -1035,7 +1035,7 @@ vfolder_load_storage (EMailBackend *backend) MailFolderCache *folder_cache; EMailSession *session; gchar *xmlfile; - GConfClient *client; + GSettings *settings; g_return_if_fail (E_IS_MAIL_BACKEND (backend)); @@ -1112,11 +1112,11 @@ vfolder_load_storage (EMailBackend *backend) } /* reenable the feature if required */ - client = gconf_client_get_default (); - key = "/apps/evolution/mail/display/enable_vfolders"; - if (!gconf_client_get_bool (client, key, NULL)) - gconf_client_set_bool (client, key, TRUE, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + key = "enable-vfolders"; + if (!g_settings_get_boolean (settings, key)) + g_settings_set_boolean (settings, key, TRUE); + g_object_unref (settings); folder_cache = e_mail_session_get_folder_cache (session); diff --git a/mail/message-list.c b/mail/message-list.c index e01f42fca2..e9793355fb 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -36,8 +36,6 @@ #include <glib/gi18n.h> #include <glib/gstdio.h> -#include <gconf/gconf-client.h> - #include "e-util/e-icon-factory.h" #include "e-util/e-poolv.h" #include "e-util/e-util-private.h" @@ -1961,18 +1959,21 @@ filter_date (time_t date) static ECell * create_composite_cell (gint col) { ECell *cell_vbox, *cell_hbox, *cell_sub, *cell_date, *cell_from, *cell_tree, *cell_attach; - GConfClient *client; + GSettings *settings; gchar *fixed_name = NULL; gboolean show_email; gint alt_col = (col == COL_FROM) ? COL_SENDER : COL_RECIPIENTS; gboolean same_font = FALSE; - client = gconf_client_get_default (); - show_email = gconf_client_get_bool (client, "/apps/evolution/mail/display/show_email", NULL); - same_font = gconf_client_get_bool (client, "/apps/evolution/mail/display/vertical_view_fonts", NULL); - if (!same_font) - fixed_name = gconf_client_get_string (client, "/desktop/gnome/interface/monospace_font_name", NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + show_email = g_settings_get_boolean (settings, "show-email"); + same_font = g_settings_get_boolean (settings, "vertical-view-fonts"); + g_object_unref (settings); + if (!same_font) { + settings = g_settings_new ("org.gnome.desktop.interface"); + fixed_name = g_settings_get_string (settings, "monospace-font-name"); + g_object_unref (settings); + } cell_vbox = e_cell_vbox_new (); @@ -2830,34 +2831,13 @@ message_list_selectable_init (ESelectableInterface *interface) interface->select_all = message_list_selectable_select_all; } -static gboolean -read_boolean_with_default (GConfClient *gconf, - const gchar *key, - gboolean def_value) -{ - GConfValue *value; - gboolean res; - - g_return_val_if_fail (gconf != NULL, def_value); - g_return_val_if_fail (key != NULL, def_value); - - value = gconf_client_get (gconf, key, NULL); - if (!value) - return def_value; - - res = gconf_value_get_bool (value); - gconf_value_free (value); - - return res; -} - static void message_list_construct (MessageList *message_list) { AtkObject *a11y; gboolean constructed; gchar *etspecfile; - GConfClient *client; + GSettings *settings; message_list->model = e_tree_memory_callbacks_new (ml_tree_icon_at, @@ -2883,15 +2863,13 @@ message_list_construct (MessageList *message_list) message_list); - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); e_tree_memory_set_expanded_default ( E_TREE_MEMORY (message_list->model), - read_boolean_with_default ( - client, "/apps/evolution/mail/display/thread_expand", TRUE)); + g_settings_get_boolean (settings, "thread-expand")); message_list->priv->thread_latest = - read_boolean_with_default ( - client, "/apps/evolution/mail/display/thread_latest", TRUE); - g_object_unref (client); + g_settings_get_boolean (settings, "thread-latest"); + g_object_unref (settings); /* * The etree @@ -3902,7 +3880,7 @@ message_list_set_folder (MessageList *message_list, { ETreeModel *etm = message_list->model; gboolean hide_deleted; - GConfClient *client; + GSettings *settings; g_return_if_fail (IS_MESSAGE_LIST (message_list)); @@ -3991,9 +3969,9 @@ message_list_set_folder (MessageList *message_list, folder, "changed", G_CALLBACK (folder_changed), message_list); - client = gconf_client_get_default (); - hide_deleted = !gconf_client_get_bool (client, "/apps/evolution/mail/display/show_deleted", NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + hide_deleted = !g_settings_get_boolean (settings, "show-deleted"); + g_object_unref (settings); message_list->hidedeleted = hide_deleted && non_trash_folder; @@ -5031,7 +5009,7 @@ mail_regen_list (MessageList *ml, gboolean scroll_to_cursor) { struct _regen_list_msg *m; - GConfClient *client; + GSettings *settings; const gchar *key; gboolean thread_subject; @@ -5049,10 +5027,9 @@ mail_regen_list (MessageList *ml, mail_regen_cancel (ml); - client = gconf_client_get_default (); - key = "/apps/evolution/mail/display/thread_subject"; - thread_subject = gconf_client_get_bool (client, key, NULL); - g_object_unref (client); + settings = g_settings_new ("org.gnome.evolution.mail"); + thread_subject = g_settings_get_boolean (settings, "thread-subject"); + g_object_unref (settings); #ifndef BROKEN_ETREE /* this can sometimes crash,so ... */ |