top-left text
- From: Alexander Larsson <alexl redhat com>
- To: nautilus-list gnome org, <gnome-hackers gnome org>, <release-team gnome org>
- Cc: andersca codefactory com
- Subject: top-left text
- Date: Fri, 24 Jan 2003 05:40:27 -0500 (EST)
I looked into why we don't get top-left text for text/plain files in
nautilus HEAD. The reason is the generic mimetype icon for "text/*" in
gnome-icon-theme (called "gnome-mime-text"). It is a "text file" icon,
i.e. it looks like a paper with some text on it.
This is great for typical applications, but for nautilus or any app that
does text embedding you really want to use "gnome-fs-regular", as that
icon has an EmbeddedTextRectangle and looks like an empty paper.
Nautilus passes GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT to
gnome_icon_lookup(), so we can special case this libgnomeui if we want.
Here are patches that makes text get top-left text in nautilus if enabled.
patch for libgnomeui to make it work:
diff -u -p -r1.7 gnome-icon-lookup.c
--- gnome-icon-lookup.c 7 Nov 2002 13:51:32 -0000 1.7
+++ gnome-icon-lookup.c 24 Jan 2003 10:36:51 -0000
@@ -139,7 +139,7 @@ make_mime_name (const char *mime_type)
}
static char *
-make_generic_mime_name (const char *mime_type)
+make_generic_mime_name (const char *mime_type, gboolean embedd_text)
{
char *generic_mime_type, *icon_name;
char *p;
@@ -155,8 +155,11 @@ make_generic_mime_name (const char *mime
if ((p = strchr(generic_mime_type, '/')) != NULL)
{
*p = 0;
-
- icon_name = g_strconcat (ICON_NAME_MIME_PREFIX, generic_mime_type, NULL);
+
+ if (strcmp ("text", generic_mime_type) == 0 && embedd_text)
+ icon_name = g_strdup ("gnome-fs-regular");
+ else
+ icon_name = g_strconcat (ICON_NAME_MIME_PREFIX, generic_mime_type, NULL);
}
g_free (generic_mime_type);
@@ -289,7 +292,7 @@ gnome_icon_lookup (GnomeIconTheme
return mime_name;
g_free (mime_name);
- mime_name = make_generic_mime_name (mime_type);
+ mime_name = make_generic_mime_name (mime_type, flags & GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT);
if (mime_name && gnome_icon_theme_has_icon (icon_theme, mime_name))
return mime_name;
g_free (mime_name);
patch for nautilus to get the real text mime icon if embedded text is
disabled:
diff -u -p -r1.285 nautilus-icon-factory.c
--- nautilus-icon-factory.c 20 Jan 2003 17:29:20 -0000 1.285
+++ nautilus-icon-factory.c 24 Jan 2003 10:38:25 -0000
@@ -747,7 +747,8 @@ nautilus_icon_factory_get_icon_for_file
GnomeVFSFileInfo *file_info;
GnomeThumbnailFactory *thumb_factory;
gboolean show_thumb;
-
+ GnomeIconLookupFlags lookup_flags;
+
if (file == NULL) {
return NULL;
}
@@ -783,15 +784,18 @@ nautilus_icon_factory_get_icon_for_file
} else {
thumb_factory = NULL;
}
-
+
+ lookup_flags = GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES;
+ if (nautilus_file_peek_top_left_text (file) != NULL) {
+ lookup_flags |= GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT;
+ }
icon_name = gnome_icon_lookup (factory->icon_theme,
thumb_factory,
file_uri,
custom_icon,
nautilus_file_peek_vfs_file_info (file),
mime_type,
- GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT |
- GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES,
+ lookup_flags,
&lookup_result);
Should we try to get this into the 2.2.0 release? I guess this is a bit of
a regression.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's a hate-fuelled ninja ex-con with a mysterious suitcase handcuffed to his
arm. She's a sarcastic out-of-work bounty hunter from the wrong side of the
tracks. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]