ocarina: Split footer into multiple files

This should help keep things organized
This commit is contained in:
Bryan Schumaker 2011-10-28 17:06:18 -04:00
parent 39f74eb6b4
commit 9d22d6b278
4 changed files with 41 additions and 19 deletions

View File

@ -2,8 +2,10 @@
#define OCARINA_FOOTER
#include <ocarina/gtk.h>
#include <libsaria/track.h>
GtkWidget *get_footer();
void put_footer();
void set_footer_track(Track &);
#endif /* OCARINA_FOOTER */

View File

@ -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;
}

View File

@ -1,37 +1,24 @@
#include <ocarina/footer.h>
#include <ocarina/button.h>
#include <libsaria/track.h>
#include "footer.h"
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()
{
GtkWidget *sep = gtk_hseparator_new();
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
* this point, and then add the controls
*/
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()

6
ocarina/footer/footer.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef OCARINA_FOOTER_PRIVATE_H
#define OCARINA_FOOTER_PRIVATE_H
GtkWidget *get_controls();
#endif /* OCARINA_FOOTER_PRIVATE_H */