[totem] main: Save the current position when saving session
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] main: Save the current position when saving session
- Date: Mon, 11 Mar 2013 14:11:30 +0000 (UTC)
commit b215c7a17b1dd650184074f453d065939f499c16
Author: Bastien Nocera <hadess hadess net>
Date: Mon Mar 11 15:06:48 2013 +0100
main: Save the current position when saving session
src/totem-playlist.c | 17 ++++++++++++++++-
src/totem-playlist.h | 3 ++-
src/totem-session.c | 5 +++--
3 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 17e4ccc..31be1a7 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -411,6 +411,7 @@ totem_playlist_save_iter_foreach (GtkTreeModel *model,
gchar *uri, *title, *subtitle_uri, *mime_type;
TotemPlaylistStatus status;
gboolean custom_title;
+ const char *starttime;
gtk_tree_model_get (model, iter,
URI_COL, &uri,
@@ -421,6 +422,11 @@ totem_playlist_save_iter_foreach (GtkTreeModel *model,
MIME_TYPE_COL, &mime_type,
-1);
+ if (status != TOTEM_PLAYLIST_STATUS_NONE)
+ starttime = g_object_get_data (G_OBJECT (playlist), "starttime");
+ else
+ starttime = NULL;
+
totem_pl_playlist_append (playlist, &pl_iter);
totem_pl_playlist_set (playlist, &pl_iter,
TOTEM_PL_PARSER_FIELD_URI, uri,
@@ -428,6 +434,7 @@ totem_playlist_save_iter_foreach (GtkTreeModel *model,
TOTEM_PL_PARSER_FIELD_SUBTITLE_URI, subtitle_uri,
TOTEM_PL_PARSER_FIELD_PLAYING, status != TOTEM_PLAYLIST_STATUS_NONE ? "true" :
"",
TOTEM_PL_PARSER_FIELD_CONTENT_TYPE, mime_type,
+ TOTEM_PL_PARSER_FIELD_STARTTIME, starttime,
NULL);
g_free (uri);
@@ -440,7 +447,8 @@ totem_playlist_save_iter_foreach (GtkTreeModel *model,
void
totem_playlist_save_session_playlist (TotemPlaylist *playlist,
- GFile *output)
+ GFile *output,
+ gint64 starttime)
{
TotemPlPlaylist *pl_playlist;
GError *error = NULL;
@@ -458,6 +466,13 @@ totem_playlist_save_session_playlist (TotemPlaylist *playlist,
pl_playlist = totem_pl_playlist_new ();
+ if (starttime > 0) {
+ char *starttime_sec;
+
+ starttime_sec = g_strdup_printf ("%" G_GINT64_FORMAT, starttime / 1000);
+ g_object_set_data_full (G_OBJECT (pl_playlist), "starttime", starttime_sec, g_free);
+ }
+
gtk_tree_model_foreach (playlist->priv->model,
totem_playlist_save_iter_foreach,
pl_playlist);
diff --git a/src/totem-playlist.h b/src/totem-playlist.h
index d28649e..1d76735 100644
--- a/src/totem-playlist.h
+++ b/src/totem-playlist.h
@@ -115,7 +115,8 @@ gboolean totem_playlist_add_mrls_finish (TotemPlaylist *self,
GError **error);
void totem_playlist_save_session_playlist (TotemPlaylist *playlist,
- GFile *output);
+ GFile *output,
+ gint64 starttime);
void totem_playlist_save_current_playlist_ext (TotemPlaylist *playlist,
const char *output, TotemPlParserType type);
void totem_playlist_select_subtitle_dialog (TotemPlaylist *playlist,
diff --git a/src/totem-session.c b/src/totem-session.c
index be51f5d..efc90e2 100644
--- a/src/totem-session.c
+++ b/src/totem-session.c
@@ -95,10 +95,11 @@ void
totem_session_save (Totem *totem)
{
GFile *file;
+ gint64 curr;
file = get_session_file ();
- /* FIXME: Save the current seek time somehow */
/* FIXME: Check whether we actually want to be saved */
- totem_playlist_save_session_playlist (totem->playlist, file);
+ curr = bacon_video_widget_get_current_time (totem->bvw);
+ totem_playlist_save_session_playlist (totem->playlist, file, curr);
g_object_unref (file);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]