don't save invisible properties.

2004-05-09  Joaquin Cuenca Abela  <e98cuenc@yahoo.com>

	* src/glade-property.c: don't save invisible properties.

	* src/glade-widget.c, glade-property-class.[ch]: little janitorial
	work.
This commit is contained in:
Joaquin Cuenca Abela 2004-05-09 19:17:30 +00:00 committed by Joaquín Cuenca Abela
parent 745e90f59d
commit 8f2ae17f99
5 changed files with 24 additions and 17 deletions

View File

@ -1,3 +1,10 @@
2004-05-09 Joaquin Cuenca Abela <e98cuenc@yahoo.com>
* src/glade-property.c: don't save invisible properties.
* src/glade-widget.c, glade-property-class.[ch]: little janitorial
work.
2004-05-08 Damon Chaplin <damon@gnome.org> 2004-05-08 Damon Chaplin <damon@gnome.org>
* src/glade-gtk.c (ask_for_number, glade_gtk_table_post_create): set * src/glade-gtk.c (ask_for_number, glade_gtk_table_post_create): set

View File

@ -240,8 +240,7 @@ glade_property_class_get_type_from_spec (GParamSpec *spec)
static GValue * static GValue *
glade_property_class_get_default_from_spec (GParamSpec *spec, glade_property_class_get_default_from_spec (GParamSpec *spec,
GladePropertyClass *class, GladePropertyClass *class)
GladeXmlNode *node)
{ {
GValue *value; GValue *value;
@ -604,7 +603,7 @@ glade_property_class_new_from_spec (GParamSpec *spec)
} }
property_class->tooltip = g_strdup (g_param_spec_get_blurb (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, NULL); property_class->def = glade_property_class_get_default_from_spec (spec, property_class);
switch (property_class->type) switch (property_class->type)
{ {
@ -773,7 +772,8 @@ glade_property_class_update_from_node (GladeXmlNode *node,
#endif #endif
/* Get the default */ /* Get the default */
buff = glade_xml_get_property_string (node, GLADE_TAG_DEFAULT); buff = glade_xml_get_property_string (node, GLADE_TAG_DEFAULT);
if (buff) { if (buff)
{
if (class->def) if (class->def)
{ {
if (G_VALUE_TYPE (class->def) != 0) if (G_VALUE_TYPE (class->def) != 0)
@ -791,7 +791,7 @@ glade_property_class_update_from_node (GladeXmlNode *node,
if (class->optional) if (class->optional)
class->optional_default = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL_DEFAULT, FALSE); class->optional_default = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL_DEFAULT, FALSE);
/* If this property can't be set with g_object_set, get the workarround /* If this property can't be set with g_object_set, get the work around
* function * function
*/ */
/* I use here a g_warning to signal these errors instead of a dialog box, as if there is one /* I use here a g_warning to signal these errors instead of a dialog box, as if there is one
@ -799,7 +799,8 @@ glade_property_class_update_from_node (GladeXmlNode *node,
* the user the pain of plenty of dialog boxes. Ideally, we should collect these errors, * the user the pain of plenty of dialog boxes. Ideally, we should collect these errors,
* and show all of them at the end of the load processus. */ * and show all of them at the end of the load processus. */
child = glade_xml_search_child (node, GLADE_TAG_SET_FUNCTION); child = glade_xml_search_child (node, GLADE_TAG_SET_FUNCTION);
if (child) { if (child)
{
gchar *symbol_name = glade_xml_get_content (child); gchar *symbol_name = glade_xml_get_content (child);
if (!widget_class->module) if (!widget_class->module)
@ -813,11 +814,12 @@ glade_property_class_update_from_node (GladeXmlNode *node,
g_free (symbol_name); g_free (symbol_name);
} }
/* If this property can't be get with g_object_get, get the workarround /* If this property can't be get with g_object_get, get the work around
* function * function
*/ */
child = glade_xml_search_child (node, GLADE_TAG_GET_FUNCTION); child = glade_xml_search_child (node, GLADE_TAG_GET_FUNCTION);
if (child) { if (child)
{
gchar *symbol_name = glade_xml_get_content (child); gchar *symbol_name = glade_xml_get_content (child);
if (!widget_class->module) if (!widget_class->module)
@ -836,4 +838,3 @@ glade_property_class_update_from_node (GladeXmlNode *node,
return TRUE; return TRUE;
} }

View File

@ -144,11 +144,6 @@ struct _GladePropertyClass
*/ */
gboolean optional_default; /* For optional values, what the default is */ gboolean optional_default; /* For optional values, what the default is */
GladePropertyQuery *query; /* Some widgets require us to query the user
* before creating the widget. Like a vbox will
* want to know the number of columns.
*/
GladeWidgetClass *child; /* A GladeWidgetClass pointer of objects GladeWidgetClass *child; /* A GladeWidgetClass pointer of objects
* that we need to set for this widget * that we need to set for this widget
* for example : GtkSpinButton has a Adjustment inside * for example : GtkSpinButton has a Adjustment inside

View File

@ -178,6 +178,9 @@ glade_property_write (GladeXmlContext *context, GladeProperty *property)
if (!property->enabled) if (!property->enabled)
return NULL; return NULL;
if (!glade_property_class_is_visible (property->class, glade_widget_get_class (property->widget)))
return NULL;
node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY); node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY);
if (!node) if (!node)
return NULL; return NULL;

View File

@ -1063,7 +1063,8 @@ glade_widget_write (GladeWidget *widget, GladeXmlContext *context)
/* Write the properties */ /* Write the properties */
list = widget->properties; list = widget->properties;
for (; list; list = list->next) { for (; list; list = list->next)
{
GladeProperty *property = list->data; GladeProperty *property = list->data;
if (property->class->packing) if (property->class->packing)
continue; continue;
@ -1087,9 +1088,9 @@ glade_widget_write (GladeWidget *widget, GladeXmlContext *context)
GtkWidget *child_widget; GtkWidget *child_widget;
child_widget = GTK_WIDGET (list->data); child_widget = GTK_WIDGET (list->data);
child = glade_widget_write_child (context, child_widget); child = glade_widget_write_child (context, child_widget);
if (!child) { if (!child)
continue; continue;
}
glade_xml_node_append_child (node, child); glade_xml_node_append_child (node, child);
} }
} }