~ubuntu-branches/ubuntu/trusty/gnome-system-monitor/trusty

« back to all changes in this revision

Viewing changes to src/iconthemewrapper.cpp

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2012-11-13 10:21:06 UTC
  • mfrom: (1.1.74)
  • Revision ID: package-import@ubuntu.com-20121113102106-3llisgpxxx0euc1w
Tags: 3.6.1-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    }
28
28
}
29
29
 
 
30
Glib::RefPtr<Gdk::Pixbuf>
 
31
procman::IconThemeWrapper::load_gicon(const Glib::RefPtr<Gio::Icon>& gicon,
 
32
                                      int size, Gtk::IconLookupFlags flags) const
 
33
{
 
34
    Gtk::IconInfo icon_info;
 
35
    icon_info = Gtk::IconTheme::get_default()->lookup_icon(gicon, size, flags);
 
36
 
 
37
    if (!icon_info) {
 
38
        return Glib::RefPtr<Gdk::Pixbuf>();
 
39
    }
 
40
 
 
41
    try
 
42
    {
 
43
        return icon_info.load_icon();
 
44
    }
 
45
    catch (Gtk::IconThemeError &error)
 
46
    {
 
47
        if (error.code() != Gtk::IconThemeError::ICON_THEME_NOT_FOUND)
 
48
            g_error("Cannot load gicon from theme: %s", error.what().c_str());
 
49
        return Glib::RefPtr<Gdk::Pixbuf>();
 
50
    }
 
51
    catch (Gio::Error &error)
 
52
    {
 
53
        g_debug("Could not load gicon: %s", error.what().c_str());
 
54
        return Glib::RefPtr<Gdk::Pixbuf>();
 
55
    }
 
56
}