gui: Create a common ocarina_init()

To initialize the needed backend modules, shared by normal main() and
testing main().

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-01-20 20:14:22 -05:00 committed by Anna Schumaker
parent e0770030d5
commit 3d1e8872d3
4 changed files with 19 additions and 10 deletions

View File

@ -1,17 +1,24 @@
/* /*
* Copyright 2014 (c) Anna Schumaker. * Copyright 2014 (c) Anna Schumaker.
*/ */
#include <deck.h>
#include <ocarina.h> #include <ocarina.h>
Gtk::Window *ocarina_init()
{
Gtk::Window *window = connect_wires();
deck::init();
library::init();
return window;
}
#ifndef CONFIG_TEST #ifndef CONFIG_TEST
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
Gtk::Window *window;
Gtk::Main ocarina(argc, argv); Gtk::Main ocarina(argc, argv);
window = connect_wires(); Gtk::Window *window = ocarina_init();
Gtk::Main::run(*window); Gtk::Main::run(*window);
cleanup_tabs();
return 0; return 0;
} }
#endif /* CONFIG_TEST */ #endif /* CONFIG_TEST */

View File

@ -30,7 +30,7 @@ public:
Gtk::TreeModelColumn<unsigned int> q_col_count; Gtk::TreeModelColumn<unsigned int> q_col_count;
Gtk::TreeModelColumn<std::string> q_col_played; Gtk::TreeModelColumn<std::string> q_col_played;
} queue_cols; } queue_cols;
static unsigned int q_col_width[] = { 20, 300, 1, 125, 125, 1, 125, 1, 1 }; static unsigned int q_col_width[] = { 20, 300, 60, 125, 125, 1, 125, 60, 1 };
/* /*
@ -131,6 +131,7 @@ void OcarinaTab::setup_columns()
for (unsigned int i = 0; i < columns.size(); i++) { for (unsigned int i = 0; i < columns.size(); i++) {
columns[i]->set_resizable(); columns[i]->set_resizable();
columns[i]->set_fixed_width(q_col_width[i]); columns[i]->set_fixed_width(q_col_width[i]);
columns[i]->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED);
} }
} }

View File

@ -6,6 +6,10 @@
#include <playqueue.h> #include <playqueue.h>
#include <gtkmm.h> #include <gtkmm.h>
/* main.cpp */
Gtk::Window *ocarina_init();
/* model.cpp */ /* model.cpp */
class PlayqueueModel : public Gtk::TreeModel, public Glib::Object { class PlayqueueModel : public Gtk::TreeModel, public Glib::Object {
private: private:

View File

@ -131,14 +131,11 @@ bool test_0()
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
Gtk::Window *window;
Gtk::Main ocarina(argc, argv); Gtk::Main ocarina(argc, argv);
Gtk::Window *window = ocarina_init();
deck :: init();
window = connect_wires();
schedule_test(test_0); schedule_test(test_0);
Gtk::Main::run(*window); Gtk::Main::run(*window);
cleanup_tabs(); cleanup_tabs();
return 0; return 0;