[Glade-users] Glade-3 and derived widgets

From: Tristan Van Berkom <tristan van berkom gmail com>
Subject: Re: [Glade-users] Glade-3 and derived widgets
Date: Sat, 07 Jan 2006 14:40:23 -0500
Message-ID: <43C01927 9030905 gnome org>

Hi Tristan,

Magnus Danielson wrote:
I make a few assumptions, which may be far off, so please point that out if

I assume that I can provide my XML file with the glade-catalog of my objects.



I assume that I the XML file is sufficient to bind the widgets and its events.

Not exactly; the actual object/widget needs to be visible to glade-3; usually
you'd achieve this by providing a support module that implicitly links
to the library containing the object.


glade-3 --> dlopen'd glade-gnome.so via the catalog reference
glade-gnome.so --> Implicitly compuled with "-lgnome"

Once glade-3 has a way to instanciate your object; all the properties
should be automagicly editable in the glade-3 tool.

Well, fair enougth. So, if I only provide a glade-mywidgets.so which my
catalog reference (I assume this is the library part of
<glade-catalog name="gtk+" library="gladegtk">) with my widgets then I am home
free on this part. Fine.

I assume that I can inherit and object from another XML file.

Yes, there is a dependancy chain though; in the xml file you can
declare depends="gtk+" and this will ensure that the gtk+ catalog
will be loaded before yours (and then inheritance will work properly).

OK. Good. Sound like a very reasnoble process.

(I seriously need to update glade3/widgets/adding-widgets.txt which
"should" cover all of this)

Please do. It seems that glade-3 is mature enought for me to bother about it
compared to glade-2, so I will be reading things and ask questions to make
things tick. I know that I need to add things which is not standard Gtk widgets
and I want to be able to use Glade as an interface builder for those objects.

I was however forced to checkout the CVS stuff to see it. The latest snap-shot
is as much latest as it maybe should be. 3 months of fine developments later...

I assume that I somehow need to build a library hold the functionality of my
new widgets.

This library typicly will only provide support for non-standard object
behaviour, like if you have objects that parent other object which
are not GtkWidget or GtkContainer; or if you have parameters to implement
that are not implemented via GParamSpec/g_object_install_property.

But any derived widgets needs to be put away in a library anyway, so that
glade-3 can display them, right?

I know I will add new events for instance.

I assume that I can then use this environment to acheive the same kind of
Glade-3 widget compositing as I can do with previously known objects, create a
glade XML file which then libglade is able to execute correctly including my
privately added widgets.

Yes. Released versions of libglade will allow you to:
     - glade_xml_register_widget(), which should also be a one-liner assuming
       your code operates purly with GtkContainer->GtkWidget parenting and
       with introspectable properties.
     - Add "build_widget" and "build_children" and "set_custom_property" support
       to any objects that need any special-casing.

OK. Fine.

If this is within the vision but not quite there, what is missing (i.e. is
there something where I may help out)?

It seems like not all objects are there with all their events. Right?

Most of the Gtk+ objects are implemented, there is still some minor
enhancements to make on that front:
     - Add non-widget objects like GtkAdjustment & GtkSizeGroup
       (underlying framework for this is layed out and thoroughly tested,
        just need to add the special-casing code).
     - Make a toolbar editor (which should be a sinch since we can
       now copy Juan's excelent work on the menubar editor).
     - Possibly make a treeview, icon-view etc. editor(s) supporting
       child TreeViewColumns and thier child renderers... which could
       easily work but would just take some time to write the editors.

OK. Sounds like things is fairly set then.

No other catalogs are implemented ATM (like gnomeui or gnome-db).

OK. I do not intend to use those right now.

Maybe you should look at the possibility to do something similar to "tolua"
which helps create those catalogs. For the Lua environment, it seems like it is
a real little power-horse in providing portings. Just a flimsy idea...

Anyway, my resulting conclusion is that libglade and glade-3 is certainly
giving me the oppertunity to do what I wished to do and it is all there plus
minus some teething. There is still some questions regarding the real hows on
the nitty gritty (documentation should solve this), but it should be capable of
doing it.

Many thanks for answering my questions, now I know it is worth the risc! I'll
go this path.


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