[Glade-users] Binding data to widgets?

On Mon, 2004-08-30 at 21:05, Dave Andruczyk wrote:
Is it possible to bind data to a widget with glade in the same manner as using
"g_object_set_data(object,key,value)" in direct C? (using libglade-2.4.4, glade

No, I'm afraid you can't do that within Glade.

I'm trying to make my application
be able to use libglade to load parts of the gui on demand.  This is needed
because the app talks to external hardware (a Fuel injection ECU) and needs to
adapt based on what features are supported in the hardware it's talking to.

The current code uses LOTS of g_object_set_data() calls to bind various data to
the gui elements that is used in the signal handlers, from digging around in
glade I didn't see any easy way to do this. (for the most part I'm binding
numeric values to textual keys. 
 i.e. g_object_set_data(G_OBJECT(spinner),"offset",121);  I'm not trying to
bind pointers or pointers to structures which would be invalid in a glade file,
just simple data that the handler needs in order to handle changes to the
widget's value.

You should be using GINT_TO_POINTER() there, e.g.

  g_object_set_data(G_OBJECT(spinner),"offset",GINT_TO_POINTER (121))

I think you may have problems on 64-bit systems if you don't do that.


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