forked from AuroraMiddleware/gtk
stylecontext: Add gtk_style_context_add_named()
This is an intermediate step for cssnode introduction. It gives a name for the node created by saving the style context.
This commit is contained in:
parent
385fda80b4
commit
72615a1b16
@ -1179,6 +1179,29 @@ gtk_style_context_get_parent (GtkStyleContext *context)
|
||||
return context->priv->parent;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_style_context_save_named (GtkStyleContext *context,
|
||||
const char *name)
|
||||
{
|
||||
GtkStyleContextPrivate *priv;
|
||||
GtkCssNode *cssnode;
|
||||
|
||||
priv = context->priv;
|
||||
|
||||
/* Make sure we have the style existing. It is the
|
||||
* parent of the new saved node after all. */
|
||||
if (!gtk_style_context_is_saved (context))
|
||||
gtk_style_context_lookup_style (context);
|
||||
|
||||
cssnode = gtk_css_transient_node_new (priv->cssnode);
|
||||
gtk_css_node_set_parent (cssnode, gtk_style_context_get_root (context));
|
||||
if (name)
|
||||
gtk_css_node_set_name (cssnode, g_intern_string (name));
|
||||
|
||||
priv->saved_nodes = g_slist_prepend (priv->saved_nodes, priv->cssnode);
|
||||
priv->cssnode = cssnode;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_save:
|
||||
* @context: a #GtkStyleContext
|
||||
@ -1196,24 +1219,9 @@ gtk_style_context_get_parent (GtkStyleContext *context)
|
||||
void
|
||||
gtk_style_context_save (GtkStyleContext *context)
|
||||
{
|
||||
GtkStyleContextPrivate *priv;
|
||||
GtkCssNode *cssnode;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
priv = context->priv;
|
||||
|
||||
/* Make sure we have the style existing. It is the
|
||||
* parent of the new saved node after all.
|
||||
*/
|
||||
if (!gtk_style_context_is_saved (context))
|
||||
gtk_style_context_lookup_style (context);
|
||||
|
||||
cssnode = gtk_css_transient_node_new (priv->cssnode);
|
||||
gtk_css_node_set_parent (cssnode, gtk_style_context_get_root (context));
|
||||
|
||||
priv->saved_nodes = g_slist_prepend (priv->saved_nodes, priv->cssnode);
|
||||
priv->cssnode = cssnode;
|
||||
gtk_style_context_save_named (context, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,9 @@ const char * gtk_style_context_get_id (GtkStyleContext *c
|
||||
GtkStyleProviderPrivate *
|
||||
gtk_style_context_get_style_provider (GtkStyleContext *context);
|
||||
|
||||
void gtk_style_context_save_named (GtkStyleContext *context,
|
||||
const char *name);
|
||||
|
||||
const GtkBitmask *
|
||||
_gtk_style_context_get_changes (GtkStyleContext *context);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user