[gtk+/gtk-style-context: 88/276] GtkWidget: Generate GtkWidgetPath on set_parent.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 88/276] GtkWidget: Generate GtkWidgetPath on set_parent.
- Date: Sat, 23 Oct 2010 19:02:30 +0000 (UTC)
commit 3519328d92d2cba4ed47491c874f3c61902549aa
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jun 13 17:26:18 2010 +0200
GtkWidget: Generate GtkWidgetPath on set_parent.
There's no need to wait for realize() to have the right widget style.
gtk/gtkwidget.c | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 51d4a83..cfb8b89 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4299,17 +4299,6 @@ gtk_widget_realize (GtkWidget *widget)
gdk_window_set_support_multidevice (priv->window, TRUE);
_gtk_widget_enable_device_events (widget);
-
- context = g_object_get_qdata (G_OBJECT (widget),
- quark_style_context);
- if (context)
- {
- GtkWidgetPath *path;
-
- path = gtk_widget_get_path (widget);
- gtk_style_context_set_path (context, path);
- gtk_widget_path_free (path);
- }
}
}
@@ -7315,7 +7304,8 @@ gtk_widget_set_parent (GtkWidget *widget,
{
GtkWidgetPrivate *priv;
GtkStateData data;
-
+ GtkStyleContext *context;
+
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_IS_WIDGET (parent));
g_return_if_fail (widget != parent);
@@ -7388,6 +7378,17 @@ gtk_widget_set_parent (GtkWidget *widget,
{
gtk_widget_queue_compute_expand (parent);
}
+
+ context = g_object_get_qdata (G_OBJECT (widget),
+ quark_style_context);
+ if (context)
+ {
+ GtkWidgetPath *path;
+
+ path = gtk_widget_get_path (widget);
+ gtk_style_context_set_path (context, path);
+ gtk_widget_path_free (path);
+ }
}
/**
@@ -13269,7 +13270,7 @@ gtk_widget_get_path (GtkWidget *widget)
GList *regions, *reg;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
- g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
+ g_return_val_if_fail ((widget->parent || gtk_widget_is_toplevel (widget)), NULL);
parent = widget->priv->parent;
@@ -13358,7 +13359,8 @@ gtk_widget_get_style_context (GtkWidget *widget)
GTK_STYLE_PROVIDER_PRIORITY_USER);
}
- if (gtk_widget_get_realized (widget))
+ if (widget->parent ||
+ gtk_widget_is_toplevel (widget))
{
GtkWidgetPath *path;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]