Commit 57f41a7e authored by Tristan Van Berkom's avatar Tristan Van Berkom

- made some members properties - added glade_property_set (property, ...)


* src/glade-property.[ch]:
  - made some members properties
  - added glade_property_set (property, ...) convenience function
  - Added set_tooltip & tooltip changed signal
  - Added insensitive property.

* src/glade-property-class.h: Clarified comment

* src/glade-property-class.c: Properties that are native to GtkWidget go in
  the "common" tab by default (unless overridden by the xml file).

* src/glade-editor.[ch]: Now we watch property sensitivity and tooltip status

* src/glade-gtk.c: The beginnings of stock buttons.
parent e07fc567
2005-07-29 Tristan Van Berkom <tvb@gnome.org>
* src/glade-property.[ch]:
- made some members properties
- added glade_property_set (property, ...) convenience function
- Added set_tooltip & tooltip changed signal
- Added insensitive property.
* src/glade-property-class.h: Clarified comment
* src/glade-property-class.c: Properties that are native to GtkWidget go in
the "common" tab by default (unless overridden by the xml file).
* src/glade-editor.[ch]: Now we watch property sensitivity and tooltip status
* src/glade-gtk.c: The beginnings of stock buttons.
2005-07-28 Tristan Van Berkom <tvb@gnome.org>
* src/glade-app.c: Fixed a few compile warnings and fixed signal emmission to
......
......@@ -47,6 +47,9 @@
static GtkNotebookClass *parent_class = NULL;
static GdkColor *insensitive_colour = NULL;
static GdkColor *normal_colour = NULL;
static void glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget);
static void glade_editor_property_load_flags (GladeEditorProperty *property);
......@@ -322,7 +325,7 @@ glade_editor_property_changed_enabled (GtkWidget *button,
state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
gtk_widget_set_sensitive (spin, state);
property = g_object_get_data (G_OBJECT (button), "user_data");
property->property->enabled = state;
glade_property_set_enabled (property->property, state);
}
static void
......@@ -1059,22 +1062,34 @@ glade_editor_create_input_unichar (GladeEditorProperty *property)
* Returns:
*/
GtkWidget *
glade_editor_create_item_label (GladePropertyClass *class)
glade_editor_create_item_label (GladeEditorProperty *property)
{
GtkWidget *eventbox;
GtkWidget *label;
gchar *text;
gchar *text;
g_return_val_if_fail (GLADE_IS_EDITOR_PROPERTY (property), NULL);
g_return_val_if_fail (property->class != NULL, NULL);
text = g_strdup_printf ("%s :", class->name);
text = g_strdup_printf ("%s :", property->class->name);
label = gtk_label_new (text);
g_free (text);
if (insensitive_colour == NULL)
insensitive_colour =
&(GTK_WIDGET
(label)->style->text[GTK_STATE_INSENSITIVE]);
if (normal_colour == NULL)
normal_colour =
&(GTK_WIDGET
(label)->style->text[GTK_STATE_NORMAL]);
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.0);
/* we need to wrap the label in an event box to add tooltips */
eventbox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (eventbox), label);
glade_util_widget_set_tooltip (eventbox, class->tooltip);
return eventbox;
}
......@@ -1082,8 +1097,6 @@ glade_editor_create_item_label (GladePropertyClass *class)
static void
glade_editor_table_attach (GtkWidget *table, GtkWidget *child, gint pos, gint row)
{
/* gtk_table_attach_defaults (GTK_TABLE (table), child, */
/* pos, pos+1, row, row +1); */
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
pos ? GTK_EXPAND | GTK_FILL : GTK_FILL,
......@@ -1097,7 +1110,6 @@ glade_editor_append_item_real (GladeEditorTable *table,
GladeEditorProperty *property)
{
GladePropertyClass *class;
GtkWidget *label;
GtkWidget *input = NULL;
g_return_val_if_fail (GLADE_IS_EDITOR_TABLE (table), NULL);
......@@ -1134,9 +1146,9 @@ glade_editor_append_item_real (GladeEditorTable *table,
return gtk_label_new ("Implement me !");
}
label = glade_editor_create_item_label (class);
property->item_label = glade_editor_create_item_label (property);
glade_editor_table_attach (table->table_widget, label, 0, table->rows);
glade_editor_table_attach (table->table_widget, property->item_label, 0, table->rows);
glade_editor_table_attach (table->table_widget, input, 1, table->rows);
table->rows++;
......@@ -1191,21 +1203,17 @@ glade_editor_table_append_name_field (GladeEditorTable *table)
static void
glade_editor_table_append_class_field (GladeEditorTable *table)
{
GtkWidget *gtk_table;
GtkWidget *label;
GtkWidget *entry;
GtkWidget *class_label;
gtk_table = table->table_widget;
/* Class */
label = gtk_label_new (_("Class :"));
label = gtk_label_new (_("Class :"));
class_label = gtk_label_new (table->glade_widget_class->name);
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.0);
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), table->glade_widget_class->name);
gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE);
gtk_misc_set_alignment (GTK_MISC (class_label), 0.0, 0.0);
glade_editor_table_attach (gtk_table, label, 0, table->rows);
glade_editor_table_attach (gtk_table, entry, 1, table->rows);
glade_editor_table_attach (table->table_widget, label, 0, table->rows);
glade_editor_table_attach (table->table_widget, class_label, 1, table->rows);
table->rows++;
}
......@@ -1450,16 +1458,38 @@ glade_editor_load_widget_class (GladeEditor *editor, GladeWidgetClass *class)
}
/* ============================ Load properties ============================ */
static void
glade_editor_tooltip_cb (GladeProperty *property,
const gchar *tooltip,
GladeEditorProperty *editor_prop)
{
glade_util_widget_set_tooltip (editor_prop->input, tooltip);
glade_util_widget_set_tooltip (editor_prop->item_label, tooltip);
}
static void
glade_editor_property_set_tooltips (GladeEditorProperty *property)
{
gchar *tooltip;
g_return_if_fail (property != NULL);
g_return_if_fail (GLADE_IS_PROPERTY (property->property));
g_return_if_fail (property->input != NULL);
glade_util_widget_set_tooltip (property->input, property->property->class->tooltip);
if (property->tooltip_id > 0)
g_signal_handler_disconnect (G_OBJECT (property->tooltip_prop),
property->tooltip_id);
property->tooltip_prop = property->property;
property->tooltip_id =
g_signal_connect (G_OBJECT (property->property),
"tooltip-changed",
G_CALLBACK (glade_editor_tooltip_cb),
property);
return;
tooltip = (gchar *)glade_property_get_tooltip (property->property);
glade_util_widget_set_tooltip (property->input, tooltip);
glade_util_widget_set_tooltip (property->item_label, tooltip);
return;
}
static void
......@@ -1498,9 +1528,10 @@ glade_editor_property_load_integer (GladeEditorProperty *property)
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin));
g_return_if_fail (GTK_IS_CHECK_BUTTON (button));
gtk_widget_set_sensitive (GTK_WIDGET (spin), property->property->enabled);
gtk_widget_set_sensitive (GTK_WIDGET (spin),
glade_property_get_enabled (property->property));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
property->property->enabled);
glade_property_get_enabled (property->property));
g_object_set_data (G_OBJECT (button), "user_data", property);
} else {
spin = property->input;
......@@ -1527,7 +1558,6 @@ glade_editor_property_load_integer (GladeEditorProperty *property)
g_type_name(class->pspec->value_type));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), val);
g_object_set_data (G_OBJECT (spin), "user_data", property);
}
......@@ -1689,10 +1719,24 @@ glade_editor_property_load_unichar (GladeEditorProperty *property)
g_object_set_data (G_OBJECT (property->input), "user_data", property);
}
static void
glade_editor_sensitivity_cb (GladeProperty *property,
GParamSpec *pspec,
GladeEditorProperty *editor_prop)
{
gboolean sensitive = glade_property_get_sensitive (editor_prop->property);
gtk_widget_modify_fg
(GTK_WIDGET (editor_prop->item_label),
GTK_STATE_NORMAL,
sensitive ? normal_colour : insensitive_colour);
gtk_widget_set_sensitive (editor_prop->input, sensitive);
}
static void
glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
{
GladePropertyClass *class;
gboolean sensitive;
g_return_if_fail (GLADE_IS_EDITOR_PROPERTY (property));
g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property->class));
......@@ -1700,7 +1744,8 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
class = property->class;
/* Load the property */
if ((property->property = glade_widget_get_property (widget, class->id)) == NULL)
if ((property->property =
glade_widget_get_property (widget, class->id)) == NULL)
{
g_critical ("Couldnt find property of class %s on widget of class %s\n",
class->id, widget->widget_class->name);
......@@ -1732,6 +1777,26 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
g_warning ("%s : type %s not implemented (%s)\n", G_GNUC_FUNCTION,
class->name, g_type_name (class->pspec->value_type));
/* Set insensitive and hook cb here XXX */
if (property->sensitive_id > 0)
g_signal_handler_disconnect (property->sensitive_prop,
property->sensitive_id);
property->sensitive_prop = property->property;
property->sensitive_id =
g_signal_connect (G_OBJECT (property->property),
"notify::sensitive",
G_CALLBACK (glade_editor_sensitivity_cb),
property);
sensitive = glade_property_get_sensitive (property->property);
gtk_widget_modify_fg
(GTK_WIDGET (property->item_label),
GTK_STATE_NORMAL,
sensitive ? normal_colour : insensitive_colour);
gtk_widget_set_sensitive (property->input, sensitive);
glade_editor_property_set_tooltips (property);
property->property->loading = FALSE;
......
......@@ -177,6 +177,14 @@ struct _GladeEditorProperty
gboolean from_query_dialog; /* If this input is part of a query dialog
* this is TRUE.
*/
gulong tooltip_id; /* signal connection id for tooltip changes */
GladeProperty *tooltip_prop; /* the last object this was connected to */
gulong sensitive_id; /* signal connection id for sensitivity changes */
GladeProperty *sensitive_prop; /* the last object this was connected to */
GtkWidget *item_label; /* Keep a hold of this for tooltips */
};
LIBGLADEUI_API GType glade_editor_get_type (void);
......
......@@ -49,6 +49,7 @@ glade_gtk_stock_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
{ 0, "None", "glade-none" },
{ 1, "Ok", "gtk-ok" },
......@@ -841,75 +842,40 @@ glade_gtk_table_verify_n_columns (GObject *object, GValue *value)
void GLADEGTK_API
glade_gtk_button_set_stock (GObject *object, GValue *value)
{
GladeWidget *glade_widget;
GtkWidget *button;
GtkStockItem item;
GladeWidget *glade_widget;
GladeProperty *property;
GladeProperty *text;
GEnumClass *eclass;
guint i;
gint val;
glade_widget = glade_widget_get_from_gobject (object);
g_return_if_fail (GTK_IS_BUTTON (object));
g_return_if_fail (glade_widget != NULL);
val = g_value_get_enum (value);
if (val == GPOINTER_TO_INT (g_object_get_data (object, "stock")))
return;
button = GTK_WIDGET (object);
g_return_if_fail (GTK_IS_BUTTON (button));
glade_widget = glade_widget_get_from_gobject (button);
g_return_if_fail (glade_widget != NULL);
property = glade_widget_get_property (glade_widget, "stock");
text = glade_widget_get_property (glade_widget, "label");
eclass = g_type_class_ref (property->class->pspec->value_type);
g_return_if_fail (property != NULL);
g_return_if_fail (text != NULL);
eclass = g_type_class_ref (property->class->pspec->value_type);
for (i = 0; i < eclass->n_values; i++)
{
if (val == eclass->values[i].value)
break;
if (i >= eclass->n_values) {
g_type_class_unref (eclass);
return;
}
g_return_if_fail (i < eclass->n_values);
gtk_container_remove (GTK_CONTAINER (button),
GTK_BIN (button)->child);
if (!gtk_stock_lookup (eclass->values[i].value_nick, &item))
{
GtkWidget *label;
if (g_value_get_boolean (
glade_widget_get_property (
glade_widget, "use-underline")->value))
label = gtk_label_new_with_mnemonic (g_value_get_string (text->value));
else
label = gtk_label_new (g_value_get_string (text->value));
gtk_container_add (GTK_CONTAINER (button), label);
gtk_widget_show_all (button);
}
else
{
GtkWidget *label;
GtkWidget *image;
GtkWidget *hbox;
hbox = gtk_hbox_new (FALSE, 1);
label = gtk_label_new_with_mnemonic (item.label);
image = gtk_image_new_from_stock (eclass->values[i].value_nick,
GTK_ICON_SIZE_BUTTON);
property = glade_widget_get_property (glade_widget, "use-stock");
glade_property_set (property, TRUE);
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
button);
property = glade_widget_get_property (glade_widget, "label");
glade_property_set (property, eclass->values[i].value_nick);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button), hbox);
gtk_widget_show_all (button);
}
glade_property_set_sensitive (property, FALSE, "Jolly rancher");
g_type_class_unref (eclass);
g_object_set_data (object, "stock", GINT_TO_POINTER (val));
......
......@@ -539,9 +539,11 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class
GladePropertyClass *
glade_property_class_new_from_spec (GParamSpec *spec)
{
GObjectClass *gtk_widget_class;
GladePropertyClass *property_class;
g_return_val_if_fail (spec != NULL, NULL);
gtk_widget_class = g_type_class_ref (GTK_TYPE_WIDGET);
property_class = glade_property_class_new ();
......@@ -554,6 +556,15 @@ glade_property_class_new_from_spec (GParamSpec *spec)
property_class->id = g_strdup (spec->name);
property_class->name = g_strdup (g_param_spec_get_nick (spec));
/* If its on the GtkWidgetClass, it goes in "common"
* (unless stipulated otherwise in the xml file)
*/
if (g_object_class_find_property (gtk_widget_class,
g_param_spec_get_name (spec)) != NULL)
property_class->common = TRUE;
if (!property_class->id || !property_class->name)
{
g_warning ("Failed to create property class from spec");
......@@ -567,6 +578,7 @@ glade_property_class_new_from_spec (GParamSpec *spec)
lblError:
glade_property_class_free (property_class);
g_type_class_unref (gtk_widget_class);
return NULL;
}
......
......@@ -98,10 +98,8 @@ struct _GladePropertyClass
gchar *name; /* The name of the property. Like "Label" or "X Pad"
* this is a translatable string
*/
gchar *tooltip; /* The tooltip. Currently unimplemented. Not sure if
* it should go here
gchar *tooltip; /* The default tooltip for the property editor rows.
*/
GValue *def; /* The default value for this property */
GValue *orig_def; /* If def is overridden by a xml file,
......
......@@ -20,10 +20,16 @@
* Chema Celorio <chema@celorio.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h> /* for atoi and atof */
#include <string.h>
#include <glib/gi18n-lib.h>
#include "glade.h"
#include "glade-widget.h"
#include "glade-property.h"
......@@ -39,9 +45,20 @@
enum
{
VALUE_CHANGED,
TOOLTIP_CHANGED,
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_ENABLED,
PROP_SENSITIVE,
PROP_I18N_TRANSLATABLE,
PROP_I18N_HAS_CONTEXT,
PROP_I18N_COMMENT
};
static guint glade_property_signals[LAST_SIGNAL] = { 0 };
static GObjectClass* parent_class = NULL;
......@@ -130,6 +147,14 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value)
}
static void
glade_property_get_value_impl (GladeProperty *property, GValue *value)
{
g_value_init (value, property->class->pspec->value_type);
g_value_copy (property->value, value);
}
static void
glade_property_sync_impl (GladeProperty *property)
{
......@@ -273,70 +298,81 @@ glade_property_write_impl (GladeProperty *property,
return TRUE;
}
/* Parameters for translatable properties. */
static void
glade_property_i18n_set_comment_impl (GladeProperty *property,
const gchar *str)
{
if (property->i18n_comment)
g_free (property->i18n_comment);
property->i18n_comment = g_strdup (str);
}
static const gchar *
glade_property_i18n_get_comment_impl (GladeProperty *property)
static G_CONST_RETURN gchar *
glade_property_get_tooltip_impl (GladeProperty *property)
{
return property->i18n_comment;
gchar *tooltip = NULL;
if (property->sensitive == FALSE)
tooltip = property->insensitive_tooltip;
else
tooltip = property->class->tooltip;
return tooltip;
}
/*******************************************************************************
GObjectClass & Object Construction
*******************************************************************************/
static void
glade_property_i18n_set_translatable_impl (GladeProperty *property,
gboolean translatable)
glade_property_set_real_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
property->i18n_translatable = translatable;
}
GladeProperty *property = GLADE_PROPERTY (object);
static gboolean
glade_property_i18n_get_translatable_impl (GladeProperty *property)
{
return property->i18n_translatable;
switch (prop_id)
{
case PROP_ENABLED:
glade_property_set_enabled (property, g_value_get_boolean (value));
break;
case PROP_I18N_TRANSLATABLE:
glade_property_i18n_set_translatable (property, g_value_get_boolean (value));
break;
case PROP_I18N_HAS_CONTEXT:
glade_property_i18n_set_has_context (property, g_value_get_boolean (value));
break;
case PROP_I18N_COMMENT:
glade_property_i18n_set_comment (property, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
glade_property_i18n_set_has_context_impl (GladeProperty *property,
gboolean has_context)
glade_property_get_real_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
property->i18n_has_context = has_context;
}
static gboolean
glade_property_i18n_get_has_context_impl (GladeProperty *property)
{
return property->i18n_has_context;
}
GladeProperty *property = GLADE_PROPERTY (object);
static void
glade_property_set_sensitive_impl (GladeProperty *property,
gboolean sensitive)
{
if (property->sensitive != sensitive)
switch (prop_id)
{
GladeEditor *editor = glade_default_app_get_editor ();
property->sensitive = sensitive;
/* Reload editor if this widget is selected */
if (editor->loaded_widget == property->widget)
glade_editor_refresh (editor);
case PROP_ENABLED:
g_value_set_boolean (value, glade_property_get_enabled (property));
break;
case PROP_SENSITIVE:
g_value_set_boolean (value, glade_property_get_sensitive (property));
break;
case PROP_I18N_TRANSLATABLE:
g_value_set_boolean (value, glade_property_i18n_get_translatable (property));
break;
case PROP_I18N_HAS_CONTEXT:
g_value_set_boolean (value, glade_property_i18n_get_has_context (property));
break;
case PROP_I18N_COMMENT:
g_value_set_string (value, glade_property_i18n_get_comment (property));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/*******************************************************************************
GObjectClass & Object Construction
*******************************************************************************/
static void
glade_property_finalize (GObject *object)
{
......@@ -372,25 +408,59 @@ glade_property_cinfo_init (GladePropertyCinfo *prop_class)
parent_class = g_type_class_peek_parent (prop_class);
object_class = G_OBJECT_CLASS (prop_class);
/* GObjectClass */
object_class->set_property = glade_property_set_real_property;
object_class->get_property = glade_property_get_real_property;
object_class->finalize = glade_property_finalize;
/* Class methods */
prop_class->dup = glade_property_dup_impl;
prop_class->set_value = glade_property_set_value_impl;
prop_class->get_value = glade_property_get_value_impl;
prop_class->sync = glade_property_sync_impl;
prop_class->write = glade_property_write_impl;
prop_class->dup = glade_property_dup_impl;
prop_class->set_sensitive = glade_property_set_sensitive_impl;
prop_class->i18n_set_comment = glade_property_i18n_set_comment_impl;
prop_class->i18n_get_comment = glade_property_i18n_get_comment_impl;
prop_class->i18n_set_translatable = glade_property_i18n_set_translatable_impl;
prop_class->i18n_get_translatable = glade_property_i18n_get_translatable_impl;
prop_class->i18n_set_has_context = glade_property_i18n_set_has_context_impl;
prop_class->i18n_get_has_context = glade_property_i18n_get_has_context_impl;
/* Signals */
prop_class->get_tooltip = glade_property_get_tooltip_impl;
prop_class->value_changed = NULL;
prop_class->tooltip_changed = NULL;
/* Properties */
g_object_class_install_property
(object_class, PROP_ENABLED,
g_param_spec_boolean
("enabled", _("Enabled"),
_("If the property is optional, this is its enabled state"),
TRUE, G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_SENSITIVE,
g_param_spec_boolean
("sensitive", _("Sensitive"),
_("This gives backends control to set property sensitivity"),
TRUE, G_PARAM_READABLE));
g_object_class_install_property
(object_class, PROP_I18N_COMMENT,
g_param_spec_string
("i18n-comment", _("Comment"),
_("XXX FIXME: The translators comment ?"),
NULL, G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_I18N_TRANSLATABLE,
g_param_spec_boolean
("i18n-translatable", _("Translatable"),
_("Whether this property is translatable or not"),
TRUE, G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_I18N_HAS_CONTEXT,
g_param_spec_boolean
("i18n-has-context", _("Has Context"),
_("Whether this property is translatable or not"),
TRUE, G_PARAM_READWRITE));
/* Signals */
glade_property_signals[VALUE_CHANGED] =
g_signal_new ("value-changed",
G_TYPE_FROM_CLASS (parent_class),
......@@ -400,6 +470,18 @@ glade_property_cinfo_init (GladePropertyCinfo *prop_class)
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
glade_property_signals[TOOLTIP_CHANGED] =
g_signal_new ("tooltip-changed",
G_TYPE_FROM_CLASS (parent_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GladePropertyCinfo,
tooltip_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
}
......@@ -516,6 +598,21 @@ glade_property_set_value (GladeProperty *property, const GValue *value)
GLADE_PROPERTY_GET_CINFO (property)->set_value (property, value);
}
/**
* glade_property_set_value:
* @property: a #GladeProperty
* @value: a #GValue
*
* TODO: write me
*/
void
glade_property_get_value (GladeProperty *property, GValue *value)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (value != NULL);
GLADE_PROPERTY_GET_CINFO (property)->get_value (property, value);
}
/**
* glade_property_set:
......@@ -579,6 +676,70 @@ glade_property_set (GladeProperty *property, ...)
g_free (value);
}
/**
* glade_property_set:
* @property: a #GladeProperty
* @value: a #GValue
*
* TODO: write me
*/
void
glade_property_get (GladeProperty *property, ...)
{
va_list vl;
GValue *value;
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (value != NULL);
value = g_new0 (GValue, 1);
GLADE_PROPERTY_GET_CINFO (property)->get_value (property, value);
va_start (vl, property);
/* The argument is a pointer of the specified type, cast the pointer and assign
* the value using the proper g_value_get_ variation.
*/
if (G_IS_PARAM_SPEC_ENUM(property->class->pspec))
*(gint *)(va_arg (vl, gint *)) = g_value_get_enum (property->value);
else if (G_IS_PARAM_SPEC_FLAGS(property->class->pspec))
*(gint *)(va_arg (vl, gint *)) = g_value_get_flags (property->value);
else if (G_IS_PARAM_SPEC_INT(property->class->pspec))
*(gint *)(va_arg (vl, gint *)) = g_value_get_int (property->value);
else if (G_IS_PARAM_SPEC_UINT(property->class->pspec))
*(guint *)(va_arg (vl, guint *)) = g_value_get_uint (property->value);
else if (G_IS_PARAM_SPEC_LONG(property->class->pspec))
*(glong *)(va_arg (vl, glong *)) = g_value_get_long (property->value);
else if (G_IS_PARAM_SPEC_ULONG(property->class->pspec))