> 
> Isn't the pike module all about generating the code. And  as such
> shouldn't it try to implement the same?
> 
> I have no idea how  hard it is, but isn't it just adding this data to the
> "mixed data" which is  called together with signal_auttoconnect for each
> handler?
> 
> 

The difference in this case is that pike not generating code.  It is using the 
gladexml bindings, which isn't quite the same as the code generated for signals 
in glade.  glade actually goes through all the objects and signals in its xml 
file, and writes out signal connect code using g_signal_connect() for each 
widget.  However, the glade bindings don't give you anyway to do that.  The 
only 
way we would be able to do the same thing would be to load up the xml file 
manually, and parse it for widgets and signals and stuff, like glade does.  
glade only accepts a gobject also, so you can't connect a pike object to it.  
Basically, the User Data field in the glade interface designer is not used in 
pike, only in the bindings that glade provides (c, c++, ada).

I was looking and I can't find a way to get a list of children, though.

> >  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.
> > 
> 
> The goal is not to have data at hand, the  goal was to differentiate
> between the objects sending the  signal.
> 
> Maybe I'm doing something very uncommon in interface design?
> I  have i.e. two buttons, which have the same signal handler, and in the
> signal  handler I want to do two different things based on which of the
> two buttons  is pressed.
> 
> What is normally done here? Do you use different signal  handlers for
> each button, or is there a different way to determine which  button is
> pressed? And what if the buttons are dynamically created, maybe  even
> with the same name?
> 
> (mind I'm very new to GTK  altogether).
> 
> > 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.
> > 
> 
> This would work I think. Then I could add a variable to  the button object.
>

the g_object_set_data/g_object_get_data methods may be the easiest right now.

glade3/gtkbuilder provides the appropriate functionality though.  We should 
implement a glade3 object.  glade3 is able to use the new gtkbuilder functions 
which is provided with gtk2.12 and higher.  It provides 
gtk_builder_get_objects(), which would let me run down the entire list of 
objects and add signal handlers, or gtk_builder_get_object() to get an 
individual widget, so then I would be able to implement something like that in 
pike code (c or pike level).



I will add set_data()/get_data(), and work on some glade3/gtkbuilder bindings.


      

  • 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
                • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum

Reply via email to