[gtk+] Preserve gtk_widget_get_default_style semantics
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Preserve gtk_widget_get_default_style semantics
- Date: Mon, 17 Sep 2012 11:53:28 +0000 (UTC)
commit 70384941fb85eabc6e0383a3a64f3f3b68c23e77
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 17 07:51:04 2012 -0400
Preserve gtk_widget_get_default_style semantics
Make sure that we return a GtkStyle even if there's no screen yet.
gtk/deprecated/gtkstyle.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtk/deprecated/gtkstyle.c b/gtk/deprecated/gtkstyle.c
index 12a8826..c7ea815 100644
--- a/gtk/deprecated/gtkstyle.c
+++ b/gtk/deprecated/gtkstyle.c
@@ -4045,15 +4045,23 @@ gtk_widget_get_default_style_for_screen (GdkScreen *screen)
* gtk_css_provider_get_default() to obtain a #GtkStyleProvider
* with the default widget style information.
*/
-GtkStyle*
+GtkStyle *
gtk_widget_get_default_style (void)
{
+ static GtkStyle *default_style = NULL;
+ GtkStyle *style = NULL;
GdkScreen *screen = gdk_screen_get_default ();
if (screen)
- return gtk_widget_get_default_style_for_screen (screen);
+ style = gtk_widget_get_default_style_for_screen (screen);
else
- return NULL;
+ {
+ if (default_style == NULL)
+ default_style = gtk_style_new ();
+ style = default_style;
+ }
+
+ return style;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]