[totem/wip/hadess/starttime: 2/4] main: Add totem_playlist_steal_current_starttime()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/starttime: 2/4] main: Add totem_playlist_steal_current_starttime()
- Date: Sun, 17 Feb 2019 01:56:30 +0000 (UTC)
commit bdd6241e7b3d082a425a21f420655e32dca3e3dc
Author: Bastien Nocera <hadess hadess net>
Date: Sat Feb 16 20:25:19 2019 +0100
main: Add totem_playlist_steal_current_starttime()
Read, and remove starttime from currently playing entry.
src/totem-playlist.c | 30 ++++++++++++++++++++++++++++++
src/totem-playlist.h | 1 +
2 files changed, 31 insertions(+)
---
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 734d0435e..7666c0e19 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -1714,6 +1714,36 @@ totem_playlist_get_current_content_type (TotemPlaylist *playlist)
return content_type;
}
+gint64
+totem_playlist_steal_current_starttime (TotemPlaylist *playlist)
+{
+ GtkTreeIter iter;
+ gint64 starttime;
+
+ g_return_val_if_fail (TOTEM_IS_PLAYLIST (playlist), 0);
+
+ if (update_current_from_playlist (playlist) == FALSE)
+ return 0;
+
+ gtk_tree_model_get_iter (playlist->priv->model,
+ &iter,
+ playlist->priv->current);
+
+ gtk_tree_model_get (playlist->priv->model,
+ &iter,
+ STARTTIME_COL, &starttime,
+ -1);
+
+ /* And reset the starttime so it's only used once,
+ * hence the "steal" in the API name */
+ gtk_list_store_set (GTK_LIST_STORE (playlist->priv->model),
+ &iter,
+ STARTTIME_COL, 0,
+ -1);
+
+ return starttime;
+}
+
char *
totem_playlist_get_title (TotemPlaylist *playlist, guint title_index)
{
diff --git a/src/totem-playlist.h b/src/totem-playlist.h
index 819fea25f..13dc1e378 100644
--- a/src/totem-playlist.h
+++ b/src/totem-playlist.h
@@ -130,6 +130,7 @@ char *totem_playlist_get_current_mrl (TotemPlaylist *playlist,
char **subtitle);
char *totem_playlist_get_current_title (TotemPlaylist *playlist);
char *totem_playlist_get_current_content_type (TotemPlaylist *playlist);
+gint64 totem_playlist_steal_current_starttime (TotemPlaylist *playlist);
char *totem_playlist_get_title (TotemPlaylist *playlist,
guint title_index);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]