[evolution] Drop (optional) dependency on org.gnome.settings-daemon.plugins.xsettings schema



commit 1efbfc212eb10892634263674ba1a7137437d6ad
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jun 17 10:10:32 2020 +0200

    Drop (optional) dependency on org.gnome.settings-daemon.plugins.xsettings schema
    
    It had been used, if installed, to guide WebKiGTK font antialiasing,
    but WebKitGTK can guess this on its own, even on Wayland.
    
    Partly related to https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/-/issues/31

 src/e-util/e-web-view.c                     | 69 ++---------------------------
 src/e-util/e-web-view.h                     |  1 -
 src/modules/webkit-editor/e-webkit-editor.c | 42 +-----------------
 3 files changed, 4 insertions(+), 108 deletions(-)
---
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index b0fd84f078..895bd814f6 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -75,9 +75,6 @@ struct _EWebViewPrivate {
        gulong font_name_changed_handler_id;
        gulong monospace_font_name_changed_handler_id;
 
-       GSettings *aliasing_settings;
-       gulong antialiasing_changed_handler_id;
-
        GHashTable *old_settings;
 
        WebKitFindController *find_controller;
@@ -1117,13 +1114,6 @@ web_view_dispose (GObject *object)
                priv->monospace_font_name_changed_handler_id = 0;
        }
 
-       if (priv->antialiasing_changed_handler_id > 0) {
-               g_signal_handler_disconnect (
-                       priv->aliasing_settings,
-                       priv->antialiasing_changed_handler_id);
-               priv->antialiasing_changed_handler_id = 0;
-       }
-
        if (priv->found_text_handler_id > 0) {
                g_signal_handler_disconnect (
                        priv->find_controller,
@@ -1147,7 +1137,6 @@ web_view_dispose (GObject *object)
        g_clear_object (&priv->open_proxy);
        g_clear_object (&priv->print_proxy);
        g_clear_object (&priv->save_as_proxy);
-       g_clear_object (&priv->aliasing_settings);
        g_clear_object (&priv->font_settings);
 
        /* Chain up to parent's dispose() method. */
@@ -1296,9 +1285,7 @@ static void
 web_view_initialize (WebKitWebView *web_view)
 {
        EContentRequest *content_request;
-       const gchar *id = "org.gnome.settings-daemon.plugins.xsettings";
-       GSettings *settings = NULL, *font_settings;
-       GSettingsSchema *settings_schema;
+       GSettings *font_settings;
 
        content_request = e_file_request_new ();
        e_web_view_register_content_request_for_scheme (E_WEB_VIEW (web_view), "evo-file", content_request);
@@ -1311,22 +1298,11 @@ web_view_initialize (WebKitWebView *web_view)
        e_web_view_register_content_request_for_scheme (E_WEB_VIEW (web_view), "gtk-stock", content_request);
        g_object_unref (content_request);
 
-       /* Optional schema */
-       settings_schema = g_settings_schema_source_lookup (
-               g_settings_schema_source_get_default (), id, FALSE);
-
-       if (settings_schema) {
-               settings = e_util_ref_settings (id);
-               g_settings_schema_unref (settings_schema);
-       }
-
        font_settings = e_util_ref_settings ("org.gnome.desktop.interface");
-       e_web_view_update_fonts_settings (
-               font_settings, settings, NULL, NULL, GTK_WIDGET (web_view));
+
+       e_web_view_update_fonts_settings (font_settings, NULL, NULL, GTK_WIDGET (web_view));
 
        g_object_unref (font_settings);
-       if (settings)
-               g_object_unref (settings);
 }
 
 static void
@@ -2403,7 +2379,6 @@ e_web_view_init (EWebView *web_view)
        GtkUIManager *ui_manager;
        GtkActionGroup *action_group;
        EPopupAction *popup_action;
-       GSettingsSchema *settings_schema;
        GSettings *settings;
        const gchar *domain = GETTEXT_PACKAGE;
        const gchar *id;
@@ -2459,21 +2434,6 @@ e_web_view_init (EWebView *web_view)
        web_view->priv->monospace_font_name_changed_handler_id = handler_id;
        g_object_unref (settings);
 
-       /* This schema is optional.  Use if available. */
-       id = "org.gnome.settings-daemon.plugins.xsettings";
-       settings_schema = g_settings_schema_source_lookup (
-               g_settings_schema_source_get_default (), id, FALSE);
-       if (settings_schema != NULL) {
-               settings = e_util_ref_settings (id);
-               web_view->priv->aliasing_settings = g_object_ref (settings);
-               handler_id = g_signal_connect_swapped (
-                       settings, "changed::antialiasing",
-                       G_CALLBACK (e_web_view_test_change_and_update_fonts_cb), web_view);
-               web_view->priv->antialiasing_changed_handler_id = handler_id;
-               g_object_unref (settings);
-               g_settings_schema_unref (settings_schema);
-       }
-
        action_group = gtk_action_group_new ("uri");
        gtk_action_group_set_translation_domain (action_group, domain);
        gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
@@ -3289,15 +3249,12 @@ e_web_view_get_citation_color_for_level (gint level)
 
 void
 e_web_view_update_fonts_settings (GSettings *font_settings,
-                                  GSettings *aliasing_settings,
                                   PangoFontDescription *ms_font,
                                   PangoFontDescription *vw_font,
                                   GtkWidget *view_widget)
 {
        gboolean clean_ms = FALSE, clean_vw = FALSE;
-       gchar *aa = NULL;
        const gchar *styles[] = { "normal", "oblique", "italic" };
-       const gchar *smoothing = NULL;
        gchar fsbuff[G_ASCII_DTOSTR_BUF_SIZE];
        GdkColor *link = NULL;
        GdkColor *visited = NULL;
@@ -3356,25 +3313,6 @@ e_web_view_update_fonts_settings (GSettings *font_settings,
                pango_font_description_get_weight (vw),
                styles[pango_font_description_get_style (vw)]);
 
-       if (aliasing_settings != NULL)
-               aa = g_settings_get_string (
-                       aliasing_settings, "antialiasing");
-
-       if (g_strcmp0 (aa, "none") == 0)
-               smoothing = "none";
-       else if (g_strcmp0 (aa, "grayscale") == 0)
-               smoothing = "antialiased";
-       else if (g_strcmp0 (aa, "rgba") == 0)
-               smoothing = "subpixel-antialiased";
-
-       if (smoothing != NULL)
-               g_string_append_printf (
-                       stylesheet,
-                       " -webkit-font-smoothing: %s;\n",
-                       smoothing);
-
-       g_free (aa);
-
        g_string_append (stylesheet, "}\n");
 
        g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
@@ -3683,7 +3621,6 @@ e_web_view_update_fonts (EWebView *web_view)
 
        e_web_view_update_fonts_settings (
                web_view->priv->font_settings,
-               web_view->priv->aliasing_settings,
                ms, vw, GTK_WIDGET (web_view));
 
        pango_font_description_free (ms);
diff --git a/src/e-util/e-web-view.h b/src/e-util/e-web-view.h
index 1bde0cd00f..ef238d8f68 100644
--- a/src/e-util/e-web-view.h
+++ b/src/e-util/e-web-view.h
@@ -139,7 +139,6 @@ void                e_web_view_register_content_request_for_scheme
                                                 EContentRequest *content_request);
 void           e_web_view_update_fonts_settings
                                                (GSettings *font_settings,
-                                                GSettings *aliasing_settings,
                                                 PangoFontDescription *ms_font,
                                                 PangoFontDescription *vw_font,
                                                 GtkWidget *view_widget);
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 71bfce1777..d6fef27358 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -129,7 +129,6 @@ struct _EWebKitEditorPrivate {
 
        GSettings *mail_settings;
        GSettings *font_settings;
-       GSettings *aliasing_settings;
 
        GHashTable *old_settings;
 
@@ -1160,9 +1159,8 @@ webkit_editor_update_styles (EContentEditor *editor)
 {
        EWebKitEditor *wk_editor;
        gboolean mark_citations, use_custom_font;
-       gchar *font, *aa = NULL, *citation_color;
+       gchar *font, *citation_color;
        const gchar *styles[] = { "normal", "oblique", "italic" };
-       const gchar *smoothing = NULL;
        gchar fsbuff[G_ASCII_DTOSTR_BUF_SIZE];
        GString *stylesheet;
        PangoFontDescription *ms, *vw;
@@ -1221,25 +1219,6 @@ webkit_editor_update_styles (EContentEditor *editor)
                pango_font_description_get_weight (vw),
                styles[pango_font_description_get_style (vw)]);
 
-       if (wk_editor->priv->aliasing_settings != NULL)
-               aa = g_settings_get_string (
-                       wk_editor->priv->aliasing_settings, "antialiasing");
-
-       if (g_strcmp0 (aa, "none") == 0)
-               smoothing = "none";
-       else if (g_strcmp0 (aa, "grayscale") == 0)
-               smoothing = "antialiased";
-       else if (g_strcmp0 (aa, "rgba") == 0)
-               smoothing = "subpixel-antialiased";
-
-       if (smoothing != NULL)
-               g_string_append_printf (
-                       stylesheet,
-                       " -webkit-font-smoothing: %s;\n",
-                       smoothing);
-
-       g_free (aa);
-
        g_string_append (stylesheet, "}\n");
 
        g_ascii_dtostr (fsbuff, G_ASCII_DTOSTR_BUF_SIZE,
@@ -4266,12 +4245,6 @@ webkit_editor_dispose (GObject *object)
        if (priv->cancellable)
                g_cancellable_cancel (priv->cancellable);
 
-       if (priv->aliasing_settings != NULL) {
-               g_signal_handlers_disconnect_by_data (priv->aliasing_settings, object);
-               g_object_unref (priv->aliasing_settings);
-               priv->aliasing_settings = NULL;
-       }
-
        if (priv->current_user_stylesheet != NULL) {
                g_free (priv->current_user_stylesheet);
                priv->current_user_stylesheet = NULL;
@@ -5576,7 +5549,6 @@ static void
 e_webkit_editor_init (EWebKitEditor *wk_editor)
 {
        GSettings *g_settings;
-       GSettingsSchema *settings_schema;
 
        wk_editor->priv = E_WEBKIT_EDITOR_GET_PRIVATE (wk_editor);
 
@@ -5658,18 +5630,6 @@ e_webkit_editor_init (EWebKitEditor *wk_editor)
                g_settings, "changed::composer-inherit-theme-colors",
                G_CALLBACK (webkit_editor_style_settings_changed_cb), wk_editor);
 
-       /* This schema is optional.  Use if available. */
-       settings_schema = g_settings_schema_source_lookup (
-               g_settings_schema_source_get_default (),
-               "org.gnome.settings-daemon.plugins.xsettings", FALSE);
-       if (settings_schema != NULL) {
-               g_settings = e_util_ref_settings ("org.gnome.settings-daemon.plugins.xsettings");
-               g_signal_connect (
-                       g_settings, "changed::antialiasing",
-                       G_CALLBACK (webkit_editor_settings_changed_cb), wk_editor);
-               wk_editor->priv->aliasing_settings = g_settings;
-       }
-
        wk_editor->priv->html_mode = TRUE;
        wk_editor->priv->changed = FALSE;
        wk_editor->priv->can_copy = FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]