diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/client/PluginModel.cpp | 2 | ||||
-rw-r--r-- | src/libs/gui/App.cpp | 13 | ||||
-rw-r--r-- | src/libs/gui/App.hpp | 4 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 11 |
4 files changed, 16 insertions, 14 deletions
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp index 786a5fb5..8c2ad71c 100644 --- a/src/libs/client/PluginModel.cpp +++ b/src/libs/client/PluginModel.cpp @@ -134,7 +134,7 @@ PluginModel::ui(EngineInterface* engine, NodeModel* node) const SLV2UIInstance ret = NULL; - const char* gtk_gui_uri = "http://ll-plugins.nongnu.org/lv2/ext/gui#"; + const char* gtk_gui_uri = "http://ll-plugins.nongnu.org/lv2/ext/gui#GtkGUI"; SLV2UIs uis = slv2_plugin_get_uis(_slv2_plugin); SLV2UI ui = NULL; diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index bc9148ed..3ee95540 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -361,8 +361,12 @@ App::icon_from_path(const string& path, int size) /* If weak references to Glib::Objects are needed somewhere else it will probably be a good idea to create a proper WeakPtr class instead of using raw pointers, but for a single use this will do. */ + + Glib::RefPtr<Gdk::Pixbuf> buf; + if (path.length() == 0) + return buf; - IconMap::iterator iter = _icons.find(make_pair(path, size)); + Icons::iterator iter = _icons.find(make_pair(path, size)); if (iter != _icons.end()) { // we need to reference manually since the RefPtr constructor doesn't do it @@ -370,15 +374,14 @@ App::icon_from_path(const string& path, int size) return Glib::RefPtr<Gdk::Pixbuf>(iter->second); } - Glib::RefPtr<Gdk::Pixbuf> buf; try { buf = Gdk::Pixbuf::create_from_file(path, size, size); _icons.insert(make_pair(make_pair(path, size), buf.operator->())); buf->add_destroy_notify_callback(new pair<string, int>(path, size), &App::icon_destroyed); cerr << "Loaded icon " << path << " with size " << size << endl; - } catch (...) { - cerr << "Caught exception, failed to load icon " << path << endl; + } catch (Glib::Error e) { + cerr << "Error loading icon: " << e.what() << endl; } return buf; } @@ -389,7 +392,7 @@ App::icon_destroyed(void* data) { pair<string, int>* p = static_cast<pair<string, int>*>(data); cerr << "Destroyed icon " << p->first << " with size " << p->second << endl; - IconMap::iterator iter = instance()._icons.find(*p); + Icons::iterator iter = instance()._icons.find(*p); if (iter != instance()._icons.end()) instance()._icons.erase(iter); diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index 261a9c72..6f2d71fc 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -130,8 +130,8 @@ protected: } }; - typedef map<pair<string, int>, Gdk::Pixbuf*, LexicalCompare<string, int> > IconMap; - IconMap _icons; + typedef map<pair<string, int>, Gdk::Pixbuf*, LexicalCompare<string, int> > Icons; + Icons _icons; App(Ingen::Shared::World* world); diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index 4fec2626..90e873a9 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -244,14 +244,13 @@ PatchCanvas::add_node(SharedPtr<NodeModel> nm) SharedPtr<PatchModel> pm = PtrCast<PatchModel>(nm); SharedPtr<NodeModule> module; - if (pm) + if (pm) { module = SubpatchModule::create(shared_this, pm); - else { + } else { module = NodeModule::create(shared_this, nm); - const PluginModel* plugm = - dynamic_cast<const PluginModel*>(nm->plugin()); - if (plugm) - module->set_icon(App::instance().icon_from_path(plugm->icon_path(), 100)); + const PluginModel* plugm = dynamic_cast<const PluginModel*>(nm->plugin()); + if (plugm && plugm->icon_path() != "") + module->set_icon(App::instance().icon_from_path(plugm->icon_path(), 100)); } add_item(module); |