newgui: Load the gtk builder file
Right now it's just a toplevel window. I also added a script for launching the new gui without needing to manually set the environment variable. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
f6cb19145d
commit
5eb24ee04f
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
export OCARINA_LIB_PATH=`dirname $0`/lib/ocarina/
|
||||
`dirname $0`/bin/newgui-player
|
|
@ -14,8 +14,8 @@ env.ParseConfig('pkg-config --cflags --libs gtkmm-2.4')
|
|||
# os.chmod(str(target[0]), 0755)
|
||||
|
||||
|
||||
#extra_files = [
|
||||
# ("ocarina.xml", "../lib/ocarina/ocarina.xml", copy),
|
||||
extra_files = [
|
||||
("newgui.xml", "../lib/ocarina/newgui.xml", copy),
|
||||
# ("images/random.png", "../lib/ocarina/random.png", copy),
|
||||
# ("images/ocarina.png", "../lib/ocarina/ocarina.png", copy),
|
||||
# ("images/thumbs_up.png", "../lib/ocarina/thumbs_up.png", copy),
|
||||
|
@ -23,11 +23,11 @@ env.ParseConfig('pkg-config --cflags --libs gtkmm-2.4')
|
|||
# ("scripts/ocarina", "../bin/ocarina", script),
|
||||
# ("scripts/ocarina-completion.bash", "../lib/ocarina/ocarina-completion.bash", copy),
|
||||
# ("../bin/ocarina", "../ocarina.bin", symlink),
|
||||
#]
|
||||
]
|
||||
|
||||
build = [env.Program("../bin/newgui-player", libsaria + get_cpp_files())]
|
||||
#for (src, dst, func) in extra_files:
|
||||
# build.append(env.Command(dst, src, func))
|
||||
for (src, dst, func) in extra_files:
|
||||
build.append(env.Command(dst, src, func))
|
||||
|
||||
env.Alias("newgui", build)
|
||||
Return('build')
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.24"/>
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<object class="GtkWindow" id="Ocarina">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Ocarina</property>
|
||||
<property name="default_width">900</property>
|
||||
<property name="default_height">600</property>
|
||||
<property name="gravity">north-east</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -3,17 +3,40 @@
|
|||
#include <version.h>
|
||||
#include <print.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ocarina.h"
|
||||
|
||||
Glib::RefPtr<Gtk::Builder> builder;
|
||||
|
||||
void on_notify(notify_t event, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
string lib_file(const string &file)
|
||||
{
|
||||
string res;
|
||||
char *var = getenv("OCARINA_LIB_PATH");
|
||||
if (var == NULL) {
|
||||
println("OCARINA_LIB_PATH has not been set!");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
res = var;
|
||||
res += "/" + file;
|
||||
return res;
|
||||
}
|
||||
|
||||
void init(int argc, char **argv)
|
||||
{
|
||||
Gtk::Window *window;
|
||||
|
||||
Gtk::Main app(argc, argv);
|
||||
Gtk::Window window;
|
||||
Gtk::Main::run(window);
|
||||
builder = Gtk::Builder::create_from_file(lib_file("newgui.xml"));
|
||||
builder->get_widget("Ocarina", window);
|
||||
gtk_builder_connect_signals(builder->gobj(), NULL);
|
||||
|
||||
Gtk::Main::run(*window);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
Loading…
Reference in New Issue