From a0d8947866db1486e0be0744cec62cfdcc2199d4 Mon Sep 17 00:00:00 2001 From: Denis Gorodnichev Date: Sun, 9 Nov 2014 17:30:11 +0300 Subject: use gtk icon(pixmap) cache insteadof custom one --- mate-panel/panel-util.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mate-panel/panel-util.c') diff --git a/mate-panel/panel-util.c b/mate-panel/panel-util.c index 4406b755..850ea8c1 100644 --- a/mate-panel/panel-util.c +++ b/mate-panel/panel-util.c @@ -256,6 +256,28 @@ panel_uri_exists (const char *uri) return ret; } +GIcon * +panel_gicon_from_icon_name (const char *icon_name) { + GIcon *icon = NULL; + if (g_path_is_absolute(icon_name)) { + if (!g_file_test (icon_name, G_FILE_TEST_EXISTS)) { + gchar *name = g_path_get_basename (icon_name); + icon = g_themed_icon_new (name); + g_free (name); + } else { + GFile *gfile = g_file_new_for_path (icon_name); + icon = g_file_icon_new (gfile); + g_object_unref (gfile); + } + } + else { + gchar *name = panel_xdg_icon_remove_extension (icon_name); + icon = g_themed_icon_new (name); + g_free (name); + } + return icon; +} + char * panel_find_icon (GtkIconTheme *icon_theme, const char *icon_name, -- cgit v1.2.1