gui: Move ocarina6.glade to share/ocarina/

This directory will be copied directly into /usr/ during an install.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-03-01 17:39:00 -05:00 committed by Anna Schumaker
parent 6f7ce86091
commit 5b34b11dd8
5 changed files with 21 additions and 2 deletions

2
.gitignore vendored
View File

@ -3,6 +3,6 @@
*.run
*.test
*.glade~
gui/#*
share/ocarina/#*
bin/
.sconsign.dblite

View File

@ -7,6 +7,23 @@
#include <playlist.h>
#include <tabs.h>
const std::string share_file(const std::string &file)
{
char buf[1024];
std::string res;
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
if (len == -1)
return "";
buf[len] = '\0';
res = std::string(buf);
// len("bin/ocarina") == 11
res = res.substr(0, res.size() - 11);
return res + "share/ocarina/" + file;
}
Gtk::Window *ocarina_init(int *argc, char ***argv)
{
Gtk::Window *window = connect_wires();
@ -15,6 +32,7 @@ Gtk::Window *ocarina_init(int *argc, char ***argv)
library::init();
playlist::init();
share_file("ocarina6.glade");
post_init_tabs();
return window;
}

View File

@ -242,7 +242,7 @@ Gtk::Window *connect_wires()
struct Callbacks *cb = get_callbacks();
builder = Gtk::Builder::create();
builder->add_from_file("gui/ocarina6.glade");
builder->add_from_file(share_file("ocarina6.glade"));
/* Controls */

View File

@ -13,6 +13,7 @@ void collection_mgr_init();
/* main.cpp */
const std::string share_file(const std::string &);
Gtk::Window *ocarina_init(int *, char ***);