[nautilus] icon-info: add nautilus_icon_theme_can_render()



commit 110a0e8f2b9ec96b34e4b76390e3f78adc9cda30
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Aug 20 09:56:30 2010 +0200

    icon-info: add nautilus_icon_theme_can_render()

 libnautilus-private/nautilus-icon-info.c |   21 +++++++++++++++++++++
 libnautilus-private/nautilus-icon-info.h |    1 +
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-icon-info.c b/libnautilus-private/nautilus-icon-info.c
index f39ad42..afe5c07 100644
--- a/libnautilus-private/nautilus-icon-info.c
+++ b/libnautilus-private/nautilus-icon-info.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 /* nautilus-icon-info.c
  * Copyright (C) 2007  Red Hat, Inc.,  Alexander Larsson <alexl redhat com>
  *
@@ -695,3 +696,23 @@ nautilus_icon_get_emblem_size_for_icon_size (guint size)
 	
 	return 0; /* no emblems for smaller sizes */
 }
+
+gboolean
+nautilus_icon_theme_can_render (GThemedIcon *icon)
+{
+	GtkIconTheme *icon_theme;
+	const gchar * const *names;
+	gint idx;
+
+	names = g_themed_icon_get_names (icon);
+
+	icon_theme = gtk_icon_theme_get_default ();
+
+	for (idx = 0; names[idx] != NULL; idx++) {
+		if (gtk_icon_theme_has_icon (icon_theme, names[idx])) {
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
diff --git a/libnautilus-private/nautilus-icon-info.h b/libnautilus-private/nautilus-icon-info.h
index 5ef6cd2..95a5341 100644
--- a/libnautilus-private/nautilus-icon-info.h
+++ b/libnautilus-private/nautilus-icon-info.h
@@ -87,6 +87,7 @@ guint nautilus_icon_get_smaller_icon_size            (guint              size);
 gint  nautilus_get_icon_size_for_stock_size          (GtkIconSize        size);
 guint nautilus_icon_get_emblem_size_for_icon_size    (guint              size);
 
+gboolean nautilus_icon_theme_can_render              (GThemedIcon *icon);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]