From e12d27ec69532e490a6b293cd44c11796b19b222 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Fri, 29 Jul 2016 19:58:04 +0200 Subject: GTK+-3 close button: style context fix maybe i will drop this! taken from: https://git.gnome.org/browse/gedit/commit/?id=df3ce63 --- pluma/pluma-close-button.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'pluma') diff --git a/pluma/pluma-close-button.c b/pluma/pluma-close-button.c index 4a4286e5..3fab3e35 100644 --- a/pluma/pluma-close-button.c +++ b/pluma/pluma-close-button.c @@ -34,7 +34,6 @@ static void pluma_close_button_init (PlumaCloseButton *button) { GtkWidget *image; - GtkStyleContext *context; GtkCssProvider *css; GError *error = NULL; const gchar button_style[] = @@ -57,17 +56,21 @@ pluma_close_button_init (PlumaCloseButton *button) /* make it as small as possible */ css = gtk_css_provider_new (); - if (!gtk_css_provider_load_from_data (css, button_style, - -1, &error)) + if (gtk_css_provider_load_from_data (css, button_style, + -1, &error)) + { + GtkStyleContext *context; + + context = gtk_widget_get_style_context (GTK_WIDGET (button)); + gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (css), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (css); + } + else { g_warning ("%s", error->message); g_error_free (error); } - - context = gtk_widget_get_style_context (GTK_WIDGET (button)); - gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (css), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (css); } #else pluma_close_button_style_set (GtkWidget *button, -- cgit v1.2.1