[gtk+/gtk-style-context: 57/191] GtkStyleContext: allow late set_path() calls.



commit 5a5de9f9de8090d566d5da7804bb5bbf5c7facd3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Apr 11 19:46:57 2010 +0200

    GtkStyleContext: allow late set_path() calls.
    
    Now the properties will only be regenerated whenever there's a GtkWidgetPath
    to query about.

 gtk/gtkstylecontext.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index cb6bab6..9bf51e1 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -196,7 +196,8 @@ gtk_style_context_add_provider (GtkStyleContext  *context,
   if (!added)
     priv->providers = g_list_append (priv->providers, new_data);
 
-  rebuild_properties (context);
+  if (priv->widget_path)
+    rebuild_properties (context);
 }
 
 void
@@ -233,7 +234,7 @@ gtk_style_context_remove_provider (GtkStyleContext  *context,
       list = list->next;
     }
 
-  if (removed)
+  if (removed && priv->widget_path)
     rebuild_properties (context);
 }
 
@@ -358,7 +359,10 @@ gtk_style_context_set_path (GtkStyleContext *context,
     }
 
   if (path)
-    priv->widget_path = gtk_widget_path_copy (path);
+    {
+      priv->widget_path = gtk_widget_path_copy (path);
+      rebuild_properties (context);
+    }
 }
 
 G_CONST_RETURN GtkWidgetPath *



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