[epiphany/wip/exalm/960] web-view: Use theme_base_color as background



commit 72ac9106d657cb771c585601ad2668329f932e3f
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Oct 1 19:59:30 2019 +0500

    web-view: Use theme_base_color as background
    
    Fixes https://gitlab.gnome.org/GNOME/epiphany/issues/960

 embed/ephy-web-view.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 96d885aa8..aeedd254c 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1162,6 +1162,25 @@ process_terminated_cb (EphyWebView                       *web_view,
   }
 }
 
+static void
+style_updated_cb (EphyWebView *web_view,
+                  gpointer     user_data)
+{
+  GtkStyleContext *context;
+  GdkRGBA color;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (web_view));
+  if (!gtk_style_context_lookup_color (context, "theme_base_color", &color)) {
+    /* Fall back to white */
+    color.red = 1;
+    color.green = 1;
+    color.blue = 1;
+    color.alpha = 1;
+  }
+
+  webkit_web_view_set_background_color (WEBKIT_WEB_VIEW (web_view), &color);
+}
+
 static void
 ephy_web_view_constructed (GObject *object)
 {
@@ -1175,6 +1194,10 @@ ephy_web_view_constructed (GObject *object)
                     G_CALLBACK (process_terminated_cb), NULL);
   g_signal_connect_swapped (webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (web_view)),
                             "changed", G_CALLBACK (update_navigation_flags), web_view);
+
+  g_signal_connect (web_view, "style-updated",
+                    G_CALLBACK (style_updated_cb), NULL);
+  style_updated_cb (web_view, NULL);
 }
 
 static void


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