----- Original Message ----
> From: Marc Dirix <m...@electronics-design.nl>
> To: Lance Dillon <riffraff...@yahoo.com>
> Sent: Fri, September 10, 2010 4:25:37 PM
> Subject: Re: glade signals with user data
> 
> Thank you for your answer.
> 
> I think you miss the point here.
> 
> The  glade, interface designer, has an option "User Data" which should be
> send  along with the signal to the signal handler function. This is
> defined in the  glade xml file as "object=" in the signal directive.
> 
> If I now create two  different buttons with the same signal handler, but
> different "User Data" I  can differentiate between the two buttons.
> 

I see what you are talking about here.  That is something different.  That is 
for when you build a c, c++, or ada project by going to Project->Build.  It 
outputs a bunch of files.  In the src directory there is a file called 
interface.c that has the code for connecting the signal.  If you look in 
interface.c, you will see this in there somewhere:

  g_signal_connect_swapped ((gpointer) Home, "clicked",
                            G_CALLBACK (Change_Location),
                            GTK_OBJECT (Home));


That is the callback.  That is something completely different from 
signal_autoconnect().  That is a pike function that calls 


  
glade_xml_signal_autoconnect_full(GLADE_XML(THIS->obj),pgtk2__signal_connect,&args);


which itself ends up calling pgtk2__signal_connect (in 
GTK2/source/gladexml.pre), which itself calls g_signal-connect_data with the 
pgtk2_signal_func_wrapper (standard pike/GTK2 signal function) with the pike 
callback and the args (the passed in object from signal_autoconnect()).

Since the code is a little different, what I would do would be to create a 
mapping with a bunch of data to be used by multiple callbacks.  Then you can 
say 
match the object with a key in the mapping for data to pass to the signal.

I should add set_data() and get_data() to gobject (in the inheritance tree of 
all the widgets) so we could attach arbitrary data to gtk2 objects.  It could 
be 
used to get around this problem.


For other people who may or may not be paying attention to this thread, what do 
you think about adding the gobject set_data/get_data functions?

http://library.gnome.org/devel/gobject/stable/gobject-The-Base-Object-Type.html#g-object-get-data


      

  • Re:... Lance Dillon
    • ... Marc Dirix
      • ... Lance Dillon
      • ... Martin Bähr
        • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
          • ... Martin Baehr
            • ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum
              • ... Martin Baehr
                • ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum
                • ... Martin Baehr
                • ... Martin Nilsson (Opera Mini - AFK!) @ Pike (-) developers forum

Reply via email to