[gtk+/gtk-style-context: 147/276] GtkWidget: Construct style for partial widget hierarchies.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 147/276] GtkWidget: Construct style for partial widget hierarchies.
- Date: Sat, 23 Oct 2010 19:07:28 +0000 (UTC)
commit 10fee8251c8ae1c2d8e49c34b86a5504f97b3da5
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Aug 2 16:11:40 2010 +0200
GtkWidget: Construct style for partial widget hierarchies.
Some unparented widgets like to ask style details, so now the style is
constructed regardless of the parent being present or not, and then
reconstructed if the parent changes.
gtk/gtkwidget.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2b01d30..c398334 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13276,7 +13276,6 @@ gtk_widget_get_path (GtkWidget *widget)
GList *regions, *reg;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
- g_return_val_if_fail ((widget->parent || gtk_widget_is_toplevel (widget)), NULL);
parent = widget->priv->parent;
@@ -13335,6 +13334,7 @@ gtk_widget_get_style_context (GtkWidget *widget)
if (G_UNLIKELY (!context))
{
static GtkCssProvider *css_provider = NULL;
+ GtkWidgetPath *path;
context = g_object_new (GTK_TYPE_STYLE_CONTEXT, NULL);
g_object_set_qdata_full (G_OBJECT (widget),
@@ -13365,18 +13365,13 @@ gtk_widget_get_style_context (GtkWidget *widget)
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
- if (widget->parent ||
- gtk_widget_is_toplevel (widget))
- {
- GtkWidgetPath *path;
- path = gtk_widget_get_path (widget);
- gtk_style_context_set_path (context, path);
- gtk_widget_path_free (path);
+ path = gtk_widget_get_path (widget);
+ gtk_style_context_set_path (context, path);
+ gtk_widget_path_free (path);
- gtk_style_context_set_screen (context,
- gtk_widget_get_screen (widget));
- }
+ gtk_style_context_set_screen (context,
+ gtk_widget_get_screen (widget));
}
return context;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]