[Glade-devel] Dialogs & construct_only



Hi all,
    Here is a little design issue I ran into, when we rebuild a widget
(glade-widget.c:glade_widget_rebuild() after aplying my patch)
We do two seperate steps to ensure the integrity of the widget heirarchy:
  - Essentialy call the "replace_child" function of the parent instance
    (same proceedure as in glade_widget_replace)
  - If the widget we are rebuilding is a container, we call
glade_widget_transport_children
    which loops over the children calling gtk_container_add/gtk_container_remove
    and then calling glade_widget_set_packing_properties().

Now the problem arises when the widget we are rebuilding is a GtkDialog,
which is a GtkBin with a GTK_BIN(dialog)->child of type GtkVBox already
installed by the creation of the dialog.

So, the code that initialy looked like this:
    if (GTK_IS_CONTAINER(new_widget))
              glade_widget_transport_children(...);

Will essentialy look like this:
    /* If we are not a bin, or we are a childless bin */
    if (GTK_IS_CONTAINER(new_widget) &&
       (GTK_IS_BIN(new_widget) == FALSE || GTK_BIN(new_widget)->child == NULL)
              glade_widget_transport_children(...);
    /* If the new widget was constructed as a Bin with a child */
    else if (GTK_IS_BIN(new_widget) && 
                 GTK_IS_CONTAINER(GTK_BIN(new_widget)->child))
              glade_widget_transport_children( with args to transport from old
                                                                      
   bin->child to new bin->child);

And that just sounds a little icky to me, does anyone have a better idea ?
otherwise thats the way its going to stay AFAICS...

Cheers,
                                                   -Tristan




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