[nautilus] tree-model: only display the first emblem



commit 1d660252b408f3628a2d3d5943abcf6bfdd9091b
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Aug 20 09:57:57 2010 +0200

    tree-model: only display the first emblem
    
    Only display the first emblem we can render.

 src/file-manager/fm-tree-model.c |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index 08591df..38a092b 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -293,28 +293,23 @@ get_menu_icon_for_file (TreeNode *node,
 	emblem_icons = nautilus_file_get_emblem_icons (node->file,
 						       emblems_to_ignore);
 
-	if (emblem_icons != NULL) {
-		emblem_icon = emblem_icons->data;
-		emblem = g_emblem_new (emblem_icon);
-		emblemed_icon = g_emblemed_icon_new (gicon, emblem);
-
-		g_object_unref (emblem);
-
-		for (l = emblem_icons->next; l != NULL; l = l->next) {
-			emblem_icon = l->data;
+	/* pick only the first emblem we can render for the tree view */
+	for (l = emblem_icons; l != NULL; l = l->next) {
+		emblem_icon = l->data;
+		if (nautilus_icon_theme_can_render (G_THEMED_ICON (emblem_icon))) {
 			emblem = g_emblem_new (emblem_icon);
-			g_emblemed_icon_add_emblem
-				(G_EMBLEMED_ICON (emblemed_icon), emblem);
+			emblemed_icon = g_emblemed_icon_new (gicon, emblem);
 
+			g_object_unref (gicon);
 			g_object_unref (emblem);
-		}
-
-		eel_g_object_list_free (emblem_icons);
+			gicon = emblemed_icon;
 
-		g_object_unref (gicon);
-		gicon = emblemed_icon;
+			break;
+		}
 	}
 
+	eel_g_object_list_free (emblem_icons);
+
 	info = nautilus_icon_info_lookup (gicon, size);
 	retval = nautilus_icon_info_get_pixbuf_nodefault_at_size (info, size);
 	model = node->root->model;



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