summaryrefslogtreecommitdiff
path: root/src/glade-property.c
diff options
context:
space:
mode:
authorTristan Van Berkom <tvb@src.gnome.org>2005-07-31 23:02:13 +0000
committerTristan Van Berkom <tvb@src.gnome.org>2005-07-31 23:02:13 +0000
commit81ed86529d8f62d71cd080a08c7d373cb5ff7e89 (patch)
tree8c7bd1ab8e9416daaca9c463e21a29c0e8df9a34 /src/glade-property.c
parent83880dc0314d093b14bb5cb0be5e5d72391009c1 (diff)
downloadglade-81ed86529d8f62d71cd080a08c7d373cb5ff7e89.tar.gz
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.
Diffstat (limited to 'src/glade-property.c')
-rw-r--r--src/glade-property.c52
1 files changed, 47 insertions, 5 deletions
diff --git a/src/glade-property.c b/src/glade-property.c
index 944b770d..c1e17366 100644
--- a/src/glade-property.c
+++ b/src/glade-property.c
@@ -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: