[totem] main: Remove "remember position" setting



commit 84283b802294028b26afda11195399e99205a90c
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Mar 11 14:13:50 2013 +0100

    main: Remove "remember position" setting
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675462

 data/org.gnome.totem.gschema.xml.in.in |    4 -
 data/totem.convert                     |    1 -
 src/totem-object.c                     |   44 --------------
 src/totem-private.h                    |    1 -
 src/totem-uri.c                        |   98 --------------------------------
 src/totem-uri.h                        |    3 -
 6 files changed, 0 insertions(+), 151 deletions(-)
---
diff --git a/data/org.gnome.totem.gschema.xml.in.in b/data/org.gnome.totem.gschema.xml.in.in
index eec3757..a3691fa 100644
--- a/data/org.gnome.totem.gschema.xml.in.in
+++ b/data/org.gnome.totem.gschema.xml.in.in
@@ -102,10 +102,6 @@
                        <default>true</default>
                        <_summary>Whether to autoload external chapter files when a movie is loaded</_summary>
                </key>
-               <key name="remember-position" type="b">
-                       <default>false</default>
-                       <_summary>Whether to remember the position of played audio/video files when pausing 
or closing them</_summary>
-               </key>
                <key name="save-playback-state" type="b">
                        <default>true</default>
                        <_summary>Whether to remember the current playlist, the playing track and 
position.</_summary>
diff --git a/data/totem.convert b/data/totem.convert
index 86d0e71..0d5f273 100644
--- a/data/totem.convert
+++ b/data/totem.convert
@@ -21,4 +21,3 @@ disable-user-plugins = /apps/totem/disable_user_plugins
 disable-keyboard-shortcuts = /apps/totem/disable_keyboard_shortcuts
 autoload-subtitles = /apps/totem/autoload_subtitles
 autoload-chapters = /apps/totem/autoload_chapters
-remember-position = /apps/totem/remember_position
diff --git a/src/totem-object.c b/src/totem-object.c
index 5d5e02b..148a77f 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -129,10 +129,6 @@ enum {
        LAST_SIGNAL
 };
 
-static void totem_object_set_property          (GObject *object,
-                                                guint property_id,
-                                                const GValue *value,
-                                                GParamSpec *pspec);
 static void totem_object_get_property          (GObject *object,
                                                 guint property_id,
                                                 GValue *value,
@@ -224,7 +220,6 @@ totem_object_class_init (TotemObjectClass *klass)
        object_class = (GObjectClass *) klass;
        app_class = (GApplicationClass *) klass;
 
-       object_class->set_property = totem_object_set_property;
        object_class->get_property = totem_object_get_property;
        object_class->finalize = totem_object_finalize;
 
@@ -309,16 +304,6 @@ totem_object_class_init (TotemObjectClass *klass)
                                                              NULL, G_PARAM_READABLE));
 
        /**
-        * TotemObject:remember-position:
-        *
-        * If %TRUE, Totem will remember the position it was at last time a given file was opened.
-        **/
-       g_object_class_install_property (object_class, PROP_REMEMBER_POSITION,
-                                        g_param_spec_boolean ("remember-position", "Remember position?",
-                                                              "Whether to remember the position each video 
was at last time.",
-                                                              FALSE, G_PARAM_READWRITE));
-
-       /**
         * TotemObject::file-opened:
         * @totem: the #TotemObject which received the signal
         * @mrl: the MRL of the opened stream
@@ -438,23 +423,6 @@ totem_object_finalize (GObject *object)
 }
 
 static void
-totem_object_set_property (GObject *object,
-                          guint property_id,
-                          const GValue *value,
-                          GParamSpec *pspec)
-{
-       TotemObject *totem = TOTEM_OBJECT (object);
-
-       switch (property_id) {
-               case PROP_REMEMBER_POSITION:
-                       totem->remember_position = g_value_get_boolean (value);
-                       break;
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-       }
-}
-
-static void
 totem_object_get_property (GObject *object,
                           guint property_id,
                           GValue *value,
@@ -490,9 +458,6 @@ totem_object_get_property (GObject *object,
        case PROP_CURRENT_DISPLAY_NAME:
                g_value_take_string (value, totem_playlist_get_current_title (totem->playlist));
                break;
-       case PROP_REMEMBER_POSITION:
-               g_value_set_boolean (value, totem->remember_position);
-               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
        }
@@ -1109,7 +1074,6 @@ totem_object_action_exit (TotemObject *totem)
 
        if (totem->bvw) {
                totem_action_save_size (totem);
-               totem_save_position (totem);
                bacon_video_widget_close (totem->bvw);
        }
 
@@ -1404,9 +1368,6 @@ totem_object_action_play_pause (TotemObject *totem)
        } else {
                bacon_video_widget_pause (totem->bvw);
                play_pause_set_label (totem, STATE_PAUSED);
-
-               /* Save the stream position */
-               totem_save_position (totem);
        }
 }
 
@@ -1423,9 +1384,6 @@ totem_action_pause (TotemObject *totem)
        if (bacon_video_widget_is_playing (totem->bvw) != FALSE) {
                bacon_video_widget_pause (totem->bvw);
                play_pause_set_label (totem, STATE_PAUSED);
-
-               /* Save the stream position */
-               totem_save_position (totem);
        }
 }
 
@@ -1673,7 +1631,6 @@ totem_action_set_mrl_with_warning (TotemObject *totem,
                totem->seek_to = 0;
                totem->seek_to_start = 0;
 
-               totem_save_position (totem);
                g_free (totem->mrl);
                totem->mrl = NULL;
                bacon_video_widget_close (totem->bvw);
@@ -1736,7 +1693,6 @@ totem_action_set_mrl_with_warning (TotemObject *totem,
                g_free (user_agent);
 
                totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (totem->win));
-               totem_try_restore_position (totem, mrl);
                retval = bacon_video_widget_open (totem->bvw, mrl, &err);
                bacon_video_widget_set_text_subtitle (totem->bvw, subtitle ? subtitle : autoload_sub);
                g_free (autoload_sub);
diff --git a/src/totem-private.h b/src/totem-private.h
index ff92472..8807070 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -150,7 +150,6 @@ struct _TotemObject {
        GSettings *settings;
        TotemStates state;
        TotemOpenLocation *open_location;
-       gboolean remember_position;
        gboolean disable_kbd_shortcuts;
        gboolean has_played_emitted;
 };
diff --git a/src/totem-uri.c b/src/totem-uri.c
index 0a59c03..16043db 100644
--- a/src/totem-uri.c
+++ b/src/totem-uri.c
@@ -37,15 +37,6 @@
 #include "totem-uri.h"
 #include "totem-private.h"
 
-/* 5 minute threshold. We don't want to save the position within a 3
- * minute song for example. */
-#define SAVE_POSITION_THRESHOLD 5 * 60 * 1000
-/* Don't save the position of a stream if we're within 5% of the beginning or end so that,
- * for example, we don't save if the user exits when they reach the credits of a film */
-#define SAVE_POSITION_END_THRESHOLD 0.05
-/* The GIO file attribute used to store the position in a stream */
-#define SAVE_POSITION_FILE_ATTRIBUTE "metadata::totem::position"
-
 static GtkFileFilter *filter_all = NULL;
 static GtkFileFilter *filter_subs = NULL;
 static GtkFileFilter *filter_supported = NULL;
@@ -558,92 +549,3 @@ totem_add_files (GtkWindow *parent, const char *path)
 
        return filenames;
 }
-
-void
-totem_save_position (Totem *totem)
-{
-       gint64 stream_length, position;
-       char *pos_str;
-       GFile *file;
-       GError *error = NULL;
-
-       if (totem->remember_position == FALSE)
-               return;
-       if (totem->mrl == NULL)
-               return;
-
-       stream_length = bacon_video_widget_get_stream_length (totem->bvw);
-       position = bacon_video_widget_get_current_time (totem->bvw);
-
-       file = g_file_new_for_uri (totem->mrl);
-
-       /* Don't save if it's:
-        *  - a live stream
-        *  - too short to make saving useful
-        *  - too close to the beginning or end to make saving useful
-        */
-       if (stream_length < SAVE_POSITION_THRESHOLD ||
-           (stream_length - position) < stream_length * SAVE_POSITION_END_THRESHOLD ||
-           position < stream_length * SAVE_POSITION_END_THRESHOLD) {
-               g_debug ("not saving position because the video/track is too short");
-
-               /* Remove the attribute if it is currently set on the file; this ensures that if we start 
watching a stream and save the position
-                * half-way through, then later continue watching it to the end, the mid-way saved position 
will be removed when we finish the
-                * stream. Only do this for non-live streams. */
-               if (stream_length > 0) {
-                       g_file_set_attribute_string (file, SAVE_POSITION_FILE_ATTRIBUTE, "", 
G_FILE_QUERY_INFO_NONE, NULL, &error);
-                       if (error != NULL) {
-                               g_warning ("g_file_set_attribute_string failed: %s", error->message);
-                               g_error_free (error);
-                       }
-               }
-
-               g_object_unref (file);
-               return;
-       }
-
-       g_debug ("saving position: %"G_GINT64_FORMAT, position);
-
-       /* Save the position in the stream as a file attribute */
-       pos_str = g_strdup_printf ("%"G_GINT64_FORMAT, position);
-       g_file_set_attribute_string (file, SAVE_POSITION_FILE_ATTRIBUTE, pos_str, G_FILE_QUERY_INFO_NONE, 
NULL, &error);
-       g_free (pos_str);
-
-       if (error != NULL) {
-               g_warning ("g_file_set_attribute_string failed: %s", error->message);
-               g_error_free (error);
-       }
-       g_object_unref (file);
-}
-
-void
-totem_try_restore_position (Totem *totem, const char *mrl)
-{
-       GFile *file;
-       GFileInfo *file_info;
-       const char *seek_str;
-
-       if (totem->remember_position == FALSE)
-               return;
-
-       if (mrl == NULL)
-               return;
-
-       file = g_file_new_for_uri (mrl);
-       g_debug ("trying to restore position of: %s", mrl);
-
-       /* Get the file attribute containing the position */
-       file_info = g_file_query_info (file, SAVE_POSITION_FILE_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, NULL, 
NULL);
-       g_object_unref (file);
-
-       if (file_info == NULL)
-               return;
-
-       seek_str = g_file_info_get_attribute_string (file_info, SAVE_POSITION_FILE_ATTRIBUTE);
-       g_debug ("seek time: %s", seek_str);
-
-       if (seek_str != NULL)
-               totem->seek_to = g_ascii_strtoull (seek_str, NULL, 0);
-
-       g_object_unref (file_info);
-}
diff --git a/src/totem-uri.h b/src/totem-uri.h
index 3581d62..3e89606 100644
--- a/src/totem-uri.h
+++ b/src/totem-uri.h
@@ -47,9 +47,6 @@ GSList *      totem_add_files                 (GtkWindow *parent,
 char *         totem_add_subtitle              (GtkWindow *parent, 
                                                 const char *uri);
 
-void totem_save_position (Totem *totem);
-void totem_try_restore_position (Totem *totem, const char *mrl);
-
 G_END_DECLS
 
 #endif /* TOTEM_URI_H */


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