diff options
author | Sven Neumann <sven@gimp.org> | 2008-08-11 18:36:07 +0000 |
---|---|---|
committer | Sven Neumann <neo@src.gnome.org> | 2008-08-11 18:36:07 +0000 |
commit | 82f6ccd79cc9c6c1d032a620649c1a0b500943eb (patch) | |
tree | a7fe470d84196b53139ee2d9d8f4bef6c352edcc /examples/selection | |
parent | e3e126ae9eb9f860f2b99157d18cb3d6428add78 (diff) | |
download | gtk+-82f6ccd79cc9c6c1d032a620649c1a0b500943eb.tar.gz |
updated the (quite outdated) examples to use canonical signal names as
2008-08-11 Sven Neumann <sven@gimp.org>
* examples/*: updated the (quite outdated) examples to use
canonical signal names as well. Removed some unneeded casts and
trailing whitespace while I was on it...
svn path=/trunk/; revision=21071
Diffstat (limited to 'examples/selection')
-rw-r--r-- | examples/selection/gettargets.c | 22 | ||||
-rw-r--r-- | examples/selection/setselection.c | 24 |
2 files changed, 23 insertions, 23 deletions
diff --git a/examples/selection/gettargets.c b/examples/selection/gettargets.c index 388664553b..9b4aca4d7f 100644 --- a/examples/selection/gettargets.c +++ b/examples/selection/gettargets.c @@ -2,8 +2,8 @@ #include <stdlib.h> #include <gtk/gtk.h> -static void selection_received( GtkWidget *widget, - GtkSelectionData *selection_data, +static void selection_received( GtkWidget *widget, + GtkSelectionData *selection_data, gpointer data ); /* Signal handler invoked when user clicks on the "Get Targets" button */ @@ -11,7 +11,7 @@ static void get_targets( GtkWidget *widget, gpointer data ) { static GdkAtom targets_atom = GDK_NONE; - GtkWidget *window = (GtkWidget *)data; + GtkWidget *window = (GtkWidget *)data; /* Get the atom corresponding to the string "TARGETS" */ if (targets_atom == GDK_NONE) @@ -24,7 +24,7 @@ static void get_targets( GtkWidget *widget, /* Signal handler called when the selections owner returns the data */ static void selection_received( GtkWidget *widget, - GtkSelectionData *selection_data, + GtkSelectionData *selection_data, gpointer data ) { GdkAtom *atoms; @@ -43,7 +43,7 @@ static void selection_received( GtkWidget *widget, g_print ("Selection \"TARGETS\" was not returned as atoms!\n"); return; } - + /* Print out the atoms we received */ atoms = (GdkAtom *)selection_data->data; @@ -66,7 +66,7 @@ int main( int argc, { GtkWidget *window; GtkWidget *button; - + gtk_init (&argc, &argv); /* Create the toplevel window */ @@ -75,7 +75,7 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - g_signal_connect (G_OBJECT (window), "destroy", + g_signal_connect (window, "destroy", G_CALLBACK (exit), NULL); /* Create a button the user can click to get targets */ @@ -83,15 +83,15 @@ int main( int argc, button = gtk_button_new_with_label ("Get Targets"); gtk_container_add (GTK_CONTAINER (window), button); - g_signal_connect (G_OBJECT (button), "clicked", + g_signal_connect (button, "clicked", G_CALLBACK (get_targets), (gpointer) window); - g_signal_connect (G_OBJECT (window), "selection_received", + g_signal_connect (window, "selection-received", G_CALLBACK (selection_received), NULL); gtk_widget_show (button); gtk_widget_show (window); - + gtk_main (); - + return 0; } diff --git a/examples/selection/setselection.c b/examples/selection/setselection.c index 8ecf96c42a..1e22c4eea1 100644 --- a/examples/selection/setselection.c +++ b/examples/selection/setselection.c @@ -47,7 +47,7 @@ static gboolean selection_clear( GtkWidget *widget, } /* Supplies the current time as the selection. */ -static void selection_handle( GtkWidget *widget, +static void selection_handle( GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint time_stamp, @@ -57,7 +57,7 @@ static void selection_handle( GtkWidget *widget, time_t current_time; current_time = time (NULL); - timestr = asctime (localtime (¤t_time)); + timestr = asctime (localtime (¤t_time)); /* When we return a single string, it should not be null terminated. That will be done for us */ @@ -71,7 +71,7 @@ int main( int argc, GtkWidget *window; static int have_selection = FALSE; - + gtk_init (&argc, &argv); /* Create the toplevel window */ @@ -80,7 +80,7 @@ int main( int argc, gtk_window_set_title (GTK_WINDOW (window), "Event Box"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); - g_signal_connect (G_OBJECT (window), "destroy", + g_signal_connect (window, "destroy", G_CALLBACK (exit), NULL); /* Create a toggle button to act as the selection */ @@ -90,22 +90,22 @@ int main( int argc, gtk_container_add (GTK_CONTAINER (window), selection_button); gtk_widget_show (selection_button); - g_signal_connect (G_OBJECT (selection_button), "toggled", - G_CALLBACK (selection_toggled), (gpointer) &have_selection); - g_signal_connect (G_OBJECT (selection_widget), "selection_clear_event", - G_CALLBACK (selection_clear), (gpointer) &have_selection); + g_signal_connect (selection_button, "toggled", + G_CALLBACK (selection_toggled), &have_selection); + g_signal_connect (selection_widget, "selection-clear-event", + G_CALLBACK (selection_clear), &have_selection); gtk_selection_add_target (selection_widget, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1); - g_signal_connect (G_OBJECT (selection_widget), "selection_get", - G_CALLBACK (selection_handle), (gpointer) &have_selection); + g_signal_connect (selection_widget, "selection-get", + G_CALLBACK (selection_handle), &have_selection); gtk_widget_show (selection_button); gtk_widget_show (window); - + gtk_main (); - + return 0; } |