summaryrefslogtreecommitdiff
path: root/src/iconthemewrapper.cpp
blob: 4a66f5c108218edef915fb16c8711c4aaa99e61a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <config.h>

#include <gtkmm/icontheme.h>

#include "iconthemewrapper.h"


Glib::RefPtr<Gdk::Pixbuf>
procman::IconThemeWrapper::load_icon(const Glib::ustring& icon_name,
                                     int size, Gtk::IconLookupFlags flags) const
{
    try
    {
      return Gtk::IconTheme::get_default()->load_icon(icon_name, size, flags);
    }
    catch (Gtk::IconThemeError &error)
    {
        if (error.code() != Gtk::IconThemeError::ICON_THEME_NOT_FOUND)
            g_error("Cannot load icon '%s' from theme: %s", icon_name.c_str(), error.what().c_str());
        return Glib::RefPtr<Gdk::Pixbuf>();
    }
}