diff options
author | Luciana Fujii Pontello <luciana@fujii.eti.br> | 2011-04-15 20:37:21 -0300 |
---|---|---|
committer | Luciana Fujii Pontello <luciana@fujii.eti.br> | 2011-04-19 14:53:54 -0300 |
commit | 744a58757cc7fb36281c67b736d0194ff8981f66 (patch) | |
tree | 926a621f9484985f3807d1104841f988c90f3338 /tests | |
parent | 9151f56c7a15fe03e4bf6e7e7e9cce0c9fd6bce1 (diff) |
cheese-test-flash: Quit when window is closed
When the window was closed, cheese-test-flash would continue to run. Now
the test quits when the window is closed.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cheese-test-flash.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/cheese-test-flash.c b/tests/cheese-test-flash.c index 40aeda24..1fde9392 100644 --- a/tests/cheese-test-flash.c +++ b/tests/cheese-test-flash.c @@ -1,6 +1,16 @@ #include <gtk/gtk.h> #include "cheese-flash.h" +static gboolean +delete_callback (GtkWidget *window, + GdkEvent *event, + gpointer data) +{ + gtk_widget_destroy (window); + gtk_main_quit (); + return FALSE; +} + static void button_clicked (GtkButton *button, CheeseFlash *flash) @@ -16,6 +26,8 @@ int main (int argc, char **argv) gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + g_signal_connect (G_OBJECT (window), "delete-event", + G_CALLBACK (delete_callback), NULL); flash = cheese_flash_new (window); button = gtk_button_new_with_label ("Fire flash"); g_signal_connect (G_OBJECT (button), "clicked", |