Commit 81ed8652 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Cleared up property->class references, Added comments, Made spin button


	* src/glade-editor.c: Cleared up property->class references, Added comments,
	  Made spin button adjustments from the class, not from Glade Parameters.

	* src/glade-parameter.[ch]: Removed convenience create_adjustement function,
	  Certain data found in the xml file is parsed directly onto the class data and
	  others are dynamicly added through glade params, for this reason I'm
	  depricating use of glade-parameters in the core code, glade-parameters can
	  be kept around as a usefull configuration mechanism for plugin writers.

	* src/glade-gtk.c:
	    - Added special enum type & pspec for GtkImage
	    - Now GtkImage uses one of three methods to save
	        o Filename
	        o Stock
	        o Icon Theme
	      the appropriate controls are disabled & enabled
	      accordingly and survive a save/load with no custom
	      property help.
	    - Icon Size is disabled if a Pixel Size is specified
	      (as pixel size takes precedence on this object).
	    - Removed pointless unfinished API doc headers, the core
	      (i.e. libgladeui) could well be documented for use by
	      plugin writers and application writers (like anjuta for
	      instance) but in the plugin its pretty pointless.

	* src/glade-property-class.[ch]:
	    - Fiddled with g_critical outputs
	    - Added glade_property_class_make_adjustment
	    - Added LIBGLADEUI_API to func headers.

	* src/glade-property.[ch]: Added glade_property_reset()/glade_property_default()
	* src/glade-widget.[ch]: Added glade_widget_property_reset(),
	  glade_widget_pack_property_reset(), glade_widget_property_default(),
	  glade_widget_pack_property_default().

	* src/glade.h: Added definitions for defaults in editor adjustments.

	* widgets/gtk+.xml: Added information for GtkImage properties.
parent 83880dc0
2005-07-31 Tristan Van Berkom <tvb@gnome.org>
* src/glade-editor.c: Cleared up property->class references, Added comments,
Made spin button adjustments from the class, not from Glade Parameters.
* src/glade-parameter.[ch]: Removed convenience create_adjustement function,
Certain data found in the xml file is parsed directly onto the class data and
others are dynamicly added through glade params, for this reason I'm
depricating use of glade-parameters in the core code, glade-parameters can
be kept around as a usefull configuration mechanism for plugin writers.
* src/glade-gtk.c:
- Added special enum type & pspec for GtkImage
- Now GtkImage uses one of three methods to save
o Filename
o Stock
o Icon Theme
the appropriate controls are disabled & enabled
accordingly and survive a save/load with no custom
property help.
- Icon Size is disabled if a Pixel Size is specified
(as pixel size takes precedence on this object).
- Removed pointless unfinished API doc headers, the core
(i.e. libgladeui) could well be documented for use by
plugin writers and application writers (like anjuta for
instance) but in the plugin its pretty pointless.
* src/glade-property-class.[ch]:
- Fiddled with g_critical outputs
- Added glade_property_class_make_adjustment
- Added LIBGLADEUI_API to func headers.
* src/glade-property.[ch]: Added glade_property_reset()/glade_property_default()
* src/glade-widget.[ch]: Added glade_widget_property_reset(),
glade_widget_pack_property_reset(), glade_widget_property_default(),
glade_widget_pack_property_default().
* src/glade.h: Added definitions for defaults in editor adjustments.
* widgets/gtk+.xml: Added information for GtkImage properties.
2005-07-30 Tristan Van Berkom <tvb@gnome.org>
* src/glade-gtk.c, widgets/gtk+.xml:
......
......@@ -341,35 +341,35 @@ glade_editor_property_changed_numeric (GtkWidget *spin,
if (property->property->loading)
return;
g_value_init (&val, property->property->class->pspec->value_type);
g_value_init (&val, property->class->pspec->value_type);
if (G_IS_PARAM_SPEC_INT(property->property->class->pspec))
if (G_IS_PARAM_SPEC_INT(property->class->pspec))
g_value_set_int (&val, gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
else if (G_IS_PARAM_SPEC_UINT(property->property->class->pspec))
else if (G_IS_PARAM_SPEC_UINT(property->class->pspec))
g_value_set_uint (&val, gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
else if (G_IS_PARAM_SPEC_LONG(property->property->class->pspec))
else if (G_IS_PARAM_SPEC_LONG(property->class->pspec))
g_value_set_long (&val, (glong)gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
else if (G_IS_PARAM_SPEC_ULONG(property->property->class->pspec))
else if (G_IS_PARAM_SPEC_ULONG(property->class->pspec))
g_value_set_ulong (&val, (gulong)gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
else if (G_IS_PARAM_SPEC_INT64(property->property->class->pspec))
else if (G_IS_PARAM_SPEC_INT64(property->class->pspec))
g_value_set_int64 (&val, (gint64)gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
else if (G_IS_PARAM_SPEC_UINT64(property->property->class->pspec))
else if (G_IS_PARAM_SPEC_UINT64(property->class->pspec))
g_value_set_uint64 (&val, (guint64)gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
else if (G_IS_PARAM_SPEC_FLOAT(property->property->class->pspec))
else if (G_IS_PARAM_SPEC_FLOAT(property->class->pspec))
g_value_set_float (&val, (gfloat) gtk_spin_button_get_value
(GTK_SPIN_BUTTON (spin)));
else if (G_IS_PARAM_SPEC_DOUBLE(property->property->class->pspec))
else if (G_IS_PARAM_SPEC_DOUBLE(property->class->pspec))
g_value_set_double (&val, gtk_spin_button_get_value
(GTK_SPIN_BUTTON (spin)));
else
g_warning ("Unsupported type %s\n",
g_type_name(property->property->class->pspec->value_type));
g_type_name(G_PARAM_SPEC_TYPE (property->class->pspec)));
if (property->from_query_dialog)
glade_property_set_value (property->property, &val);
......@@ -588,7 +588,7 @@ glade_editor_property_show_flags_dialog (GtkWidget *entry,
mask = class->values[flag_num].value;
setting = ((value & mask) == mask) ? TRUE : FALSE;
value_name = glade_property_class_get_displayable_value (property->property->class,
value_name = glade_property_class_get_displayable_value (property->class,
class->values[flag_num].value);
if (value_name == NULL) value_name = class->values[flag_num].value_name;
......@@ -941,6 +941,9 @@ glade_editor_create_input_text (GladeEditorProperty *property)
class = property->class;
/* XXX Make this class data GladeParamater can be used just for the plugin, if the
* data gets treated in the core, we dont need to special case this like this.
*/
glade_parameter_get_integer (class->parameters, GLADE_TAG_VISIBLE_LINES, &lines);
if (lines < 2) {
......@@ -1004,19 +1007,16 @@ glade_editor_create_input_text (GladeEditorProperty *property)
static GtkWidget *
glade_editor_create_input_numeric (GladeEditorProperty *property)
{
GladePropertyClass *class;
GtkAdjustment *adjustment;
GtkWidget *spin;
g_return_val_if_fail (GLADE_IS_EDITOR_PROPERTY (property), NULL);
g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property->class), NULL);
class = property->class;
adjustment = glade_parameter_adjustment_new (class);
adjustment = glade_property_class_make_adjustment (property->class);
spin = gtk_spin_button_new (adjustment, 4,
G_IS_PARAM_SPEC_FLOAT (class->pspec) ||
G_IS_PARAM_SPEC_DOUBLE (class->pspec)
G_IS_PARAM_SPEC_FLOAT (property->class->pspec) ||
G_IS_PARAM_SPEC_DOUBLE (property->class->pspec)
? 2 : 0);
g_signal_connect (G_OBJECT (spin), "value_changed",
......@@ -1026,7 +1026,7 @@ glade_editor_create_input_numeric (GladeEditorProperty *property)
/* Some numeric types are optional, for example the default window size, so
* they have a toggle button right next to the spin button.
*/
if (class->optional) {
if (property->class->optional) {
GtkWidget *check;
GtkWidget *hbox;
check = gtk_check_button_new ();
......@@ -1534,7 +1534,7 @@ glade_editor_property_load_integer (GladeEditorProperty *property)
g_return_if_fail (property->property->value != NULL);
g_return_if_fail (property->input != NULL);
class = property->property->class;
class = property->class;
if (class->optional) {
GtkBoxChild *child;
......@@ -1585,7 +1585,7 @@ glade_editor_property_load_integer (GladeEditorProperty *property)
val = g_value_get_float (property->property->value);
else
g_warning ("Unsupported type %s\n",
g_type_name(class->pspec->value_type));
g_type_name(G_PARAM_SPEC_TYPE (class->pspec)));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), val);
g_object_set_data (G_OBJECT (spin), "user_data", property);
......@@ -1606,9 +1606,9 @@ glade_editor_property_load_enum (GladeEditorProperty *property)
g_return_if_fail (property->property->value != NULL);
g_return_if_fail (property->input != NULL);
g_return_if_fail ((eclass = g_type_class_ref
(property->property->class->pspec->value_type)) != NULL);
(property->class->pspec->value_type)) != NULL);
pclass = property->property->class;
pclass = property->class;
value = g_value_get_enum (property->property->value);
......@@ -1648,7 +1648,7 @@ glade_editor_property_load_flags (GladeEditorProperty *property)
entry = child->widget;
g_return_if_fail (GTK_IS_ENTRY (entry));
text = glade_property_class_make_string_from_flags(property->property->class,
text = glade_property_class_make_string_from_flags(property->class,
g_value_get_flags(property->property->value),
TRUE);
......@@ -1957,7 +1957,7 @@ glade_editor_load_widget (GladeEditor *editor, GladeWidget *widget)
{
g_return_if_fail (GLADE_IS_EDITOR (editor));
g_return_if_fail (widget == NULL || GLADE_IS_WIDGET (widget));
if (editor->loaded_widget == widget)
return;
......
This diff is collapsed.
......@@ -283,57 +283,3 @@ glade_parameter_list_new_from_node (GList *list, GladeXmlNode *node)
return list;
}
/**
* glade_parameter_adjustment_new:
* @property_class: a #GladePropertyClass
*
* Creates a #GtkAdjustment from the list of parameters inside @property_class.
*
* Returns: a new #GtkAdjustment
*/
GtkAdjustment *
glade_parameter_adjustment_new (GladePropertyClass *property_class)
{
GList *parameters = property_class->parameters;
GValue *def = property_class->def;
GtkAdjustment *adjustment;
gfloat value = 1;
gfloat lower = 0;
gfloat upper = 999999;
gfloat step_increment = 1.0;
gfloat page_increment = 10.0;
gfloat climb_rate = 1.0;
if (def) {
switch (def->g_type) {
case G_TYPE_FLOAT:
value = g_value_get_float (def);
step_increment = 0.01f;
break;
case G_TYPE_INT:
value = (float) g_value_get_int (def);
step_increment = 1.0f;
break;
case G_TYPE_DOUBLE:
value = (float) g_value_get_double (def);
step_increment = 0.01f;
break;
}
page_increment = 10 * step_increment;
}
glade_parameter_get_float (parameters, "Min", &lower);
glade_parameter_get_float (parameters, "Max", &upper);
glade_parameter_get_float (parameters, "StepIncrement", &step_increment);
glade_parameter_get_float (parameters, "PageIncrement", &page_increment);
glade_parameter_get_float (parameters, "ClimbRate", &climb_rate);
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (value,
lower,
upper,
step_increment,
page_increment,
climb_rate));
return adjustment;
}
......@@ -28,10 +28,9 @@ struct _GladeParameter {
gchar *key; /* The name of the parameter */
gchar *value; /* The textual representation of the parameter */
};
GladeParameter * glade_parameter_new (void);
GladeParameter *glade_parameter_new (void);
GladeParameter *glade_parameter_clone (GladeParameter *parameter);
void glade_parameter_free (GladeParameter *parameter);
......@@ -43,9 +42,6 @@ void glade_parameter_get_string (GList *parameters, const gchar *key, gchar **v
GList * glade_parameter_list_new_from_node (GList *list, GladeXmlNode *node);
/* Convenience functions */
GtkAdjustment * glade_parameter_adjustment_new (GladePropertyClass *property_class);
G_END_DECLS
#endif /* __GLADE_PARAMETER_H__ */
......@@ -206,8 +206,7 @@ glade_property_class_free (GladePropertyClass *class)
static GValue *
glade_property_class_get_default_from_spec (GParamSpec *spec,
GladePropertyClass *class)
glade_property_class_get_default_from_spec (GParamSpec *spec)
{
GValue *value;
value = g_new0 (GValue, 1);
......@@ -342,7 +341,7 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class
GLADE_TAG_TRUE : GLADE_TAG_FALSE);
else
g_critical ("Unsupported pspec type %s",
g_type_name(property_class->pspec->value_type));
g_type_name(G_PARAM_SPEC_TYPE (property_class->pspec)));
return string;
}
......@@ -524,7 +523,8 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class
}
else
g_critical ("Unsupported pspec type %s",
g_type_name(property_class->pspec->value_type));
g_type_name(G_PARAM_SPEC_TYPE (property_class->pspec)));
return value;
}
......@@ -572,7 +572,7 @@ glade_property_class_new_from_spec (GParamSpec *spec)
}
property_class->tooltip = g_strdup (g_param_spec_get_blurb (spec));
property_class->def = glade_property_class_get_default_from_spec (spec, property_class);
property_class->def = glade_property_class_get_default_from_spec (spec);
return property_class;
......@@ -674,6 +674,79 @@ gpc_get_displayable_values_from_node (GladeXmlNode *node, GEnumValue *values, gi
return array;
}
/**
* glade_property_class_make_adjustment:
*
* @property_class: a pointer to the property class
*
* Creates and appropriate GtkAdjustment for use in the editor
*
* Returns: An appropriate #GtkAdjustment for use in the Property editor
*/
GtkAdjustment *
glade_property_class_make_adjustment (GladePropertyClass *property_class)
{
gdouble min, max, def;
gboolean float_range = FALSE;
g_return_val_if_fail (property_class != NULL, NULL);
g_return_val_if_fail (property_class->pspec != NULL, NULL);
if (G_IS_PARAM_SPEC_INT(property_class->pspec))
{
min = (gdouble)((GParamSpecInt *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecInt *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecInt *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_UINT(property_class->pspec))
{
min = (gdouble)((GParamSpecUInt *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecUInt *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecUInt *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_LONG(property_class->pspec))
{
min = (gdouble)((GParamSpecLong *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecLong *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecLong *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_ULONG(property_class->pspec))
{
min = (gdouble)((GParamSpecULong *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecULong *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecULong *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_INT64(property_class->pspec))
{
min = (gdouble)((GParamSpecInt64 *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecInt64 *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecInt64 *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_UINT64(property_class->pspec))
{
min = (gdouble)((GParamSpecUInt64 *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecUInt64 *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecUInt64 *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_FLOAT(property_class->pspec))
{
float_range = TRUE;
min = (gdouble)((GParamSpecFloat *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecFloat *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecFloat *) property_class->pspec)->default_value;
} else if (G_IS_PARAM_SPEC_DOUBLE(property_class->pspec))
{
float_range = TRUE;
min = (gdouble)((GParamSpecFloat *) property_class->pspec)->minimum;
max = (gdouble)((GParamSpecFloat *) property_class->pspec)->maximum;
def = (gdouble)((GParamSpecFloat *) property_class->pspec)->default_value;
} else
{
g_critical ("Can't make adjustment for pspec type %s",
g_type_name(G_PARAM_SPEC_TYPE (property_class->pspec)));
}
return (GtkAdjustment *)gtk_adjustment_new (def, min, max,
float_range ?
GLADE_FLOATING_STEP_INCREMENT :
GLADE_NUMERICAL_STEP_INCREMENT,
GLADE_NUMERICAL_PAGE_INCREMENT,
GLADE_NUMERICAL_PAGE_SIZE);
}
/**
* glade_property_class_update_from_node:
......@@ -742,8 +815,23 @@ glade_property_class_update_from_node (GladeXmlNode *node,
if (class->pspec->flags & G_PARAM_CONSTRUCT_ONLY)
class->construct_only = TRUE;
else if (class->def)
class->orig_def = class->def;
class->def = glade_property_class_get_default_from_spec (class->pspec);
}
} else {
} else {
/* Get the default */
buff = glade_xml_get_property_string (node, GLADE_TAG_DEFAULT);
if (buff)
{
if (class->def)
class->orig_def = class->def;
class->def = glade_property_class_make_gvalue_from_string (class, buff);
g_free (buff);
}
if (!class->pspec)
{
/* If catalog file didn't specify a pspec function
......@@ -795,18 +883,6 @@ glade_property_class_update_from_node (GladeXmlNode *node,
class->parameters = glade_parameter_list_new_from_node (class->parameters, child);
glade_parameter_get_boolean (class->parameters, GLADE_TAG_OPTIONAL, &class->optional);
/* Get the default */
buff = glade_xml_get_property_string (node, GLADE_TAG_DEFAULT);
if (buff)
{
if (class->def)
class->orig_def = class->def;
class->def = glade_property_class_make_gvalue_from_string (class, buff);
g_free (buff);
if (!class->def)
return FALSE;
}
/* Whether or not the property is translatable. This is only used for
* string properties.
*/
......
......@@ -184,27 +184,25 @@ struct _GladePropertyClass
};
GladePropertyClass * glade_property_class_new (void);
GladePropertyClass * glade_property_class_new_from_spec (GParamSpec *spec);
GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class);
void glade_property_class_free (GladePropertyClass *property_class);
gboolean glade_property_class_is_visible (GladePropertyClass *property_class, GladeWidgetClass *widget_class);
GValue * glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class,
const gchar *string);
gchar * glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class,
const GValue *value);
gboolean glade_property_class_update_from_node (GladeXmlNode *node,
GladeWidgetClass *widget_class,
GladePropertyClass **property_class);
gchar *
glade_property_class_make_string_from_flags (GladePropertyClass *class, guint fvals, gboolean displayables);
gchar *
glade_property_class_get_displayable_value(GladePropertyClass *class, gint value);
LIBGLADEUI_API GladePropertyClass *glade_property_class_new (void);
LIBGLADEUI_API GladePropertyClass *glade_property_class_new_from_spec (GParamSpec *spec);
LIBGLADEUI_API GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class);
LIBGLADEUI_API void glade_property_class_free (GladePropertyClass *property_class);
LIBGLADEUI_API gboolean glade_property_class_is_visible (GladePropertyClass *property_class,
GladeWidgetClass *widget_class);
LIBGLADEUI_API GValue *glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class,
const gchar *string);
LIBGLADEUI_API gchar *glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class,
const GValue *value);
LIBGLADEUI_API gboolean glade_property_class_update_from_node (GladeXmlNode *node,
GladeWidgetClass *widget_class,
GladePropertyClass **property_class);
LIBGLADEUI_API gchar *glade_property_class_make_string_from_flags (GladePropertyClass *class,
guint fvals,
gboolean displayables);
LIBGLADEUI_API gchar *glade_property_class_get_displayable_value (GladePropertyClass *class,
gint value);
LIBGLADEUI_API GtkAdjustment *glade_property_class_make_adjustment (GladePropertyClass *class);
G_END_DECLS
......
......@@ -94,6 +94,21 @@ glade_property_dup_impl (GladeProperty *template, GladeWidget *widget)
return property;
}
void
glade_property_reset_impl (GladeProperty *property)
{
GLADE_PROPERTY_GET_CINFO (property)->set_value
(property, property->class->def);
}
gboolean
glade_property_default_impl (GladeProperty *property)
{
return !g_param_values_cmp (property->class->pspec,
property->value,
property->class->def);
}
/**
* Generic set function for properties that do not have a
* custom set_property method. This includes packing properties.
......@@ -103,11 +118,11 @@ glade_property_set_property (GladeProperty *property, const GValue *value)
{
if (property->class->packing)
{
GladeWidget *parent = glade_widget_get_parent (property->widget);
GladeWidget *child = property->widget;
glade_widget_class_container_set_property (parent->widget_class,
parent->object, child->object,
property->class->id, value);
GladeWidget *parent = glade_widget_get_parent (property->widget);
GladeWidget *child = property->widget;
glade_widget_class_container_set_property
(parent->widget_class, parent->object, child->object,
property->class->id, value);
}
else
{
......@@ -420,6 +435,8 @@ glade_property_cinfo_init (GladePropertyCinfo *prop_class)
/* Class methods */
prop_class->dup = glade_property_dup_impl;
prop_class->reset = glade_property_reset_impl;
prop_class->def = glade_property_default_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;
......@@ -585,6 +602,31 @@ glade_property_dup (GladeProperty *template, GladeWidget *widget)
return GLADE_PROPERTY_GET_CINFO (template)->dup (template, widget);
}
/**
* glade_property_reset:
* @property:
*
* TODO: write me
*/
void
glade_property_reset (GladeProperty *property)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
GLADE_PROPERTY_GET_CINFO (property)->reset (property);
}
/**
* glade_property_reset:
* @property:
*
* TODO: write me
*/
gboolean
glade_property_default (GladeProperty *property)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
return GLADE_PROPERTY_GET_CINFO (property)->def (property);
}
/**
* glade_property_set_value:
......
......@@ -65,6 +65,8 @@ struct _GladePropertyCinfo
/* Class methods */
GladeProperty * (* dup) (GladeProperty *, GladeWidget *);
void (* reset) (GladeProperty *);
gboolean (* def) (GladeProperty *);
void (* set_value) (GladeProperty *, const GValue *);
void (* get_value) (GladeProperty *, GValue *);
void (* sync) (GladeProperty *);
......@@ -82,6 +84,8 @@ LIBGLADEUI_API GladeProperty *glade_property_new (Gla
GValue *value);
LIBGLADEUI_API GladeProperty *glade_property_dup (GladeProperty *template,
GladeWidget *widget);
LIBGLADEUI_API void glade_property_reset (GladeProperty *property);
LIBGLADEUI_API gboolean glade_property_default (GladeProperty *property);
LIBGLADEUI_API void glade_property_set_value (GladeProperty *property,
const GValue *value);
LIBGLADEUI_API void glade_property_set_va_list (GladeProperty *property,
......
......@@ -144,7 +144,6 @@ glade_widget_class_list_properties (GladeWidgetClass *class)
last = 0;
for (i = 0; i < n_specs; i++)
{
spec = specs[i];
/* We only use the writable properties */
......
......@@ -1136,7 +1136,6 @@ glade_widget_get_property (GladeWidget *widget, const gchar *id_property)
if (strcmp (property->class->id, id_property) == 0)
return property;
}
return glade_widget_get_pack_property (widget, id_property);
}
......@@ -1162,10 +1161,8 @@ glade_widget_get_pack_property (GladeWidget *widget, const gchar *id_property)
if (strcmp (property->class->id, id_property) == 0)
return property;
}
g_warning ("Could not get property \"%s\" for widget %s",
id_property, widget->name);
g_critical ("Unable to find property %s on widget %s of class %s",
id_property, widget->name, widget->widget_class->name);
return NULL;
}
......@@ -1182,7 +1179,7 @@ glade_widget_get_pack_property (GladeWidget *widget, const gchar *id_property)
*/
gboolean
glade_widget_property_get (GladeWidget *widget,
const char *id_property,
const gchar *id_property,
...)
{
GladeProperty *property;
......@@ -1212,7 +1209,7 @@ glade_widget_property_get (GladeWidget *widget,
*/
gboolean
glade_widget_property_set (GladeWidget *widget,
const char *id_property,
const gchar *id_property,
...)
{
GladeProperty *property;
......@@ -1242,7 +1239,7 @@ glade_widget_property_set (GladeWidget *widget,
*/
gboolean
glade_widget_pack_property_get (GladeWidget *widget,
const char *id_property,
const gchar *id_property,
...)
{
GladeProperty *property;
......@@ -1272,7 +1269,7 @@ glade_widget_pack_property_get (GladeWidget *widget,
*/
gboolean
glade_widget_pack_property_set (GladeWidget *widget,
const char *id_property,
const gchar *id_property,
...)
{
GladeProperty *property;
......@@ -1302,7 +1299,7 @@ glade_widget_pack_property_set (GladeWidget *widget,
*/
gboolean
glade_widget_property_set_sensitive (GladeWidget *widget,
const char *id_property,
const gchar *id_property,
gboolean sensitive,
const gchar *reason)
{
......@@ -1332,7 +1329,7 @@ glade_widget_property_set_sensitive (GladeWidget *widget,
*/
gboolean
glade_widget_pack_property_set_sensitive (GladeWidget *widget,
const char *id_property,
const gchar *id_property,
gboolean sensitive,
const gchar *reason)
{
......@@ -1346,9 +1343,67 @@ glade_widget_pack_property_set_sensitive (GladeWidget *widget,
return TRUE;
}
return FALSE;
}
gboolean
glade_widget_property_reset (GladeWidget *widget,
const gchar *id_property)
{
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
{
glade_property_reset (property);
return TRUE;
}
return FALSE;
}
gboolean
glade_widget_pack_property_reset (GladeWidget *widget,
const gchar *id_property)
{
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
{
glade_property_reset (property);
return TRUE;
}
return FALSE;
}
gboolean
glade_widget_property_default (GladeWidget *widget,
const gchar *id_property)
{
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
return glade_property_default (property);
return FALSE;
}
gboolean
glade_widget_pack_property_default (GladeWidget *widget,
const gchar *id_property)
{
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
return glade_property_default (property);
return FALSE;
}
static gboolean
glade_widget_popup_menu (GtkWidget *widget, gpointer unused_data)
{
......
......@@ -87,12 +87,12 @@ LIBGLADEUI_API GladeWidget * glade_widget_new (GladeWidget *pa
LIBGLADEUI_API GladeWidget * glade_widget_new_for_internal_child (GladeWidgetClass *klass,
GladeWidget *parent,
GObject *internal_object,
const char *internal_name);