From 203d851e116d4590897eceab582f735fb30c4e26 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 23 Oct 2007 01:34:20 +0000 Subject: 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 --- src/libs/gui/App.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/libs/gui/App.cpp') 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 +App::icon_from_path(const string& path) +{ + map >::iterator iter = _icons.find(path); + + if (iter != _icons.end()) + return iter->second; + + Glib::RefPtr buf; + try { + buf = Gdk::Pixbuf::create_from_file(path, 20, 20); + _icons.insert(make_pair(path, buf)); + } catch (...) { + buf = Glib::RefPtr(0); + } + return buf; +} + + } // namespace GUI } // namespace Ingen -- cgit v1.2.1