summaryrefslogtreecommitdiff
path: root/src/totem-uri.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-03-11 14:13:50 +0100
committerBastien Nocera <hadess@hadess.net>2013-03-11 14:13:50 +0100
commit84283b802294028b26afda11195399e99205a90c (patch)
tree972425e04c6b5e4248ab4a3f963db542f0b9a86f /src/totem-uri.c
parentffb803c6baca0868f3f563d47c866ea76d913ace (diff)
downloadtotem-84283b802294028b26afda11195399e99205a90c.tar.gz
main: Remove "remember position" setting
https://bugzilla.gnome.org/show_bug.cgi?id=675462
Diffstat (limited to 'src/totem-uri.c')
-rw-r--r--src/totem-uri.c98
1 files changed, 0 insertions, 98 deletions
diff --git a/src/totem-uri.c b/src/totem-uri.c
index 0a59c03e8..16043db6a 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);
-}