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:
parent
6f7ce86091
commit
5b34b11dd8
|
@ -3,6 +3,6 @@
|
|||
*.run
|
||||
*.test
|
||||
*.glade~
|
||||
gui/#*
|
||||
share/ocarina/#*
|
||||
bin/
|
||||
.sconsign.dblite
|
||||
|
|
18
gui/main.cpp
18
gui/main.cpp
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -13,6 +13,7 @@ void collection_mgr_init();
|
|||
|
||||
|
||||
/* main.cpp */
|
||||
const std::string share_file(const std::string &);
|
||||
Gtk::Window *ocarina_init(int *, char ***);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue