diff options
author | Colin Atkinson <colin@atakama.com> | 2019-08-07 13:36:43 -0400 |
---|---|---|
committer | António Fernandes <antoniojpfernandes@gmail.com> | 2019-08-31 18:37:56 +0000 |
commit | 8efe35665368539de0e15f150292996cb0ab9121 (patch) | |
tree | a6eea6c5aa34ca81b4de38af0c08769f650f8b8c | |
parent | 4a8ff42c82992c32bbc7b295937a62d618d935d2 (diff) | |
download | nautilus-8efe35665368539de0e15f150292996cb0ab9121.tar.gz |
file: use emblems for files that use default icon
Files that fall back on the statically-allocated default GIcon will not
have emblems drawn on them. Create a new GIcon with emblems on it if
needed, and document the circumstances that lead to this case being hit.
Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/1189
-rw-r--r-- | src/nautilus-file.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/nautilus-file.c b/src/nautilus-file.c index 8d1fbb54c..45603af08 100644 --- a/src/nautilus-file.c +++ b/src/nautilus-file.c @@ -5327,10 +5327,31 @@ nautilus_file_get_icon (NautilusFile *file, icon = nautilus_icon_info_lookup (gicon, size, scale); g_object_unref (gicon); + /* Files for which the MIME type cannot be determined will result in + * the icon being detected as a fallback. This is because the default + * theme does not have icons for the names corresponding to these file + * types. */ if (nautilus_icon_info_is_fallback (icon)) { g_object_unref (icon); - icon = nautilus_icon_info_lookup (get_default_file_icon (), size, scale); + + gicon = get_default_file_icon (); + + /* Increase ref count on gicon, even though it is statically + * allocated. This is needed because apply_emblems_to_icon + * decreases the ref count on the original icon it is given. */ + g_object_ref (gicon); + + if (flags & NAUTILUS_FILE_ICON_FLAGS_USE_EMBLEMS) + { + apply_emblems_to_icon (file, &gicon, flags); + } + + icon = nautilus_icon_info_lookup (gicon, size, scale); + + /* Decrease ref count on either the static default icon, or on the + * newly-created emblemed icon. */ + g_object_unref (gicon); } } |