summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Wieser <pwieser@trychlos.org>2009-11-25 08:31:39 +0100
committerAlexander Larsson <alexl@redhat.com>2009-11-25 08:33:49 +0100
commite60d5e25b010f58f34231b160c90592a13b9efe8 (patch)
treeca152784bbce6f7a829c00bba21b4d4a63099920
parentc45bb3bdc577fd845eaec7a15171946e2331ce38 (diff)
downloadnautilus-e60d5e25b010f58f34231b160c90592a13b9efe8.tar.gz
Add nautilus_icon_info_lookup_from_path()
(cherry picked from commit 36d83807cc0744e131e3532714849a7d1bbbf65d)
-rw-r--r--libnautilus-private/nautilus-icon-info.c17
-rw-r--r--libnautilus-private/nautilus-icon-info.h2
2 files changed, 18 insertions, 1 deletions
diff --git a/libnautilus-private/nautilus-icon-info.c b/libnautilus-private/nautilus-icon-info.c
index f1ddd7cb8..f39ad4250 100644
--- a/libnautilus-private/nautilus-icon-info.c
+++ b/libnautilus-private/nautilus-icon-info.c
@@ -435,13 +435,28 @@ nautilus_icon_info_lookup_from_name (const char *name,
{
GIcon *icon;
NautilusIconInfo *info;
-
+
icon = g_themed_icon_new (name);
info = nautilus_icon_info_lookup (icon, size);
g_object_unref (icon);
return info;
}
+NautilusIconInfo *
+nautilus_icon_info_lookup_from_path (const char *path,
+ int size)
+{
+ GFile *icon_file;
+ GIcon *icon;
+ NautilusIconInfo *info;
+
+ icon_file = g_file_new_for_path (path);
+ icon = g_file_icon_new (icon_file);
+ info = nautilus_icon_info_lookup (icon, size);
+ g_object_unref (icon);
+ g_object_unref (icon_file);
+ return info;
+}
GdkPixbuf *
nautilus_icon_info_get_pixbuf_nodefault (NautilusIconInfo *icon)
diff --git a/libnautilus-private/nautilus-icon-info.h b/libnautilus-private/nautilus-icon-info.h
index d6f5b2f1b..5ef6cd2a8 100644
--- a/libnautilus-private/nautilus-icon-info.h
+++ b/libnautilus-private/nautilus-icon-info.h
@@ -58,6 +58,8 @@ NautilusIconInfo * nautilus_icon_info_lookup (GIcon
int size);
NautilusIconInfo * nautilus_icon_info_lookup_from_name (const char *name,
int size);
+NautilusIconInfo * nautilus_icon_info_lookup_from_path (const char *path,
+ int size);
gboolean nautilus_icon_info_is_fallback (NautilusIconInfo *icon);
GdkPixbuf * nautilus_icon_info_get_pixbuf (NautilusIconInfo *icon);
GdkPixbuf * nautilus_icon_info_get_pixbuf_nodefault (NautilusIconInfo *icon);