From 2e87aa81fc94f5d9564421e036adae7b48e7380a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 10 Mar 2013 09:53:12 -0400 Subject: Remove EMailShellSettings. EShellSettings predates GSettings and is no longer necessary. GSettings allows binding GObject properties to GSettings keys, with optional mapping functions. That fulfills the purpose of EShellSettings. --- composer/e-composer-private.c | 44 +++++++++++++++++++++++-------------------- composer/e-msg-composer.c | 39 ++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 36 deletions(-) (limited to 'composer') 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; } -- cgit