Re: GtkBuilder Public API - Last call



On Wed, 2007-06-13 at 10:48 -0400, Tristan Van Berkom wrote:

>   <object class="GtkEntry" id="entry">
>     <signal name="activate" handler="button_clicked" swapped="True"/>  
>  </object>

Why should "swapped" be a property of the xml ? it looks closely tied to
the code, to me, and should not be specified in the XML file, but set
while actually connecting the widget.

A (bad, but demonstrative enough) example:

  g_signal_connect_swapped (window->close_button, "clicked",
                            G_CALLBACK (gtk_widget_destroy), window);

vs

  void close_button_clicked (GtkButton *button, GtkWidget *window)
  {
    g_print ("close button clicked !\n");
    gtk_widget_destroy (window);
  }

  g_signal_connect (window->close_button, "clicked",
                    G_CALLBACK (close_button_clicked), window);

This shows that it's really an implementation detail that shouldn't
appear in the XML. It would be error prone and would require to edit
the interface when the implementation change (thus breaking the "VC"
separation, and, more importantly, would be unhandy).

So I second Christian Persch's suggestion of using CONNECT_SWAPPED and
Tristan's one of dropping the "connect_object" convention as well.




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