[gtk+/gtk-style-context] GtkWidget: Add gtk_widget_reset_style().



commit 30b03c0c989b8ec5f8ce5c6dbce9fa6b577789c8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Sep 11 12:40:31 2010 +0200

    GtkWidget: Add gtk_widget_reset_style().
    
    This function is analogous to gtk_widget_reset_rc_styles(),
    updates style recursively on a widget.

 gtk/gtkwidget.c |   24 ++++++++++++++++++++----
 gtk/gtkwidget.h |    2 ++
 2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 58052c5..91841dc 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7220,17 +7220,33 @@ _gtk_widget_propagate_screen_changed (GtkWidget    *widget,
 }
 
 static void
-reset_rc_styles_recurse (GtkWidget *widget, gpointer data)
+reset_style_recurse (GtkWidget *widget, gpointer data)
 {
+  GtkStyleContext *context;
+
+#if 0
   if (gtk_widget_has_rc_style (widget))
     gtk_widget_reset_rc_style (widget);
-  
+#endif
+
+  context = g_object_get_qdata (G_OBJECT (widget),
+                                quark_style_context);
+  if (context)
+    gtk_style_context_invalidate (context);
+
   if (GTK_IS_CONTAINER (widget))
     gtk_container_forall (GTK_CONTAINER (widget),
-			  reset_rc_styles_recurse,
+			  reset_style_recurse,
 			  NULL);
 }
 
+void
+gtk_widget_reset_style (GtkWidget *widget)
+{
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+
+  reset_style_recurse (widget, NULL);
+}
 
 /**
  * gtk_widget_reset_rc_styles:
@@ -7247,7 +7263,7 @@ gtk_widget_reset_rc_styles (GtkWidget *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  reset_rc_styles_recurse (widget, NULL);
+  reset_style_recurse (widget, NULL);
 }
 
 /**
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 8deda54..7d59db6 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -858,6 +858,8 @@ gchar* gtk_widget_get_composite_name	(GtkWidget	*widget);
 /* Descend recursively and set rc-style on all widgets without user styles */
 void       gtk_widget_reset_rc_styles   (GtkWidget      *widget);
 
+void       gtk_widget_reset_style       (GtkWidget      *widget);
+
 /* Push/pop pairs, to change default values upon a widget's creation.
  * This will override the values that got set by the
  * gtk_widget_set_default_* () functions.



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