[totem/wip/hadess/mpris-can-go-next: 2/5] main: Add can_seek_{previous, next} API
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/mpris-can-go-next: 2/5] main: Add can_seek_{previous, next} API
- Date: Thu, 14 Feb 2019 03:16:51 +0000 (UTC)
commit 45eac192579a98ce3a280091e5f0b25d4d039c33
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 14 03:34:59 2019 +0100
main: Add can_seek_{previous,next} API
src/totem-object.c | 28 ++++++++++++++++++++++++++++
src/totem.h | 2 ++
2 files changed, 30 insertions(+)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index f55514f19..4dd5485d0 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1933,6 +1933,20 @@ totem_object_direction (TotemObject *totem, TotemPlaylistDirection dir)
}
}
+/**
+ * totem_object_can_seek_previous:
+ * @totem: a #TotemObject
+ *
+ * Returns true if totem_object_seek_previous() would have an effect.
+ */
+gboolean
+totem_object_can_seek_previous (TotemObject *totem)
+{
+ return bacon_video_widget_has_previous_track (totem->bvw) ||
+ totem_playlist_has_previous_mrl (totem->playlist) ||
+ totem_playlist_get_repeat (totem->playlist);
+}
+
/**
* totem_object_seek_previous:
* @totem: a #TotemObject
@@ -1947,6 +1961,20 @@ totem_object_seek_previous (TotemObject *totem)
totem_object_direction (totem, TOTEM_PLAYLIST_DIRECTION_PREVIOUS);
}
+/**
+ * totem_object_can_seek_next:
+ * @totem: a #TotemObject
+ *
+ * Returns true if totem_object_seek_next() would have an effect.
+ */
+gboolean
+totem_object_can_seek_next (TotemObject *totem)
+{
+ return bacon_video_widget_has_next_track (totem->bvw) ||
+ totem_playlist_has_next_mrl (totem->playlist) ||
+ totem_playlist_get_repeat (totem->playlist);
+}
+
/**
* totem_object_seek_next:
* @totem: a #TotemObject
diff --git a/src/totem.h b/src/totem.h
index 926e8bfe5..69649e0ef 100644
--- a/src/totem.h
+++ b/src/totem.h
@@ -168,7 +168,9 @@ void totem_object_play (TotemObject *totem);
void totem_object_stop (TotemObject *totem);
void totem_object_play_pause (TotemObject *totem);
void totem_object_pause (TotemObject *totem);
+gboolean totem_object_can_seek_next (TotemObject *totem);
void totem_object_seek_next (TotemObject *totem);
+gboolean totem_object_can_seek_previous (TotemObject *totem);
void totem_object_seek_previous (TotemObject *totem);
void totem_object_seek_time (TotemObject *totem, gint64 msec, gboolean accurate);
void totem_object_seek_relative (TotemObject *totem, gint64 offset, gboolean accurate);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]