Tutorial error in 2.5 - explanation



The tutorial states this:
--------
Because the gtk_widget_destroy() function accepts only a GtkWidget *widget
as an argument, we use the g_signal_connect_swapped() function here instead
of straight g_signal_connect().
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
                              G_CALLBACK (gtk_widget_destroy),
                              G_OBJECT (window));
-------------
However, the actual code in 2.1 is as such:
    /* This will cause the window to be destroyed by calling
     * gtk_widget_destroy(window) when "clicked".  Again, the destroy
     * signal could come from here, or the window manager. */
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
         G_CALLBACK (gtk_widget_destroy),
                              window);
--------------------------
I've successfully compiled it as shown in section 2.1, but section 2.5 does
a G_OBJECT casting of (window) which I'm not sure is necessary.  Could
someone please clear up this difference between the explanation and the
actual code?

Rich G




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