summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorAlberts Muktupavels <[email protected]>2014-11-24 17:36:49 +0200
committerlukefromdc <[email protected]>2019-04-23 18:40:58 +0000
commit6da9dbba7d41ce8b08dcd9e4a025b409a59b68a0 (patch)
tree5ffb2307eecc6747d4b7da765f3dbfbd63083d13 /src/ui
parentc1f37cbc48d9f781bfb029ad40c0f0ed6689ac92 (diff)
downloadmarco-6da9dbba7d41ce8b08dcd9e4a025b409a59b68a0.tar.bz2
marco-6da9dbba7d41ce8b08dcd9e4a025b409a59b68a0.tar.xz
theme-viewer: avoid deprecated gtk_widget_override_background_color
origin commit by: https://gitlab.gnome.org/GNOME/metacity/commit/542a2b4
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/theme-viewer.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c
index 65df34fa..d4331b8e 100644
--- a/src/ui/theme-viewer.c
+++ b/src/ui/theme-viewer.c
@@ -366,6 +366,26 @@ menu_contents (void)
return frame;
}
+static void
+override_background_color (GtkWidget *widget,
+ GdkRGBA *rgba)
+{
+ gchar *css;
+ GtkCssProvider *provider;
+
+ provider = gtk_css_provider_new ();
+
+ css = g_strdup_printf ("* { background-color: %s; }",
+ gdk_rgba_to_string (rgba));
+ gtk_css_provider_load_from_data (provider, css, -1, NULL);
+ g_free (css);
+
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+}
+
static GtkWidget*
border_only_contents (void)
{
@@ -380,7 +400,7 @@ border_only_contents (void)
color.green = 0;
color.blue = 0.6;
color.alpha = 1.0;
- gtk_widget_override_background_color (event_box, 0, &color);
+ override_background_color (event_box, &color);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
@@ -545,7 +565,7 @@ preview_collection (int font_size,
desktop_color.blue = 0.65;
desktop_color.alpha = 1.0;
- gtk_widget_override_background_color (eventbox, 0, &desktop_color);
+ override_background_color (eventbox, &desktop_color);
i = 0;
while (i < META_FRAME_TYPE_LAST)
@@ -771,7 +791,7 @@ previews_of_button_layouts (void)
desktop_color.blue = 0.65;
desktop_color.alpha = 1.0;
- gtk_widget_override_background_color (eventbox, 0, &desktop_color);
+ override_background_color (eventbox, &desktop_color);
i = 0;
while (i < BUTTON_LAYOUT_COMBINATIONS)