diff options
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-composer-header-table.c | 56 | ||||
-rw-r--r-- | composer/e-composer-private.c | 43 | ||||
-rw-r--r-- | composer/e-composer-private.h | 33 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 103 |
4 files changed, 66 insertions, 169 deletions
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index 2dd94eb875..5083ef38a1 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -25,7 +25,6 @@ #include <libedataserverui/e-name-selector.h> #include <shell/e-shell.h> -#include <e-util/gconf-bridge.h> #include <misc/e-signature-combo-box.h> #include "e-msg-composer.h" @@ -63,7 +62,6 @@ enum { struct _EComposerHeaderTablePrivate { EComposerHeader *headers[E_COMPOSER_NUM_HEADERS]; - guint gconf_bindings[E_COMPOSER_NUM_HEADERS]; GtkWidget *signature_label; GtkWidget *signature_combo_box; ENameSelector *name_selector; @@ -305,35 +303,30 @@ from_header_should_be_visible (EComposerHeaderTable *table) static void composer_header_table_setup_mail_headers (EComposerHeaderTable *table) { - GConfBridge *bridge; + GSettings *settings; gint ii; - bridge = gconf_bridge_get (); + settings = g_settings_new ("org.gnome.evolution.mail"); for (ii = 0; ii < E_COMPOSER_NUM_HEADERS; ii++) { EComposerHeader *header; const gchar *key; - guint binding_id; gboolean sensitive; gboolean visible; - binding_id = table->priv->gconf_bindings[ii]; header = e_composer_header_table_get_header (table, ii); - if (binding_id > 0) - gconf_bridge_unbind (bridge, binding_id); - switch (ii) { case E_COMPOSER_HEADER_BCC: - key = COMPOSER_GCONF_PREFIX "/show_mail_bcc"; + key = "composer-show-bcc"; break; case E_COMPOSER_HEADER_CC: - key = COMPOSER_GCONF_PREFIX "/show_mail_cc"; + key = "composer-show-cc"; break; case E_COMPOSER_HEADER_REPLY_TO: - key = COMPOSER_GCONF_PREFIX "/show_mail_reply_to"; + key = "composer-show-reply-to"; break; default: @@ -365,42 +358,36 @@ composer_header_table_setup_mail_headers (EComposerHeaderTable *table) e_composer_header_set_sensitive (header, sensitive); e_composer_header_set_visible (header, visible); - if (key != NULL) - binding_id = gconf_bridge_bind_property ( - bridge, key, G_OBJECT (header), "visible"); - else - binding_id = 0; - - table->priv->gconf_bindings[ii] = binding_id; + if (key != NULL) { + g_settings_unbind (settings, key); + g_settings_bind (settings, key, G_OBJECT (header), "visible", G_SETTINGS_BIND_DEFAULT); + } } + + g_object_unref (settings); } static void composer_header_table_setup_post_headers (EComposerHeaderTable *table) { - GConfBridge *bridge; + GSettings *settings; gint ii; - bridge = gconf_bridge_get (); + settings = g_settings_new ("org.gnome.evolution.mail"); for (ii = 0; ii < E_COMPOSER_NUM_HEADERS; ii++) { EComposerHeader *header; const gchar *key; - guint binding_id; - binding_id = table->priv->gconf_bindings[ii]; header = e_composer_header_table_get_header (table, ii); - if (binding_id > 0) - gconf_bridge_unbind (bridge, binding_id); - switch (ii) { case E_COMPOSER_HEADER_FROM: - key = COMPOSER_GCONF_PREFIX "/show_post_from"; + key = "composer-show-post-from"; break; case E_COMPOSER_HEADER_REPLY_TO: - key = COMPOSER_GCONF_PREFIX "/show_post_reply_to"; + key = "composer-show-post-reply-to"; break; default: @@ -423,14 +410,13 @@ composer_header_table_setup_post_headers (EComposerHeaderTable *table) break; } - if (key != NULL) - binding_id = gconf_bridge_bind_property ( - bridge, key, G_OBJECT (header), "visible"); - else - binding_id = 0; - - table->priv->gconf_bindings[ii] = binding_id; + if (key != NULL) { + g_settings_unbind (settings, key); + g_settings_bind (settings, key, G_OBJECT (header), "visible", G_SETTINGS_BIND_DEFAULT); + } } + + g_object_unref (settings); } static void 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..695510949a 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" @@ -62,34 +58,6 @@ #include <X11/XF86keysym.h> #endif -/* Mail configuration keys */ -#define MAIL_GCONF_PREFIX \ - "/apps/evolution/mail" -#define MAIL_GCONF_CHARSET_KEY \ - MAIL_GCONF_PREFIX "/format/charset" - -/* 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 \ - COMPOSER_GCONF_PREFIX "/magic_links" -#define COMPOSER_GCONF_MAGIC_SMILEYS_KEY \ - COMPOSER_GCONF_PREFIX "/magic_smileys" -#define COMPOSER_GCONF_REQUEST_RECEIPT_KEY \ - COMPOSER_GCONF_PREFIX "/request_receipt" -#define COMPOSER_GCONF_TOP_SIGNATURE_KEY \ - 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" - /* Shorthand, requires a variable named "composer". */ #define ACTION(name) (E_COMPOSER_ACTION_##name (composer)) @@ -121,7 +89,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 5ed9fad575..b7aaf883a5 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -128,8 +128,6 @@ static void handle_multipart_signed (EMsgComposer *composer, static void e_msg_composer_alert_sink_init (EAlertSinkInterface *interface); -gboolean check_blacklisted_file (gchar *filename); - G_DEFINE_TYPE_WITH_CODE ( EMsgComposer, e_msg_composer, @@ -2065,10 +2063,8 @@ msg_composer_constructed (GObject *object) EWebView *web_view; GtkUIManager *ui_manager; GtkToggleAction *action; - GArray *array; const gchar *id; gboolean active; - guint binding_id; editor = GTKHTML_EDITOR (object); composer = E_MSG_COMPOSER (object); @@ -2110,13 +2106,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 */ @@ -4007,25 +4004,24 @@ merge_always_cc_and_bcc (EComposerHeaderTable *table, e_destination_freev (addrv); } -static const gchar *blacklisted_files [] = {".", "etc", ".."}; +static const gchar *blacklisted_files [] = { ".", "etc", ".." }; -gboolean check_blacklisted_file (gchar *filename) +static gboolean +check_blacklisted_file (gchar *filename) { gboolean blacklisted = FALSE; - gint i,j,len; + guint ii, jj, length; gchar **filename_part; filename_part = g_strsplit (filename, G_DIR_SEPARATOR_S, -1); - len = g_strv_length(filename_part); - for(i = 0; !blacklisted && i < G_N_ELEMENTS(blacklisted_files); i++) - { - for (j = 0; !blacklisted && j < len;j++) - if (g_str_has_prefix (filename_part[j], blacklisted_files[i])) + length = g_strv_length (filename_part); + for (ii = 0; !blacklisted && ii < G_N_ELEMENTS (blacklisted_files); ii++) { + for (jj = 0; !blacklisted && jj < length; jj++) + if (g_str_has_prefix (filename_part[jj], blacklisted_files[ii])) blacklisted = TRUE; } + g_strfreev (filename_part); - g_strfreev(filename_part); - return blacklisted; } @@ -4120,14 +4116,13 @@ handle_mailto (EMsgComposer *composer, } else if (!g_ascii_strcasecmp (header, "attach") || !g_ascii_strcasecmp (header, "attachment")) { EAttachment *attachment; - gboolean check = FALSE; camel_url_decode (content); - check = check_blacklisted_file(content); - if(check) + if (check_blacklisted_file (content)) e_alert_submit ( - E_ALERT_SINK (composer), - "mail:blacklisted-file", content, NULL); + E_ALERT_SINK (composer), + "mail:blacklisted-file", + content, NULL); if (g_ascii_strncasecmp (content, "file:", 5) == 0) attachment = e_attachment_new_for_uri (content); else @@ -5032,21 +5027,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 ii; - /* 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 (ii = 0; strv[ii] != NULL; ii++) { + gchar *language_code = strv[ii]; const GtkhtmlSpellLanguage *language; language = gtkhtml_spell_language_lookup (language_code); @@ -5054,7 +5047,6 @@ 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); } @@ -5069,54 +5061,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, (gpointer) 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 gchar * 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); } |