From 081dc24869d3d847ee448b1552c120e2f516637d Mon Sep 17 00:00:00 2001 From: Brandon Lewis Date: Wed, 4 Aug 2010 17:27:01 +0200 Subject: [PATCH] implement the stop button --- tests/examples/ges-ui.c | 19 +++++++++++++++++-- tests/examples/ges-ui.glade | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/examples/ges-ui.c b/tests/examples/ges-ui.c index 84f8200208..4b86615243 100644 --- a/tests/examples/ges-ui.c +++ b/tests/examples/ges-ui.c @@ -93,6 +93,7 @@ void window_destroy_cb (GtkObject * window, 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); +void stop_activate_cb (GtkAction * item, App * app); void add_file_activate_cb (GtkAction * item, App * app); void add_text_activate_cb (GtkAction * item, App * app); void add_test_activate_cb (GtkAction * item, App * app); @@ -719,7 +720,7 @@ static void selection_foreach (GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, gpointer user); static void -app_toggle_playback (App * app) +app_toggle_playpause (App * app) { if (app->state != GST_STATE_PLAYING) { gst_element_set_state (GST_ELEMENT (app->pipeline), GST_STATE_PLAYING); @@ -728,6 +729,14 @@ app_toggle_playback (App * app) } } +static void +app_stop_playback (App * app) +{ + if ((app->state != GST_STATE_NULL) && (app->state != GST_STATE_READY)) { + gst_element_set_state (GST_ELEMENT (app->pipeline), GST_STATE_READY); + } +} + typedef struct { GList *objects; @@ -987,7 +996,13 @@ add_transition_activate_cb (GtkAction * item, App * app) void play_activate_cb (GtkAction * item, App * app) { - app_toggle_playback (app); + app_toggle_playpause (app); +} + +void +stop_activate_cb (GtkAction * item, App * app) +{ + app_stop_playback (app); } void diff --git a/tests/examples/ges-ui.glade b/tests/examples/ges-ui.glade index f7745372f5..18f802e035 100644 --- a/tests/examples/ges-ui.glade +++ b/tests/examples/ges-ui.glade @@ -859,5 +859,6 @@ Stop Stop gtk-media-stop +