From f23970409448c8937491caaea1765b52d4b04c24 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sat, 11 Sep 2010 12:40:31 +0200 Subject: [PATCH] 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 91c42a0715..3673fea878 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -8125,17 +8125,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: @@ -8152,7 +8168,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 c247f364cd..125d315b7a 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -803,6 +803,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.