[gtk+/wip/baedert/drawing: 396/396] GtkStyleContext: Create path node in _new
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 396/396] GtkStyleContext: Create path node in _new
- Date: Wed, 19 Jul 2017 11:43:41 +0000 (UTC)
commit a5ded5bd204a8e06b552d1ade3d15f05109b42da
Author: Timm Bäder <mail baedert org>
Date: Wed Jul 19 13:13:28 2017 +0200
GtkStyleContext: Create path node in _new
So we can avoid creating a GtkCssPathNode in _init and then throwing it
away right after when using the _new_with_node constructor, which is the
one we use for all widgets.
gtk/gtkstylecontext.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index ee7d7d5..67d96f9 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -305,10 +305,6 @@ gtk_style_context_init (GtkStyleContext *context)
gtk_style_context_set_cascade (context,
_gtk_settings_get_style_cascade (gtk_settings_get_for_screen
(priv->screen), 1));
-
- /* Create default info store */
- priv->cssnode = gtk_css_path_node_new (context);
- gtk_css_node_set_state (priv->cssnode, GTK_STATE_FLAG_DIR_LTR);
}
static void
@@ -458,7 +454,15 @@ gtk_style_context_get_node (GtkStyleContext *context)
GtkStyleContext *
gtk_style_context_new (void)
{
- return g_object_new (GTK_TYPE_STYLE_CONTEXT, NULL);
+ GtkStyleContext *context;
+
+ context = g_object_new (GTK_TYPE_STYLE_CONTEXT, NULL);
+
+ /* Create default info store */
+ context->priv->cssnode = gtk_css_path_node_new (context);
+ gtk_css_node_set_state (context->priv->cssnode, GTK_STATE_FLAG_DIR_LTR);
+
+ return context;
}
GtkStyleContext *
@@ -468,8 +472,8 @@ gtk_style_context_new_for_node (GtkCssNode *node)
g_return_val_if_fail (GTK_IS_CSS_NODE (node), NULL);
- context = gtk_style_context_new ();
- g_set_object (&context->priv->cssnode, node);
+ context = g_object_new (GTK_TYPE_STYLE_CONTEXT, NULL);
+ context->priv->cssnode = g_object_ref (node);
return context;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]