mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 09:00:34 +00:00
cssstaticstyle: Move function
We want the new() return values to be immutable, so we have to move the code that modifes them.
This commit is contained in:
parent
b7be202089
commit
8b823d7e13
@ -177,9 +177,34 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *style,
|
||||
}
|
||||
|
||||
GtkCssStyle *
|
||||
gtk_css_static_style_new (void)
|
||||
gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
int scale,
|
||||
GtkCssStyle *parent,
|
||||
GtkCssChange *out_change)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
|
||||
GtkCssStaticStyle *result;
|
||||
GtkCssLookup *lookup;
|
||||
|
||||
lookup = _gtk_css_lookup_new (NULL);
|
||||
|
||||
if (matcher)
|
||||
_gtk_style_provider_private_lookup (provider,
|
||||
matcher,
|
||||
lookup,
|
||||
out_change);
|
||||
|
||||
result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
|
||||
|
||||
_gtk_css_lookup_resolve (lookup,
|
||||
provider,
|
||||
scale,
|
||||
result,
|
||||
parent);
|
||||
|
||||
_gtk_css_lookup_free (lookup);
|
||||
|
||||
return GTK_CSS_STYLE (result);
|
||||
}
|
||||
|
||||
GtkCssStyle *
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef __GTK_CSS_STATIC_STYLE_PRIVATE_H__
|
||||
#define __GTK_CSS_STATIC_STYLE_PRIVATE_H__
|
||||
|
||||
#include "gtk/gtkcssmatcherprivate.h"
|
||||
#include "gtk/gtkcssstyleprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -54,7 +55,11 @@ struct _GtkCssStaticStyleClass
|
||||
|
||||
GType gtk_css_static_style_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkCssStyle * gtk_css_static_style_new (void);
|
||||
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
int scale,
|
||||
GtkCssStyle *parent,
|
||||
GtkCssChange *out_change);
|
||||
GtkCssStyle * gtk_css_static_style_copy (GtkCssStaticStyle *original,
|
||||
const GtkBitmask *properties_to_not_copy);
|
||||
|
||||
|
@ -734,29 +734,25 @@ build_properties (GtkStyleContext *context,
|
||||
GtkStyleContextPrivate *priv;
|
||||
GtkCssMatcher matcher;
|
||||
GtkWidgetPath *path;
|
||||
GtkCssLookup *lookup;
|
||||
GtkCssStyle *style;
|
||||
|
||||
priv = context->priv;
|
||||
|
||||
style = gtk_css_static_style_new ();
|
||||
|
||||
path = create_query_path (context, decl);
|
||||
lookup = _gtk_css_lookup_new (NULL);
|
||||
|
||||
if (_gtk_css_matcher_init (&matcher, path))
|
||||
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
|
||||
&matcher,
|
||||
lookup,
|
||||
out_change);
|
||||
style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
|
||||
&matcher,
|
||||
priv->scale,
|
||||
priv->parent ? style_values_lookup (priv->parent) : NULL,
|
||||
out_change);
|
||||
else
|
||||
style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
|
||||
NULL,
|
||||
priv->scale,
|
||||
priv->parent ? style_values_lookup (priv->parent) : NULL,
|
||||
out_change);
|
||||
|
||||
_gtk_css_lookup_resolve (lookup,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
|
||||
priv->scale,
|
||||
GTK_CSS_STATIC_STYLE (style),
|
||||
priv->parent ? style_values_lookup (priv->parent) : NULL);
|
||||
|
||||
_gtk_css_lookup_free (lookup);
|
||||
gtk_widget_path_free (path);
|
||||
|
||||
return style;
|
||||
|
Loading…
Reference in New Issue
Block a user