[gtkglarea/jjardon/gtk3: 8/9] examples/*: Do not use deprecated gtk_signal_* api
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkglarea/jjardon/gtk3: 8/9] examples/*: Do not use deprecated gtk_signal_* api
- Date: Thu, 20 Mar 2014 02:41:41 +0000 (UTC)
commit 7b245cc5051f2cce71d4ef000b0c3d079be1b936
Author: Javier Jardón <jjardon gnome org>
Date: Thu Mar 20 02:16:43 2014 +0000
examples/*: Do not use deprecated gtk_signal_* api
Its replaced by g_signal_*
docs/HOWTO.txt | 2 +-
examples/gtkglarea_demo.c | 40 ++++++++++++++++++++--------------------
examples/shaders.c | 28 ++++++++++++++--------------
examples/simple.c | 16 ++++++++--------
examples/zktor.c | 29 +++++++++++++++--------------
5 files changed, 58 insertions(+), 57 deletions(-)
---
diff --git a/docs/HOWTO.txt b/docs/HOWTO.txt
index e5d1d8e..d2bf3c2 100644
--- a/docs/HOWTO.txt
+++ b/docs/HOWTO.txt
@@ -76,4 +76,4 @@
- Prevent possible default handlers from running:
/* do this in the keypress handler and return TRUE from handler */
- gtk_signal_emit_stop_by_name(GTK_OBJECT(glarea), "key_press_event");
+ g_signal_stop_emission_by_name(GTK_OBJECT(glarea), "key-press-event");
diff --git a/examples/gtkglarea_demo.c b/examples/gtkglarea_demo.c
index cbd4f1b..6f146bd 100644
--- a/examples/gtkglarea_demo.c
+++ b/examples/gtkglarea_demo.c
@@ -137,46 +137,46 @@ GtkWidget* create_glarea (void) {
/* button_release_event - The user has released one of the */
/* mouse buttons in the window. */
- gtk_signal_connect (GTK_OBJECT(glarea), "button_release_event",
- GTK_SIGNAL_FUNC(glarea_button_release), NULL);
+ g_signal_connect (G_OBJECT(glarea), "button-release-event",
+ G_CALLBACK(glarea_button_release), NULL);
/* button_press_event - The user has pressed one of the */
/* mouse buttons in the window. */
- gtk_signal_connect (GTK_OBJECT(glarea), "button_press_event",
- GTK_SIGNAL_FUNC(glarea_button_press), NULL);
+ g_signal_connect (G_OBJECT(glarea), "button-press-event",
+ G_CALLBACK(glarea_button_press), NULL);
/* motion_notify_event - The mouse is moving in the window. */
- gtk_signal_connect (GTK_OBJECT(glarea), "motion_notify_event",
- GTK_SIGNAL_FUNC(glarea_motion_notify), NULL);
+ g_signal_connect (G_OBJECT(glarea), "motion-notify-event",
+ G_CALLBACK(glarea_motion_notify), NULL);
/* expose_event - The window was exposed and the contents */
/* need to be redrawn. */
- gtk_signal_connect (GTK_OBJECT(glarea), "expose_event",
- GTK_SIGNAL_FUNC(glarea_draw), NULL);
+ g_signal_connect (G_OBJECT(glarea), "expose-event",
+ G_CALLBACK(glarea_draw), NULL);
/* configure_event - The window has been resized. You will */
/* probably want to call your reshape */
/* function here. */
- gtk_signal_connect (GTK_OBJECT(glarea), "configure_event",
- GTK_SIGNAL_FUNC(glarea_reshape), NULL);
+ g_signal_connect (G_OBJECT(glarea), "configure-event",
+ G_CALLBACK(glarea_reshape), NULL);
/* realize - The window has been created, this is where you */
/* can hook up your initialization routines. */
- gtk_signal_connect (GTK_OBJECT(glarea), "realize",
- GTK_SIGNAL_FUNC(glarea_init), NULL);
+ g_signal_connect (G_OBJECT(glarea), "realize",
+ G_CALLBACK(glarea_init), NULL);
/* destroy - The window has received a destroy event, this */
/* is where you should do any cleanup that needs */
/* to happen, such as de-allocating data objects */
/* that you have added to your GtkGLArea. */
- gtk_signal_connect (GTK_OBJECT(glarea), "destroy",
- GTK_SIGNAL_FUNC (glarea_destroy), NULL);
+ g_signal_connect (G_OBJECT(glarea), "destroy",
+ G_CALLBACK (glarea_destroy), NULL);
gtk_widget_set_usize(GTK_WIDGET(glarea), 256, 256);
@@ -458,8 +458,8 @@ int main (int argc, char** argv) {
button_quit = gtk_button_new_with_label ("Quit");
- gtk_signal_connect (GTK_OBJECT(button_quit), "clicked",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect (G_OBJECT(button_quit), "clicked",
+ G_CALLBACK(gtk_main_quit), NULL);
/* Main window */
@@ -471,11 +471,11 @@ int main (int argc, char** argv) {
gtk_quit_add_destroy (1, GTK_OBJECT(window));
- gtk_signal_connect (GTK_OBJECT(window), "delete_event",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect (G_OBJECT(window), "delete-event",
+ G_CALLBACK(gtk_main_quit), NULL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK(gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER(window), 10);
diff --git a/examples/shaders.c b/examples/shaders.c
index d6047b4..6101016 100644
--- a/examples/shaders.c
+++ b/examples/shaders.c
@@ -245,17 +245,17 @@ GtkWidget* create_glarea (void) {
gtk_widget_set_events(GTK_WIDGET(glarea), GDK_EXPOSURE_MASK);
- gtk_signal_connect (GTK_OBJECT(glarea), "expose_event",
- GTK_SIGNAL_FUNC(glarea_draw), NULL);
+ g_signal_connect (G_OBJECT(glarea), "expose-event",
+ G_CALLBACK(glarea_draw), NULL);
- gtk_signal_connect (GTK_OBJECT(glarea), "configure_event",
- GTK_SIGNAL_FUNC(glarea_reshape), NULL);
+ g_signal_connect (G_OBJECT(glarea), "configure-event",
+ G_CALLBACK(glarea_reshape), NULL);
- gtk_signal_connect (GTK_OBJECT(glarea), "realize",
- GTK_SIGNAL_FUNC(glarea_init), NULL);
+ g_signal_connect (G_OBJECT(glarea), "realize",
+ G_CALLBACK(glarea_init), NULL);
- gtk_signal_connect (GTK_OBJECT(glarea), "destroy",
- GTK_SIGNAL_FUNC (glarea_destroy), NULL);
+ g_signal_connect (G_OBJECT(glarea), "destroy",
+ G_CALLBACK(glarea_destroy), NULL);
gtk_widget_set_usize(GTK_WIDGET(glarea), 256, 256);
@@ -436,8 +436,8 @@ int main (int argc, char** argv) {
button_quit = gtk_button_new_with_label ("Quit");
- gtk_signal_connect (GTK_OBJECT(button_quit), "clicked",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect (G_OBJECT(button_quit), "clicked",
+ G_CALLBACK(gtk_main_quit), NULL);
/* Main window */
@@ -449,11 +449,11 @@ int main (int argc, char** argv) {
gtk_quit_add_destroy (1, GTK_OBJECT(window));
- gtk_signal_connect (GTK_OBJECT(window), "delete_event",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect (G_OBJECT(window), "delete-event",
+ G_CALLBACK(gtk_main_quit), NULL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK(gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER(window), 10);
diff --git a/examples/simple.c b/examples/simple.c
index 49833fe..70dfd23 100644
--- a/examples/simple.c
+++ b/examples/simple.c
@@ -118,8 +118,8 @@ int main(int argc, char **argv)
gtk_container_set_border_width(GTK_CONTAINER(window), 10);
/* Quit form main if got delete event */
- gtk_signal_connect(GTK_OBJECT(window), "delete_event",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect(G_OBJECT(window), "delete-event",
+ G_CALLBACK(gtk_main_quit), NULL);
/* You should always delete gtk_gl_area widgets before exit or else
@@ -142,14 +142,14 @@ int main(int argc, char **argv)
/* Connect signal handlers */
/* Redraw image when exposed. */
- gtk_signal_connect(GTK_OBJECT(glarea), "expose_event",
- GTK_SIGNAL_FUNC(draw), NULL);
+ g_signal_connect(G_OBJECT(glarea), "expose-event",
+ G_CALLBACK(draw), NULL);
/* When window is resized viewport needs to be resized also. */
- gtk_signal_connect(GTK_OBJECT(glarea), "configure_event",
- GTK_SIGNAL_FUNC(reshape), NULL);
+ g_signal_connect(G_OBJECT(glarea), "configure-event",
+ G_CALLBACK(reshape), NULL);
/* Do initialization when widget has been realized. */
- gtk_signal_connect(GTK_OBJECT(glarea), "realize",
- GTK_SIGNAL_FUNC(init), NULL);
+ g_signal_connect(G_OBJECT(glarea), "realize",
+ G_CALLBACK(init), NULL);
/* set minimum size */
gtk_widget_set_usize(GTK_WIDGET(glarea), 100,100);
diff --git a/examples/zktor.c b/examples/zktor.c
index cba8d69..4430fff 100644
--- a/examples/zktor.c
+++ b/examples/zktor.c
@@ -825,7 +825,8 @@ gint key_press_event(GtkWidget *widget, GdkEventKey *event)
break;
}
/* prevent the default handler from being run */
- gtk_signal_emit_stop_by_name(GTK_OBJECT(widget),"key_press_event");
+ g_signal_stop_emission_by_name(G_OBJECT(widget),"key-press-event");
+
return TRUE;
}
@@ -847,7 +848,7 @@ gint key_release_event(GtkWidget *widget, GdkEventKey *event)
break;
}
/* prevent the default handler from being run */
- gtk_signal_emit_stop_by_name(GTK_OBJECT(widget),"key_release_event");
+ g_signal_stop_emission_by_name(G_OBJECT(widget),"key-release-event");
return TRUE;
}
@@ -897,8 +898,8 @@ int main(int argc, char **argv)
gtk_window_set_title(GTK_WINDOW(window), "Zktor");
/* Quit form main if got delete event */
- gtk_signal_connect(GTK_OBJECT(window), "delete_event",
- GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+ g_signal_connect(G_OBJECT(window), "delete-event",
+ G_CALLBACK(gtk_main_quit), NULL);
/* You should always delete gtk_gl_area widgets before exit or else
@@ -934,19 +935,19 @@ int main(int argc, char **argv)
/* Connect signal handlers */
/* Redraw image when exposed. */
- gtk_signal_connect(GTK_OBJECT(glarea), "expose_event",
- GTK_SIGNAL_FUNC(draw), NULL);
+ g_signal_connect(G_OBJECT(glarea), "expose-event",
+ G_CALLBACK(draw), NULL);
/* When window is resized viewport needs to be resized also. */
- gtk_signal_connect(GTK_OBJECT(glarea), "configure_event",
- GTK_SIGNAL_FUNC(reshape), NULL);
+ g_signal_connect(G_OBJECT(glarea), "configure-event",
+ G_CALLBACK(reshape), NULL);
/* Do initialization when widget has been realized. */
- gtk_signal_connect(GTK_OBJECT(glarea), "realize",
- GTK_SIGNAL_FUNC(init), NULL);
+ g_signal_connect(G_OBJECT(glarea), "realize",
+ G_CALLBACK(init), NULL);
/* Capture keypress events */
- gtk_signal_connect(GTK_OBJECT(glarea), "key_press_event",
- GTK_SIGNAL_FUNC(key_press_event), NULL);
- gtk_signal_connect(GTK_OBJECT(glarea), "key_release_event",
- GTK_SIGNAL_FUNC(key_release_event), NULL);
+ g_signal_connect(G_OBJECT(glarea), "key-press-event",
+ G_CALLBACK(key_press_event), NULL);
+ g_signal_connect(GTK_OBJECT(glarea), "key-release-event",
+ G_CALLBACK(key_release_event), NULL);
/* construct widget hierarchy */
gtk_container_add(GTK_CONTAINER(window),GTK_WIDGET(vbox));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]