2014-01-05 22:10:02 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
2014-12-20 15:01:10 -05:00
|
|
|
#include <core/core.h>
|
2014-06-05 10:19:22 -04:00
|
|
|
#include <core/playlist.h>
|
2014-06-04 13:59:15 -04:00
|
|
|
#include <gui/ocarina.h>
|
|
|
|
#include <gui/tabs.h>
|
2014-01-05 22:10:02 -05:00
|
|
|
|
2015-01-21 08:29:46 -05:00
|
|
|
|
2015-01-21 08:38:00 -05:00
|
|
|
static std::string share_dir = "";
|
|
|
|
|
2015-01-21 08:29:46 -05:00
|
|
|
namespace gui
|
|
|
|
{
|
|
|
|
Glib::RefPtr<Gtk::Builder> __O_BUILDER;
|
2015-01-21 08:38:00 -05:00
|
|
|
|
|
|
|
const std::string share_file(const std::string &f)
|
|
|
|
{
|
|
|
|
return share_dir + f;
|
|
|
|
}
|
2015-01-21 08:29:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-21 08:38:00 -05:00
|
|
|
static void setup_share(const std::string &path)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
|
|
|
|
|
|
|
|
if (len == -1)
|
|
|
|
return;
|
|
|
|
buf[len] = '\0';
|
|
|
|
|
|
|
|
share_dir = std::string(buf);
|
|
|
|
share_dir = share_dir.substr(0, share_dir.size() - 11);
|
|
|
|
share_dir = share_dir + "share/ocarina/";
|
|
|
|
}
|
|
|
|
|
2015-01-21 08:41:03 -05:00
|
|
|
static Gtk::Window *ocarina_init(int *argc, char ***argv)
|
2014-01-20 20:14:22 -05:00
|
|
|
{
|
2015-01-15 09:39:52 -05:00
|
|
|
Gtk::Window *window;
|
|
|
|
|
2015-01-21 08:38:00 -05:00
|
|
|
setup_share((*argv)[0]);
|
2015-01-21 08:29:46 -05:00
|
|
|
|
|
|
|
gui :: __O_BUILDER = Gtk::Builder::create();
|
2015-01-21 08:38:00 -05:00
|
|
|
if (!gui::__O_BUILDER->add_from_file(gui::share_file("ocarina6.glade")))
|
2015-01-21 08:29:46 -05:00
|
|
|
exit(1);
|
2015-01-15 09:06:59 -05:00
|
|
|
|
2015-01-17 11:14:46 -05:00
|
|
|
gst :: init(argc, argv);
|
|
|
|
plist :: init();
|
2015-01-15 09:06:59 -05:00
|
|
|
|
2014-12-20 15:01:10 -05:00
|
|
|
core :: init();
|
2014-01-24 23:01:02 -05:00
|
|
|
|
2015-01-17 12:12:07 -05:00
|
|
|
manager :: init();
|
2015-01-15 09:39:52 -05:00
|
|
|
init_tabs();
|
|
|
|
window = window_init();
|
2014-02-21 22:06:42 -05:00
|
|
|
post_init_tabs();
|
2014-01-24 23:01:02 -05:00
|
|
|
return window;
|
2014-01-20 20:14:22 -05:00
|
|
|
}
|
|
|
|
|
2014-01-05 22:10:02 -05:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2014-10-29 18:07:43 -04:00
|
|
|
Glib::RefPtr<Gtk::Application> ocarina = Gtk::Application::create(argc, argv, "ocarina");
|
|
|
|
|
2014-01-24 16:17:50 -05:00
|
|
|
Gtk::Window *window = ocarina_init(&argc, &argv);
|
2014-10-29 18:07:43 -04:00
|
|
|
ocarina->run(*window);
|
2014-01-20 20:14:22 -05:00
|
|
|
cleanup_tabs();
|
2015-01-17 09:59:25 -05:00
|
|
|
gst :: quit();
|
2014-01-05 22:10:02 -05:00
|
|
|
return 0;
|
|
|
|
}
|