summaryrefslogtreecommitdiff
path: root/mate-panel/panel-util.c
diff options
context:
space:
mode:
authorDenis Gorodnichev <[email protected]>2014-11-09 17:30:11 +0300
committerStefano Karapetsas <[email protected]>2014-11-18 09:46:26 +0100
commita0d8947866db1486e0be0744cec62cfdcc2199d4 (patch)
tree2ed949b3e16801d99caeed2072f74e572d79632b /mate-panel/panel-util.c
parentfb43ad39ab10826519d23ed42101d983113527bf (diff)
downloadmate-panel-a0d8947866db1486e0be0744cec62cfdcc2199d4.tar.bz2
mate-panel-a0d8947866db1486e0be0744cec62cfdcc2199d4.tar.xz
use gtk icon(pixmap) cache insteadof custom one
Diffstat (limited to 'mate-panel/panel-util.c')
-rw-r--r--mate-panel/panel-util.c22
1 files changed, 22 insertions, 0 deletions
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,