Nautilus hard code freeze break request: Support emblems not starting with "emblem-"



In Nautilus, we store emblems as metadata for the emblemed files, using
keywords.

Assuming an emblem base name is "emblem-foo", it is converted to "foo".
When converting the keyword name back to an emblem name, it is prefixed
with "emblem-" again:

"foo" (keyword) <-> "emblem-foo" (emblem)

This was probably introduced because it seems a bit odd to always store
the "emblem-" prefix in the keyword name.

However, we also have emblem names that do not start with "emblem-". For
them, the emblem name should not be prefixed with "emblem-":

"foo" (keyword) <-> "foo" (emblem)

The attached patch adds a file name variant that is not prefixed with
"emblem-" to the emblem file name lookup alrogithm, so that also emblem
names which do not have this prefix are displayed.

Fixes a bug report:
http://bugzilla.gnome.org/show_bug.cgi?id=350643

best regards,
 Christian Neumair

-- 
Christian Neumair <cneumair gnome org>
Index: libnautilus-private/nautilus-icon-info.c
===================================================================
--- libnautilus-private/nautilus-icon-info.c	(Revision 14632)
+++ libnautilus-private/nautilus-icon-info.c	(Arbeitskopie)
@@ -25,8 +25,6 @@
 #include <gio/gio.h>
 #include <eel/eel-gdk-pixbuf-extensions.h>
 
-#define NAUTILUS_EMBLEM_NAME_PREFIX "emblem-"
-
 struct _NautilusIconInfo
 {
 	GObject parent;
@@ -645,16 +643,6 @@ nautilus_get_icon_size_for_stock_size (G
 }
 
 
-char *
-nautilus_icon_get_emblem_icon_by_name (const char *emblem_name)
-{
-	char *name_with_prefix;
-
-	name_with_prefix = g_strconcat (NAUTILUS_EMBLEM_NAME_PREFIX, emblem_name, NULL);
-
-	return name_with_prefix;
-}
-
 guint
 nautilus_icon_get_emblem_size_for_icon_size (guint size)
 {
Index: libnautilus-private/nautilus-icon-info.h
===================================================================
--- libnautilus-private/nautilus-icon-info.h	(Revision 14632)
+++ libnautilus-private/nautilus-icon-info.h	(Arbeitskopie)
@@ -82,7 +82,6 @@ guint nautilus_icon_get_larger_icon_size
 guint nautilus_icon_get_smaller_icon_size            (guint              size);
 
 gint  nautilus_get_icon_size_for_stock_size          (GtkIconSize        size);
-char *nautilus_icon_get_emblem_icon_by_name          (const char        *emblem_name);
 guint nautilus_icon_get_emblem_size_for_icon_size    (guint              size);
 
 
Index: libnautilus-private/nautilus-file.c
===================================================================
--- libnautilus-private/nautilus-file.c	(Revision 14633)
+++ libnautilus-private/nautilus-file.c	(Arbeitskopie)
@@ -5710,7 +5709,7 @@ nautilus_file_get_emblem_icons (Nautilus
 {
 	GList *keywords, *l;
 	GList *icons;
-	char *icon_name;
+	char *icon_names[2];
 	char *keyword;
 	int i;
 	GIcon *icon;
@@ -5752,9 +5751,12 @@ nautilus_file_get_emblem_icons (Nautilus
 			}
 		}
 		
-		icon_name = nautilus_icon_get_emblem_icon_by_name (keyword);
-		icon = g_themed_icon_new (icon_name);
-		g_free (icon_name);
+
+		icon_names[0] = g_strconcat ("emblem-", keyword, NULL);
+		icon_names[1] = keyword;
+		icon = g_themed_icon_new_from_names (icon_names, 2);
+		g_free (icon_names[0]);
+
 		icons = g_list_prepend (icons, icon);
 	}
 	


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