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>
Thanks to :
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
Shane Butler <shane_b@operamail.com> - Glade Widget signals
\ No newline at end of file
Shane Butler <shane_b@operamail.com> - Glade Widget signals editor
\ 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>
* src/glade-project.c (glade_project_save): impl.
......
......@@ -11,22 +11,17 @@ plus :
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]
----------
- Implement glade_widget_delete inside glade-widget.c, delete can already
be called from the popup menu.
- 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 gtk stock buttons.
- 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
double buffering because of pango, but this is just a guess.
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.
- Implement show clipboard (blocks on copy/cut)
- Implement the menu bar widget and the menu editor.
- Implement the glade-property type "File". For example to be used with a pixmap
......
......@@ -40,6 +40,7 @@ glade2_SOURCES = \
glade-choice.c \
glade-editor.c \
glade-gtk.c \
glade-utils.c \
glade-signal-editor.c
noinst_HEADERS = \
......@@ -63,4 +64,5 @@ noinst_HEADERS = \
glade-choice.h \
glade-gtk.h \
glade-catalog.h \
glade-utils.h \
glade-xml-utils.h
......@@ -42,9 +42,9 @@ glade_catalog_new (void)
}
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;
gchar *name;
......@@ -52,7 +52,7 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node)
return NULL;
list = NULL;
child = node->children;
child = glade_xml_node_get_children (node);
while (child != NULL) {
skip_text (child);
if (!glade_xml_node_verify (child, GLADE_TAG_GLADE_WIDGET))
......@@ -61,7 +61,7 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node)
if (name == NULL)
return NULL;
list = g_list_prepend (list, name);
child = child->next;
child = glade_xml_node_next (child);
}
list = g_list_reverse (list);
......@@ -72,13 +72,15 @@ glade_catalog_load_names_from_node (XmlParseContext *context, xmlNodePtr node)
static void
glade_catalog_load_names_from_file (GladeCatalog *catalog, const gchar *file_name)
{
XmlParseContext *context;
context = glade_xml_parse_context_new_from_path (file_name, NULL, GLADE_TAG_CATALOG);
if (context == NULL) return;
catalog->names = glade_catalog_load_names_from_node (context, context->doc->children);
glade_xml_parse_context_free (context);
GladeXmlContext *context;
GladeXmlNode *root;
context = glade_xml_context_new_from_path (file_name, NULL, GLADE_TAG_CATALOG);
if (context == NULL)
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 *
......
......@@ -119,7 +119,7 @@ glade_string_from_string (const gchar *string)
}
static GladeChoice *
glade_choice_new_from_node (xmlNodePtr node)
glade_choice_new_from_node (GladeXmlNode *node)
{
GladeChoice *choice;
......@@ -142,17 +142,17 @@ glade_choice_new_from_node (xmlNodePtr node)
}
GList *
glade_choice_list_new_from_node (xmlNodePtr node)
glade_choice_list_new_from_node (GladeXmlNode *node)
{
GladeXmlNode *child;
GladeChoice *choice;
xmlNodePtr child;
GList *list;
if (!glade_xml_node_verify (node, GLADE_TAG_CHOICES))
return NULL;
list = NULL;
child = node->children;
child = glade_xml_node_get_children (node);
while (child != NULL) {
skip_text (child);
......@@ -162,7 +162,7 @@ glade_choice_list_new_from_node (xmlNodePtr node)
if (choice == NULL)
return NULL;
list = g_list_prepend (list, choice);
child = child->next;
child = glade_xml_node_next (child);
}
list = g_list_reverse (list);
......
......@@ -51,7 +51,7 @@ struct _GladeChoice {
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
......
......@@ -124,7 +124,7 @@ glade_parameter_new (void)
}
static GladeParameter *
glade_parameter_new_from_node (xmlNodePtr node)
glade_parameter_new_from_node (GladeXmlNode *node)
{
GladeParameter *parameter;
......@@ -132,8 +132,8 @@ glade_parameter_new_from_node (xmlNodePtr node)
return NULL;
parameter = glade_parameter_new ();
parameter->key = glade_xml_get_value_string_required (node, GLADE_TAG_KEY, NULL);
parameter->value = glade_xml_get_value_string_required (node, GLADE_TAG_VALUE, NULL);
parameter->key = glade_xml_get_property_string_required (node, GLADE_TAG_KEY, NULL);
parameter->value = glade_xml_get_property_string_required (node, GLADE_TAG_VALUE, NULL);
if (!parameter->key || !parameter->value)
return NULL;
......@@ -158,10 +158,10 @@ glade_parameter_list_find_by_key (GList *list, const gchar *key)
GList *
glade_parameter_list_new_from_node (GList *list, xmlNodePtr node)
glade_parameter_list_new_from_node (GList *list, GladeXmlNode *node)
{
GladeParameter *parameter;
xmlNodePtr child;
GladeXmlNode *child;
GList *findme;
if (!glade_xml_node_verify (node, GLADE_TAG_PARAMETERS))
......@@ -170,7 +170,7 @@ glade_parameter_list_new_from_node (GList *list, xmlNodePtr node)
if (child == NULL)
return NULL;
child = node->children;
child = glade_xml_node_get_children (node);
while (child != NULL) {
skip_text (child);
......@@ -187,11 +187,11 @@ glade_parameter_list_new_from_node (GList *list, xmlNodePtr node)
if (findme) {
glade_parameter_free (findme->data);
findme->data = parameter;
child = child->next;
child = glade_xml_node_next (child);
}
list = g_list_prepend (list, parameter);
child = child->next;
child = glade_xml_node_next (child);
}
list = g_list_reverse (list);
......
......@@ -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);
GList * glade_parameter_list_new_from_node (GList *list, xmlNodePtr node);
GList * glade_parameter_list_new_from_node (GList *list, GladeXmlNode *node);
/* Convenience functions */
GtkAdjustment * glade_parameter_adjustment_new (GList *parameters);
......
......@@ -28,26 +28,31 @@
#define GLADE_SELECTOR_FILENAME "GladeFileSelectorFilename"
static gint
glade_project_ui_delete_event_cb (GtkWidget *widget, GdkEventAny *event)
{
gtk_main_quit ();
return TRUE;
}
static gint
glade_project_ui_cancel_clicked (GtkWidget *button, gpointer not_used)
glade_project_ui_delete_event_cb (GtkWidget *selector, GdkEventAny *event)
{
gtk_main_quit ();
gtk_object_set_user_data (GTK_OBJECT (selector), NULL);
return TRUE;
}
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_widget_hide (selector);
return TRUE;
}
......@@ -62,14 +67,14 @@ glade_project_ui_save_get_name (GladeProject *project)
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(selector)->ok_button),
"clicked",
GTK_SIGNAL_FUNC (glade_project_ui_ok_clicked),
NULL);
GTK_SIGNAL_FUNC (glade_project_ui_selector_clicked),
selector);
gtk_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(selector)->cancel_button),
"clicked",
GTK_SIGNAL_FUNC (glade_project_ui_cancel_clicked),
NULL);
GTK_SIGNAL_FUNC (glade_project_ui_selector_clicked),
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),
NULL);
......@@ -77,8 +82,15 @@ glade_project_ui_save_get_name (GladeProject *project)
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 @@
G_BEGIN_DECLS
gchar * glade_project_ui_save_get_name (GladeProject *project);
void glade_project_ui_warn (GladeProject *project, const gchar *warning);
G_END_DECLS
......
......@@ -193,7 +193,7 @@ glade_project_view_populate_model (GtkTreeStore *model,
list = project->widgets;
for (; list != NULL; list = list->next) {
widget = list->data;
if (GLADE_WIDGET_TOPLEVEL (widget))
if (GLADE_WIDGET_IS_TOPLEVEL (widget))
toplevels = g_list_append (toplevels, widget);
}
......
......@@ -28,6 +28,9 @@
#include "glade-project-ui.h"
#include "glade-project-window.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_init (GladeProject *project);
......@@ -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:
* @project:
......@@ -342,11 +400,35 @@ glade_project_selection_set (GladeWidget *widget,
*
* Return Value: TRUE on success, FALSE otherwise
**/
gboolean
static gboolean
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;
}
......@@ -369,10 +451,10 @@ glade_project_save (GladeProject *project)
if (project->path == NULL)
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;
glade_project_save_to_file (project, project->path);
}
return TRUE;
}
......
......@@ -98,7 +98,7 @@ glade_property_query_new (void)
static GladePropertyQuery *
glade_query_new_from_node (xmlNodePtr node)
glade_query_new_from_node (GladeXmlNode *node)
{
GladePropertyQuery *query;
......@@ -377,10 +377,10 @@ glade_property_get_parameters_choice (GParamSpec *spec,
static GList *
glade_property_class_get_parameters_from_spec (GParamSpec *spec,
GladePropertyClass *class,
xmlNodePtr node)
GladeXmlNode *node)
{
GList *parameters = NULL;
xmlNodePtr child;
GladeXmlNode *child;
switch (class->type) {
case GLADE_PROPERTY_TYPE_CHOICE:
......@@ -421,7 +421,7 @@ glade_property_class_get_parameters_from_spec (GParamSpec *spec,
static GladePropertyClass *
glade_property_class_new_from_param_spec (const gchar *name,
GladeWidgetClass *widget_class,
xmlNodePtr node)
GladeXmlNode *node)
{
GladePropertyClass *class;
GParamSpec *spec;
......@@ -488,9 +488,9 @@ glade_property_class_get_set_function (GladePropertyClass *class, const gchar *f
}
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;
gchar *item;
......@@ -498,7 +498,7 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t
if (child == NULL)
return NULL;
child = child->children;
child = glade_xml_node_get_children (child);
while (child != NULL) {
skip_text (child);
......@@ -507,7 +507,7 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t
item = glade_xml_get_content (child);
if (item != NULL)
list = g_list_prepend (list, item);
child = child->next;
child = glade_xml_node_next (child);
}
list = g_list_reverse (list);
......@@ -517,10 +517,10 @@ glade_xml_read_list (xmlNodePtr node, const gchar *list_tag, const gchar *item_t
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;
xmlNodePtr child;
GladeXmlNode *child;
gchar *type;
gchar *id;
gchar *name;
......@@ -528,7 +528,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
if (!glade_xml_node_verify (node, GLADE_TAG_PROPERTY))
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)
return NULL;
......@@ -537,9 +537,7 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
* We can have a property like ... ParamSpec="TRUE">
* Or a child like <ParamSpec/>, but this will be deprecated
*/
child = glade_xml_search_child (node, GLADE_TAG_PARAM_SPEC);
if (child ||
glade_xml_get_boolean (node, GLADE_TAG_PARAM_SPEC)) {
if (glade_xml_property_get_boolean (node, GLADE_TAG_PARAM_SPEC)) {
property_class = glade_property_class_new_from_param_spec (id, widget_class, node);
g_free (id);
if (property_class == NULL)
......@@ -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)
return NULL;
......@@ -622,17 +620,17 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
}
GList *
glade_property_class_list_new_from_node (xmlNodePtr node, GladeWidgetClass *class)
glade_property_class_list_new_from_node (GladeXmlNode *node, GladeWidgetClass *class)
{
GladePropertyClass *property_class;
xmlNodePtr child;
GladeXmlNode *child;
GList *list;
if (!glade_xml_node_verify (node, GLADE_TAG_PROPERTIES))
return NULL;
list = NULL;
child = node->children;
child = glade_xml_node_get_children (node);
while (child != NULL) {
skip_text (child);
......@@ -641,7 +639,7 @@ glade_property_class_list_new_from_node (xmlNodePtr node, GladeWidgetClass *clas
property_class = glade_property_class_new_from_node (child, class);
if (property_class != NULL)
list = g_list_prepend (list, property_class);
child = child->next;
child = glade_xml_node_next (child);
}
list = g_list_reverse (list);
......
......@@ -170,7 +170,7 @@ struct _GladePropertyClass {
GtkWidget * glade_property_class_create_label (GladePropertyClass *pclass);
GtkWidget * glade_property_class_create_input (GladePropertyClass *pclass);
GList * glade_property_class_list_new_from_node (xmlNodePtr node, GladeWidgetClass *class);
GList * glade_property_class_list_new_from_node (GladeXmlNode * node, GladeWidgetClass *class);
GParamSpec * glade_property_class_find_spec (GladeWidgetClass *class, const gchar *name);
......
......@@ -479,3 +479,16 @@ glade_property_query_result_destroy (GladePropertyQueryResult *result)
g_free (result);
}
GladeXmlNode *
glade_property_write (GladeXmlContext *context, GladeProperty *property)
{
GladeXmlNode *node;
node = glade_xml_node_new (context, GLADE_XML_TAG_PROPERTY);
glade_xml_node_set_property_string (node, GLADE_XML_TAG_NAME, property->class->id);
glade_xml_set_content (node, property->value);
return node;
}
......@@ -86,6 +86,9 @@ void glade_property_query_result_set_int (GladePropertyQueryResult *result,
const gchar *key,
gint value);
/* XML i/o */
GladeXmlNode * glade_property_write (GladeXmlContext *context, GladeProperty *property);
G_END_DECLS
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* Chema Celorio <chema@celorio.com>
*/
#include "glade.h"
gboolean
glade_util_path_is_writable (const gchar *full_path)
{
glade_implement_me (NULL);
return TRUE;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __GLADE_UTILS_H__
#define __GLADE_UTILS_H__
G_BEGIN_DECLS
/* Function is a GNU extension */
#ifndef __GNUC__
#define __FUNCTION__ ""
#endif
#define glade_implement_me(m) g_print ("Implement me : %s %d %s\n", __FILE__, __LINE__, __FUNCTION__);
gboolean glade_util_path_is_writable (const gchar *full_path);
G_END_DECLS
#endif /* __GLADE_UTILS_H__ */
......@@ -198,10 +198,10 @@ glade_widget_class_set_type (GladeWidgetClass *class, const gchar *init_function
}
GladeWidgetClass *
glade_widget_class_new_from_node (xmlNodePtr node)
glade_widget_class_new_from_node (GladeXmlNode *node)
{
GladeWidgetClass *class;
xmlNodePtr child;
GladeXmlNode *child;
gchar *init_function_name;
if (!glade_xml_node_verify (node, GLADE_TAG_GLADE_WIDGET_CLASS))
......@@ -283,17 +283,17 @@ glade_widget_class_create_pixmap (GladeWidgetClass *class)
GladeWidgetClass *
glade_widget_class_new_from_name (const gchar *name)
{
XmlParseContext *context;
GladeXmlContext *context;
GladeWidgetClass *class;
gchar *file_name;
file_name = g_strconcat (WIDGETS_DIR, "/", name, ".xml", NULL);
context = glade_xml_parse_context_new_from_path (file_name, NULL, GLADE_TAG_GLADE_WIDGET_CLASS);
context = glade_xml_context_new_from_path (file_name, NULL, GLADE_TAG_GLADE_WIDGET_CLASS);
if (context == NULL)
return NULL;
class = glade_widget_class_new_from_node (context->doc->children);
glade_xml_parse_context_free (context);
class = glade_widget_class_new_from_node (glade_xml_context_get_root (context));
glade_xml_context_free (context);
if (!glade_widget_class_create_pixmap (class))
return NULL;
......
......@@ -13,7 +13,7 @@ typedef enum {
#define GLADE_IS_WIDGET_CLASS(gwc) (gwc != NULL)
#define GLADE_WIDGET_FLAGS(gw) ((GLADE_WIDGET(gw)->class)->flags)
#define GLADE_WIDGET_TOPLEVEL(gw) ((GLADE_WIDGET_FLAGS(gw) & GLADE_TOPLEVEL) != 0)
#define GLADE_WIDGET_IS_TOPLEVEL(gw) ((GLADE_WIDGET_FLAGS(gw) & GLADE_TOPLEVEL) != 0)
#define GLADE_WIDGET_ADD_PLACEHOLDER(gw) ((GLADE_WIDGET_FLAGS(gw) & GLADE_ADD_PLACEHOLDER) != 0)
#define GLADE_WIDGET_CLASS_FLAGS(gwc) ((GLADE_WIDGET_CLASS(gwc)->flags))
......@@ -70,7 +70,7 @@ struct _GladeWidgetClassSignal {
};
GladeWidgetClass * glade_widget_class_new_from_name (const gchar *name);
GladeWidgetClass * glade_widget_class_new_from_node (xmlNodePtr node);
GladeWidgetClass * glade_widget_class_new_from_node (GladeXmlNode *node);
GladeWidgetClass * glade_widget_class_get_by_name (const gchar *name);
const gchar * glade_widget_class_get_name (GladeWidgetClass *class);
......
......@@ -814,3 +814,34 @@ glade_widget_new_from_class_name (const gchar *name,
}
GladeXmlNode *
glade_widget_write (GladeXmlContext *context, GladeWidget *widget)
{
GladeProperty *property;
GladeXmlNode *node;
GladeXmlNode *child;
GList *list;
g_return_val_if_fail (GLADE_XML_IS_CONTEXT (context), NULL);
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
node = glade_xml_node_new (context, GLADE_XML_TAG_WIDGET);
glade_xml_node_set_property_string (node, GLADE_XML_TAG_CLASS, widget->class->name);
glade_xml_node_set_property_string (node, GLADE_XML_TAG_ID, widget->name);
list = widget