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



commit 24239e0f596e70fc6c324fc7d4f362bc6afc63c0
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 |   22 +++++++++++++++++++---
 gtk/gtkwidget.h |    2 ++
 2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ce798e1..35fc32a 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8155,17 +8155,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 (widget->priv->rc_style)
     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:
@@ -8182,7 +8198,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 7bc20cb..07f769e 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -805,6 +805,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]