Commit 6e03fd3f authored by Bastien Nocera's avatar Bastien Nocera

main: Add a useful totem_object_stop() API

Which behaves like the Stop button on a CD player.
parent a134dd05
......@@ -10,6 +10,7 @@ totem_object_show_error
totem_object_exit
totem_object_play
totem_object_play_pause
totem_object_stop
totem_object_seek_next
totem_object_seek_previous
totem_object_remote_get_setting
......
......@@ -1573,6 +1573,30 @@ totem_object_play_pause (TotemObject *totem)
}
}
/**
* totem_object_stop:
* @totem: a #TotemObject
*
* Stops playback, and sets the playlist back at the start.
*/
void
totem_object_stop (TotemObject *totem)
{
char *mrl, *subtitle;
totem_playlist_set_at_start (totem->playlist);
update_buttons (totem);
bacon_video_widget_stop (totem->bvw);
play_pause_set_label (totem, STATE_STOPPED);
mrl = totem_playlist_get_current_mrl (totem->playlist, &subtitle);
if (mrl != NULL) {
totem_object_set_mrl (totem, mrl, subtitle);
bacon_video_widget_pause (totem->bvw);
g_free (mrl);
g_free (subtitle);
}
}
/**
* totem_object_pause:
* @totem: a #TotemObject
......@@ -2807,22 +2831,9 @@ totem_object_remote_command (TotemObject *totem, TotemRemoteCommand cmd, const c
case TOTEM_REMOTE_COMMAND_PAUSE:
totem_object_pause (totem);
break;
case TOTEM_REMOTE_COMMAND_STOP: {
char *mrl, *subtitle;
totem_playlist_set_at_start (totem->playlist);
update_buttons (totem);
bacon_video_widget_stop (totem->bvw);
play_pause_set_label (totem, STATE_STOPPED);
mrl = totem_playlist_get_current_mrl (totem->playlist, &subtitle);
if (mrl != NULL) {
totem_object_set_mrl (totem, mrl, subtitle);
bacon_video_widget_pause (totem->bvw);
g_free (mrl);
g_free (subtitle);
}
case TOTEM_REMOTE_COMMAND_STOP:
totem_object_stop (totem);
break;
};
case TOTEM_REMOTE_COMMAND_SEEK_FORWARD: {
double offset = 0;
......
......@@ -165,6 +165,7 @@ GType totem_object_get_type (void);
void totem_object_exit (TotemObject *totem) G_GNUC_NORETURN;
void totem_object_play (TotemObject *totem);
void totem_object_stop (TotemObject *totem);
void totem_object_play_pause (TotemObject *totem);
void totem_object_pause (TotemObject *totem);
gboolean totem_object_can_seek_next (TotemObject *totem);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment