Example #1
0
static void
gtk_css_custom_property_query (GtkStyleProperty   *property,
                               GValue             *value,
                               GtkStyleQueryFunc   query_func,
                               gpointer            query_data)
{
  GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property);
  GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
  GtkCssValue *css_value;
  
  css_value = (* query_func) (_gtk_css_style_property_get_id (style), query_data);
  if (css_value == NULL)
    css_value = _gtk_css_style_property_get_initial_value (style);

  g_value_init (value, custom->pspec->value_type);
  g_value_copy (_gtk_css_typed_value_get (css_value), value);
}
Example #2
0
static void
transition_info_add (TransitionInfo    infos[GTK_CSS_PROPERTY_N_PROPERTIES],
                     GtkStyleProperty *property,
                     guint             index)
{
    if (property == NULL)
    {
        guint i;

        for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
        {
            GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (i);

            transition_info_add (infos, GTK_STYLE_PROPERTY (prop), index);
        }
    }
    else if (GTK_IS_CSS_SHORTHAND_PROPERTY (property))
    {
        GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
        guint i;

        for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
        {
            GtkCssStyleProperty *prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);

            transition_info_add (infos, GTK_STYLE_PROPERTY (prop), index);
        }
    }
    else if (GTK_IS_CSS_STYLE_PROPERTY (property))
    {
        guint id;

        if (!_gtk_css_style_property_is_animated (GTK_CSS_STYLE_PROPERTY (property)))
            return;

        id = _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (property));
        g_assert (id < GTK_CSS_PROPERTY_N_PROPERTIES);
        infos[id].index = index;
        infos[id].pending = TRUE;
    }
    else
    {
        g_assert_not_reached ();
    }
}