gtk_css_style_change_init (&change, widget_node->last_updated_style, style);
if (gtk_css_style_change_has_change (&change))
{
- GtkStyleContext *context;
-
- context = _gtk_widget_peek_style_context (widget_node->widget);
- if (context)
- gtk_style_context_validate (context, &change);
- else
- gtk_widget_css_changed (widget_node->widget, &change);
+ gtk_widget_css_changed (widget_node->widget, &change);
g_set_object (&widget_node->last_updated_style, style);
}
gtk_css_style_change_finish (&change);
GtkStyleContext *parent;
GtkCssNode *cssnode;
GSList *saved_nodes;
-
- GtkCssStyleChange *invalidating_context;
};
typedef struct _GtkStyleContextPrivate GtkStyleContextPrivate;
LAST_PROP
};
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
static GParamSpec *properties[LAST_PROP] = { NULL, };
-static guint signals[LAST_SIGNAL] = { 0 };
-
static void gtk_style_context_finalize (GObject *object);
static void gtk_style_context_impl_set_property (GObject *object,
G_DEFINE_TYPE_WITH_PRIVATE (GtkStyleContext, gtk_style_context, G_TYPE_OBJECT)
-static void
-gtk_style_context_real_changed (GtkStyleContext *context)
-{
- GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
-
- if (GTK_IS_CSS_WIDGET_NODE (priv->cssnode))
- {
- GtkWidget *widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (priv->cssnode));
- if (widget != NULL)
- gtk_widget_css_changed (widget, gtk_style_context_get_change (context));
- }
-}
-
static void
gtk_style_context_class_init (GtkStyleContextClass *klass)
{
object_class->set_property = gtk_style_context_impl_set_property;
object_class->get_property = gtk_style_context_impl_get_property;
- klass->changed = gtk_style_context_real_changed;
-
- /**
- * GtkStyleContext::changed:
- *
- * The ::changed signal is emitted when there is a change in the
- * #GtkStyleContext.
- *
- * For a #GtkStyleContext returned by gtk_widget_get_style_context(), the
- * #GtkWidget:css-changed vfunc might be more convenient to use.
- *
- * This signal is useful when using the theming layer standalone.
- */
- signals[CHANGED] =
- g_signal_new (I_("changed"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkStyleContextClass, changed),
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 0);
-
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
P_("Display"),
return gtk_style_context_resolve_color (context, value, color);
}
-static GtkCssStyleChange magic_number;
-
-void
-gtk_style_context_validate (GtkStyleContext *context,
- GtkCssStyleChange *change)
-{
- GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
-
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-
- /* Avoid reentrancy */
- if (priv->invalidating_context)
- return;
-
- if (change)
- priv->invalidating_context = change;
- else
- priv->invalidating_context = &magic_number;
-
- g_signal_emit (context, signals[CHANGED], 0);
-
- priv->invalidating_context = NULL;
-}
-
/**
* gtk_style_context_get_color:
* @context: a #GtkStyleContext
}
}
-/**
- * gtk_style_context_get_change:
- * @context: the context to query
- *
- * Queries the context for the changes for the currently executing
- * GtkStyleContext::invalidate signal. If no signal is currently
- * emitted or the signal has not been triggered by a CssNode
- * invalidation, this function returns %NULL.
- *
- * FIXME 4.0: Make this part of the signal.
- *
- * Returns: %NULL or the currently invalidating changes
- **/
-GtkCssStyleChange *
-gtk_style_context_get_change (GtkStyleContext *context)
-{
- GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
-
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-
- if (priv->invalidating_context == &magic_number)
- return NULL;
-
- return priv->invalidating_context;
-}
-
PangoAttrList *
_gtk_style_context_get_pango_attributes (GtkStyleContext *context)
{