[totem] main: Add support for starting a playlist paused



commit f22f8ddad76ff78908a4183ade78c1f8fa8798e3
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Mon Sep 16 11:49:42 2013 -0700

    main: Add support for starting a playlist paused
    
    Currently, when --pause is specified in the first command line
    invocation of Totem, the passed-in media will still start.
    This patch saves the initial state of the pause option to a separate
    variable, so that when we receive the first playlist changed event, we
    can avoid starting up the stream if the option was specified.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708184

 src/totem-object.c  |   12 ++++++++++--
 src/totem-private.h |    1 +
 src/totem.c         |    1 +
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index aceee3a..6900d40 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1734,6 +1734,7 @@ totem_object_set_mrl (TotemObject *totem,
 {
        if (totem->mrl != NULL) {
                totem->seek_to_start = 0;
+               totem->pause_start = FALSE;
 
                g_clear_pointer (&totem->mrl, g_free);
                bacon_video_widget_close (totem->bvw);
@@ -2162,6 +2163,7 @@ on_error_event (BaconVideoWidget *bvw, char *message,
        /* Clear the seek if it's there, we only want to try and seek
         * the first file, even if it's not there */
        totem->seek_to_start = 0;
+       totem->pause_start = FALSE;
 
        if (playback_stopped)
                play_pause_set_label (totem, STATE_STOPPED);
@@ -2718,8 +2720,14 @@ playlist_changed_cb (GtkWidget *playlist, TotemObject *totem)
        if (mrl == NULL)
                return;
 
-       if (totem_playlist_get_playing (totem->playlist) == TOTEM_PLAYLIST_STATUS_NONE)
-               totem_object_set_mrl_and_play (totem, mrl, subtitle);
+       if (totem_playlist_get_playing (totem->playlist) == TOTEM_PLAYLIST_STATUS_NONE) {
+               if (totem->pause_start)
+                       totem_object_set_mrl (totem, mrl, subtitle);
+               else
+                       totem_object_set_mrl_and_play (totem, mrl, subtitle);
+       }
+
+       totem->pause_start = FALSE;
 
        g_free (mrl);
        g_free (subtitle);
diff --git a/src/totem-private.h b/src/totem-private.h
index 83732f8..cb6eb5c 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -139,6 +139,7 @@ struct _TotemObject {
 
        /* session */
        gint64 seek_to_start;
+       gboolean pause_start;
        guint save_timeout_id;
 
        /* Window State */
diff --git a/src/totem.c b/src/totem.c
index 1720596..17a8c68 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -144,6 +144,7 @@ app_init (Totem *totem, char **argv)
        totem->volume = g_object_get_data (totem->controls, "volume_button");
        totem->time_label = g_object_get_data (totem->controls, "time_label");
        totem->time_rem_label = g_object_get_data (totem->controls, "time_rem_label");
+       totem->pause_start = optionstate.pause;
 
        totem_callback_connect (totem);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]