From: Brandon Lewis Date: Fri, 8 Oct 2010 11:32:15 +0000 (+0100) Subject: ges-ui: add new command, remove quit command (closing last window quits app) X-Git-Tag: 1.19.3~493^2~2531 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4f315274c50819a83363ef00594130186ac0bdd;p=platform%2Fupstream%2Fgstreamer.git ges-ui: add new command, remove quit command (closing last window quits app) --- diff --git a/tests/examples/ges-ui.c b/tests/examples/ges-ui.c index d0eec48..466c388 100644 --- a/tests/examples/ges-ui.c +++ b/tests/examples/ges-ui.c @@ -87,13 +87,16 @@ typedef struct App GtkSpinButton *frequency; } App; +static int n_instances = 0; + /* Prototypes for auto-connected signal handlers ***************************/ /** * These are declared non-static for signal auto-connection */ -gboolean window_delete_event_cb (GtkObject * window, App * app); +gboolean window_delete_event_cb (GtkObject * window, GdkEvent * event, + App * app); void quit_item_activate_cb (GtkMenuItem * item, App * app); void delete_activate_cb (GtkAction * item, App * app); void play_activate_cb (GtkAction * item, App * app); @@ -999,6 +1002,12 @@ app_dispose (App * app) g_free (app); } + + n_instances--; + + if (n_instances == 0) { + gtk_main_quit (); + } } static App * @@ -1006,6 +1015,7 @@ app_new (void) { App *ret; ret = g_new0 (App, 1); + n_instances++; ret->selected_type = G_TYPE_NONE; @@ -1040,10 +1050,10 @@ fail: /* UI callbacks ************************************************************/ gboolean -window_delete_event_cb (GtkObject * window, App * app) +window_delete_event_cb (GtkObject * window, GdkEvent * event, App * app) { - gtk_main_quit (); - return TRUE; + app_dispose (app); + return FALSE; } void @@ -1283,7 +1293,6 @@ main (int argc, char *argv[]) if ((app = app_new ())) { gtk_main (); - app_dispose (app); } return 0; diff --git a/tests/examples/ges-ui.glade b/tests/examples/ges-ui.glade index bd5431e..9f536a4 100644 --- a/tests/examples/ges-ui.glade +++ b/tests/examples/ges-ui.glade @@ -60,7 +60,9 @@ gtk-new True + True True + @@ -84,20 +86,6 @@ True - - - True - - - - - gtk-quit - True - True - True - - -