implement the stop button

This commit is contained in:
Brandon Lewis 2010-08-04 17:27:01 +02:00 committed by Edward Hervey
parent c94b446766
commit 081dc24869
2 changed files with 18 additions and 2 deletions

View file

@ -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

View file

@ -859,5 +859,6 @@
<property name="label">Stop</property>
<property name="short_label">Stop</property>
<property name="stock_id">gtk-media-stop</property>
<signal name="activate" handler="stop_activate_cb"/>
</object>
</interface>