45 lines
865 B
C++
45 lines
865 B
C++
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
#include <core/core.h>
|
|
#include <lib/lib.h>
|
|
#include <gtkmm.h>
|
|
|
|
static Glib::RefPtr<Gtk::Builder> builder;
|
|
static std::string share_dir = "";
|
|
|
|
static void setup_share(const std::string &path)
|
|
{
|
|
if (path == "/usr/bin/ocarina")
|
|
share_dir = "/usr/share/ocarina/";
|
|
else
|
|
share_dir = "./share/ocarina/";
|
|
}
|
|
|
|
void lib :: init(int *argc, char ***argv, const std::string >k_xml)
|
|
{
|
|
setup_share((*argv)[0]);
|
|
|
|
builder = Gtk::Builder::create();
|
|
if (!builder->add_from_file(lib :: share_file(gtk_xml)))
|
|
exit(1);
|
|
|
|
core :: init(argc, argv);
|
|
}
|
|
|
|
const std::string lib :: share_file(const std::string &f)
|
|
{
|
|
return share_dir + f;
|
|
}
|
|
|
|
Glib::RefPtr<Gtk::Builder> &lib :: get_builder()
|
|
{
|
|
return builder;
|
|
}
|
|
|
|
const std::string lib :: key_name(GdkEventKey *event)
|
|
{
|
|
std::string key = gdk_keyval_name(event->keyval);
|
|
return key;
|
|
}
|