gst: Update the "now playing" fields through the GST driver

This lets me remove the on_track_loaded() callback function by handling
this event directly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-12-20 12:05:22 -05:00
parent d7113cb124
commit b633f3fa0c
6 changed files with 5 additions and 12 deletions

View File

@ -58,7 +58,6 @@ static void _load_track(Track *track, bool start_playback)
return;
cur_driver->load(track);
get_callbacks()->on_track_loaded(track);
if (start_playback)
audio :: play();
else

View File

@ -8,11 +8,9 @@
static void no_op(bool, unsigned int) {}
static void no_op(Queue *, unsigned int) {}
static void no_op(Queue *) {}
static void no_op(Track *) {}
static struct Callbacks callbacks = {
.on_track_loaded = no_op,
.on_pause_count_changed = no_op,
.on_pq_removed = no_op,

View File

@ -7,6 +7,7 @@
*/
#include <core/audio.h>
#include <core/driver.h>
#include <gui/ocarina.h>
#include <gst/gst.h>
@ -37,6 +38,8 @@ public:
gst_change_state(GST_STATE_NULL);
g_object_set(G_OBJECT(gst_player), "uri", uri, NULL);
g_free(uri);
on_track_loaded(track);
}
bool play() { return gst_change_state(GST_STATE_PLAYING); }

View File

@ -37,7 +37,7 @@ static void set_label_text(Gtk::Label *label, const std::string &size,
Glib::Markup::escape_text(text) + "</span>");
}
static void on_track_loaded(Track *track)
void on_track_loaded(Track *track)
{
Gtk::ToggleButton *ban = lib :: get_widget<Gtk::ToggleButton>("o_ban");
Gtk::ToggleButton *fav = lib :: get_widget<Gtk::ToggleButton>("o_favorite");
@ -114,7 +114,6 @@ Gtk::Window *setup_gui()
Gtk::SpinButton *count = lib :: get_widget<Gtk::SpinButton>("o_pause_count");
Gtk::CheckButton *enabled = lib :: get_widget<Gtk::CheckButton>("o_pause_enabled");
cb->on_track_loaded = on_track_loaded;
cb->on_pause_count_changed = on_pause_count_changed;
count->signal_changed().connect(sigc::ptr_fun(on_config_pause));

View File

@ -15,13 +15,6 @@
struct Callbacks {
/* Audio callbacks */
/**
* Called when the audio layer loads a track.
*
* @param track The track that was just loaded.
*/
void (*on_track_loaded)(Track *);
/**
* Called when the audio layer's pause count changes.
*

View File

@ -21,6 +21,7 @@ void connect_button(const std::string &, void (*func)());
Gtk::Window *setup_gui();
void on_pq_created(Queue *, unsigned int);
void on_track_loaded(Track *);
void post_init_queue_tabs();