Re: GtkBuilder Public API - Last call



Tim Janik wrote:
> On Wed, 13 Jun 2007, Johan Dahlin wrote:
> 
>> 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.
>>>
>>
>> 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>
>>
>>> It definitely makes sense to support GConnectFlags though.
>>
>> I thought there were other flags apart from after and swapped, so this is
>> not true, right?
> 
> there could conceivably be new flags in the future. also,
> "object" is different from "swapped". the former should use
> g_signal_connect_object which needs a GObject argument and
> auto-disconnects the signal handler if the object argument
> is disposed. the later also works for void* pointers.

Oh, I knew I missed something.

Let's use this xml attributes for the signal tag;

  name: signal name
  handler: handler to connect the signal to
  after: optional, boolean if True, set flags to G_CONNECT_AFTER
  swapped: optional, boolean if True, set flags to G_CONNECT_SWAPPED
  object: optional, if set use g_signal_connect_object

user_type and user_data which I proposed doesn't make too much sense, it's
also difficult to support since you can't (AFAICT) use a GValue as user data.

g_signal_connect_object does not provide a way to send in user data so it
conflicts with the user data which may be passed in to
gtk_builder_connect_signals. Not a too big deal I guess, it just needs to be
documented.

Johan



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