[gtk+] Spell delete-event with hyphen and don't cast to G_OBJECT



commit 325c86f83c8a5c273a75e9853fd802d78a9d15c7
Author: Christian Dywan <christian twotoasts de>
Date:   Fri Mar 12 21:02:42 2010 +0100

    Spell delete-event with hyphen and don't cast to G_OBJECT

 docs/tutorial/gtk-tut.sgml |   72 ++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml
index eaa66a9..72b5c02 100755
--- a/docs/tutorial/gtk-tut.sgml
+++ b/docs/tutorial/gtk-tut.sgml
@@ -294,7 +294,7 @@ static gboolean delete_event( GtkWidget *widget,
                               GdkEvent  *event,
                               gpointer   data )
 {
-    /* If you return FALSE in the "delete_event" signal handler,
+    /* If you return FALSE in the "delete-event" signal handler,
      * GTK will emit the "destroy" signal. Returning TRUE means
      * you don't want the window to be destroyed.
      * This is useful for popping up 'are you sure you want to quit?'
@@ -303,7 +303,7 @@ static gboolean delete_event( GtkWidget *widget,
     g_print ("delete event occurred\n");
 
     /* Change TRUE to FALSE and the main window will be destroyed with
-     * a "delete_event". */
+     * a "delete-event". */
 
     return TRUE;
 }
@@ -329,18 +329,18 @@ int main( int   argc,
     /* create a new window */
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     
-    /* When the window is given the "delete_event" signal (this is given
+    /* When the window is given the "delete-event" signal (this is given
      * by the window manager, usually by the "close" option, or on the
      * titlebar), we ask it to call the delete_event () function
      * as defined above. The data passed to the callback
      * function is NULL and is ignored in the callback function. */
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
 		      G_CALLBACK (delete_event), NULL);
     
     /* Here we connect the "destroy" event to a signal handler.  
      * This event occurs when we call gtk_widget_destroy() on the window,
-     * or if we return FALSE in the "delete_event" callback. */
-    g_signal_connect (G_OBJECT (window), "destroy",
+     * or if we return FALSE in the "delete-event" callback. */
+    g_signal_connect (window, "destroy",
 		      G_CALLBACK (destroy), NULL);
     
     /* Sets the border width of the window. */
@@ -750,7 +750,7 @@ static void hello( GtkWidget *widget,
 }
 </programlisting>
 
-<para>The next callback is a bit special. The "delete_event" occurs when the
+<para>The next callback is a bit special. The "delete-event" occurs when the
 window manager sends this event to the application. We have a choice
 here as to what to do about these events. We can ignore them, make
 some sort of response, or simply quit the application.</para>
@@ -828,14 +828,14 @@ kill the window, or when we use the gtk_widget_destroy() call passing
 in the window widget as the object to destroy. The second is emitted
 when, in the "delete_event" handler, we return FALSE.
  
-The <literal>G_OBJECT</literal> and <literal>G_CALLBACK</literal> are macros 
-that perform type casting and checking for us, as well as aid the readability of
+The <literal>G_CALLBACK</literal> is a macro
+that performs type casting and checking for us, as well as aid the readability of
 the code.</para>
 
 <programlisting role="C">
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
                       G_CALLBACK (delete_event), NULL);
-    g_signal_connect (G_OBJECT (window), "destroy",
+    g_signal_connect (window, "destroy",
                       G_CALLBACK (destroy), NULL);
 </programlisting>
 
@@ -939,8 +939,8 @@ to emit the "destroy" signal, which is caught, and calls our destroy()
 callback function, which simply exits GTK.</para>
 
 <para>Another course of events is to use the window manager to kill the
-window, which will cause the "delete_event" to be emitted. This will
-call our "delete_event" handler. If we return TRUE here, the window
+window, which will cause the "delete-event" to be emitted. This will
+call our "delete-event" handler. If we return TRUE here, the window
 will be left as is and nothing will happen. Returning FALSE will cause
 GTK to emit the "destroy" signal which of course calls the "destroy"
 callback, exiting GTK.</para>
@@ -1084,7 +1084,7 @@ int main( int   argc,
 
     /* Here we just set a handler for delete_event that immediately
      * exits GTK. */
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
 		      G_CALLBACK (delete_event), NULL);
 
     /* Sets the border width of the window. */
@@ -1381,7 +1381,7 @@ int main( int   argc,
     /* You should always remember to connect the delete_event signal
      * to the main window. This is very important for proper intuitive
      * behavior */
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
 		      G_CALLBACK (delete_event), NULL);
     gtk_container_set_border_width (GTK_CONTAINER (window), 10);
     
@@ -1798,7 +1798,7 @@ int main( int   argc,
 
     /* Set a handler for delete_event that immediately
      * exits GTK. */
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
                       G_CALLBACK (delete_event), NULL);
 
     /* Sets the border width of the window. */
@@ -1840,7 +1840,7 @@ int main( int   argc,
     /* Create "Quit" button */
     button = gtk_button_new_with_label ("Quit");
 
-    /* When the button is clicked, we call the "delete_event" function
+    /* When the button is clicked, we call the "delete-event" function
      * and the program exits */
     g_signal_connect (G_OBJECT (button), "clicked",
                       G_CALLBACK (delete_event), NULL);
@@ -2187,10 +2187,10 @@ int main( int   argc,
     gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!");
 
     /* It's a good idea to do this for all windows. */
-    g_signal_connect (G_OBJECT (window), "destroy",
+    g_signal_connect (window, "destroy",
 	              G_CALLBACK (gtk_main_quit), NULL);
 
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
 	 	      G_CALLBACK (gtk_main_quit), NULL);
 
     /* Sets the border width of the window. */
@@ -2475,7 +2475,7 @@ int main( int   argc,
       
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
 		      G_CALLBACK (close_application),
                       NULL);
 
@@ -3157,7 +3157,7 @@ static void create_range_controls( void )
 
     /* Standard window-creating stuff */
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-    g_signal_connect (G_OBJECT (window), "destroy",
+    g_signal_connect (window, "destroy",
                       G_CALLBACK (gtk_main_quit),
                       NULL);
     gtk_window_set_title (GTK_WINDOW (window), "range controls");
@@ -3361,9 +3361,9 @@ int main( int   argc,
 </programlisting>
 
 <para>You will notice that the program does not call g_signal_connect()
-for the "delete_event", but only for the "destroy" signal. This will
+for the "delete-event", but only for the "destroy" signal. This will
 still perform the desired function, because an unhandled
-"delete_event" will result in a "destroy" signal being given to the
+"delete-event" will result in a "destroy" signal being given to the
 window.</para>
 
 </sect1>
@@ -3493,7 +3493,7 @@ int main( int   argc,
   gtk_init (&amp;argc, &amp;argv);
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  g_signal_connect (G_OBJECT (window), "destroy",
+  g_signal_connect (window, "destroy",
 		    G_CALLBACK (gtk_main_quit),
 		    NULL);
 
@@ -3675,7 +3675,7 @@ int main( int   argc,
   gtk_window_set_title (GTK_WINDOW (window), "Arrow Buttons");
 
   /* It's a good idea to do this for all windows. */
-  g_signal_connect (G_OBJECT (window), "destroy",
+  g_signal_connect (window, "destroy",
                     G_CALLBACK (gtk_main_quit), NULL);
 
   /* Sets the border width of the window. */
@@ -4005,7 +4005,7 @@ int main( int   argc,
     pdata-&gt;window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     gtk_window_set_resizable (GTK_WINDOW (pdata-&gt;window), TRUE);
 
-    g_signal_connect (G_OBJECT (pdata-&gt;window), "destroy",
+    g_signal_connect (pdata-&gt;window, "destroy",
 	              G_CALLBACK (destroy_progress),
                       (gpointer) pdata);
     gtk_window_set_title (GTK_WINDOW (pdata-&gt;window), "GtkProgressBar");
@@ -4306,7 +4306,7 @@ int main( int   argc,
     gtk_init (&amp;argc, &amp;argv);
 
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
                       G_CALLBACK (close_application), NULL);
     gtk_container_set_border_width (GTK_CONTAINER (window), 10);
 
@@ -4478,7 +4478,7 @@ int main( int   argc,
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
     gtk_window_set_title (GTK_WINDOW (window), "GTK Statusbar Example");
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
                       G_CALLBACK (exit), NULL);
  
     vbox = gtk_vbox_new (FALSE, 1);
@@ -4648,9 +4648,9 @@ int main( int   argc,
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
     gtk_window_set_title (GTK_WINDOW (window), "GTK Entry");
-    g_signal_connect (G_OBJECT (window), "destroy",
+    g_signal_connect (window, "destroy",
                       G_CALLBACK (gtk_main_quit), NULL);
-    g_signal_connect_swapped (G_OBJECT (window), "delete_event",
+    g_signal_connect_swapped (window, "delete-event",
                               G_CALLBACK (gtk_widget_destroy), 
                               G_OBJECT (window));
 
@@ -5004,7 +5004,7 @@ int main( int   argc,
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 
-  g_signal_connect (G_OBJECT (window), "destroy",
+  g_signal_connect (window, "destroy",
 		    G_CALLBACK (gtk_main_quit),
 		    NULL);
 
@@ -6138,8 +6138,8 @@ gint main( gint   argc,
 
   /* Attach to the "delete" and "destroy" events so we can exit */
 
-  g_signal_connect (GTK_OBJECT (window), "delete_event",
-                    GTK_SIGNAL_FUNC (destroy_window), (gpointer) window);
+  g_signal_connect (window, "delete-event",
+                    G_CALLBACK (destroy_window), (gpointer) window);
   
   /* Create drawingarea, set size and catch button events */
 
@@ -7605,7 +7605,7 @@ int main (int argc, char *argv[])
   GTK_WINDOW (dialog)->allow_shrink = TRUE;
 
   /* typically we quit if someone tries to close us */
-  g_signal_connect (G_OBJECT (dialog), "delete_event",
+  g_signal_connect (dialog, "delete-event",
                     G_CALLBACK (delete_event), NULL);
 
   /* we need to realize the window because we use pixmaps for 
@@ -8056,7 +8056,7 @@ int main( int argc,
     
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
 	              G_CALLBACK (delete), NULL);
     
     gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -8455,7 +8455,7 @@ int main( int   argc,
     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
     gtk_window_set_title (GTK_WINDOW (window), "GTK Menu Test");
-    g_signal_connect (G_OBJECT (window), "delete_event",
+    g_signal_connect (window, "delete-event",
                       G_CALLBACK (gtk_main_quit), NULL);
 
     /* Init the menu-widget, and remember -- never



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