diff options
-rw-r--r-- | composer/e-composer-private.c | 43 | ||||
-rw-r--r-- | composer/e-composer-private.h | 9 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 73 |
3 files changed, 33 insertions, 92 deletions
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c index bd7b46a4ee..467d5c6731 100644 --- a/composer/e-composer-private.c +++ b/composer/e-composer-private.c @@ -216,9 +216,6 @@ e_composer_private_constructed (EMsgComposer *composer) priv->extra_hdr_names = g_ptr_array_new (); priv->extra_hdr_values = g_ptr_array_new (); - priv->gconf_bridge_binding_ids = g_array_new ( - FALSE, FALSE, sizeof (guint)); - priv->inline_images = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) g_free, @@ -499,24 +496,6 @@ e_composer_private_constructed (EMsgComposer *composer) void e_composer_private_dispose (EMsgComposer *composer) { - if (composer->priv->gconf_bridge_binding_ids) { - GConfBridge *bridge; - GArray *array; - guint binding_id; - - bridge = gconf_bridge_get (); - array = composer->priv->gconf_bridge_binding_ids; - - while (array->len > 0) { - binding_id = g_array_index (array, guint, 0); - gconf_bridge_unbind (bridge, binding_id); - g_array_remove_index_fast (array, 0); - } - - g_array_free (composer->priv->gconf_bridge_binding_ids, TRUE); - composer->priv->gconf_bridge_binding_ids = NULL; - } - if (composer->priv->shell != NULL) { g_object_remove_weak_pointer ( G_OBJECT (composer->priv->shell), @@ -631,36 +610,26 @@ e_composer_find_data_file (const gchar *basename) gchar * e_composer_get_default_charset (void) { - GConfClient *client; + GSettings *settings; gchar *charset; - GError *error = NULL; - client = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.mail"); - charset = gconf_client_get_string ( - client, COMPOSER_GCONF_CHARSET_KEY, &error); - if (error != NULL) { - g_warning ("%s", error->message); - g_clear_error (&error); - } + charset = g_settings_get_string (settings, "composer-charset"); /* See what charset the mailer is using. - * XXX We should not have to know where this lives in GConf. + * XXX We should not have to know where this lives in GSettings. * Need a mail_config_get_default_charset() that does this. */ if (!charset || charset[0] == '\0') { g_free (charset); - charset = gconf_client_get_string ( - client, MAIL_GCONF_CHARSET_KEY, NULL); + charset = g_settings_get_string (settings, "charset"); if (charset != NULL && *charset == '\0') { g_free (charset); charset = NULL; - } else if (error != NULL) { - g_warning ("%s", error->message); - g_clear_error (&error); } } - g_object_unref (client); + g_object_unref (settings); if (charset == NULL) charset = g_strdup (camel_iconv_locale_charset ()); diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h index 69e3169de3..040f8d8d10 100644 --- a/composer/e-composer-private.h +++ b/composer/e-composer-private.h @@ -30,9 +30,6 @@ #include <glib/gstdio.h> #include <glib/gi18n-lib.h> -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> - #include <libebackend/e-extensible.h> #include "e-composer-actions.h" @@ -45,7 +42,6 @@ #include "e-util/e-plugin-ui.h" #include "e-util/e-selection.h" #include "e-util/e-util.h" -#include "e-util/gconf-bridge.h" #include "widgets/misc/e-activity-bar.h" #include "widgets/misc/e-alert-bar.h" #include "widgets/misc/e-attachment.h" @@ -71,8 +67,6 @@ /* Composer configuration keys */ #define COMPOSER_GCONF_PREFIX \ MAIL_GCONF_PREFIX "/composer" -#define COMPOSER_GCONF_CHARSET_KEY \ - COMPOSER_GCONF_PREFIX "/charset" #define COMPOSER_GCONF_INLINE_SPELLING_KEY \ COMPOSER_GCONF_PREFIX "/inline_spelling" #define COMPOSER_GCONF_MAGIC_LINKS_KEY \ @@ -85,8 +79,6 @@ COMPOSER_GCONF_PREFIX "/top_signature" #define COMPOSER_GCONF_SEND_HTML_KEY \ COMPOSER_GCONF_PREFIX "/send_html" -#define COMPOSER_GCONF_SPELL_LANGUAGES_KEY \ - COMPOSER_GCONF_PREFIX "/spell_languages" #define COMPOSER_GCONF_WINDOW_PREFIX \ COMPOSER_GCONF_PREFIX "/window" @@ -121,7 +113,6 @@ struct _EMsgComposerPrivate { GPtrArray *extra_hdr_names; GPtrArray *extra_hdr_values; - GArray *gconf_bridge_binding_ids; GtkWidget *focused_entry; diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 82bca68514..3b7208d85f 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -2110,13 +2110,14 @@ msg_composer_constructed (GObject *object) /* Restore Persistent State */ - array = composer->priv->gconf_bridge_binding_ids; + /* FIXME: need to bind this to GSettings */ + /* array = composer->priv->gconf_bridge_binding_ids; */ - binding_id = gconf_bridge_bind_window ( - gconf_bridge_get (), - COMPOSER_GCONF_WINDOW_PREFIX, - GTK_WINDOW (composer), TRUE, FALSE); - g_array_append_val (array, binding_id); + /* binding_id = gconf_bridge_bind_window ( */ + /* gconf_bridge_get (), */ + /* COMPOSER_GCONF_WINDOW_PREFIX, */ + /* GTK_WINDOW (composer), TRUE, FALSE); */ + /* g_array_append_val (array, binding_id); */ /* Honor User Preferences */ @@ -5032,21 +5033,19 @@ e_msg_composer_get_attachment_view (EMsgComposer *composer) GList * e_load_spell_languages (void) { - GConfClient *client; + GSettings *settings; GList *spell_languages = NULL; - GSList *list; - const gchar *key; - GError *error = NULL; + gchar **strv; + gint i; - /* Ask GConf for a list of spell check language codes. */ - client = gconf_client_get_default (); - key = COMPOSER_GCONF_SPELL_LANGUAGES_KEY; - list = gconf_client_get_list (client, key, GCONF_VALUE_STRING, &error); - g_object_unref (client); + /* Ask GSettings for a list of spell check language codes. */ + settings = g_settings_new ("org.gnome.evolution.mail"); + strv = g_settings_get_strv (settings, "composer-spell-languages"); + g_object_unref (settings); /* Convert the codes to spell language structs. */ - while (list != NULL) { - gchar *language_code = list->data; + for (i = 0; strv[i] != NULL; i++) { + gchar *language_code = strv[i]; const GtkhtmlSpellLanguage *language; language = gtkhtml_spell_language_lookup (language_code); @@ -5054,13 +5053,12 @@ e_load_spell_languages (void) spell_languages = g_list_prepend ( spell_languages, (gpointer) language); - list = g_slist_delete_link (list, list); g_free (language_code); } spell_languages = g_list_reverse (spell_languages); - /* Pick a default spell language if GConf came back empty. */ + /* Pick a default spell language if it came back empty. */ if (spell_languages == NULL) { const GtkhtmlSpellLanguage *language; @@ -5069,54 +5067,37 @@ e_load_spell_languages (void) if (language) { spell_languages = g_list_prepend ( spell_languages, (gpointer) language); - - /* Don't overwrite the stored spell check language - * codes if there was a problem retrieving them. */ - if (error == NULL) - e_save_spell_languages (spell_languages); } } - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } - return spell_languages; } void e_save_spell_languages (GList *spell_languages) { - GConfClient *client; - GSList *list = NULL; - const gchar *key; - GError *error = NULL; + GSettings *settings; + GPtrArray *lang_array; /* Build a list of spell check language codes. */ + lang_array = g_ptr_array_new (); while (spell_languages != NULL) { const GtkhtmlSpellLanguage *language; const gchar *language_code; language = spell_languages->data; language_code = gtkhtml_spell_language_get_code (language); - list = g_slist_prepend (list, (gpointer) language_code); + g_ptr_array_add (lang_array, language_code); spell_languages = g_list_next (spell_languages); } - list = g_slist_reverse (list); - - /* Save the language codes to GConf. */ - client = gconf_client_get_default (); - key = COMPOSER_GCONF_SPELL_LANGUAGES_KEY; - gconf_client_set_list (client, key, GCONF_VALUE_STRING, list, &error); - g_object_unref (client); + g_ptr_array_add (lang_array, NULL); - g_slist_free (list); + /* Save the language codes to GSettings. */ + settings = g_settings_new ("org.gnome.evolution.mail"); + g_settings_set_strv (settings, "composer-spell-languages", (const char * const *) lang_array->pdata); + g_object_unref (settings); - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + g_ptr_array_free (lang_array, TRUE); } |