summaryrefslogtreecommitdiffstats
path: root/src/libs/gui/App.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-23 01:34:20 +0000
committerDavid Robillard <d@drobilla.net>2007-10-23 01:34:20 +0000
commit203d851e116d4590897eceab582f735fb30c4e26 (patch)
tree6401fba1a9aadba23fe4533f0411c5368cca334a /src/libs/gui/App.cpp
parentb03655afdbcc901755492eae07bef92d9c65be8c (diff)
downloadingen-203d851e116d4590897eceab582f735fb30c4e26.tar.gz
ingen-203d851e116d4590897eceab582f735fb30c4e26.tar.bz2
ingen-203d851e116d4590897eceab582f735fb30c4e26.zip
Plugin icon cache and plugin icons in the plugin dialog, from larsl.
git-svn-id: http://svn.drobilla.net/lad/ingen@900 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui/App.cpp')
-rw-r--r--src/libs/gui/App.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index fde2fdaa..997ae791 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -355,6 +355,25 @@ App::quit()
}
+Glib::RefPtr<Gdk::Pixbuf>
+App::icon_from_path(const string& path)
+{
+ map<string, Glib::RefPtr<Gdk::Pixbuf> >::iterator iter = _icons.find(path);
+
+ if (iter != _icons.end())
+ return iter->second;
+
+ Glib::RefPtr<Gdk::Pixbuf> buf;
+ try {
+ buf = Gdk::Pixbuf::create_from_file(path, 20, 20);
+ _icons.insert(make_pair(path, buf));
+ } catch (...) {
+ buf = Glib::RefPtr<Gdk::Pixbuf>(0);
+ }
+ return buf;
+}
+
+
} // namespace GUI
} // namespace Ingen