Re: GtkBuilder and callbacks.



I used a structure like you before I realized, that I can register the
callbacks inside my Builder file. This is nice. I can add a object
property to pass an ID to the callback. But what if I need more then one
id passed to the callback. Is there an easy way to do this inside the
xml file?

thanks.

Am Freitag, den 22.01.2010, 21:07 +0100 schrieb Tadej Borovšak:
> Hello.
> 
> > I'm usong GtkBuilder, to set up my interface. My callbacks are all
take
> > the GtkBuilder as argument. This way, I can access all elements
inside
> > the callback, with gtk_builder_get_object.
> >
> > What do you think about this? Is this a good design? Or do you see
any
> > problems? And if so, what do you do?
> 
> I usually define one large global data storage (usually struct) that
> is passed as a data parameter to signal connection. This structure
> holds information that needs to accessed from callbacks. Part of this
> data are also widget pointers that are retrieved from builder at init
> phase of application.
> 
> This way, builder is not needed anymore, so I usually destroy it after
> all the pointers I need were retrieved and signals connected.
> 
> > And is it possible to add/remove objects to/from a gtkBuilder
directly?
> 
> Object can be added to builder only by passing it XML with UI
> description (XML can come from file or from string). You cannot "push"
> one of your manually constructed widgets onto builder. What you can do
> is to add widgets to the GUI that builder created (for example, you
> can pack more widgets into vertical box, created by builder). This is
> useful if you want to pack pack a custom widget inside your GUI but
> don't have Glade catalog for it.
> 
> Tadej
> 





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