[Glade-devel] [patch, glade3] rework widget creation

Joaquin Cuenca Abela e98cuenc@free.fr
Sat, 31 May 2003 21:16:29 +0200


Ok, I finally got the time to review the patch.

I was a bit hesitant at the beginning, as glade_command_{create,delete}
were not supposed to create or delete the widget, but just account for a
created or deleted widget on the project, but the change of meaning
makes sense, as the other glade_command_* really execute the action that
they are supposed to account for.

I just removed the glade_command_create_toplevel function, as it look a
bit too ad hoc to me, so I keep the creation of a widget with only
glade_command_create.

I also applied your no-warn patch, along with a fix to release allocated
GladeWidgets (not related to your code).

I will review your other patches asap.

Thank you for your work!

Cheers,

> -----Message d'origine-----
> De : glade-devel-admin@lists.ximian.com=20
> [mailto:glade-devel-admin@lists.ximian.com] De la part de=20
> paolo borelli
> Envoy=E9 : vendredi 23 mai 2003 18:35
> =C0 : glade-devel@lists.ximian.com
> Objet : [Glade-devel] [patch, glade3] rework widget creation
>=20
>=20
> Hi!
>=20
> The attached patch is a rework of how a GladeWidget is created.=20
> After the patch the code path to create a widget IMHO makes=20
> more sense and matches better the one of widget deletion: the=20
> fundamental change is that galde_command_create calls=20
> glade_widget_new_from_class to create a widget and then adds=20
> it to the project instead of being called by it.
>=20
> The patch isn't small and touches various files, so I'm going=20
> to explain the changes in detail below.
>=20
> * glade-command.c: glade_command_create now takes the widget=20
> class and the placeholder it should replace as args; it=20
> creates the widget with glade_widget_new_from_class. Toplevel=20
> widget are created with glade_command_create_toplevel.
>=20
> * glade-placeholder.c: the placeholder (if present) is passed=20
> to glade_command_create and then is passed on till=20
> create_execute which takes care of replacing it, this way we=20
> can delete glade_placeholder_replace_widget and simply call=20
> glade_command_create.
>=20
> * glade-widget.c: glade_widget_new now only take the widget=20
> class as argument; glade_new_from_class takes also a project=20
> arg so special casing for toplevels (which don't have=20
> parent->project) is not needed anymore. I also deleted=20
> glade_widget_new_from_class_name since it was not used=20
> anywhere and a bad idea to begin with (if ever needed just=20
> get the class from its name and then call=20
> glade_widget_new_from_class).
>=20
> * glade_project_window.c: use glade_command_create_toplevel
>=20
> * glade_property.c: fix up the caller of=20
> glade_widget_new_from_class (I was a little unsure about this=20
> little change since I am not familiar with property.c, but I=20
> noticed that even if before widget->project was not=20
> explicitly passed to the called function, there was a=20
> g_return_if_fail (GLADE_IS_PROJECT (parent->project))... )
>=20
>=20
> It seems to work here, but at the moment adding widget to=20
> vbox etc it's broken so the patch isn't tested a lot, if you=20
> see any problems let me know.
>=20
> Sorry for being so verbose, I hope it all makes sense and it=20
> doesn't conflict with your current work.
>=20
>=20
> ciao
> 	paolo
>=20