diff options
author | Milan Crha <mcrha@redhat.com> | 2012-06-15 15:04:08 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-06-15 15:04:08 +0800 |
commit | 94daae3dba8e86e88f69320bc82795fe660ec9cd (patch) | |
tree | 9965d4f6dfc6d48adecd0b9084442185d73d58c7 /modules/mail | |
parent | 08dedf0a8a520b55c51a8117dc015915ec39f7fe (diff) | |
download | gsoc2013-evolution-94daae3dba8e86e88f69320bc82795fe660ec9cd.tar gsoc2013-evolution-94daae3dba8e86e88f69320bc82795fe660ec9cd.tar.gz gsoc2013-evolution-94daae3dba8e86e88f69320bc82795fe660ec9cd.tar.bz2 gsoc2013-evolution-94daae3dba8e86e88f69320bc82795fe660ec9cd.tar.lz gsoc2013-evolution-94daae3dba8e86e88f69320bc82795fe660ec9cd.tar.xz gsoc2013-evolution-94daae3dba8e86e88f69320bc82795fe660ec9cd.tar.zst gsoc2013-evolution-94daae3dba8e86e88f69320bc82795fe660ec9cd.zip |
Remove the last remaining usage of GConf
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-config-format-html.c | 61 | ||||
-rw-r--r-- | modules/mail/e-mail-config-web-view.c | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-settings.c | 9 | ||||
-rw-r--r-- | modules/mail/em-composer-prefs.c | 2 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 62 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.h | 2 |
6 files changed, 52 insertions, 86 deletions
diff --git a/modules/mail/e-mail-config-format-html.c b/modules/mail/e-mail-config-format-html.c index a764e7d729..4b53d2dc28 100644 --- a/modules/mail/e-mail-config-format-html.c +++ b/modules/mail/e-mail-config-format-html.c @@ -32,28 +32,29 @@ static gpointer parent_class; static void -headers_changed_cb (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, +headers_changed_cb (GSettings *settings, + const gchar *key, gpointer user_data) { - GSList *header_config_list, *p; + gint ii; + gchar **headers; EExtension *extension; EMailFormatter *formatter; - g_return_if_fail (client != NULL); + g_return_if_fail (settings != NULL); + + if (key && !g_str_equal (key, "headers")) + return; extension = user_data; formatter = E_MAIL_FORMATTER (e_extension_get_extensible (extension)); - header_config_list = gconf_client_get_list ( - client, "/apps/evolution/mail/display/headers", - GCONF_VALUE_STRING, NULL); + headers = g_settings_get_strv (settings, "headers"); e_mail_formatter_clear_headers (formatter); - for (p = header_config_list; p; p = g_slist_next (p)) { + for (ii = 0; headers && headers[ii]; ii++) { EMailReaderHeader *h; - gchar *xml = (gchar *) p->data; + const gchar *xml = headers[ii]; h = e_mail_reader_header_from_xml (xml); if (h && h->enabled) @@ -64,26 +65,10 @@ headers_changed_cb (GConfClient *client, e_mail_reader_header_free (h); } - if (!header_config_list) + if (!headers || !headers[0]) e_mail_formatter_set_default_headers (formatter); - g_slist_foreach (header_config_list, (GFunc) g_free, NULL); - g_slist_free (header_config_list); -} - -static void -remove_header_notify_cb (gpointer data) -{ - GConfClient *client; - guint notify_id; - - notify_id = GPOINTER_TO_INT (data); - g_return_if_fail (notify_id != 0); - - client = gconf_client_get_default (); - gconf_client_notify_remove (client, notify_id); - gconf_client_remove_dir (client, "/apps/evolution/mail/display", NULL); - g_object_unref (client); + g_strfreev (headers); } static void @@ -93,8 +78,7 @@ mail_config_format_html_constructed (GObject *object) EExtensible *extensible; EShellSettings *shell_settings; EShell *shell; - GConfClient *client; - guint notify_id; + GSettings *settings; extension = E_EXTENSION (object); extensible = e_extension_get_extensible (extension); @@ -140,21 +124,16 @@ mail_config_format_html_constructed (GObject *object) G_BINDING_SYNC_CREATE); - client = gconf_client_get_default (); - gconf_client_add_dir ( - client, "/apps/evolution/mail/display", - GCONF_CLIENT_PRELOAD_NONE, NULL); - notify_id = gconf_client_notify_add ( - client, "/apps/evolution/mail/display/headers", - (GConfClientNotifyFunc) headers_changed_cb, - object, NULL, NULL); + settings = g_settings_new ("org.gnome.evolution.mail"); + g_signal_connect (settings, "changed", G_CALLBACK (headers_changed_cb), object); g_object_set_data_full ( - G_OBJECT (extensible), "reader-header-notify-id", - GINT_TO_POINTER (notify_id), remove_header_notify_cb); + G_OBJECT (extensible), "reader-header-settings", + settings, g_object_unref); + /* Initial synchronization */ - headers_changed_cb (client, 0, NULL, object); + headers_changed_cb (settings, NULL, object); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (parent_class)->constructed (object); diff --git a/modules/mail/e-mail-config-web-view.c b/modules/mail/e-mail-config-web-view.c index 12e75dfbdf..2099511d62 100644 --- a/modules/mail/e-mail-config-web-view.c +++ b/modules/mail/e-mail-config-web-view.c @@ -79,7 +79,7 @@ mail_config_web_view_load_style (EMailConfigWebView *extension) /* 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 GConf. */ + * a style sheet for the EWebView using values from GSettings. */ custom_fonts = e_shell_settings_get_boolean ( extension->shell_settings, "mail-use-custom-fonts"); diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c index 8243f79e3a..3b0c6b59c6 100644 --- a/modules/mail/e-mail-shell-settings.c +++ b/modules/mail/e-mail-shell-settings.c @@ -25,8 +25,6 @@ #include "e-mail-shell-settings.h" -#include <gconf/gconf-client.h> - #include <mail/e-mail-backend.h> #include <shell/e-shell.h> @@ -368,13 +366,6 @@ e_mail_shell_settings_init (EShellBackend *shell_backend) MAIL_SCHEMA, "paned-view-headers-state"); - /* These properties use transform functions to convert - * GConf values to forms more useful to Evolution. We - * have to use separate properties because GConfBridge - * does not support transform functions. Much of this - * is backward-compatibility cruft for poorly designed - * GConf schemas. */ - e_shell_settings_install_property ( g_param_spec_enum ( "mail-sidebar-ellipsize", diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 647e7892be..58700f26b1 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -208,7 +208,7 @@ spell_language_save (EMComposerPrefs *prefs) } spell_languages = g_list_reverse (spell_languages); - /* Update the GConf value. */ + /* Update the GSettings value. */ e_save_spell_languages (spell_languages); g_list_free (spell_languages); diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index 9262ff8bb0..b2381b2cf2 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -100,7 +100,6 @@ em_mailer_prefs_finalize (GObject *object) EMMailerPrefs *prefs = (EMMailerPrefs *) object; g_object_unref (prefs->builder); - g_object_unref (prefs->gconf); g_object_unref (prefs->settings); /* Chain up to parent's finalize() method. */ @@ -120,9 +119,6 @@ static void em_mailer_prefs_init (EMMailerPrefs *preferences) { preferences->settings = g_settings_new ("org.gnome.evolution.mail"); - - /* XXX Still need this for a little while longer. */ - preferences->gconf = gconf_client_get_default (); } enum { @@ -376,12 +372,12 @@ emmp_header_add_sensitivity (EMMailerPrefs *prefs) static void emmp_save_headers (EMMailerPrefs *prefs) { - GSList *header_list; + GPtrArray *headers; GtkTreeIter iter; gboolean valid; /* Headers */ - header_list = NULL; + headers = g_ptr_array_new_full (3, g_free); valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (prefs->header_list_store), &iter); while (valid) { struct _EMailReaderHeader h; @@ -397,16 +393,18 @@ emmp_save_headers (EMMailerPrefs *prefs) h.enabled = enabled; if ((xml = e_mail_reader_header_to_xml (&h))) - header_list = g_slist_append (header_list, xml); + g_ptr_array_add (headers, xml); g_free (h.name); valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (prefs->header_list_store), &iter); } - gconf_client_set_list (prefs->gconf, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, header_list, NULL); - g_slist_foreach (header_list, (GFunc) g_free, NULL); - g_slist_free (header_list); + g_ptr_array_add (headers, NULL); + + g_settings_set_strv (prefs->settings, "headers", (const gchar * const *) headers->pdata); + + g_ptr_array_free (headers, TRUE); } static void @@ -706,7 +704,8 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, EMailSession *session, EShell *shell) { - GSList *header_config_list, *header_add_list, *p; + GSList *header_add_list, *p; + gchar **headers_config; EShellSettings *shell_settings; GHashTable *default_header_hash; GtkWidget *toplevel; @@ -928,7 +927,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, G_BINDING_SYNC_CREATE); /* headers */ - locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/headers", NULL); + locked = !g_settings_is_writable (prefs->settings, "headers"); widget = e_builder_get_widget (prefs->builder, "photo_show"); g_object_bind_property ( @@ -999,7 +998,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, NULL); /* populated the listview with entries; firstly we add all the default headers, and then - * we add read header configuration out of gconf. If a header in gconf is a default header, + * we add read header configuration out of settings. If a header in settings is a default header, * we update the enabled flag accordingly */ header_add_list = NULL; @@ -1015,31 +1014,30 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, header_add_list = g_slist_append (header_add_list, h); } - /* read stored headers from gconf */ - header_config_list = gconf_client_get_list (prefs->gconf, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, NULL); - p = header_config_list; - while (p) { - EMailReaderHeader *h, *def; - gchar *xml = (gchar *) p->data; - - h = e_mail_reader_header_from_xml (xml); - if (h) { - def = g_hash_table_lookup (default_header_hash, h->name); - if (def) { - def->enabled = h->enabled; - e_mail_reader_header_free (h); - } else { - h->is_default = FALSE; - header_add_list = g_slist_append (header_add_list, h); + /* read stored headers from settings */ + headers_config = g_settings_get_strv (prefs->settings, "headers"); + if (headers_config) { + for (i = 0; headers_config[i]; i++) { + EMailReaderHeader *h, *def; + const gchar *xml = headers_config[i]; + + h = e_mail_reader_header_from_xml (xml); + if (h) { + def = g_hash_table_lookup (default_header_hash, h->name); + if (def) { + def->enabled = h->enabled; + e_mail_reader_header_free (h); + } else { + h->is_default = FALSE; + header_add_list = g_slist_append (header_add_list, h); + } } } - p = p->next; + g_strfreev (headers_config); } g_hash_table_destroy (default_header_hash); - g_slist_foreach (header_config_list, (GFunc) g_free, NULL); - g_slist_free (header_config_list); p = header_add_list; while (p) { diff --git a/modules/mail/em-mailer-prefs.h b/modules/mail/em-mailer-prefs.h index d672d2cc9b..4466e166e8 100644 --- a/modules/mail/em-mailer-prefs.h +++ b/modules/mail/em-mailer-prefs.h @@ -24,7 +24,6 @@ #define EM_MAILER_PREFS_H #include <gtk/gtk.h> -#include <gconf/gconf-client.h> #include <shell/e-shell.h> #include <widgets/misc/e-preferences-window.h> @@ -57,7 +56,6 @@ struct _EMMailerPrefs { GtkVBox parent_object; GtkBuilder *builder; - GConfClient *gconf; GSettings *settings; /* General tab */ |