
#include <ocarina/footer.h>
#include "footer.h"

static GtkWidget *footer = NULL;

static void make_footer()
{
	GtkWidget *sep = gtk_hseparator_new();
	GtkWidget *content = gtk_hbox_new(FALSE, 5);

	footer = gtk_vbox_new(FALSE, 0);
	box_pack_start(footer, sep,     FALSE, FALSE, 0);
	box_pack_start(footer, content, FALSE, FALSE, 0);
	/*
	 * The pause button begins life hidden, so show everything up until
	 * this point, and then add the controls
	 */
	gtk_widget_show_all(footer);

	box_pack_start(content, get_nowplaying(),  TRUE,  TRUE, 0);
	box_pack_start(content, get_controls(),   FALSE, FALSE, 0);
}

GtkWidget *get_footer()
{
	if (footer == NULL)
		make_footer();
	g_object_ref(footer);
	return footer;
}

void put_footer()
{
	if (footer != NULL)
		g_object_unref(footer);
}
