[Glade-devel] [glade3] rfc: change implementation of packing properties



--=-3MjDgr61wqFF67n9Hr2n
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi!

The attached patch is a proposal to change the way we handle packing
properties in glade3; it allows a lot of simplification by using the
information provided by gtk+ instead of using our own data structures.

I'd really love to get some feedback on this (both design and
implementation) before going on, since I'm not a guru and I'd prefer to
find out if I overlooked something before committing this to cvs.

The patch is against latest cvs and is (ligthly) tested on linux.
(Note that I have ifdeffed out some chunks of code instead of deleting
them to make the diff smaller, those parts can be deleted when/if
committing)

Feel free to skip the verbose explanation and jump to the patch :)


* Small overview:
this is actually a check to see if _I_ misunderstood something, I know
that you know these things well :)
A packing property is a property which express the relation between a
widget and its container; each widget (which is contained) has a set of
packing properies, but the type of these packing properties is
determined by the container. On the glade XML side of things, these
properties are stored at the <child> level. On the Gtk+ side these are
stored in the container's child_properties.


* before the patch:
GladeWidgetClass had a packing_properties list, each element of this
list was a structure containing a pointer to the type of container and
list of packing properties pertaining to that container. So when a
GladeWidget was added it looked into _its_ class, searched the list of
packing properties for a matching container and retrived the list of
needed packing properties.
These list of packing properties specific to each container where
constructed at init time in a IMHO hackish way (see the global arrays in
glade-packing.c for details)


* Commented list of changes:

[see glade-widget-class.h]
GladeWidgetClass has a list called child_properties (to match gtk
terminology) of GladePropertyClass which apply to the _children_ of the
widget (of course the list is empty if the widget class is not a
container). Note that this isn't a "list of lists" anymore.
When a GladeWidget is added it looks in the GladeWidgetClass of its
_parent_ to retrieve which kind of packing properties it needs.

[glade-packing.ch]
These files are not used anywhere anymore and can be removed. (just
removed from Makefile.am in the patch)

[see glade-widget.h]
A change which is orthogonal to the patch, but that IMHO makes things
cleaner, is that I added a packing_properties list to the GladeWidget
structure; packing properties used to be mixed with normal properties
before.

[see glade-widget-class.c]
The interesting part is that the list of child_properties of a
GladeWidgetClass is easyly obtained from gtk
(glade_widget_class_list_child_properties) instead of building that.

[see glade_property.c]
Each GladeProperty representing a packing property is set with a generic
function (glade_property_set_packing) instead of distinguishing on the
type of property. (in this file there is probably room for more cleanup)

[see glade_editor.c]
The packing property page of the editor is constructed from the list of
child properties of the parent. This may also allow us to cache the
table like we do for the other pages of the notebook (if we change
widget but not container the table doesn't need to be rebuilt from
scratch), but this isn't included in the patch.

The changes in the other files touched are fixups for the above.


* Issues:
The only thing that I noticed that changes for the user (modulo bugs) is
the packing properties page of a widget added to a GtkTable: the
child_properties of a table that Gtk passes to us are different from
those that we display currently. For others containers as GtkVBox or
GtkNotebook things seem fine.


Comments, suggestions, flames are really appreciated.

ciao
        Paolo


PS: I know Joaquin has not regular internet connection for a few days, I
hope this reaches him.



--=-3MjDgr61wqFF67n9Hr2n
Content-Disposition: attachment; filename=packing_prop.patch
Content-Type: text/x-patch; name=packing_prop.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

diff -upr gnome2/glade3/src/glade-catalog.c glade3/src/glade-catalog.c
--- gnome2/glade3/src/glade-catalog.c   2003-04-16 20:06:48.000000000 +0200
+++ glade3/src/glade-catalog.c  2003-07-07 13:01:26.000000000 +0200
@@ -155,13 +155,14 @@ glade_catalog_load (const gchar *file_na
        catalog->widgets = g_list_reverse (new_list);
 
        glade_catalog_list = g_list_prepend (glade_catalog_list, catalog);
-       
+
+#if 0
        list = catalog->widgets;
        for (; list != NULL; list = list->next) {
                class = list->data;
                glade_widget_class_load_packing_properties (class);
        }
-
+#endif
 
        return catalog;
 }
diff -upr gnome2/glade3/src/glade-command.c glade3/src/glade-command.c
--- gnome2/glade3/src/glade-command.c   2003-07-03 18:36:29.000000000 +0200
+++ glade3/src/glade-command.c  2003-07-07 13:01:26.000000000 +0200
@@ -20,6 +20,7 @@
  *   Joaqu�n Cuenca Abela <e98cuenc yahoo com>
  *   Archit Baweja <bighead users sourceforge net>
  */
+
 #include <gtk/gtk.h>
 #include <string.h>
 #include "glade-types.h"
@@ -29,7 +30,6 @@
 #include "glade-widget.h"
 #include "glade-widget-class.h"
 #include "glade-command.h"
-#include "glade-packing.h"
 #include "glade-property.h"
 #include "glade-property-class.h"
 #include "glade-debug.h"
@@ -576,10 +576,8 @@ glade_command_create_execute (GladeComma
        glade_project_add_widget (widget->project, widget, widget->parent);
        glade_project_selection_set (widget->project, widget->widget, TRUE);
 
-       if (!GLADE_WIDGET_IS_TOPLEVEL (widget)) {
+       if (!GLADE_WIDGET_IS_TOPLEVEL (widget))
                glade_placeholder_replace_with_widget (placeholder, widget);
-               glade_widget_set_default_packing_options (widget);
-       }
 
        if (GTK_IS_WIDGET (widget->widget))
                gtk_widget_show_all (widget->widget);
@@ -763,7 +761,6 @@ glade_command_paste_execute (GladeComman
        project = parent->project;
 
        widget->name = glade_widget_new_name (project, widget->class);
-       glade_packing_add_properties (widget);
 
        glade_widget_set_contents (widget);
        glade_widget_connect_signals (widget);
@@ -771,8 +768,9 @@ glade_command_paste_execute (GladeComman
        if (!GLADE_WIDGET_IS_TOPLEVEL (widget)) {
                gtk_widget_ref (GTK_WIDGET (placeholder));
 
+               /* we may have changed the parent, regenerate packing properties */
+               glade_widget_set_packing_properties (widget, parent->class);
                glade_placeholder_replace_with_widget (placeholder, widget);
-               glade_widget_set_default_packing_options (widget);
        }
 
        glade_project_add_widget (project, widget, parent);
diff -upr gnome2/glade3/src/glade-editor.c glade3/src/glade-editor.c
--- gnome2/glade3/src/glade-editor.c    2003-07-07 12:42:20.000000000 +0200
+++ glade3/src/glade-editor.c   2003-07-07 13:01:26.000000000 +0200
@@ -1355,7 +1361,7 @@ glade_editor_load_packing_page (GladeEdi
        static GList *old_props = NULL;
        GladeEditorProperty *editor_property;
        GladeEditorTable *table;
-       GladeProperty *property;
+       GladePropertyClass *property_class;
        GtkContainer *container;
        GList *list;
 
@@ -1379,20 +1385,23 @@ glade_editor_load_packing_page (GladeEdi
        if (!widget)
                return;
 
+       /* if the widget is a toplevel there are no packing properties */
+       if (!widget->parent)
+               return;
+
        /* Now add the new properties */
        table = glade_editor_table_new ();
        table->editor = editor;
        table->common = FALSE;
        table->packing = TRUE;
 
-       list = widget->properties;
+       list = widget->parent->class->child_properties;
        for (; list; list = list->next) {
-               property = list->data; 
-               if (property->class->packing) {
-                       editor_property = glade_editor_table_append_item (table, property->class);
-                       old_props = g_list_prepend (old_props, editor_property);
-                       glade_editor_property_load (editor_property, widget);
-               }
+               property_class = list->data; 
+               g_assert (property_class->packing == TRUE);
+               editor_property = glade_editor_table_append_item (table, property_class);
+               old_props = g_list_prepend (old_props, editor_property);
+               glade_editor_property_load (editor_property, widget);
        }
 
        gtk_widget_show_all (table->table_widget);
diff -upr gnome2/glade3/src/glade-editor.h glade3/src/glade-editor.h
--- gnome2/glade3/src/glade-editor.h    2003-06-13 18:43:20.000000000 +0200
+++ glade3/src/glade-editor.h   2003-07-07 13:01:26.000000000 +0200
@@ -155,8 +155,8 @@ struct _GladeEditorTable
 struct _GladeEditorProperty
 {
        GladePropertyClass *class; /* The class this property
-                                                  * corresponds to.
-                                                  */
+                                   * corresponds to.
+                                   */
 
        GladeProperty *property; /* The loaded GladeProperty
                                  */
diff -upr gnome2/glade3/src/glade-property.c glade3/src/glade-property.c
--- gnome2/glade3/src/glade-property.c  2003-07-07 12:34:37.000000000 +0200
+++ glade3/src/glade-property.c 2003-07-07 13:01:26.000000000 +0200
@@ -367,11 +367,43 @@ glade_property_set_enum (GladeProperty *
        glade_property_emit_changed (property);
 }
 
+/**
+ * packing properties are a special case because the property
+ * to set is in the container. Maybe this would be nicer if done
+ * overriding set/get_property of property_class, but would require
+ * to change the prototype to pass down more info...
+ */
+static void
+glade_property_set_packing (GladeProperty *property, const GValue *value)
+{
+       GtkContainer *container;
+       GtkWidget *child;
+
+       g_return_if_fail (property->class->packing);
+
+       container = GTK_CONTAINER (property->widget->parent->widget);
+       child = property->widget->widget;
+
+       g_value_reset (property->value);
+       g_value_copy (value, property->value);
+
+       property->loading = TRUE;
+       gtk_container_child_set_property (container, child, property->class->id, value);
+       property->loading = FALSE;
+
+       glade_property_emit_changed (property);
+}
+
 void
 glade_property_set (GladeProperty *property, const GValue *value)
 {
        g_return_if_fail (GLADE_IS_PROPERTY (property));
 
+       if (property->class->packing) {
+               glade_property_set_packing (property, value);
+               return;
+       }
+
        switch (property->class->type) {
        case GLADE_PROPERTY_TYPE_BOOLEAN:
                glade_property_set_boolean (property,
diff -upr gnome2/glade3/src/glade-widget.c glade3/src/glade-widget.c
--- gnome2/glade3/src/glade-widget.c    2003-07-06 17:56:42.000000000 +0200
+++ glade3/src/glade-widget.c   2003-07-07 13:01:26.000000000 +0200
@@ -35,7 +35,6 @@
 #include "glade-placeholder.h"
 #include "glade-signal.h"
 #include "glade-gtk.h"
-#include "glade-packing.h"
 #include "glade-clipboard.h"
 #include "glade-command.h"
 #include "glade-debug.h"
@@ -56,16 +55,18 @@ glade_widget_new_name (GladeProject *pro
        return glade_project_new_widget_name (project, class->generic_name);
 }
 
+/**
+ * Returns a list of GladeProperties from a list of 
+ * GladePropertyClass.
+ */
 static GList *
-glade_widget_property_list_from_class (GladeWidgetClass *class,
-                                      GladeWidget *widget)
+glade_widget_properties_from_list (GList *list, GladeWidget *widget)
 {
-       GList *list = NULL;
        GladePropertyClass *property_class;
        GladeProperty *property;
        GList *new_list = NULL;
 
-       for (list = class->properties; list; list = list->next) {
+       for (; list; list = list->next) {
                property_class = list->data;
                property = glade_property_new_from_class (property_class, widget);
                if (property == NULL)
@@ -99,7 +92,10 @@ glade_widget_new (GladeWidgetClass *clas
        widget->widget   = NULL;
        widget->project  = NULL;
        widget->class    = class;
-       widget->properties = glade_widget_property_list_from_class (class, widget);
+       widget->properties = glade_widget_properties_from_list (class->properties, widget);
+       /* we don't have packing props until we container add the widget */
+       widget->packing_properties = NULL;
+       widget->signals  = NULL;
        widget->parent   = NULL;
        widget->children = NULL;
 
@@ -122,6 +118,11 @@ glade_widget_free (GladeWidget *widget)
                glade_property_free (list->data);
        widget->properties = NULL;
 
+       list = widget->packing_properties;
+       for (; list; list = list->next)
+               glade_property_free (list->data);
+       widget->properties = NULL;
+
        list = widget->signals;
        for (; list; list = list->next)
                glade_signal_free (list->data);
@@ -341,23 +342,17 @@ glade_widget_button_release (GtkWidget *
 }
 
 /**
- * glade_widget_set_default_options:
- * @widget: 
- * 
- * Takes care of applying the default values to a newly created widget
- **/
+ * Set the deafault value to the given list of properties.
+ */
 static void
-glade_widget_set_default_options_real (GladeWidget *widget, gboolean packing)
+glade_widget_set_default_options_real (GList *properties)
 {
        GladeProperty *property;
        GList *list;
 
-       for (list = widget->properties; list; list = list->next) {
+       for (list = properties; list; list = list->next) {
                property = list->data;
 
-               if (property->class->packing != packing)
-                       continue;
-
                /* For some properties, we get the value from the GtkWidget, for example the
                 * "position" packing property. See g-p-class.h ->get_default. Chema
                 */
@@ -375,7 +370,7 @@ glade_widget_set_default_options_real (G
 static void
 glade_widget_set_default_options (GladeWidget *widget)
 {
-       glade_widget_set_default_options_real (widget, FALSE);
+       glade_widget_set_default_options_real (widget->properties);
 }
 
 /**
@@ -390,7 +385,9 @@ glade_widget_set_default_options (GladeW
 void
 glade_widget_set_default_packing_options (GladeWidget *widget)
 {
-       glade_widget_set_default_options_real (widget, TRUE);
+       g_return_if_fail (GLADE_IS_WIDGET (widget));
+
+       glade_widget_set_default_options_real (widget->packing_properties);
 }
 
 static void
@@ -504,7 +501,7 @@ glade_widget_connect_edit_signals_with_c
        GList *list;
 
        property = glade_widget_get_property_from_class (widget, class);
-       
+
        g_return_if_fail (GLADE_IS_PROPERTY (property));
 
        for (list = class->update_signals; list; list = list->next) {
@@ -625,6 +622,34 @@ glade_widget_connect_signals (GladeWidge
        glade_widget_connect_other_signals (widget);
 }
 
+/**
+ * glade_widget_set_packing_properties:
+ * @widget:
+ * @container_class:
+ *
+ * Generates the packing_properties list of the widget, given
+ * the class of the container we are adding the widget to.
+ * If the widget already has packing_properties, but the container
+ * has changed, the current list is freed and replaced.
+ **/
+void
+glade_widget_set_packing_properties (GladeWidget *widget,
+                                    GladeWidgetClass *container_class)
+{
+       g_return_if_fail (GLADE_IS_WIDGET (widget));
+       g_return_if_fail (GLADE_IS_WIDGET_CLASS (container_class));
+
+       /*
+        * toplevls dont have packing properties, so shhould not be
+        * passed to this function.
+        */
+       g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget->widget));
+
+       g_list_free (widget->packing_properties);
+       widget->packing_properties = glade_widget_properties_from_list (container_class->child_properties, 
widget);
+
+}
+
 static GladeWidget *
 glade_widget_new_full (GladeWidgetClass *class,
                       GladeProject *project,
@@ -639,9 +664,12 @@ glade_widget_new_full (GladeWidgetClass 
        widget->parent  = parent;
        widget->project = project;
 
-       glade_packing_add_properties (widget);
        glade_widget_create_gtk_widget (widget);
 
+       /* We know the parent (if we have one), we can add the packing properties */
+       if (parent)
+               glade_widget_set_packing_properties (widget, parent->class);
+
        glade_widget_set_contents (widget);
        glade_widget_connect_signals (widget);
 
@@ -805,7 +833,7 @@ glade_widget_query_properties (GladeWidg
 
        g_hash_table_destroy (hash);
        gtk_widget_destroy (dialog);
-       
+
        return FALSE;
 }
 
@@ -816,7 +844,8 @@ glade_widget_query_properties (GladeWidg
  * 
  **/
 static void
-glade_widget_apply_queried_properties (GladeWidget *widget, GladePropertyQueryResult *result)
+glade_widget_apply_queried_properties (GladeWidget *widget,
+                                      GladePropertyQueryResult *result)
 {
        GList *list;
 
@@ -883,7 +912,7 @@ glade_widget_get_name (GladeWidget *widg
 {
        return widget->name;
 }
-               
+
 GladeWidgetClass *
 glade_widget_get_class (GladeWidget *widget)
 {
@@ -893,16 +922,18 @@ glade_widget_get_class (GladeWidget *wid
 /**
  * glade_widget_get_property_from_list:
  * @list: The list of GladeProperty
- * @class: The Class that we are trying to match with GladePropery
+ * @class: The Class that we are trying to match with GladeProperty
  * @silent: True if we shuold warn when a property is not included in the list
  * 
- * Give a list of GladeProperties find the one that has ->class = to @class.
+ * Given a list of GladeProperties find the one that has ->class = to @class.
  * This function recurses into child objects if needed.
  * 
  * Return Value: 
  **/
 static GladeProperty *
-glade_widget_get_property_from_list (GList *list, GladePropertyClass *class, gboolean silent)
+glade_widget_get_property_from_list (GList *list,
+                                    GladePropertyClass *class,
+                                    gboolean silent)
 {
        GladeProperty *property = NULL;
 
@@ -948,7 +979,10 @@ glade_widget_get_property_from_class (Gl
        GladeProperty *property;
        GList *list;
 
-       list = widget->properties;
+       if (property_class->packing)
+               list = widget->packing_properties;
+       else
+               list = widget->properties;
 
        property = glade_widget_get_property_from_list (list, property_class, FALSE);
 
@@ -1171,12 +1205,11 @@ glade_widget_write (GladeXmlContext *con
 
                        /* Append the packing properties */
                        packing = glade_xml_node_new (context, GLADE_XML_TAG_PACKING);
-                       list2 = child_widget->properties;
+                       list2 = child_widget->packing_properties;
                        for (; list2; list2 = list2->next) {
                                GladeXmlNode *packing_property;
                                property = list2->data;
-                               if (!property->class->packing) 
-                                       continue;
+                               g_assert (property->class->packing == TRUE);
                                packing_property = glade_property_write (context, property);
                                if (packing_property == NULL)
                                        continue;
@@ -1220,7 +1253,7 @@ glade_widget_apply_property_from_node (G
                                                               value);
 
        glade_property_set (property, gvalue);
-               
+
        g_free (id);
        g_free (value);
        g_free (gvalue);
diff -upr gnome2/glade3/src/glade-widget-class.c glade3/src/glade-widget-class.c
--- gnome2/glade3/src/glade-widget-class.c      2003-07-06 17:48:43.000000000 +0200
+++ glade3/src/glade-widget-class.c     2003-07-07 13:33:24.000000000 +0200
@@ -46,7 +46,6 @@
 #include "glade-choice.h"
 #include "glade-parameter.h"
 #include "glade-widget-class.h"
-#include "glade-packing.h"
 
 
 static gchar *
@@ -92,7 +91,7 @@ glade_widget_class_new (void)
        class->placeholder_replace = NULL;
        class->type = 0;
        class->properties = NULL;
-       class->packing_properties = NULL;
+       class->child_properties = NULL;
 
        return class;
 }
@@ -223,6 +222,58 @@ glade_widget_class_list_properties (Glad
        return list;
 }
 
+static GList * 
+glade_widget_class_list_child_properties (GladeWidgetClass *class) 
+{
+       GladePropertyClass *property_class;
+       GObjectClass *object_class;
+       GParamSpec **specs = NULL;
+       GParamSpec *spec;
+       gint n_specs = 0;
+       gint i;
+       GList *list = NULL;
+
+       g_return_val_if_fail (GLADE_IS_WIDGET_CLASS (class), NULL);
+
+       /* only containers have child propeties */
+       if (!g_type_is_a (class->type, GTK_TYPE_CONTAINER))
+               return NULL;
+
+       object_class = g_type_class_peek (class->type);
+       if (object_class == NULL) {
+               g_warning ("Class peek failed\n");
+               return NULL;
+       }
+
+       specs = gtk_container_class_list_child_properties (object_class, &n_specs);
+
+#ifdef DEBUG
+       g_print ("class %s has n child props: %d\n", class->name, n_specs);
+#endif
+
+       for (i = 0; i < n_specs; i++) {
+               spec = specs[i];
+
+               property_class = glade_property_class_new_from_spec (spec);
+
+#ifdef DEBUG
+               g_print ("child prop. name: %s, id: %s, type: %d\n", property_class->name, 
property_class->id, property_class->type);
+#endif
+
+               property_class->optional = FALSE;
+               property_class->update_signals = NULL;
+               property_class->packing = TRUE;
+
+               list = g_list_prepend (list, property_class);
+       }       
+
+       list = g_list_reverse (list);
+
+       g_free (specs);
+
+       return list;
+}
+
 static gboolean
 glade_widget_class_set_type (GladeWidgetClass *class,
                             const gchar *init_function_name)
@@ -286,8 +337,11 @@ glade_widget_class_new_from_node (GladeX
        glade_property_class_list_add_from_node (child, class, &class->properties);
 
        /* Signals */
-       class->signals    = glade_widget_class_list_signals (class);
+       class->signals = glade_widget_class_list_signals (class);
 
+       /* Child properties */
+       class->child_properties = glade_widget_class_list_child_properties (class);
+ 
        /* Get the flags */
        if (glade_xml_get_boolean (node, GLADE_TAG_TOPLEVEL, FALSE))
                GLADE_WIDGET_CLASS_SET_FLAGS (class, GLADE_TOPLEVEL);
@@ -303,7 +357,7 @@ glade_widget_class_new_from_node (GladeX
        class->in_palette = glade_xml_get_boolean (node, GLADE_TAG_IN_PALETTE, TRUE);
 
        glade_widget_class_add_virtual_methods (class);
-       
+
        return class;
 }
 
@@ -529,6 +583,7 @@ glade_widget_class_is (GladeWidgetClass 
        return FALSE;
 }
 
+#if 0
 static void
 glade_widget_class_load_packing_properties_from_node (GladeXmlNode *node,
                                                      GladeWidgetClass *class)
@@ -598,4 +653,4 @@ glade_widget_class_load_packing_properti
 
        g_free (file_name);
 }
-
+#endif
diff -upr gnome2/glade3/src/glade-widget-class.h glade3/src/glade-widget-class.h
--- gnome2/glade3/src/glade-widget-class.h      2003-07-06 17:44:53.000000000 +0200
+++ glade3/src/glade-widget-class.h     2003-07-07 13:31:38.000000000 +0200
@@ -55,14 +55,24 @@ struct _GladeWidgetClass
                              */
        
        GList *signals;     /* List of GladeWidgetClassSignal objects */
-       
-       GList *packing_properties; /* List of Packing GladePackingProperties */
+
+       GList *child_properties;   /* List of GladePropertyClass objects
+                                   * representing child_properties of a
+                                   * GtkContainer (the list is empty if the
+                                   * class isn't a container).
+                                   * Note that the actual GladeProperty
+                                   * corresponding to each class end up
+                                   * in the packing_properties list of
+                                   * each _child_ of the container and thus
+                                   * are edited when the _child_ is selected.
+                                   */
 
        void (*placeholder_replace) (GtkWidget *current,
                                     GtkWidget *new,
                                     GtkWidget *container);
 
        gchar *post_create_function;
+
        gboolean in_palette;
 };
 
@@ -90,9 +100,6 @@ gboolean     glade_widget_class_is (Glad
 GParamSpec *glade_widget_class_find_spec (GladeWidgetClass *class, const gchar *name);
 void        glade_widget_class_dump_param_specs (GladeWidgetClass *class);
 
-/* Packing properties */
-void        glade_widget_class_load_packing_properties (GladeWidgetClass *class);
-
 
 G_END_DECLS
 
diff -upr gnome2/glade3/src/glade-widget.h glade3/src/glade-widget.h
--- gnome2/glade3/src/glade-widget.h    2003-06-20 11:30:05.000000000 +0200
+++ glade3/src/glade-widget.h   2003-07-07 13:01:26.000000000 +0200
@@ -4,15 +4,16 @@
 
 G_BEGIN_DECLS
 
+
 #define GLADE_WIDGET(w) ((GladeWidget *)w)
 #define GLADE_IS_WIDGET(w) (w != NULL)
 
+
 /* A GladeWidget is an instance of a GladeWidgetClass. For every widget
  * in the project there is a GladeWidget
  */
-
-struct _GladeWidget {
-
+struct _GladeWidget
+{
        GladeWidgetClass *class; /* The class of the widget.
                                  * [see glade-widget-class.h ]
                                  */
@@ -33,13 +34,23 @@ struct _GladeWidget {
                            * destroy this widgets once created, we should
                            * just hide them
                            */
-       
+
        GList *properties; /* A list of GladeProperty. A GladeProperty is an
                            * instance of a GladePropertyClass. If a
                            * GladePropertyClass for a gtkbutton is label, its
                            * property is "Ok". 
                            */
 
+       GList *packing_properties; /* A list of GladeProperty. Note that these
+                                   * properties are related to the container
+                                   * of the widget, thus they change after
+                                   * pasting the widget to a different
+                                   * container. Toplevels widget do not have
+                                   * packing properties.
+                                   * See also child_properties of 
+                                   * GladeWidgetClass.
+                                   */
+
        GList *signals;      /* A list of GladeSignals */
 
        /* Tree Structure */
@@ -83,11 +94,11 @@ GList *glade_widget_find_signal (GladeWi
 void glade_widget_add_signal (GladeWidget *widget, GladeSignal *signal);
 void glade_widget_remove_signal (GladeWidget *widget, GladeSignal *signal);
 
-
 /* Xml saving & reading */
 GladeXmlNode * glade_widget_write (GladeXmlContext *context, GladeWidget *widget);
 GladeWidget *  glade_widget_new_from_node (GladeXmlNode *node, GladeProject *project);
 
+
 G_END_DECLS
 
 #endif /* __GLADE_WIDGET_H__ */
diff -upr gnome2/glade3/src/main.c glade3/src/main.c
--- gnome2/glade3/src/main.c    2003-06-21 10:54:49.000000000 +0200
+++ glade3/src/main.c   2003-07-07 13:01:26.000000000 +0200
@@ -29,7 +29,6 @@
 #include "glade-editor.h"
 #include "glade-cursor.h"
 #include "glade-catalog.h"
-#include "glade-packing.h"
 #include "glade-palette.h"
 #include "glade-project.h"
 #include "glade-project-view.h"
@@ -133,11 +132,9 @@ glade_init ()
        /*
         * 1. Init the cursors
         * 2. Create the catalog
-        * 3. Create the project
-        * 4. Create the project window
+        * 3. Create the project window
         */
        glade_cursor_init ();
-       glade_packing_init ();
 
        catalogs = glade_catalog_load_all ();
        if (catalogs == NULL)
diff -upr gnome2/glade3/src/Makefile.am glade3/src/Makefile.am
--- gnome2/glade3/src/Makefile.am       2003-05-14 22:22:56.000000000 +0200
+++ glade3/src/Makefile.am      2003-07-07 13:37:39.000000000 +0200
@@ -40,7 +40,6 @@ glade_3_SOURCES = \
        glade-gtk.c \
        glade-utils.c \
        glade-signal.c \
-       glade-packing.c \
        glade-signal-editor.c \
        glade-clipboard.c \
        glade-clipboard-view.c \
@@ -71,7 +70,6 @@ noinst_HEADERS = \
        glade-catalog.h \
        glade-utils.h \
        glade-signal.h \
-       glade-packing.h \
        glade-xml-utils.h \
        glade-clipboard.h \
        glade-clipboard-view.h \

--=-3MjDgr61wqFF67n9Hr2n--





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]