Commit 0e91da53 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Manually fall back to default fallback icon for files if not found. Goes

2008-10-23  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-file.c:
        * libnautilus-private/nautilus-icon-info.[ch]:
	Manually fall back to default fallback icon for
	files if not found. Goes with the corresponding
	glib/gvfs change to not add the fallback icon to
	the end of files icons. (#528320)



svn path=/trunk/; revision=14759
parent 10d0231a
2008-10-23 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file.c:
* libnautilus-private/nautilus-icon-info.[ch]:
Manually fall back to default fallback icon for
files if not found. Goes with the corresponding
glib/gvfs change to not add the fallback icon to
the end of files icons. (#528320)
2008-10-22 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file.c
......
......@@ -3481,6 +3481,23 @@ nautilus_file_get_gicon (NautilusFile *file,
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,
......@@ -3572,11 +3589,15 @@ nautilus_file_get_icon (NautilusFile *file,
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 *
......
......@@ -59,6 +59,12 @@ nautilus_icon_info_init (NautilusIconInfo *icon)
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,
......
......@@ -58,6 +58,7 @@ NautilusIconInfo * nautilus_icon_info_lookup (GIcon
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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment