Re: GtkBuilder Public API - Last call



Christian Persch wrote:
> Hi;
> 
> Le mercredi 13 juin 2007 �0:01 -0300, Johan Dahlin a �it :
>> Johan Dahlin wrote:
>>> Christian Persch wrote:
>>>> Hi;
>>>>
>>>>> typedef void (*GtkBuilderConnectFunc) (GtkBuilder  *builder,
>>>>>                                        const gchar *handler_name,
>>>>>                                        GObject     *object,
>>>>>                                        const gchar *signal_name,
>>>>>                                        GObject     *connect_object,
>>>>>                                        gboolean     after,
>>>>>                                        gpointer     user_data);
>>>> Could we have "GConnectFlags flags" instead of "gboolean after" here, so
>>>> this could also support swapped handlers in future?
>>> This was copied more or less directly from libglade, there's a certain
>>> advantage of making this compatible with the existing code.
>>>
> 
> I think I misunderstood the API. I thought |user_data| in
> gtk_builder_connect_signals_full was the data that the signal handlers
> get connected to, but it actually is the data that's passed to the
> GtkBuilderConnectFunc function (and the signal handler data is always
> NULL with the default builder func, unless it's a connect_object). That
> probably makes a destroy notify unnecessary.
> 
> The API has no equivalent to glade_xml_signal_connect_data, so one needs
> to implement that oneself with a custom connect function?

Right, I didn't add these.
Is there are reason to prefer glade_xml_signal_connect[data] to the
connect_signals() api? Assuming we add a user data argument to
connect_signals, see separate discussion.

>> Well, actually swapped handlers are supported, using the object attribute, eg:
>>
>>   <object class="GtkButton" id="button"/>
>>   <object class="GtkEntry" id="entry">
>>     <signal name="activate" handler="button_clicked" object="button"/>
>>   </object>
> 
> The default builder func uses SWAPPED for this case, yes (why?). I don't
> see why every builder func would do the same though, so a way to hint
> that from the XML would needed.

It uses swapped because you specified an object you want to connect the
signal to, if you remove the object it'll connect without using swapped.

Johan



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