Commit 550709b2 authored by Chema Celorio's avatar Chema Celorio Committed by Jose Maria Celorio

implement, new file.

2001-07-22  Chema Celorio  <chema@celorio.com>

	* src/glade-utils.c (glade_util_path_is_writable): implement, new file.

	* src/glade-property.c (glade_property_write): implement.

	* src/glade-widget.c (glade_widget_write): add content.

	* src/glade-xml-utils.c (glade_xml_set_value): fix a lot of the broken issues.
	Don't confuse properties for node content. Use GladeXmlNode as API entry.
	Lots of small new functions, lots of cleanup.
parent a0477ad8
...@@ -2,6 +2,5 @@ Chema Celorio <chema@ximian.com> ...@@ -2,6 +2,5 @@ Chema Celorio <chema@ximian.com>
Thanks to : Thanks to :
Michal Palczewski <mpalczew@u.washington.edu> - Widget tree window Michal Palczewski <mpalczew@u.washington.edu> - Widget tree window
Neil Mock <mock_nt0@yahoo.com> - XML saving
Archit Baweja <bighead@crosswinds.net> - New widgets, _get_type Archit Baweja <bighead@crosswinds.net> - New widgets, _get_type
Shane Butler <shane_b@operamail.com> - Glade Widget signals Shane Butler <shane_b@operamail.com> - Glade Widget signals editor
\ No newline at end of file \ No newline at end of file
2001-07-22 Chema Celorio <chema@celorio.com>
* src/glade-utils.c (glade_util_path_is_writable): implement, new file.
* src/glade-property.c (glade_property_write): implement.
* src/glade-widget.c (glade_widget_write): add content.
* src/glade-xml-utils.c (glade_xml_set_value): fix a lot of the broken issues.
Don't confuse properties for node content. Use GladeXmlNode as API entry.
Lots of small new functions, lots of cleanup.
2001-07-21 Chema Celorio <chema@celorio.com> 2001-07-21 Chema Celorio <chema@celorio.com>
* src/glade-project.c (glade_project_save): impl. * src/glade-project.c (glade_project_save): impl.
......
...@@ -11,22 +11,17 @@ plus : ...@@ -11,22 +11,17 @@ plus :
TODO TODO
==== ====
TAKEN ITEMS (someone is already working on)
-----------
- File loading and saving
- Common part of the editor
OPEN ITEMS [PLease let me know before starting working on any of this] OPEN ITEMS [PLease let me know before starting working on any of this]
---------- ----------
- Implement glade_widget_delete inside glade-widget.c, delete can already - Implement glade_widget_delete inside glade-widget.c, delete can already
be called from the popup menu. be called from the popup menu.
- Implement the popup menu option "Select", it needs to create submenus for - Implement the popup menu option "Select", it needs to create submenus for
every parent widget and a "Select" option inside it. Inside glade-popup.c every parent widget and a "Select" option inside it. Inside glade-popup.c
- Implement file opened history feature. - Implement file opened history feature.
- Implement gtk stock buttons. - Implement gtk stock buttons.
- gtklabels can't be selected. This looks like a fun thing and maybe tricky - gtklabels can't be selected. This looks like a fun thing and maybe tricky
to fix. I am guessing that gtklabeles don't like the idea of disabling to fix. I am guessing that gtklabeles don't like the idea of disabling
double buffering because of pango, but this is just a guess. double buffering because of pango, but this is just a guess.
- Implement show clipboard (blocks on copy/cut) - Implement show clipboard (blocks on copy/cut)
- Implement the menu bar widget and the menu editor. - Implement the menu bar widget and the menu editor.
- Implement the glade-property type "File". For example to be used with a pixmap - Implement the glade-property type "File". For example to be used with a pixmap
......
...@@ -40,6 +40,7 @@ glade2_SOURCES = \ ...@@ -40,6 +40,7 @@ glade2_SOURCES = \
glade-choice.c \ glade-choice.c \
glade-editor.c \ glade-editor.c \
glade-gtk.c \ glade-gtk.c \
glade-utils.c \
glade-signal-editor.c glade-signal-editor.c
noinst_HEADERS = \ noinst_HEADERS = \
...@@ -63,4 +64,5 @@ noinst_HEADERS = \ ...@@ -63,4 +64,5 @@ noinst_HEADERS = \
glade-choice.h \ glade-choice.h \
glade-gtk.h \ glade-gtk.h \
glade-catalog.h \ glade-catalog.h \
glade-utils.h \
glade-xml-utils.h glade-xml-utils.h
...@@ -42,9 +42,9 @@ glade_catalog_new (void) ...@@ -42,9 +42,9 @@ glade_catalog_new (void)
} }
static GList * static GList *
glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node) glade_catalog_load_names_from_node (GladeXmlContext *context, GladeXmlNode *node)
{ {
xmlNodePtr child; GladeXmlNode *child;
GList *list; GList *list;
gchar *name; gchar *name;
...@@ -52,7 +52,7 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node) ...@@ -52,7 +52,7 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node)
return NULL; return NULL;
list = NULL; list = NULL;
child = node->children; child = glade_xml_node_get_children (node);
while (child != NULL) { while (child != NULL) {
skip_text (child); skip_text (child);
if (!glade_xml_node_verify (child, GLADE_TAG_GLADE_WIDGET)) if (!glade_xml_node_verify (child, GLADE_TAG_GLADE_WIDGET))
...@@ -61,7 +61,7 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node) ...@@ -61,7 +61,7 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node)
if (name == NULL) if (name == NULL)
return NULL; return NULL;
list = g_list_prepend (list, name); list = g_list_prepend (list, name);
child = child->next; child = glade_xml_node_next (child);
} }
list = g_list_reverse (list); list = g_list_reverse (list);
...@@ -72,13 +72,15 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node) ...@@ -72,13 +72,15 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node)
static void static void
glade_catalog_load_names_from_file (GladeCatalog *catalog, const gchar *file_name) glade_catalog_load_names_from_file (GladeCatalog *catalog, const gchar *file_name)
{ {
XmlParseContext *context; GladeXmlContext *context;
GladeXmlNode *root;
context = glade_xml_parse_context_new_from_path (file_name, NULL, GLADE_TAG_CATALOG);
if (context == NULL) return; context = glade_xml_context_new_from_path (file_name, NULL, GLADE_TAG_CATALOG);
catalog->names = glade_catalog_load_names_from_node (context, context->doc->children); if (context == NULL)
glade_xml_parse_context_free (context); return;
root = glade_xml_doc_get_root (context->doc);
catalog->names = glade_catalog_load_names_from_node (context, root);
glade_xml_context_free (context);
} }
static GladeCatalog * static GladeCatalog *
......
...@@ -119,7 +119,7 @@ glade_string_from_string (const gchar *string) ...@@ -119,7 +119,7 @@ glade_string_from_string (const gchar *string)
} }
static GladeChoice * static GladeChoice *
glade_choice_new_from_node (xmlNodePtr node) glade_choice_new_from_node (GladeXmlNode *node)
{ {
GladeChoice *choice; GladeChoice *choice;
...@@ -142,17 +142,17 @@ glade_choice_new_from_node (xmlNodePtr node) ...@@ -142,17 +142,17 @@ glade_choice_new_from_node (xmlNodePtr node)
} }
GList * GList *
glade_choice_list_new_from_node (xmlNodePtr node) glade_choice_list_new_from_node (GladeXmlNode *node)
{ {
GladeXmlNode *child;
GladeChoice *choice; GladeChoice *choice;
xmlNodePtr child;
GList *list; GList *list;
if (!glade_xml_node_verify (node, GLADE_TAG_CHOICES)) if (!glade_xml_node_verify (node, GLADE_TAG_CHOICES))
return NULL; return NULL;
list = NULL; list = NULL;
child = node->children; child = glade_xml_node_get_children (node);
while (child != NULL) { while (child != NULL) {
skip_text (child); skip_text (child);
...@@ -162,7 +162,7 @@ glade_choice_list_new_from_node (xmlNodePtr node) ...@@ -162,7 +162,7 @@ glade_choice_list_new_from_node (xmlNodePtr node)
if (choice == NULL) if (choice == NULL)
return NULL; return NULL;
list = g_list_prepend (list, choice); list = g_list_prepend (list, choice);
child = child->next; child = glade_xml_node_next (child);
} }
list = g_list_reverse (list); list = g_list_reverse (list);
......
...@@ -51,7 +51,7 @@ struct _GladeChoice { ...@@ -51,7 +51,7 @@ struct _GladeChoice {
GladeChoice * glade_choice_new (void); GladeChoice * glade_choice_new (void);
GList * glade_choice_list_new_from_node (xmlNodePtr node); GList * glade_choice_list_new_from_node (GladeXmlNode *node);
G_END_DECLS G_END_DECLS
......
...@@ -124,7 +124,7 @@ glade_parameter_new (void) ...@@ -124,7 +124,7 @@ glade_parameter_new (void)
} }
static GladeParameter * static GladeParameter *
glade_parameter_new_from_node (xmlNodePtr node) glade_parameter_new_from_node (GladeXmlNode *node)
{ {
GladeParameter *parameter; GladeParameter *parameter;
...@@ -132,8 +132,8 @@ glade_parameter_new_from_node (xmlNodePtr node) ...@@ -132,8 +132,8 @@ glade_parameter_new_from_node (xmlNodePtr node)
return NULL; return NULL;
parameter = glade_parameter_new (); parameter = glade_parameter_new ();
parameter->key = glade_xml_get_value_string_required (node, GLADE_TAG_KEY, NULL); parameter->key = glade_xml_get_property_string_required (node, GLADE_TAG_KEY, NULL);
parameter->value = glade_xml_get_value_string_required (node, GLADE_TAG_VALUE, NULL); parameter->value = glade_xml_get_property_string_required (node, GLADE_TAG_VALUE, NULL);
if (!parameter->key || !parameter->value) if (!parameter->key || !parameter->value)
return NULL; return NULL;
...@@ -158,10 +158,10 @@ glade_parameter_list_find_by_key (GList *list, const gchar *key) ...@@ -158,10 +158,10 @@ glade_parameter_list_find_by_key (GList *list, const gchar *key)
GList * GList *
glade_parameter_list_new_from_node (GList *list, xmlNodePtr node) glade_parameter_list_new_from_node (GList *list, GladeXmlNode *node)
{ {
GladeParameter *parameter; GladeParameter *parameter;
xmlNodePtr child; GladeXmlNode *child;
GList *findme; GList *findme;
if (!glade_xml_node_verify (node, GLADE_TAG_PARAMETERS)) if (!glade_xml_node_verify (node, GLADE_TAG_PARAMETERS))
...@@ -170,7 +170,7 @@ glade_parameter_list_new_from_node (GList *list, xmlNodePtr node) ...@@ -170,7 +170,7 @@ glade_parameter_list_new_from_node (GList *list, xmlNodePtr node)
if (child == NULL) if (child == NULL)
return NULL; return NULL;
child = node->children; child = glade_xml_node_get_children (node);
while (child != NULL) { while (child != NULL) {
skip_text (child); skip_text (child);
...@@ -187,11 +187,11 @@ glade_parameter_list_new_from_node (GList *list, xmlNodePtr node) ...@@ -187,11 +187,11 @@ glade_parameter_list_new_from_node (GList *list, xmlNodePtr node)
if (findme) { if (findme) {
glade_parameter_free (findme->data); glade_parameter_free (findme->data);
findme->data = parameter; findme->data = parameter;
child = child->next; child = glade_xml_node_next (child);
} }
list = g_list_prepend (list, parameter); list = g_list_prepend (list, parameter);
child = child->next; child = glade_xml_node_next (child);
} }
list = g_list_reverse (list); list = g_list_reverse (list);
......
...@@ -39,7 +39,7 @@ void glade_parameter_get_boolean (GList *parameters, const gchar *key, gboolean ...@@ -39,7 +39,7 @@ void glade_parameter_get_boolean (GList *parameters, const gchar *key, gboolean
void glade_parameter_get_string (GList *parameters, const gchar *key, gchar **value); void glade_parameter_get_string (GList *parameters, const gchar *key, gchar **value);
GList * glade_parameter_list_new_from_node (GList *list, xmlNodePtr node); GList * glade_parameter_list_new_from_node (GList *list, GladeXmlNode *node);
/* Convenience functions */ /* Convenience functions */
GtkAdjustment * glade_parameter_adjustment_new (GList *parameters); GtkAdjustment * glade_parameter_adjustment_new (GList *parameters);
......
...@@ -28,26 +28,31 @@ ...@@ -28,26 +28,31 @@
#define GLADE_SELECTOR_FILENAME "GladeFileSelectorFilename" #define GLADE_SELECTOR_FILENAME "GladeFileSelectorFilename"
static gint static gint
glade_project_ui_delete_event_cb (GtkWidget *widget, GdkEventAny *event) glade_project_ui_delete_event_cb (GtkWidget *selector, GdkEventAny *event)
{
gtk_main_quit ();
return TRUE;
}
static gint
glade_project_ui_cancel_clicked (GtkWidget *button, gpointer not_used)
{ {
gtk_main_quit (); gtk_main_quit ();
gtk_object_set_user_data (GTK_OBJECT (selector), NULL);
return TRUE; return TRUE;
} }
static gint static gint
glade_project_ui_ok_clicked (GtkWidget *button, gpointer not_used) glade_project_ui_selector_clicked (GtkWidget *button, GtkWidget *selector)
{ {
g_return_val_if_fail (GTK_IS_FILE_SELECTION (selector), FALSE);
if (button == GTK_FILE_SELECTION (selector)->ok_button) {
const gchar *file;
file = gtk_file_selection_get_filename (GTK_FILE_SELECTION (selector));
gtk_object_set_user_data (GTK_OBJECT (selector), g_strdup (file));
} else
gtk_object_set_user_data (GTK_OBJECT (selector), NULL);
gtk_main_quit (); gtk_main_quit ();
gtk_widget_hide (selector);
return TRUE; return TRUE;
} }
...@@ -62,14 +67,14 @@ glade_project_ui_save_get_name (GladeProject *project) ...@@ -62,14 +67,14 @@ glade_project_ui_save_get_name (GladeProject *project)
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(selector)->ok_button), gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(selector)->ok_button),
"clicked", "clicked",
GTK_SIGNAL_FUNC (glade_project_ui_ok_clicked), GTK_SIGNAL_FUNC (glade_project_ui_selector_clicked),
NULL); selector);
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(selector)->cancel_button), gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(selector)->cancel_button),
"clicked", "clicked",
GTK_SIGNAL_FUNC (glade_project_ui_cancel_clicked), GTK_SIGNAL_FUNC (glade_project_ui_selector_clicked),
NULL); selector);
gtk_signal_connect( GTK_OBJECT(selector), "delete_event", gtk_signal_connect (GTK_OBJECT(selector), "delete_event",
GTK_SIGNAL_FUNC (glade_project_ui_delete_event_cb), GTK_SIGNAL_FUNC (glade_project_ui_delete_event_cb),
NULL); NULL);
...@@ -77,8 +82,15 @@ glade_project_ui_save_get_name (GladeProject *project) ...@@ -77,8 +82,15 @@ glade_project_ui_save_get_name (GladeProject *project)
gtk_main (); gtk_main ();
return g_strdup ("Foo.xml"); return gtk_object_get_user_data (GTK_OBJECT (selector));
} }
void
glade_project_ui_warn (GladeProject *project, const gchar *warning)
{
/* This are warnings to the users, use a nice dialog and stuff */
g_warning (warning);
}
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
gchar * glade_project_ui_save_get_name (GladeProject *project); gchar * glade_project_ui_save_get_name (GladeProject *project);
void glade_project_ui_warn (GladeProject *project, const gchar *warning);
G_END_DECLS G_END_DECLS
......
...@@ -193,7 +193,7 @@ glade_project_view_populate_model (GtkTreeStore *model, ...@@ -193,7 +193,7 @@ glade_project_view_populate_model (GtkTreeStore *model,
list = project->widgets; list = project->widgets;
for (; list != NULL; list = list->next) { for (; list != NULL; list = list->next) {
widget = list->data; widget = list->data;
if (GLADE_WIDGET_TOPLEVEL (widget)) if (GLADE_WIDGET_IS_TOPLEVEL (widget))
toplevels = g_list_append (toplevels, widget); toplevels = g_list_append (toplevels, widget);
} }
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include "glade-project-ui.h" #include "glade-project-ui.h"
#include "glade-project-window.h" #include "glade-project-window.h"
#include "glade-widget.h" #include "glade-widget.h"
#include "glade-widget-class.h"
#include "glade-xml-utils.h"
#include "glade-widget.h"
static void glade_project_class_init (GladeProjectClass * klass); static void glade_project_class_init (GladeProjectClass * klass);
static void glade_project_init (GladeProject *project); static void glade_project_init (GladeProject *project);
...@@ -333,6 +336,61 @@ glade_project_selection_set (GladeWidget *widget, ...@@ -333,6 +336,61 @@ glade_project_selection_set (GladeWidget *widget,
} }
/**
* glade_project_write_widgets:
* @context:
* @node:
*
* Give a project it appends to @node all the toplevel widgets. Each widget is responsible
* for appending it's childrens
*
* Return Value: FALSE on error, TRUE otherwise
**/
static gboolean
glade_project_write_widgets (const GladeProject *project, GladeXmlContext *context, GladeXmlNode *node)
{
GladeXmlNode *child;
GladeWidget *widget;
GList *list;
list = project->widgets;
for (; list != NULL; list = list->next) {
widget = list->data;
if (GLADE_WIDGET_IS_TOPLEVEL (widget)) {
child = glade_widget_write (context, widget);
if (child != NULL)
glade_xml_append_child (node, child);
else
return FALSE;
}
}
return TRUE;
}
/**
* glade_project_write:
* @project:
*
* Retrns the root node of a newly created xml representation of the project and its contents
*
* Return Value:
**/
static GladeXmlNode *
glade_project_write (GladeXmlContext *context, const GladeProject *project)
{
GladeXmlNode *node;
node = glade_xml_node_new (context, GLADE_XML_TAG_PROJECT);
if (node == NULL)
return NULL;
if (!glade_project_write_widgets (project, context, node))
return NULL;
return node;
}
/** /**
* glade_project_save_to_file: * glade_project_save_to_file:
* @project: * @project:
...@@ -342,11 +400,35 @@ glade_project_selection_set (GladeWidget *widget, ...@@ -342,11 +400,35 @@ glade_project_selection_set (GladeWidget *widget,
* *
* Return Value: TRUE on success, FALSE otherwise * Return Value: TRUE on success, FALSE otherwise
**/ **/
gboolean static gboolean
glade_project_save_to_file (GladeProject *project, glade_project_save_to_file (GladeProject *project,
const gchar *file_name) const gchar * full_path)
{ {
g_print ("Save %s to %s\n", project->name, file_name); GladeXmlContext *context;
GladeXmlNode *root;
GladeXmlDoc *xml_doc;
gboolean ret;
if (!glade_util_path_is_writable (full_path))
return FALSE;
xml_doc = glade_xml_doc_new ();
if (xml_doc == NULL) {
g_warning ("Could not create xml document\n");
return FALSE;
}
context = glade_xml_context_new (xml_doc, NULL);
root = glade_project_write (context, project);
glade_xml_context_destroy (context);
if (root == NULL)
return FALSE;
glade_xml_doc_set_root (xml_doc, root);
ret = glade_xml_doc_save (xml_doc, full_path);
glade_xml_doc_free (xml_doc);
if (ret < 0)
return FALSE;
return TRUE; return TRUE;
} }
...@@ -369,10 +451,10 @@ glade_project_save (GladeProject *project) ...@@ -369,10 +451,10 @@ glade_project_save (GladeProject *project)
if (project->path == NULL) if (project->path == NULL)
project->path = glade_project_ui_save_get_name (project); project->path = glade_project_ui_save_get_name (project);
if (project->path == NULL) if (!glade_project_save_to_file (project, project->path)) {
glade_project_ui_warn (project, _("Invalid file name"));
return FALSE; return FALSE;
}
glade_project_save_to_file (project, project->path);
return TRUE; return TRUE;
} }
......
...@@ -98,7 +98,7 @@ glade_property_query_new (void) ...@@ -98,7 +98,7 @@ glade_property_query_new (void)
static GladePropertyQuery * static GladePropertyQuery *
glade_query_new_from_node (xmlNodePtr node) glade_query_new_from_node (GladeXmlNode *node)
{ {
GladePropertyQuery *query; GladePropertyQuery *query;
...@@ -377,10 +377,10 @@ glade_property_get_parameters_choice (GParamSpec *spec, ...@@ -377,10 +377,10 @@ glade_property_get_parameters_choice (GParamSpec *spec,
static GList * static GList *
glade_property_class_get_parameters_from_spec (GParamSpec *spec, glade_property_class_get_parameters_from_spec (GParamSpec *spec,
GladePropertyClass *class, GladePropertyClass *class,
xmlNodePtr node) GladeXmlNode *node)
{ {
GList *parameters = NULL; GList *parameters = NULL;
xmlNodePtr child; GladeXmlNode *child;
switch (class->type) { switch (class->type) {
case GLADE_PROPERTY_TYPE_CHOICE: case GLADE_PROPERTY_TYPE_CHOICE:
...@@ -421,7 +421,7 @@ glade_property_class_get_parameters_from_spec (GParamSpec *spec, ...@@ -421,7 +421,7 @@ glade_property_class_get_parameters_from_spec (GParamSpec *spec,
static GladePropertyClass * static GladePropertyClass *
glade_property_class_new_from_param_spec (const gchar *name, glade_property_class_new_from_param_spec (const gchar *name,
GladeWidgetClass *widget_class, GladeWidgetClass *widget_class,
xmlNodePtr node) GladeXmlNode *node)
{ {
GladePropertyClass *class; GladePropertyClass *class;
GParamSpec *spec; GParamSpec *spec;
...@@ -488,9 +488,9 @@ glade_property_class_get_set_function (GladePropertyClass *class, const gchar *f ...@@ -488,9 +488,9 @@ glade_property_class_get_set_function (GladePropertyClass *class, const gchar *f
} }
static GList * static GList *
glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_tag) glade_xml_read_list (GladeXmlNode *node, const gchar *list_tag, const gchar *item_tag)
{ {
xmlNodePtr child; GladeXmlNode *child;
GList *list = NULL; GList *list = NULL;
gchar *item; gchar *item;
...@@ -498,7 +498,7 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t ...@@ -498,7 +498,7 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t
if (child == NULL) if (child == NULL)
return NULL; return NULL;
child = child->children; child = glade_xml_node_get_children (child);
while (child != NULL) { while (child != NULL) {
skip_text (child); skip_text (child);
...@@ -507,7 +507,7 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t ...@@ -507,7 +507,7 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t
item = glade_xml_get_content (child); item = glade_xml_get_content (child);
if (item != NULL) if (item != NULL)
list = g_list_prepend (list, item); list = g_list_prepend (list, item);
child = child->next; child = glade_xml_node_next (child);
} }
list = g_list_reverse (list); list = g_list_reverse (list);
...@@ -517,10 +517,10 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t ...@@ -517,10 +517,10 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t
static GladePropertyClass * static GladePropertyClass *
glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_class) glade_property_class_new_from_node (GladeXmlNode *node, GladeWidgetClass *widget_class)
{ {
GladePropertyClass *property_class; GladePropertyClass *property_class;
xmlNodePtr child; GladeXmlNode *child;
gchar *type; gchar *type;
gchar *id; gchar *id;
gchar *name; gchar *name;
...@@ -528,7 +528,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl ...@@ -528,7 +528,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
if (!glade_xml_node_verify (node, GLADE_TAG_PROPERTY)) if (!glade_xml_node_verify (node, GLADE_TAG_PROPERTY))
return NULL; return NULL;
id = glade_xml_get_value_string_required (node, GLADE_TAG_ID, widget_class->name); id = glade_xml_get_property_string_required (node, GLADE_TAG_ID, widget_class->name);
if (id == NULL) if (id == NULL)
return NULL; return NULL;
...@@ -537,9 +537,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl ...@@ -537,9 +537,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
* We can have a property like ... ParamSpec="TRUE"> * We can have a property like ... ParamSpec="TRUE">
* Or a child like <ParamSpec/>, but this will be deprecated * Or a child like <ParamSpec/>, but this will be deprecated
*/ */
child = glade_xml_search_child (node, GLADE_TAG_PARAM_SPEC); if (glade_xml_property_get_boolean (node, GLADE_TAG_PARAM_SPEC)) {
if (child ||
glade_xml_get_boolean (node, GLADE_TAG_PARAM_SPEC)) {
property_class = glade_property_class_new_from_param_spec (id, widget_class, node); property_class = glade_property_class_new_from_param_spec (id, widget_class, node);
g_free (id); g_free (id);
if (property_class == NULL) if (property_class == NULL)
...@@ -548,7 +546,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl ...@@ -548,7 +546,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
} }
name = glade_xml_get_value_string_required (node, GLADE_TAG_NAME, widget_class->name); name = glade_xml_get_property_string_required (node, GLADE_TAG_NAME, widget_class->name);
if (name == NULL) if (name == NULL)
return NULL; return NULL;
...@@ -622,17 +620,17 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl ...@@ -622,17 +620,17 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
} }