ocarina: Split footer into multiple files
This should help keep things organized
This commit is contained in:
parent
39f74eb6b4
commit
9d22d6b278
|
@ -2,8 +2,10 @@
|
||||||
#define OCARINA_FOOTER
|
#define OCARINA_FOOTER
|
||||||
|
|
||||||
#include <ocarina/gtk.h>
|
#include <ocarina/gtk.h>
|
||||||
|
#include <libsaria/track.h>
|
||||||
|
|
||||||
GtkWidget *get_footer();
|
GtkWidget *get_footer();
|
||||||
void put_footer();
|
void put_footer();
|
||||||
|
void set_footer_track(Track &);
|
||||||
|
|
||||||
#endif /* OCARINA_FOOTER */
|
#endif /* OCARINA_FOOTER */
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
#include <ocarina/gtk.h>
|
||||||
|
#include <ocarina/button.h>
|
||||||
|
#include "footer.h"
|
||||||
|
|
||||||
|
static GtkWidget *controls = NULL;
|
||||||
|
|
||||||
|
static void make_controls()
|
||||||
|
{
|
||||||
|
controls = gtk_hbox_new(FALSE, 0);
|
||||||
|
gtk_widget_show(controls);
|
||||||
|
|
||||||
|
box_pack_end(controls, make_volume_button(), FALSE, FALSE, 0);
|
||||||
|
box_pack_end(controls, make_stop_button(), FALSE, FALSE, 0);
|
||||||
|
box_pack_end(controls, make_pause_button(), FALSE, FALSE, 0);
|
||||||
|
box_pack_end(controls, make_play_button(), FALSE, FALSE, 0);
|
||||||
|
box_pack_end(controls, make_forward_button(), FALSE, FALSE, 0);
|
||||||
|
box_pack_end(controls, make_rewind_button(), FALSE, FALSE, 0);
|
||||||
|
box_pack_end(controls, make_open_button(), FALSE, FALSE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget *get_controls()
|
||||||
|
{
|
||||||
|
if (controls == NULL)
|
||||||
|
make_controls();
|
||||||
|
return controls;
|
||||||
|
}
|
|
@ -1,37 +1,24 @@
|
||||||
|
|
||||||
#include <ocarina/footer.h>
|
#include <ocarina/footer.h>
|
||||||
#include <ocarina/button.h>
|
#include <libsaria/track.h>
|
||||||
|
#include "footer.h"
|
||||||
|
|
||||||
static GtkWidget *footer = NULL;
|
static GtkWidget *footer = NULL;
|
||||||
|
|
||||||
static void add_controls()
|
|
||||||
{
|
|
||||||
GtkWidget *controls = gtk_hbox_new(FALSE, 0);
|
|
||||||
gtk_widget_show(controls);
|
|
||||||
|
|
||||||
box_pack_end(controls, make_volume_button(), FALSE, FALSE, 0);
|
|
||||||
box_pack_end(controls, make_stop_button(), FALSE, FALSE, 0);
|
|
||||||
box_pack_end(controls, make_pause_button(), FALSE, FALSE, 0);
|
|
||||||
box_pack_end(controls, make_play_button(), FALSE, FALSE, 0);
|
|
||||||
box_pack_end(controls, make_forward_button(), FALSE, FALSE, 0);
|
|
||||||
box_pack_end(controls, make_rewind_button(), FALSE, FALSE, 0);
|
|
||||||
box_pack_end(controls, make_open_button(), FALSE, FALSE, 0);
|
|
||||||
|
|
||||||
box_pack_start(footer, controls, FALSE, FALSE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void make_footer()
|
static void make_footer()
|
||||||
{
|
{
|
||||||
GtkWidget *sep = gtk_hseparator_new();
|
GtkWidget *sep = gtk_hseparator_new();
|
||||||
footer = gtk_vbox_new(FALSE, 0);
|
footer = gtk_vbox_new(FALSE, 0);
|
||||||
box_pack_start(footer, sep, FALSE, FALSE, 0);
|
|
||||||
|
|
||||||
|
gtk_widget_show(sep);
|
||||||
|
gtk_widget_show(footer);
|
||||||
/*
|
/*
|
||||||
* The pause button begins life hidden, so show everything up until
|
* The pause button begins life hidden, so show everything up until
|
||||||
* this point, and then add the controls
|
* this point, and then add the controls
|
||||||
*/
|
*/
|
||||||
gtk_widget_show_all(footer);
|
gtk_widget_show_all(footer);
|
||||||
add_controls();
|
box_pack_start(footer, sep, FALSE, FALSE, 0);
|
||||||
|
box_pack_start(footer, get_controls(), FALSE, FALSE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *get_footer()
|
GtkWidget *get_footer()
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef OCARINA_FOOTER_PRIVATE_H
|
||||||
|
#define OCARINA_FOOTER_PRIVATE_H
|
||||||
|
|
||||||
|
GtkWidget *get_controls();
|
||||||
|
|
||||||
|
#endif /* OCARINA_FOOTER_PRIVATE_H */
|
Loading…
Reference in New Issue