summaryrefslogtreecommitdiffstats
path: root/src/libs/gui/App.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-12-19 06:58:52 +0000
committerDavid Robillard <d@drobilla.net>2007-12-19 06:58:52 +0000
commit15b8dcbbdd68473df4ad188be16a1344985fbf66 (patch)
treed5bbcfaf7ae4aaa4f22aba8aa40c72bc8d404788 /src/libs/gui/App.cpp
parent961b74bb60ee45954972dce5aec194fd5c21e569 (diff)
downloadingen-15b8dcbbdd68473df4ad188be16a1344985fbf66.tar.gz
ingen-15b8dcbbdd68473df4ad188be16a1344985fbf66.tar.bz2
ingen-15b8dcbbdd68473df4ad188be16a1344985fbf66.zip
Fix LV2 GUI embedding.
Clean up LV2 icon stuff. Fix flood of "unable to load icon" warnings. git-svn-id: http://svn.drobilla.net/lad/ingen@980 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui/App.cpp')
-rw-r--r--src/libs/gui/App.cpp13
1 files changed, 8 insertions, 5 deletions
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);