summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private/caja-file.c')
-rw-r--r--libcaja-private/caja-file.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 1958fafc..85f8a9ce 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -4276,7 +4276,9 @@ caja_file_get_icon (CajaFile *file,
pixbuf = caja_icon_info_get_pixbuf (icon);
if (pixbuf != NULL) {
- caja_ui_frame_image (&pixbuf);
+ if (!file->details->is_launcher && !gdk_pixbuf_get_has_alpha (pixbuf)) {
+ caja_ui_frame_image (&pixbuf);
+ }
g_object_unref (icon);
icon = caja_icon_info_new_for_pixbuf (pixbuf);
@@ -4320,7 +4322,14 @@ caja_file_get_icon (CajaFile *file,
MAX (h * scale, 1),
GDK_INTERP_BILINEAR);
- caja_ui_frame_image (&scaled_pixbuf);
+ /* Render frames only for thumbnails of non-image files
+ and for images with no alpha channel. */
+ gboolean is_image = strncmp(eel_ref_str_peek (file->details->mime_type), "image/", 6) == 0;
+ if (!is_image ||
+ is_image && !gdk_pixbuf_get_has_alpha (raw_pixbuf)) {
+ caja_ui_frame_image (&scaled_pixbuf);
+ }
+
g_object_unref (raw_pixbuf);
/* Don't scale up if more than 25%, then read the original
@@ -7149,7 +7158,7 @@ caja_file_is_binary (CajaFile *file)
gboolean is_binary = FALSE;
int c;
- int i;
+ int i = 0;
FILE *fp;
/* Check the first 4096 bytes of the files. If these contains a 0,
@@ -7158,15 +7167,21 @@ caja_file_is_binary (CajaFile *file)
*/
fp = g_fopen (g_file_get_path (caja_file_get_location (file)), "r");
- for (i = 0; i < 4096; i++) {
- c = fgetc(fp);
- if (c == EOF) {
+ if (fp == NULL)
+ {
+ return FALSE;
+ }
+
+ while (!feof (fp)) {
+ if (i > 4096) {
break;
}
- else if (c == 0) {
+ c = fgetc(fp);
+ if (c == 0) {
is_binary = TRUE;
break;
}
+ i++;
}
fclose(fp);