2010-03-04 19:59:18 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2010-11-26 01:39:53 +00:00
|
|
|
#include "gtkstyleproperties.h"
|
|
|
|
|
2010-03-05 00:45:47 +00:00
|
|
|
#include <stdlib.h>
|
2010-03-05 02:02:59 +00:00
|
|
|
#include <gobject/gvaluecollector.h>
|
2010-11-12 20:43:13 +00:00
|
|
|
#include <cairo-gobject.h>
|
2010-03-05 00:45:47 +00:00
|
|
|
|
2010-10-22 08:38:21 +00:00
|
|
|
#include "gtktypebuiltins.h"
|
2010-03-04 21:51:56 +00:00
|
|
|
#include "gtkstyleprovider.h"
|
2010-11-26 01:39:53 +00:00
|
|
|
#include "gtksymboliccolor.h"
|
2010-03-04 19:59:18 +00:00
|
|
|
#include "gtkprivate.h"
|
2010-06-13 15:31:22 +00:00
|
|
|
#include "gtkthemingengine.h"
|
2010-08-19 19:49:22 +00:00
|
|
|
#include "gtkanimationdescription.h"
|
2010-11-26 01:39:53 +00:00
|
|
|
#include "gtkborder.h"
|
|
|
|
#include "gtkgradient.h"
|
2010-09-24 20:02:39 +00:00
|
|
|
#include "gtk9slice.h"
|
2010-03-04 19:59:18 +00:00
|
|
|
#include "gtkintl.h"
|
|
|
|
|
2010-11-21 23:00:30 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gtkstyleproperties
|
|
|
|
* @Short_description: Store for style property information
|
|
|
|
* @Title: GtkStyleProperties
|
|
|
|
*
|
|
|
|
* GtkStyleProperties provides the storage for style information
|
|
|
|
* that is used by #GtkStyleContext and other #GtkStyleProvider
|
|
|
|
* implementations.
|
|
|
|
*
|
|
|
|
* Before style properties can be stored in GtkStyleProperties, they
|
|
|
|
* must be registered with gtk_style_properties_register_property().
|
|
|
|
*
|
|
|
|
* Unless you are writing a #GtkStyleProvider implementation, you
|
|
|
|
* are unlikely to use this API directly, as gtk_style_context_get()
|
|
|
|
* and its variants are the preferred way to access styling information
|
|
|
|
* from widget implementations and theming engine implementations
|
|
|
|
* should use the APIs provided by #GtkThemingEngine instead.
|
|
|
|
*/
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
typedef struct GtkStylePropertiesPrivate GtkStylePropertiesPrivate;
|
2010-03-04 19:59:18 +00:00
|
|
|
typedef struct PropertyData PropertyData;
|
2010-03-05 00:45:47 +00:00
|
|
|
typedef struct PropertyNode PropertyNode;
|
2010-08-16 17:09:34 +00:00
|
|
|
typedef struct ValueData ValueData;
|
2010-03-05 00:45:47 +00:00
|
|
|
|
|
|
|
struct PropertyNode
|
|
|
|
{
|
|
|
|
GQuark property_quark;
|
2010-11-13 18:53:36 +00:00
|
|
|
GParamSpec *pspec;
|
2010-08-04 15:49:15 +00:00
|
|
|
GtkStylePropertyParser parse_func;
|
2010-03-05 00:45:47 +00:00
|
|
|
};
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
struct ValueData
|
|
|
|
{
|
|
|
|
GtkStateFlags state;
|
|
|
|
GValue value;
|
|
|
|
};
|
|
|
|
|
2010-03-04 19:59:18 +00:00
|
|
|
struct PropertyData
|
|
|
|
{
|
2010-08-16 17:09:34 +00:00
|
|
|
GArray *values;
|
2010-03-04 19:59:18 +00:00
|
|
|
};
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
struct GtkStylePropertiesPrivate
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-06-25 17:37:54 +00:00
|
|
|
GHashTable *color_map;
|
2010-03-04 19:59:18 +00:00
|
|
|
GHashTable *properties;
|
|
|
|
};
|
|
|
|
|
2010-03-05 00:45:47 +00:00
|
|
|
static GArray *properties = NULL;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
static void gtk_style_properties_provider_init (GtkStyleProviderIface *iface);
|
|
|
|
static void gtk_style_properties_finalize (GObject *object);
|
2010-03-04 19:59:18 +00:00
|
|
|
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
G_DEFINE_TYPE_EXTENDED (GtkStyleProperties, gtk_style_properties, G_TYPE_OBJECT, 0,
|
2010-03-04 21:51:56 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_STYLE_PROVIDER,
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_provider_init));
|
2010-03-04 19:59:18 +00:00
|
|
|
|
|
|
|
static void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_class_init (GtkStylePropertiesClass *klass)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
object_class->finalize = gtk_style_properties_finalize;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-03-05 00:45:47 +00:00
|
|
|
/* Initialize default property set */
|
2010-11-13 18:53:36 +00:00
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("color",
|
|
|
|
"Foreground color",
|
|
|
|
"Foreground color",
|
|
|
|
GDK_TYPE_RGBA, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("background-color",
|
|
|
|
"Background color",
|
|
|
|
"Background color",
|
|
|
|
GDK_TYPE_RGBA, 0));
|
|
|
|
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("font",
|
|
|
|
"Font Description",
|
|
|
|
"Font Description",
|
|
|
|
PANGO_TYPE_FONT_DESCRIPTION, 0));
|
|
|
|
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("margin",
|
|
|
|
"Margin",
|
|
|
|
"Margin",
|
|
|
|
GTK_TYPE_BORDER, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("padding",
|
|
|
|
"Padding",
|
|
|
|
"Padding",
|
|
|
|
GTK_TYPE_BORDER, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
2010-11-30 23:55:14 +00:00
|
|
|
g_param_spec_boxed ("border-width",
|
|
|
|
"Border width",
|
|
|
|
"Border width, in pixels",
|
|
|
|
GTK_TYPE_BORDER, 0));
|
2010-11-13 18:53:36 +00:00
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_int ("border-radius",
|
|
|
|
"Border radius",
|
|
|
|
"Border radius, in pixels",
|
|
|
|
0, G_MAXINT, 0, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_enum ("border-style",
|
|
|
|
"Border style",
|
|
|
|
"Border style",
|
|
|
|
GTK_TYPE_BORDER_STYLE,
|
|
|
|
GTK_BORDER_STYLE_NONE, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("border-color",
|
|
|
|
"Border color",
|
|
|
|
"Border color",
|
|
|
|
GDK_TYPE_RGBA, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("background-image",
|
|
|
|
"Background Image",
|
|
|
|
"Background Image",
|
|
|
|
CAIRO_GOBJECT_TYPE_PATTERN, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("border-image",
|
|
|
|
"Border Image",
|
|
|
|
"Border Image",
|
|
|
|
GTK_TYPE_9SLICE, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_object ("engine",
|
|
|
|
"Theming Engine",
|
|
|
|
"Theming Engine",
|
|
|
|
GTK_TYPE_THEMING_ENGINE, 0));
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("transition",
|
|
|
|
"Transition animation description",
|
|
|
|
"Transition animation description",
|
|
|
|
GTK_TYPE_ANIMATION_DESCRIPTION, 0));
|
2010-08-19 19:49:22 +00:00
|
|
|
|
2011-01-28 08:59:02 +00:00
|
|
|
/* Private property holding the binding sets */
|
|
|
|
gtk_style_properties_register_property (NULL,
|
|
|
|
g_param_spec_boxed ("gtk-key-bindings",
|
|
|
|
"Key bindings",
|
|
|
|
"Key bindings",
|
|
|
|
G_TYPE_PTR_ARRAY, 0));
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_type_class_add_private (object_class, sizeof (GtkStylePropertiesPrivate));
|
2010-03-04 19:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static PropertyData *
|
|
|
|
property_data_new (void)
|
|
|
|
{
|
|
|
|
PropertyData *data;
|
|
|
|
|
|
|
|
data = g_slice_new0 (PropertyData);
|
2010-08-16 17:09:34 +00:00
|
|
|
data->values = g_array_new (FALSE, FALSE, sizeof (ValueData));
|
2010-03-04 19:59:18 +00:00
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-01-17 03:06:57 +00:00
|
|
|
property_data_remove_values (PropertyData *data)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-08-16 17:09:34 +00:00
|
|
|
guint i;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
for (i = 0; i < data->values->len; i++)
|
2010-03-04 21:51:56 +00:00
|
|
|
{
|
2010-08-16 17:09:34 +00:00
|
|
|
ValueData *value_data;
|
|
|
|
|
|
|
|
value_data = &g_array_index (data->values, ValueData, i);
|
|
|
|
|
|
|
|
if (G_IS_VALUE (&value_data->value))
|
|
|
|
g_value_unset (&value_data->value);
|
2010-03-04 21:51:56 +00:00
|
|
|
}
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2011-01-17 03:06:57 +00:00
|
|
|
if (data->values->len > 0)
|
|
|
|
g_array_remove_range (data->values, 0, data->values->len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
property_data_free (PropertyData *data)
|
|
|
|
{
|
|
|
|
property_data_remove_values (data);
|
2010-08-19 23:16:40 +00:00
|
|
|
g_array_free (data->values, TRUE);
|
2010-03-04 19:59:18 +00:00
|
|
|
g_slice_free (PropertyData, data);
|
|
|
|
}
|
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
static gboolean
|
|
|
|
property_data_find_position (PropertyData *data,
|
|
|
|
GtkStateFlags state,
|
|
|
|
guint *pos)
|
|
|
|
{
|
|
|
|
gint min, max, mid;
|
|
|
|
gboolean found = FALSE;
|
|
|
|
guint position;
|
|
|
|
|
|
|
|
if (pos)
|
|
|
|
*pos = 0;
|
|
|
|
|
|
|
|
if (data->values->len == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Find position for the given state, or the position where
|
|
|
|
* it would be if not found, the array is ordered by the
|
|
|
|
* state flags.
|
|
|
|
*/
|
|
|
|
min = 0;
|
|
|
|
max = data->values->len - 1;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ValueData *value_data;
|
|
|
|
|
|
|
|
mid = (min + max) / 2;
|
|
|
|
value_data = &g_array_index (data->values, ValueData, mid);
|
|
|
|
|
|
|
|
if (value_data->state == state)
|
|
|
|
{
|
|
|
|
found = TRUE;
|
|
|
|
position = mid;
|
|
|
|
}
|
|
|
|
else if (value_data->state < state)
|
|
|
|
position = min = mid + 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
max = mid - 1;
|
|
|
|
position = mid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (!found && min <= max);
|
|
|
|
|
|
|
|
if (pos)
|
|
|
|
*pos = position;
|
|
|
|
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GValue *
|
|
|
|
property_data_get_value (PropertyData *data,
|
|
|
|
GtkStateFlags state)
|
|
|
|
{
|
|
|
|
ValueData *val_data;
|
|
|
|
guint pos;
|
|
|
|
|
|
|
|
if (!property_data_find_position (data, state, &pos))
|
|
|
|
{
|
|
|
|
ValueData new = { 0 };
|
|
|
|
|
|
|
|
new.state = state;
|
|
|
|
g_array_insert_val (data->values, pos, new);
|
|
|
|
}
|
|
|
|
|
|
|
|
val_data = &g_array_index (data->values, ValueData, pos);
|
|
|
|
|
|
|
|
return &val_data->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GValue *
|
|
|
|
property_data_match_state (PropertyData *data,
|
|
|
|
GtkStateFlags state)
|
|
|
|
{
|
|
|
|
guint pos;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
if (property_data_find_position (data, state, &pos))
|
|
|
|
{
|
|
|
|
ValueData *val_data;
|
|
|
|
|
|
|
|
/* Exact match */
|
|
|
|
val_data = &g_array_index (data->values, ValueData, pos);
|
|
|
|
return &val_data->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pos >= data->values->len)
|
|
|
|
pos = data->values->len - 1;
|
|
|
|
|
|
|
|
/* No exact match, go downwards the list to find
|
|
|
|
* the closest match to the given state flags, as
|
|
|
|
* a side effect, there is an implicit precedence
|
|
|
|
* of higher flags over the smaller ones.
|
|
|
|
*/
|
|
|
|
for (i = pos; i >= 0; i--)
|
|
|
|
{
|
|
|
|
ValueData *val_data;
|
|
|
|
|
|
|
|
val_data = &g_array_index (data->values, ValueData, i);
|
|
|
|
|
|
|
|
/* Check whether any of the requested
|
|
|
|
* flags are set, and no other flags are.
|
|
|
|
*
|
|
|
|
* Also, no flags acts as a wildcard, such
|
|
|
|
* value should be always in the first position
|
|
|
|
* in the array (if present) anyways.
|
|
|
|
*/
|
|
|
|
if (val_data->state == 0 ||
|
|
|
|
((val_data->state & state) != 0 &&
|
|
|
|
(val_data->state & ~state) == 0))
|
|
|
|
return &val_data->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-03-04 19:59:18 +00:00
|
|
|
static void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_init (GtkStyleProperties *props)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv = G_TYPE_INSTANCE_GET_PRIVATE (props,
|
|
|
|
GTK_TYPE_STYLE_PROPERTIES,
|
|
|
|
GtkStylePropertiesPrivate);
|
2010-07-03 00:19:54 +00:00
|
|
|
|
2010-03-05 01:06:53 +00:00
|
|
|
priv->properties = g_hash_table_new_full (NULL, NULL, NULL,
|
2010-03-04 19:59:18 +00:00
|
|
|
(GDestroyNotify) property_data_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_finalize (GObject *object)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
|
|
|
GtkStyleProperties *props;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
props = GTK_STYLE_PROPERTIES (object);
|
|
|
|
priv = props->priv;
|
2010-03-04 19:59:18 +00:00
|
|
|
g_hash_table_destroy (priv->properties);
|
|
|
|
|
2010-06-25 17:37:54 +00:00
|
|
|
if (priv->color_map)
|
|
|
|
g_hash_table_destroy (priv->color_map);
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
G_OBJECT_CLASS (gtk_style_properties_parent_class)->finalize (object);
|
2010-03-04 19:59:18 +00:00
|
|
|
}
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStyleProperties *
|
|
|
|
gtk_style_properties_get_style (GtkStyleProvider *provider,
|
|
|
|
GtkWidgetPath *path)
|
2010-03-04 21:51:56 +00:00
|
|
|
{
|
|
|
|
/* Return style set itself */
|
|
|
|
return g_object_ref (provider);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_provider_init (GtkStyleProviderIface *iface)
|
2010-03-04 21:51:56 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
iface->get_style = gtk_style_properties_get_style;
|
2010-03-04 21:51:56 +00:00
|
|
|
}
|
|
|
|
|
2010-03-05 00:45:47 +00:00
|
|
|
static int
|
|
|
|
compare_property (gconstpointer p1,
|
|
|
|
gconstpointer p2)
|
|
|
|
{
|
|
|
|
PropertyNode *key = (PropertyNode *) p1;
|
|
|
|
PropertyNode *node = (PropertyNode *) p2;
|
|
|
|
|
2010-10-25 22:16:22 +00:00
|
|
|
if (key->property_quark > node->property_quark)
|
|
|
|
return 1;
|
|
|
|
else if (key->property_quark < node->property_quark)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
2010-03-05 00:45:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static PropertyNode *
|
|
|
|
property_node_lookup (GQuark quark)
|
|
|
|
{
|
|
|
|
PropertyNode key = { 0 };
|
|
|
|
|
|
|
|
if (!quark)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (!properties)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
key.property_quark = quark;
|
|
|
|
|
|
|
|
return bsearch (&key, properties->data, properties->len,
|
|
|
|
sizeof (PropertyNode), compare_property);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Property registration functions */
|
2010-10-19 08:59:46 +00:00
|
|
|
|
|
|
|
/**
|
2011-01-18 05:37:11 +00:00
|
|
|
* gtk_style_properties_register_property: (skip)
|
2010-10-19 08:59:46 +00:00
|
|
|
* @parse_func: parsing function to use, or %NULL
|
2010-11-13 18:53:36 +00:00
|
|
|
* @pspec: the #GParamSpec for the new property
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Registers a property so it can be used in the CSS file format.
|
|
|
|
* This function is the low-level equivalent of
|
|
|
|
* gtk_theming_engine_register_property(), if you are implementing
|
|
|
|
* a theming engine, you want to use that function instead.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-03-05 00:45:47 +00:00
|
|
|
void
|
2010-11-13 18:53:36 +00:00
|
|
|
gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
|
|
|
GParamSpec *pspec)
|
2010-03-05 00:45:47 +00:00
|
|
|
{
|
|
|
|
PropertyNode *node, new = { 0 };
|
|
|
|
GQuark quark;
|
|
|
|
gint i;
|
|
|
|
|
2010-11-13 18:53:36 +00:00
|
|
|
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
2010-03-05 00:45:47 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (!properties))
|
|
|
|
properties = g_array_new (FALSE, TRUE, sizeof (PropertyNode));
|
|
|
|
|
2010-11-13 18:53:36 +00:00
|
|
|
quark = g_quark_from_string (pspec->name);
|
2010-03-05 00:45:47 +00:00
|
|
|
|
|
|
|
if ((node = property_node_lookup (quark)) != NULL)
|
|
|
|
{
|
|
|
|
g_warning ("Property \"%s\" was already registered with type %s",
|
2010-11-13 18:53:36 +00:00
|
|
|
pspec->name, g_type_name (node->pspec->value_type));
|
2010-03-05 00:45:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
new.property_quark = quark;
|
2010-11-13 18:53:36 +00:00
|
|
|
new.pspec = pspec;
|
2010-08-02 13:26:41 +00:00
|
|
|
|
2010-08-04 15:49:15 +00:00
|
|
|
if (parse_func)
|
|
|
|
new.parse_func = parse_func;
|
|
|
|
|
2010-03-05 00:45:47 +00:00
|
|
|
for (i = 0; i < properties->len; i++)
|
|
|
|
{
|
|
|
|
node = &g_array_index (properties, PropertyNode, i);
|
|
|
|
|
|
|
|
if (node->property_quark > quark)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_array_insert_val (properties, i, new);
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2011-01-18 05:37:11 +00:00
|
|
|
* gtk_style_properties_lookup_property: (skip)
|
2010-10-19 08:59:46 +00:00
|
|
|
* @property_name: property name to look up
|
2010-11-13 18:53:36 +00:00
|
|
|
* @parse_func: (out): return location for the parse function
|
2011-01-18 05:37:11 +00:00
|
|
|
* @pspec: (out) (transfer none): return location for the #GParamSpec
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
2010-11-13 18:53:36 +00:00
|
|
|
* Returns %TRUE if a property has been registered, if @pspec or
|
|
|
|
* @parse_func are not %NULL, the #GParamSpec and parsing function
|
2010-10-19 08:59:46 +00:00
|
|
|
* will be respectively returned.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the property is registered, %FALSE otherwise
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-04-11 18:26:49 +00:00
|
|
|
gboolean
|
2010-11-13 18:53:36 +00:00
|
|
|
gtk_style_properties_lookup_property (const gchar *property_name,
|
|
|
|
GtkStylePropertyParser *parse_func,
|
|
|
|
GParamSpec **pspec)
|
2010-04-11 18:26:49 +00:00
|
|
|
{
|
|
|
|
PropertyNode *node;
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesClass *klass;
|
2010-06-13 15:10:05 +00:00
|
|
|
gboolean found = FALSE;
|
2010-04-11 18:26:49 +00:00
|
|
|
GQuark quark;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_val_if_fail (property_name != NULL, FALSE);
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
klass = g_type_class_ref (GTK_TYPE_STYLE_PROPERTIES);
|
2010-04-11 18:26:49 +00:00
|
|
|
quark = g_quark_try_string (property_name);
|
|
|
|
|
|
|
|
if (quark == 0)
|
|
|
|
{
|
|
|
|
g_type_class_unref (klass);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < properties->len; i++)
|
|
|
|
{
|
|
|
|
node = &g_array_index (properties, PropertyNode, i);
|
|
|
|
|
|
|
|
if (node->property_quark == quark)
|
|
|
|
{
|
2010-11-13 18:53:36 +00:00
|
|
|
if (pspec)
|
|
|
|
*pspec = node->pspec;
|
2010-04-11 18:26:49 +00:00
|
|
|
|
2010-08-04 15:49:15 +00:00
|
|
|
if (parse_func)
|
|
|
|
*parse_func = node->parse_func;
|
|
|
|
|
2010-06-13 15:10:05 +00:00
|
|
|
found = TRUE;
|
|
|
|
break;
|
2010-04-11 18:26:49 +00:00
|
|
|
}
|
|
|
|
else if (node->property_quark > quark)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_type_class_unref (klass);
|
|
|
|
|
2010-06-13 15:10:05 +00:00
|
|
|
return found;
|
2010-03-05 00:45:47 +00:00
|
|
|
}
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
/* GtkStyleProperties methods */
|
2010-03-04 21:51:56 +00:00
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_new:
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Returns a newly created #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Returns: a new #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
**/
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStyleProperties *
|
|
|
|
gtk_style_properties_new (void)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
return g_object_new (GTK_TYPE_STYLE_PROPERTIES, NULL);
|
2010-03-04 19:59:18 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_map_color:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @name: color name
|
|
|
|
* @color: #GtkSymbolicColor to map @name to
|
|
|
|
*
|
|
|
|
* Maps @color so it can be referenced by @name. See
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_lookup_color()
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-06-25 17:37:54 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_map_color (GtkStyleProperties *props,
|
|
|
|
const gchar *name,
|
|
|
|
GtkSymbolicColor *color)
|
2010-06-25 17:37:54 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-06-25 17:37:54 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-06-25 17:37:54 +00:00
|
|
|
g_return_if_fail (name != NULL);
|
|
|
|
g_return_if_fail (color != NULL);
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-06-25 17:37:54 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (!priv->color_map))
|
|
|
|
priv->color_map = g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
(GDestroyNotify) g_free,
|
|
|
|
(GDestroyNotify) gtk_symbolic_color_unref);
|
|
|
|
|
|
|
|
g_hash_table_replace (priv->color_map,
|
|
|
|
g_strdup (name),
|
|
|
|
gtk_symbolic_color_ref (color));
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_lookup_color:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @name: color name to lookup
|
|
|
|
*
|
|
|
|
* Returns the symbolic color that is mapped
|
|
|
|
* to @name.
|
|
|
|
*
|
2011-01-18 09:01:17 +00:00
|
|
|
* Returns: (transfer none): The mapped color
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-06-25 17:37:54 +00:00
|
|
|
GtkSymbolicColor *
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_lookup_color (GtkStyleProperties *props,
|
|
|
|
const gchar *name)
|
2010-06-25 17:37:54 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-06-25 17:37:54 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), NULL);
|
2010-06-25 17:37:54 +00:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-06-25 17:37:54 +00:00
|
|
|
|
|
|
|
if (!priv->color_map)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return g_hash_table_lookup (priv->color_map, name);
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_set_property:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @property: styling property to set
|
|
|
|
* @state: state to set the value for
|
|
|
|
* @value: new value for the property
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Sets a styling property in @props.
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-08-16 17:09:34 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_set_property (GtkStyleProperties *props,
|
|
|
|
const gchar *property,
|
|
|
|
GtkStateFlags state,
|
|
|
|
const GValue *value)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-03-05 01:06:53 +00:00
|
|
|
PropertyNode *node;
|
2010-03-04 19:59:18 +00:00
|
|
|
PropertyData *prop;
|
2010-06-25 18:08:07 +00:00
|
|
|
GType value_type;
|
2010-05-04 17:55:19 +00:00
|
|
|
GValue *val;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-08-16 17:09:34 +00:00
|
|
|
g_return_if_fail (property != NULL);
|
|
|
|
g_return_if_fail (value != NULL);
|
|
|
|
|
2010-06-25 18:08:07 +00:00
|
|
|
value_type = G_VALUE_TYPE (value);
|
2010-03-05 01:06:53 +00:00
|
|
|
node = property_node_lookup (g_quark_try_string (property));
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
{
|
|
|
|
g_warning ("Style property \"%s\" is not registered", property);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-11-13 18:53:36 +00:00
|
|
|
if (node->pspec->value_type == GDK_TYPE_RGBA ||
|
|
|
|
node->pspec->value_type == GDK_TYPE_COLOR)
|
2010-06-25 18:08:07 +00:00
|
|
|
{
|
|
|
|
/* Allow GtkSymbolicColor as well */
|
2010-11-13 00:25:07 +00:00
|
|
|
g_return_if_fail (value_type == GDK_TYPE_RGBA ||
|
|
|
|
value_type == GDK_TYPE_COLOR ||
|
|
|
|
value_type == GTK_TYPE_SYMBOLIC_COLOR);
|
2010-06-25 18:08:07 +00:00
|
|
|
}
|
2010-11-13 18:53:36 +00:00
|
|
|
else if (node->pspec->value_type == CAIRO_GOBJECT_TYPE_PATTERN)
|
2010-09-02 00:11:12 +00:00
|
|
|
{
|
|
|
|
/* Allow GtkGradient as a substitute */
|
2010-10-13 14:33:38 +00:00
|
|
|
g_return_if_fail (value_type == CAIRO_GOBJECT_TYPE_PATTERN ||
|
2010-09-02 00:11:12 +00:00
|
|
|
value_type == GTK_TYPE_GRADIENT);
|
|
|
|
}
|
2010-06-25 18:08:07 +00:00
|
|
|
else
|
2010-11-13 18:53:36 +00:00
|
|
|
g_return_if_fail (node->pspec->value_type == value_type);
|
2010-03-05 01:06:53 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-03-05 01:06:53 +00:00
|
|
|
prop = g_hash_table_lookup (priv->properties,
|
|
|
|
GINT_TO_POINTER (node->property_quark));
|
2010-03-04 19:59:18 +00:00
|
|
|
|
|
|
|
if (!prop)
|
|
|
|
{
|
|
|
|
prop = property_data_new ();
|
|
|
|
g_hash_table_insert (priv->properties,
|
2010-03-05 01:06:53 +00:00
|
|
|
GINT_TO_POINTER (node->property_quark),
|
2010-03-04 19:59:18 +00:00
|
|
|
prop);
|
|
|
|
}
|
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
val = property_data_get_value (prop, state);
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-06-25 18:08:07 +00:00
|
|
|
if (G_VALUE_TYPE (val) == value_type)
|
2010-05-04 17:55:19 +00:00
|
|
|
g_value_reset (val);
|
|
|
|
else
|
2010-06-25 18:08:07 +00:00
|
|
|
{
|
|
|
|
if (G_IS_VALUE (val))
|
|
|
|
g_value_unset (val);
|
|
|
|
|
|
|
|
g_value_init (val, value_type);
|
|
|
|
}
|
2010-05-04 17:55:19 +00:00
|
|
|
|
|
|
|
g_value_copy (value, val);
|
2010-03-04 19:59:18 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_set_valist:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @state: state to set the values for
|
|
|
|
* @args: va_list of property name/value pairs, followed by %NULL
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Sets several style properties on @props.
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-05-04 17:55:19 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_set_valist (GtkStyleProperties *props,
|
|
|
|
GtkStateFlags state,
|
|
|
|
va_list args)
|
2010-03-05 02:02:59 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-03-05 02:02:59 +00:00
|
|
|
const gchar *property_name;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-03-05 02:02:59 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-03-05 02:02:59 +00:00
|
|
|
property_name = va_arg (args, const gchar *);
|
|
|
|
|
|
|
|
while (property_name)
|
|
|
|
{
|
|
|
|
PropertyNode *node;
|
|
|
|
PropertyData *prop;
|
|
|
|
gchar *error = NULL;
|
2010-08-16 17:09:34 +00:00
|
|
|
GValue *val;
|
2010-03-05 02:02:59 +00:00
|
|
|
|
|
|
|
node = property_node_lookup (g_quark_try_string (property_name));
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
{
|
|
|
|
g_warning ("Style property \"%s\" is not registered", property_name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
prop = g_hash_table_lookup (priv->properties,
|
|
|
|
GINT_TO_POINTER (node->property_quark));
|
|
|
|
|
|
|
|
if (!prop)
|
|
|
|
{
|
|
|
|
prop = property_data_new ();
|
|
|
|
g_hash_table_insert (priv->properties,
|
|
|
|
GINT_TO_POINTER (node->property_quark),
|
|
|
|
prop);
|
|
|
|
}
|
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
val = property_data_get_value (prop, state);
|
|
|
|
|
|
|
|
if (G_IS_VALUE (val))
|
|
|
|
g_value_unset (val);
|
|
|
|
|
2011-02-05 17:54:02 +00:00
|
|
|
G_VALUE_COLLECT_INIT (val, node->pspec->value_type,
|
|
|
|
args, 0, &error);
|
2010-03-05 02:02:59 +00:00
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_warning ("Could not set style property \"%s\": %s", property_name, error);
|
2010-08-16 17:09:34 +00:00
|
|
|
g_value_unset (val);
|
|
|
|
g_free (error);
|
2010-03-05 02:02:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
property_name = va_arg (args, const gchar *);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_set:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @state: state to set the values for
|
|
|
|
* @...: property name/value pairs, followed by %NULL
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Sets several style properties on @props.
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-03-05 02:02:59 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_set (GtkStyleProperties *props,
|
|
|
|
GtkStateFlags state,
|
|
|
|
...)
|
2010-03-05 02:02:59 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-03-05 02:02:59 +00:00
|
|
|
|
|
|
|
va_start (args, state);
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_set_valist (props, state, args);
|
2010-03-05 02:02:59 +00:00
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
2010-06-25 18:08:07 +00:00
|
|
|
static gboolean
|
2010-10-29 04:47:32 +00:00
|
|
|
resolve_color (GtkStyleProperties *props,
|
|
|
|
GValue *value)
|
2010-06-25 18:08:07 +00:00
|
|
|
{
|
2010-10-22 10:41:19 +00:00
|
|
|
GdkRGBA color;
|
2010-06-25 18:08:07 +00:00
|
|
|
|
2010-10-22 10:41:19 +00:00
|
|
|
/* Resolve symbolic color to GdkRGBA */
|
2010-10-29 04:47:32 +00:00
|
|
|
if (!gtk_symbolic_color_resolve (g_value_get_boxed (value), props, &color))
|
2010-06-25 18:08:07 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2010-10-22 10:41:19 +00:00
|
|
|
/* Store it back, this is where GdkRGBA caching happens */
|
2010-06-25 18:08:07 +00:00
|
|
|
g_value_unset (value);
|
2010-10-22 10:41:19 +00:00
|
|
|
g_value_init (value, GDK_TYPE_RGBA);
|
2010-06-25 18:08:07 +00:00
|
|
|
g_value_set_boxed (value, &color);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-11-13 00:25:07 +00:00
|
|
|
static gboolean
|
|
|
|
resolve_color_rgb (GtkStyleProperties *props,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
GdkColor color = { 0 };
|
|
|
|
GdkRGBA rgba;
|
|
|
|
|
|
|
|
if (!gtk_symbolic_color_resolve (g_value_get_boxed (value), props, &rgba))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
color.red = rgba.red * 65535. + 0.5;
|
|
|
|
color.green = rgba.green * 65535. + 0.5;
|
|
|
|
color.blue = rgba.blue * 65535. + 0.5;
|
|
|
|
|
|
|
|
g_value_unset (value);
|
|
|
|
g_value_init (value, GDK_TYPE_COLOR);
|
|
|
|
g_value_set_boxed (value, &color);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-09-02 00:11:12 +00:00
|
|
|
static gboolean
|
2010-10-29 04:47:32 +00:00
|
|
|
resolve_gradient (GtkStyleProperties *props,
|
|
|
|
GValue *value)
|
2010-09-02 00:11:12 +00:00
|
|
|
{
|
|
|
|
cairo_pattern_t *gradient;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
if (!gtk_gradient_resolve (g_value_get_boxed (value), props, &gradient))
|
2010-09-02 00:11:12 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Store it back, this is where cairo_pattern_t caching happens */
|
|
|
|
g_value_unset (value);
|
2010-10-13 14:33:38 +00:00
|
|
|
g_value_init (value, CAIRO_GOBJECT_TYPE_PATTERN);
|
2010-09-02 00:11:12 +00:00
|
|
|
g_value_take_boxed (value, gradient);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-12-02 22:37:15 +00:00
|
|
|
static gboolean
|
|
|
|
style_properties_resolve_type (GtkStyleProperties *props,
|
|
|
|
PropertyNode *node,
|
|
|
|
GValue *val)
|
|
|
|
{
|
|
|
|
if (val && G_VALUE_TYPE (val) == GTK_TYPE_SYMBOLIC_COLOR)
|
|
|
|
{
|
|
|
|
if (node->pspec->value_type == GDK_TYPE_RGBA)
|
|
|
|
{
|
|
|
|
if (!resolve_color (props, val))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (node->pspec->value_type == GDK_TYPE_COLOR)
|
|
|
|
{
|
|
|
|
if (!resolve_color_rgb (props, val))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (val && G_VALUE_TYPE (val) == GTK_TYPE_GRADIENT)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (node->pspec->value_type == CAIRO_GOBJECT_TYPE_PATTERN, FALSE);
|
|
|
|
|
|
|
|
if (!resolve_gradient (props, val))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-11-13 18:53:36 +00:00
|
|
|
static void
|
|
|
|
lookup_default_value (PropertyNode *node,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
if (node->pspec->value_type == GTK_TYPE_THEMING_ENGINE)
|
|
|
|
g_value_set_object (value, gtk_theming_engine_load (NULL));
|
2010-12-20 11:26:11 +00:00
|
|
|
else if (node->pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION)
|
|
|
|
g_value_take_boxed (value, pango_font_description_from_string ("Sans 10"));
|
2010-12-21 23:17:58 +00:00
|
|
|
else if (node->pspec->value_type == GDK_TYPE_RGBA)
|
|
|
|
{
|
|
|
|
GdkRGBA color;
|
|
|
|
gdk_rgba_parse (&color, "pink");
|
|
|
|
g_value_set_boxed (value, &color);
|
|
|
|
}
|
2011-01-20 01:42:50 +00:00
|
|
|
else if (node->pspec->value_type == GTK_TYPE_BORDER)
|
|
|
|
{
|
|
|
|
g_value_take_boxed (value, gtk_border_new ());
|
|
|
|
}
|
2010-11-13 18:53:36 +00:00
|
|
|
else
|
|
|
|
g_param_value_set_default (node->pspec, value);
|
|
|
|
}
|
|
|
|
|
2010-12-02 22:41:24 +00:00
|
|
|
const GValue *
|
|
|
|
_gtk_style_properties_peek_property (GtkStyleProperties *props,
|
|
|
|
const gchar *prop_name,
|
|
|
|
GtkStateFlags state)
|
|
|
|
{
|
|
|
|
GtkStylePropertiesPrivate *priv;
|
|
|
|
PropertyNode *node;
|
|
|
|
PropertyData *prop;
|
|
|
|
GValue *val;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), NULL);
|
|
|
|
g_return_val_if_fail (prop_name != NULL, NULL);
|
|
|
|
|
|
|
|
node = property_node_lookup (g_quark_try_string (prop_name));
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
{
|
|
|
|
g_warning ("Style property \"%s\" is not registered", prop_name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv = props->priv;
|
|
|
|
prop = g_hash_table_lookup (priv->properties,
|
|
|
|
GINT_TO_POINTER (node->property_quark));
|
|
|
|
|
|
|
|
if (!prop)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
val = property_data_match_state (prop, state);
|
|
|
|
|
|
|
|
if (val &&
|
|
|
|
!style_properties_resolve_type (props, node, val))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_get_property:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @property: style property name
|
|
|
|
* @state: state to retrieve the property value for
|
|
|
|
* @value: (out) (transfer full): return location for the style property value.
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Gets a style property from @props for the given state. When done with @value,
|
2010-10-19 08:59:46 +00:00
|
|
|
* g_value_unset() needs to be called to free any allocated memory.
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Returns: %TRUE if the property exists in @props, %FALSE otherwise
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-03-04 19:59:18 +00:00
|
|
|
gboolean
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_get_property (GtkStyleProperties *props,
|
|
|
|
const gchar *property,
|
|
|
|
GtkStateFlags state,
|
|
|
|
GValue *value)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-03-05 01:06:53 +00:00
|
|
|
PropertyNode *node;
|
2010-03-04 19:59:18 +00:00
|
|
|
PropertyData *prop;
|
2010-06-25 18:08:07 +00:00
|
|
|
GValue *val;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
|
2010-03-04 19:59:18 +00:00
|
|
|
g_return_val_if_fail (property != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (value != NULL, FALSE);
|
|
|
|
|
2010-03-05 01:06:53 +00:00
|
|
|
node = property_node_lookup (g_quark_try_string (property));
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
{
|
|
|
|
g_warning ("Style property \"%s\" is not registered", property);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-03-05 01:06:53 +00:00
|
|
|
prop = g_hash_table_lookup (priv->properties,
|
|
|
|
GINT_TO_POINTER (node->property_quark));
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-06-13 15:10:05 +00:00
|
|
|
if (!prop)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-11-13 18:53:36 +00:00
|
|
|
g_value_init (value, node->pspec->value_type);
|
2010-08-16 17:09:34 +00:00
|
|
|
val = property_data_match_state (prop, state);
|
|
|
|
|
2010-12-02 22:37:15 +00:00
|
|
|
if (val &&
|
|
|
|
!style_properties_resolve_type (props, node, val))
|
|
|
|
return FALSE;
|
2010-06-25 18:08:07 +00:00
|
|
|
|
2010-11-13 18:53:36 +00:00
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
g_param_value_validate (node->pspec, val);
|
|
|
|
g_value_copy (val, value);
|
|
|
|
}
|
|
|
|
else
|
2010-12-02 22:37:15 +00:00
|
|
|
lookup_default_value (node, value);
|
2010-03-04 19:59:18 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_get_valist:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @state: state to retrieve the property values for
|
|
|
|
* @args: va_list of property name/return location pairs, followed by %NULL
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Retrieves several style property values from @props for a given state.
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-03-05 02:02:59 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_get_valist (GtkStyleProperties *props,
|
|
|
|
GtkStateFlags state,
|
|
|
|
va_list args)
|
2010-03-05 02:02:59 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-03-05 02:02:59 +00:00
|
|
|
const gchar *property_name;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-03-05 02:02:59 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-03-05 02:02:59 +00:00
|
|
|
property_name = va_arg (args, const gchar *);
|
|
|
|
|
|
|
|
while (property_name)
|
|
|
|
{
|
|
|
|
PropertyNode *node;
|
|
|
|
PropertyData *prop;
|
|
|
|
gchar *error = NULL;
|
2010-09-01 23:58:48 +00:00
|
|
|
GValue *val = NULL;
|
2010-03-05 02:02:59 +00:00
|
|
|
|
|
|
|
node = property_node_lookup (g_quark_try_string (property_name));
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
{
|
|
|
|
g_warning ("Style property \"%s\" is not registered", property_name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
prop = g_hash_table_lookup (priv->properties,
|
|
|
|
GINT_TO_POINTER (node->property_quark));
|
|
|
|
|
2010-09-01 23:58:48 +00:00
|
|
|
if (prop)
|
|
|
|
val = property_data_match_state (prop, state);
|
2010-06-13 15:10:05 +00:00
|
|
|
|
2010-12-02 22:37:15 +00:00
|
|
|
if (val &&
|
|
|
|
!style_properties_resolve_type (props, node, val))
|
|
|
|
val = NULL;
|
2010-11-13 18:53:36 +00:00
|
|
|
|
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
g_param_value_validate (node->pspec, val);
|
|
|
|
G_VALUE_LCOPY (val, args, 0, &error);
|
2010-09-02 00:11:12 +00:00
|
|
|
}
|
2010-11-13 18:53:36 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GValue default_value = { 0 };
|
2010-03-05 02:02:59 +00:00
|
|
|
|
2010-12-02 22:37:15 +00:00
|
|
|
g_value_init (&default_value, node->pspec->value_type);
|
2010-11-13 18:53:36 +00:00
|
|
|
lookup_default_value (node, &default_value);
|
|
|
|
G_VALUE_LCOPY (&default_value, args, 0, &error);
|
|
|
|
g_value_unset (&default_value);
|
|
|
|
}
|
2010-09-01 23:58:48 +00:00
|
|
|
|
2010-03-05 02:02:59 +00:00
|
|
|
if (error)
|
|
|
|
{
|
|
|
|
g_warning ("Could not get style property \"%s\": %s", property_name, error);
|
2010-06-13 15:10:05 +00:00
|
|
|
g_free (error);
|
2010-03-05 02:02:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
property_name = va_arg (args, const gchar *);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_get:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @state: state to retrieve the property values for
|
|
|
|
* @...: property name /return value pairs, followed by %NULL
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Retrieves several style property values from @props for a
|
2010-10-19 08:59:46 +00:00
|
|
|
* given state.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-03-05 02:02:59 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_get (GtkStyleProperties *props,
|
|
|
|
GtkStateFlags state,
|
|
|
|
...)
|
2010-03-05 02:02:59 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-03-05 02:02:59 +00:00
|
|
|
|
|
|
|
va_start (args, state);
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_get_valist (props, state, args);
|
2010-03-05 02:02:59 +00:00
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_unset_property:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @property: property to unset
|
|
|
|
* @state: state to unset
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Unsets a style property in @props.
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-03-04 19:59:18 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_unset_property (GtkStyleProperties *props,
|
|
|
|
const gchar *property,
|
|
|
|
GtkStateFlags state)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-03-05 01:06:53 +00:00
|
|
|
PropertyNode *node;
|
2010-03-04 19:59:18 +00:00
|
|
|
PropertyData *prop;
|
2010-08-16 17:09:34 +00:00
|
|
|
guint pos;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-03-04 19:59:18 +00:00
|
|
|
g_return_if_fail (property != NULL);
|
|
|
|
|
2010-03-05 01:06:53 +00:00
|
|
|
node = property_node_lookup (g_quark_try_string (property));
|
|
|
|
|
|
|
|
if (!node)
|
|
|
|
{
|
|
|
|
g_warning ("Style property \"%s\" is not registered", property);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-03-05 01:06:53 +00:00
|
|
|
prop = g_hash_table_lookup (priv->properties,
|
|
|
|
GINT_TO_POINTER (node->property_quark));
|
2010-03-04 19:59:18 +00:00
|
|
|
|
|
|
|
if (!prop)
|
|
|
|
return;
|
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
if (property_data_find_position (prop, state, &pos))
|
|
|
|
{
|
|
|
|
ValueData *data;
|
|
|
|
|
|
|
|
data = &g_array_index (prop->values, ValueData, pos);
|
|
|
|
|
|
|
|
if (G_IS_VALUE (&data->value))
|
|
|
|
g_value_unset (&data->value);
|
|
|
|
|
|
|
|
g_array_remove_index (prop->values, pos);
|
|
|
|
}
|
2010-03-04 19:59:18 +00:00
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_clear:
|
|
|
|
* @props: a #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Clears all style information from @props.
|
2010-10-19 08:59:46 +00:00
|
|
|
**/
|
2010-03-04 19:59:18 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_clear (GtkStyleProperties *props)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
2010-03-04 19:59:18 +00:00
|
|
|
g_hash_table_remove_all (priv->properties);
|
|
|
|
}
|
|
|
|
|
2010-10-19 08:59:46 +00:00
|
|
|
/**
|
2010-10-29 04:47:32 +00:00
|
|
|
* gtk_style_properties_merge:
|
|
|
|
* @props: a #GtkStyleProperties
|
|
|
|
* @props_to_merge: a second #GtkStyleProperties
|
2010-10-19 08:59:46 +00:00
|
|
|
* @replace: whether to replace values or not
|
|
|
|
*
|
2010-10-29 04:47:32 +00:00
|
|
|
* Merges into @props all the style information contained
|
|
|
|
* in @props_to_merge. If @replace is %TRUE, the values
|
2010-10-19 08:59:46 +00:00
|
|
|
* will be overwritten, if it is %FALSE, the older values
|
|
|
|
* will prevail.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
2010-03-04 19:59:18 +00:00
|
|
|
void
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_merge (GtkStyleProperties *props,
|
|
|
|
const GtkStyleProperties *props_to_merge,
|
|
|
|
gboolean replace)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-10-29 04:47:32 +00:00
|
|
|
GtkStylePropertiesPrivate *priv, *priv_to_merge;
|
2010-03-04 19:59:18 +00:00
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props_to_merge));
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
priv = props->priv;
|
|
|
|
priv_to_merge = props_to_merge->priv;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-06-25 17:37:54 +00:00
|
|
|
/* Merge symbolic color map */
|
|
|
|
if (priv_to_merge->color_map)
|
|
|
|
{
|
|
|
|
g_hash_table_iter_init (&iter, priv_to_merge->color_map);
|
|
|
|
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
GtkSymbolicColor *color;
|
|
|
|
|
|
|
|
name = key;
|
|
|
|
color = value;
|
|
|
|
|
|
|
|
if (!replace &&
|
|
|
|
g_hash_table_lookup (priv->color_map, name))
|
|
|
|
continue;
|
|
|
|
|
2010-10-29 04:47:32 +00:00
|
|
|
gtk_style_properties_map_color (props, name, color);
|
2010-06-25 17:37:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Merge symbolic style properties */
|
2010-03-04 19:59:18 +00:00
|
|
|
g_hash_table_iter_init (&iter, priv_to_merge->properties);
|
|
|
|
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
|
|
|
{
|
|
|
|
PropertyData *prop_to_merge = value;
|
2010-08-16 17:09:34 +00:00
|
|
|
PropertyData *prop;
|
|
|
|
guint i;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
prop = g_hash_table_lookup (priv->properties, key);
|
|
|
|
|
|
|
|
if (!prop)
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-08-16 17:09:34 +00:00
|
|
|
prop = property_data_new ();
|
|
|
|
g_hash_table_insert (priv->properties, key, prop);
|
|
|
|
}
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
for (i = 0; i < prop_to_merge->values->len; i++)
|
|
|
|
{
|
|
|
|
ValueData *data;
|
|
|
|
GValue *value;
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
data = &g_array_index (prop_to_merge->values, ValueData, i);
|
2011-01-17 03:06:57 +00:00
|
|
|
|
|
|
|
if (replace && data->state == GTK_STATE_FLAG_NORMAL &&
|
|
|
|
G_VALUE_TYPE (&data->value) != PANGO_TYPE_FONT_DESCRIPTION)
|
|
|
|
{
|
|
|
|
/* Let normal state override all states
|
|
|
|
* previously set in the original set
|
|
|
|
*/
|
|
|
|
property_data_remove_values (prop);
|
|
|
|
}
|
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
value = property_data_get_value (prop, data->state);
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-11-03 10:36:18 +00:00
|
|
|
if (G_VALUE_TYPE (&data->value) == PANGO_TYPE_FONT_DESCRIPTION &&
|
|
|
|
G_IS_VALUE (value))
|
|
|
|
{
|
|
|
|
PangoFontDescription *font_desc;
|
|
|
|
PangoFontDescription *font_desc_to_merge;
|
|
|
|
|
|
|
|
/* Handle merging of font descriptions */
|
|
|
|
font_desc = g_value_get_boxed (value);
|
|
|
|
font_desc_to_merge = g_value_get_boxed (&data->value);
|
|
|
|
|
|
|
|
pango_font_description_merge (font_desc, font_desc_to_merge, replace);
|
|
|
|
}
|
2011-01-28 08:59:02 +00:00
|
|
|
else if (G_VALUE_TYPE (&data->value) == G_TYPE_PTR_ARRAY &&
|
|
|
|
G_IS_VALUE (value))
|
|
|
|
{
|
|
|
|
GPtrArray *array, *array_to_merge;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
/* Append the array, mainly thought
|
|
|
|
* for the gtk-key-bindings property
|
|
|
|
*/
|
|
|
|
array = g_value_get_boxed (value);
|
|
|
|
array_to_merge = g_value_get_boxed (&data->value);
|
|
|
|
|
|
|
|
for (i = 0; i < array_to_merge->len; i++)
|
|
|
|
g_ptr_array_add (array, g_ptr_array_index (array_to_merge, i));
|
|
|
|
}
|
2010-11-03 10:36:18 +00:00
|
|
|
else if (replace || !G_IS_VALUE (value))
|
2010-03-04 19:59:18 +00:00
|
|
|
{
|
2010-08-16 17:09:34 +00:00
|
|
|
if (!G_IS_VALUE (value))
|
|
|
|
g_value_init (value, G_VALUE_TYPE (&data->value));
|
|
|
|
else if (G_VALUE_TYPE (value) != G_VALUE_TYPE (&data->value))
|
2010-08-02 13:26:41 +00:00
|
|
|
{
|
2010-08-16 17:09:34 +00:00
|
|
|
g_value_unset (value);
|
|
|
|
g_value_init (value, G_VALUE_TYPE (&data->value));
|
2010-08-02 13:26:41 +00:00
|
|
|
}
|
2010-03-04 19:59:18 +00:00
|
|
|
|
2010-08-16 17:09:34 +00:00
|
|
|
g_value_copy (&data->value, value);
|
2010-03-04 19:59:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|