diff --git a/gui/GladeFile.hpp b/gui/GladeFile.hpp deleted file mode 100644 index 27dee7c6..00000000 --- a/gui/GladeFile.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of Patchage. - * Copyright (C) 2007 Dave Robillard - * - * Patchage is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef PATCHAGE_GLADEFILE_HPP -#define PATCHAGE_GLADEFILE_HPP - -#include -#include -#include -#include -#include -#include "config.h" -#include "binary_location.h" - -class GladeFile { -public: - static Glib::RefPtr open(const std::string& base_name) { - // Check for the .glade file in ./src/ - std::string glade_filename = std::string("./src/").append(base_name).append(".glade"); - std::ifstream fs(glade_filename.c_str()); - if (fs.fail()) { // didn't find it, check DATA_PATH - fs.clear(); - -#ifdef BUNDLE - char* loc = binary_location(); - std::string bundle = loc; - bundle = bundle.substr(0, bundle.find_last_of("/")); - glade_filename = bundle + "/" + PATCHAGE_DATA_DIR + "/" + base_name + ".glade"; - free(loc); -#else - glade_filename = std::string(PATCHAGE_DATA_DIR) + "/" + base_name + ".glade"; -#endif - - fs.open(glade_filename.c_str()); - if (fs.fail()) { - std::ostringstream ss; - ss << "Unable to find " << base_name << "glade in current directory or " << PATCHAGE_DATA_DIR << std::endl; - throw std::runtime_error(ss.str()); - } - fs.close(); - } - - return Gnome::Glade::Xml::create(glade_filename); - } -}; - -#endif // PATCHAGE_GLADEFILE_HPP diff --git a/gui/Patchage.cpp b/gui/Patchage.cpp index 377fc579..22268b0a 100644 --- a/gui/Patchage.cpp +++ b/gui/Patchage.cpp @@ -1,6 +1,8 @@ -/* This file is part of Patchage. +/* + * This file is part of LADI session handler. + * + * Copyright (C) 2008, 2009 Nedko Arnaudov * Copyright (C) 2007 Dave Robillard - * Copyright (C) 2008 Nedko Arnaudov * * Patchage is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software @@ -120,7 +122,7 @@ Patchage::Patchage(int argc, char** argv) g_app = this; _settings_filename = getenv("HOME"); - _settings_filename += "/." PATCHAGE_APPNAME "rc"; + _settings_filename += "/.gladishrc"; _state_manager = new StateManager(); _canvas = boost::shared_ptr(new PatchageCanvas(this, 1600*2, 1200*2)); @@ -138,8 +140,8 @@ Patchage::Patchage(int argc, char** argv) Glib::set_application_name("Patchage"); _about_win->property_program_name() = "Patchage"; - _about_win->property_logo_icon_name() = PATCHAGE_APPNAME; - gtk_window_set_default_icon_name(PATCHAGE_APPNAME); + _about_win->property_logo_icon_name() = "gladish"; + gtk_window_set_default_icon_name("gladish"); gtkmm_set_width_for_given_text(*_buffer_size_combo, "4096 frames", 40); diff --git a/gui/patchage.glade b/gui/gui.glade similarity index 100% rename from gui/patchage.glade rename to gui/gui.glade diff --git a/gui/main.cpp b/gui/main.cpp index c05087b4..7455af00 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -1,4 +1,7 @@ -/* This file is part of Patchage. +/* + * This file is part of LADI session handler. + * + * Copyright (C) 2009 Nedko Arnaudov * Copyright (C) 2007 Dave Robillard * * Patchage is free software; you can redistribute it and/or modify it under the @@ -21,12 +24,45 @@ #include #include +#include +#include +#include +#include +#include +#include "config.h" +#include "binary_location.h" + #include "Patchage.hpp" -#include "GladeFile.hpp" #include "globals.hpp" Glib::RefPtr g_xml; +static +Glib::RefPtr +glade_open() +{ + // Check for the .glade file in ./src/ + std::string glade_filename = std::string("./gui/gui.glade"); + std::ifstream fs(glade_filename.c_str()); + if (fs.fail()) + { // didn't find it, check DATA_PATH + fs.clear(); + + glade_filename = DATA_DIR "/gui.glade"; + + fs.open(glade_filename.c_str()); + if (fs.fail()) + { + std::ostringstream ss; + ss << "Unable to find gui.glade file" << std::endl; + throw std::runtime_error(ss.str()); + } + fs.close(); + } + + return Gnome::Glade::Xml::create(glade_filename); +} + int main(int argc, char** argv) { try { @@ -34,7 +70,7 @@ int main(int argc, char** argv) Gnome::Canvas::init(); Gtk::Main app(argc, argv); - g_xml = GladeFile::open("patchage"); + g_xml = glade_open(); Patchage patchage(argc, argv); app.run(*patchage.window()); diff --git a/wscript b/wscript index f23cd0e1..350b9bdb 100644 --- a/wscript +++ b/wscript @@ -110,10 +110,7 @@ def configure(conf): conf.check_tool('boost') conf.check_boost() - conf.define('PATCHAGE_APPNAME', "gladish") - conf.env['PATCHAGE_VERSION'] = VERSION - conf.define('PATCHAGE_DATA_DIR', os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', "gladish"))) - + conf.define('DATA_DIR', os.path.normpath(os.path.join(conf.env['PREFIX'], 'share', APPNAME))) conf.define('DEFAULT_PROJECT_DIR', "audio-projects") conf.define('PACKAGE_VERSION', VERSION) conf.define('DBUS_NAME_BASE', DBUS_NAME_BASE)