summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-08 19:11:13 +0000
committerDavid Robillard <d@drobilla.net>2011-01-08 19:11:13 +0000
commita7b46a0695acfa55d591b0e5ce585d9f92fdad3e (patch)
tree30d7e670c77568684df23a1e02fcc9a0e271a76c /src/gui
parentd95f3e089619d35873acdad4b79e3f7e0f6ccf15 (diff)
downloadingen-a7b46a0695acfa55d591b0e5ce585d9f92fdad3e.tar.gz
ingen-a7b46a0695acfa55d591b0e5ce585d9f92fdad3e.tar.bz2
ingen-a7b46a0695acfa55d591b0e5ce585d9f92fdad3e.zip
Support via waf for running from the build directory.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2799 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GladeFactory.cpp35
-rw-r--r--src/gui/ingen_gui.glade4
-rw-r--r--src/gui/wscript11
3 files changed, 34 insertions, 16 deletions
diff --git a/src/gui/GladeFactory.cpp b/src/gui/GladeFactory.cpp
index df000cd8..6036d359 100644
--- a/src/gui/GladeFactory.cpp
+++ b/src/gui/GladeFactory.cpp
@@ -30,24 +30,37 @@ namespace GUI {
Glib::ustring GladeFactory::glade_filename = "";
+inline static bool
+is_readable(const std::string& filename)
+{
+ std::ifstream fs(filename.c_str());
+ const bool fail = fs.fail();
+ fs.close();
+ return !fail;
+}
void
GladeFactory::find_glade_file()
{
- char* env_path = getenv("INGEN_GLADE_PATH");
- if (env_path)
- glade_filename = env_path;
- else
- glade_filename = Shared::data_file_path("ingen_gui.glade");
+ // Try file in bundle (directory where executable resides)
+ glade_filename = Shared::bundle_file_path("ingen_gui.glade");
+ if (is_readable(glade_filename))
+ return;
- ifstream fs(glade_filename.c_str());
- if (fs.fail()) {
- error << "[GladeFactory] Unable to find ingen_gui.glade in " << INGEN_DATA_DIR << endl;
- throw;
+ // Try ENGINE_GLADE_PATH from the environment
+ const char* const env_path = getenv("INGEN_GLADE_PATH");
+ if (env_path && is_readable(env_path)) {
+ glade_filename = env_path;
+ return;
}
- fs.close();
- info << "[GladeFactory] Loading widgets from " << glade_filename.c_str() << endl;
+ // Try the default system installed path
+ glade_filename = Shared::data_file_path("ingen_gui.glade");
+ if (is_readable(glade_filename))
+ return;
+
+ error << "[GladeFactory] Unable to find ingen_gui.glade in " << INGEN_DATA_DIR << endl;
+ throw std::runtime_error("Unable to find glade file");
}
diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade
index 39e5f8bd..6b135a2a 100644
--- a/src/gui/ingen_gui.glade
+++ b/src/gui/ingen_gui.glade
@@ -1829,7 +1829,9 @@
<widget class="GtkAboutDialog" id="about_win">
<property name="destroy_with_parent">True</property>
<property name="type_hint">normal</property>
- <property name="copyright" translatable="yes">Copyright (C) 2005-2008 David Robillard &lt;http://drobilla.net&gt;</property>
+ <property name="program_name">Ingen</property>
+ <property name="version">@INGEN_VERSION@</property>
+ <property name="copyright" translatable="yes">Copyright (C) 2005-2010 David Robillard &lt;http://drobilla.net&gt;</property>
<property name="website">http://drobilla.net/software/ingen</property>
<property name="license" translatable="yes">Licensed under the GNU GPL, Version 2.
diff --git a/src/gui/wscript b/src/gui/wscript
index 5ae04233..40c6a270 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -66,7 +66,10 @@ def build(bld):
XML2
''')
- # GUI runtime files
- bld.install_files('${DATADIR}/ingen', 'ingen_gui.glade')
-
-
+ # Glade XML UI definition
+ bld(features = 'subst',
+ source = 'ingen_gui.glade',
+ target = '../../ingen_gui.glade',
+ install_path = '${DATADIR}/ingen',
+ chmod = 0755,
+ INGEN_VERSION = bld.env['INGEN_VERSION'])