- Manually check for fallback file icon since we're not always returning

that from gio anymore (from upstream)
This commit is contained in:
Alexander Larsson 2008-10-24 09:33:34 +00:00
parent 4245746db1
commit ca101f0ba7
2 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,75 @@
Index: libnautilus-private/nautilus-icon-info.c
===================================================================
--- libnautilus-private/nautilus-icon-info.c (revision 14759)
+++ libnautilus-private/nautilus-icon-info.c (revision 14760)
@@ -59,6 +59,12 @@ nautilus_icon_info_init (NautilusIconInf
icon->sole_owner = TRUE;
}
+gboolean
+nautilus_icon_info_is_fallback (NautilusIconInfo *icon)
+{
+ return icon->pixbuf == NULL;
+}
+
static void
pixbuf_toggle_notify (gpointer info,
GObject *object,
Index: libnautilus-private/nautilus-icon-info.h
===================================================================
--- libnautilus-private/nautilus-icon-info.h (revision 14759)
+++ libnautilus-private/nautilus-icon-info.h (revision 14760)
@@ -58,6 +58,7 @@ NautilusIconInfo * nautilus_icon_info
int size);
NautilusIconInfo * nautilus_icon_info_lookup_from_name (const char *name,
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);
GdkPixbuf * nautilus_icon_info_get_pixbuf_nodefault_at_size (NautilusIconInfo *icon,
Index: libnautilus-private/nautilus-file.c
===================================================================
--- libnautilus-private/nautilus-file.c (revision 14759)
+++ libnautilus-private/nautilus-file.c (revision 14760)
@@ -3482,6 +3482,23 @@ nautilus_file_get_gicon (NautilusFile *f
return g_themed_icon_new ("text-x-generic");
}
+static GIcon *
+get_default_file_icon (NautilusFileIconFlags flags)
+{
+ static GIcon *fallback_icon = NULL;
+ static GIcon *fallback_icon_preview = NULL;
+ if (fallback_icon == NULL) {
+ fallback_icon = g_themed_icon_new ("text-x-generic");
+ fallback_icon_preview = g_themed_icon_new ("text-x-preview");
+ g_themed_icon_append_name (G_THEMED_ICON (fallback_icon_preview), "text-x-generic");
+ }
+ if (flags & NAUTILUS_FILE_ICON_FLAGS_EMBEDDING_TEXT) {
+ return fallback_icon_preview;
+ } else {
+ return fallback_icon;
+ }
+}
+
NautilusIconInfo *
nautilus_file_get_icon (NautilusFile *file,
int size,
@@ -3573,11 +3590,15 @@ nautilus_file_get_icon (NautilusFile *fi
if (gicon) {
icon = nautilus_icon_info_lookup (gicon, size);
+ if (nautilus_icon_info_is_fallback (icon)) {
+ g_object_unref (icon);
+ icon = nautilus_icon_info_lookup (get_default_file_icon (flags), size);
+ }
g_object_unref (gicon);
return icon;
+ } else {
+ return nautilus_icon_info_lookup (get_default_file_icon (flags), size);
}
-
- return nautilus_icon_info_new_for_pixbuf (NULL);
}
GdkPixbuf *

View File

@ -19,7 +19,7 @@
Name: nautilus
Summary: Nautilus is a file manager for GNOME
Version: 2.24.1
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
Group: User Interface/Desktops
Source: http://download.gnome.org/sources/%{name}/2.24/%{name}-%{version}.tar.bz2
@ -99,6 +99,9 @@ Patch15: nautilus-2.22.0-treeview-xds-dnd.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=519743
Patch17: nautilus-filetype-symlink-fix.patch
# From svn
Patch18: nautilus-2.24-fallback-file-icon.patch
%description
Nautilus integrates access to files, applications, media,
Internet-based resources and the Web. Nautilus delivers a dynamic and
@ -137,6 +140,7 @@ for writing nautilus extensions.
%patch10 -p0 -b .gvfs-desktop-key
%patch15 -p1 -b .xds
%patch17 -p0 -b .symlink
%patch18 -p0 -b .fallback-file-icon
%build
@ -265,6 +269,10 @@ fi
%changelog
* Fri Oct 24 2008 Alexander Larsson <alexl@redhat.com> - 2.24.1-2
- Manually check for fallback file icon since we're not
always returning that from gio anymore (from upstream)
* Mon Oct 20 2008 Tomas Bzatek <tbzatek@redhat.com> - 2.24.1-1
- Update to 2.24.1