[rhythmbox] source: add method/signal for playback status
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] source: add method/signal for playback status
- Date: Mon, 1 Apr 2013 11:06:03 +0000 (UTC)
commit ab1760c36709e127c3438010b0d80a4a72e976a5
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat Mar 23 23:46:29 2013 +1000
source: add method/signal for playback status
This will be used to report playback status such as buffering.
sources/rb-source.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
sources/rb-source.h | 5 +++++
2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/sources/rb-source.c b/sources/rb-source.c
index a75cc87..f8f169a 100644
--- a/sources/rb-source.c
+++ b/sources/rb-source.c
@@ -135,6 +135,7 @@ enum
{
FILTER_CHANGED,
RESET_FILTERS,
+ PLAYBACK_STATUS_CHANGED,
LAST_SIGNAL
};
@@ -342,6 +343,21 @@ rb_source_class_init (RBSourceClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
+ /**
+ * RBSource::playback-status-changed:
+ * @source: the #RBSource
+ *
+ * Emitted to indicate playback status (buffering etc.) has changed
+ */
+ rb_source_signals[PLAYBACK_STATUS_CHANGED] =
+ g_signal_new ("playback-status-changed",
+ RB_TYPE_SOURCE,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
g_type_class_add_private (object_class, sizeof (RBSourcePrivate));
}
@@ -1466,6 +1482,37 @@ rb_source_bind_settings (RBSource *source, GtkWidget *entry_view, GtkWidget *pan
g_free (name);
}
+/**
+ * rb_source_notify_playback_status_changed:
+ * @source: a #RBSource
+ *
+ * Source implementations call this when their playback status
+ * changes.
+ */
+void
+rb_source_notify_playback_status_changed (RBSource *source)
+{
+ g_signal_emit (G_OBJECT (source), rb_source_signals[PLAYBACK_STATUS_CHANGED], 0);
+}
+
+/**
+ * rb_source_get_playback_status:
+ * @source: a #RBSource
+ * @text: (inout) (allow-none) (transfer full): holds returned playback status text
+ * @progress: (inout) (allow-none): holds returned playback status progress value
+ *
+ * Retrieves playback status details, such as buffering progress.
+ */
+void
+rb_source_get_playback_status (RBSource *source, char **text, float *progress)
+{
+ RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
+
+ if (klass->impl_get_playback_status)
+ klass->impl_get_playback_status (source, text, progress);
+}
+
+
/* This should really be standard. */
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
diff --git a/sources/rb-source.h b/sources/rb-source.h
index cbae67a..81ac149 100644
--- a/sources/rb-source.h
+++ b/sources/rb-source.h
@@ -130,6 +130,7 @@ struct _RBSourceClass
gboolean (*impl_can_pause) (RBSource *source);
RBSourceEOFType (*impl_handle_eos) (RBSource *source);
+ void (*impl_get_playback_status) (RBSource *source, char **text, float *progress);
char * (*impl_get_delete_label) (RBSource *source);
};
@@ -191,6 +192,9 @@ GList * rb_source_gather_selected_properties (RBSource *source,
RhythmDBPropTyp
void rb_source_set_hidden_when_empty (RBSource *source,
gboolean hidden);
+void rb_source_get_playback_status (RBSource *source,
+ char **text,
+ float *progress);
/* Protected methods, should only be used by objects inheriting from RBSource */
@@ -205,6 +209,7 @@ void rb_source_bind_settings (RBSource *source,
GtkWidget *entry_view,
GtkWidget *paned,
GtkWidget *browser);
+void rb_source_notify_playback_status_changed (RBSource *source);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]