static void nemo_icon_view_container_unfreeze_updates (NemoIconContainer *container) { NemoIconView *icon_view; icon_view = get_icon_view (container); g_return_if_fail (icon_view != NULL); nemo_view_unfreeze_updates (NEMO_VIEW (icon_view)); }
static void fm_icon_container_unfreeze_updates (CajaIconContainer *container) { FMIconView *icon_view; icon_view = get_icon_view (container); g_return_if_fail (icon_view != NULL); fm_directory_view_unfreeze_updates (FM_DIRECTORY_VIEW (icon_view)); }
static int nemo_icon_view_container_compare_icons (NemoIconContainer *container, NemoIconData *icon_a, NemoIconData *icon_b) { NemoIconView *icon_view; icon_view = get_icon_view (container); g_return_val_if_fail (icon_view != NULL, 0); if (NEMO_ICON_VIEW_CONTAINER (container)->sort_for_desktop) { return fm_desktop_icon_container_icons_compare (container, icon_a, icon_b); } /* Type unsafe comparisons for performance */ return nemo_icon_view_compare_files (icon_view, (NemoFile *)icon_a, (NemoFile *)icon_b); }
static int fm_icon_container_compare_icons (CajaIconContainer *container, CajaIconData *icon_a, CajaIconData *icon_b) { FMIconView *icon_view; icon_view = get_icon_view (container); g_return_val_if_fail (icon_view != NULL, 0); if (FM_ICON_CONTAINER (container)->sort_for_desktop) { return fm_desktop_icon_container_icons_compare (container, icon_a, icon_b); } /* Type unsafe comparisons for performance */ return fm_icon_view_compare_files (icon_view, (CajaFile *)icon_a, (CajaFile *)icon_b); }
static NemoIconInfo * nemo_icon_view_container_get_icon_images (NemoIconContainer *container, NemoIconData *data, int size, char **embedded_text, gboolean for_drag_accept, gboolean need_large_embeddded_text, gboolean *embedded_text_needs_loading, gboolean *has_window_open) { NemoIconView *icon_view; char **emblems_to_ignore; NemoFile *file; NemoFileIconFlags flags; NemoIconInfo *icon_info; GdkPixbuf *pixbuf; GIcon *emblemed_icon; GEmblem *emblem; GList *emblem_icons, *l; gint scale; file = (NemoFile *) data; g_assert (NEMO_IS_FILE (file)); icon_view = get_icon_view (container); g_return_val_if_fail (icon_view != NULL, NULL); *has_window_open = nemo_file_has_open_window (file); flags = NEMO_FILE_ICON_FLAGS_USE_MOUNT_ICON_AS_EMBLEM | NEMO_FILE_ICON_FLAGS_USE_THUMBNAILS; if (for_drag_accept) { flags |= NEMO_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT; } emblems_to_ignore = nemo_view_get_emblem_names_to_exclude (NEMO_VIEW (icon_view)); emblem_icons = nemo_file_get_emblem_icons (file, emblems_to_ignore); g_strfreev (emblems_to_ignore); scale = gtk_widget_get_scale_factor (GTK_WIDGET (icon_view)); icon_info = nemo_file_get_icon (file, size, scale, flags); /* apply emblems */ if (emblem_icons != NULL) { l = emblem_icons; pixbuf = nemo_icon_info_get_pixbuf (icon_info); gint w, h, s; gboolean bad_ratio; w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); s = MAX (w, h); if (s < size) size = s; bad_ratio = nemo_icon_get_emblem_size_for_icon_size (size) * scale > w || nemo_icon_get_emblem_size_for_icon_size (size) * scale > h; if (bad_ratio) goto skip_emblem; /* Would prefer to not use goto, but * I don't want to do these checks on * non-emblemed icons (the majority) * as it would be too costly */ emblem = g_emblem_new (l->data); emblemed_icon = g_emblemed_icon_new (G_ICON (pixbuf), emblem); g_object_unref (emblem); for (l = l->next; l != NULL; l = l->next) { emblem = g_emblem_new (l->data); g_emblemed_icon_add_emblem (G_EMBLEMED_ICON (emblemed_icon), emblem); g_object_unref (emblem); } g_clear_object (&icon_info); icon_info = nemo_icon_info_lookup (emblemed_icon, size, scale); g_object_unref (emblemed_icon); skip_emblem: g_object_unref (pixbuf); } if (emblem_icons != NULL) { g_list_free_full (emblem_icons, g_object_unref); } return icon_info; }
/* This callback returns the text, both the editable part, and the * part below that is not editable. */ static void nemo_icon_view_container_get_icon_text (NemoIconContainer *container, NemoIconData *data, char **editable_text, char **additional_text, gboolean include_invisible) { GQuark *attributes; char *text_array[4]; int i, j, num_attributes; NemoIconView *icon_view; NemoFile *file; gboolean use_additional; file = NEMO_FILE (data); g_assert (NEMO_IS_FILE (file)); g_assert (editable_text != NULL); icon_view = get_icon_view (container); g_return_if_fail (icon_view != NULL); use_additional = (additional_text != NULL); /* In the smallest zoom mode, no text is drawn. */ if (nemo_icon_container_get_zoom_level (container) == NEMO_ZOOM_LEVEL_SMALLEST && !include_invisible) { *editable_text = NULL; } else { /* Strip the suffix for nemo object xml files. */ *editable_text = nemo_file_get_display_name (file); } if (!use_additional) { return; } if (nemo_icon_view_is_compact (icon_view)) { *additional_text = NULL; return; } if (NEMO_IS_DESKTOP_ICON_FILE (file) || nemo_file_is_nemo_link (file)) { /* Don't show the normal extra information for desktop icons, * or desktop files, it doesn't make sense. */ *additional_text = NULL; return; } /* Find out what attributes go below each icon. */ attributes = nemo_icon_view_container_get_icon_text_attribute_names (container, &num_attributes); /* Get the attributes. */ j = 0; for (i = 0; i < num_attributes; ++i) { if (attributes[i] == attribute_none_q) { continue; } text_array[j++] = nemo_file_get_string_attribute_with_default_q (file, attributes[i]); } text_array[j] = NULL; /* Return them. */ if (j == 0) { *additional_text = NULL; } else if (j == 1) { /* Only one item, avoid the strdup + free */ *additional_text = text_array[0]; } else { *additional_text = g_strjoinv ("\n", text_array); for (i = 0; i < j; i++) { g_free (text_array[i]); } } }
static CajaIconInfo * fm_icon_container_get_icon_images (CajaIconContainer *container, CajaIconData *data, int size, GList **emblem_pixbufs, char **embedded_text, gboolean for_drag_accept, gboolean need_large_embeddded_text, gboolean *embedded_text_needs_loading, gboolean *has_window_open) { FMIconView *icon_view; char **emblems_to_ignore; CajaFile *file; gboolean use_embedding; CajaFileIconFlags flags; guint emblem_size; file = (CajaFile *) data; g_assert (CAJA_IS_FILE (file)); icon_view = get_icon_view (container); g_return_val_if_fail (icon_view != NULL, NULL); use_embedding = FALSE; if (embedded_text) { *embedded_text = caja_file_peek_top_left_text (file, need_large_embeddded_text, embedded_text_needs_loading); use_embedding = *embedded_text != NULL; } if (emblem_pixbufs != NULL) { emblem_size = caja_icon_get_emblem_size_for_icon_size (size); /* don't return images larger than the actual icon size */ emblem_size = MIN (emblem_size, size); if (emblem_size > 0) { emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude (FM_DIRECTORY_VIEW (icon_view)); *emblem_pixbufs = caja_file_get_emblem_pixbufs (file, emblem_size, FALSE, emblems_to_ignore); g_strfreev (emblems_to_ignore); } } *has_window_open = caja_file_has_open_window (file); flags = CAJA_FILE_ICON_FLAGS_USE_MOUNT_ICON_AS_EMBLEM; if (!fm_icon_view_is_compact (icon_view) || caja_icon_container_get_zoom_level (container) > CAJA_ZOOM_LEVEL_STANDARD) { flags |= CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS; if (fm_icon_view_is_compact (icon_view)) { flags |= CAJA_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE; } } if (use_embedding) { flags |= CAJA_FILE_ICON_FLAGS_EMBEDDING_TEXT; } if (for_drag_accept) { flags |= CAJA_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT; } return caja_file_get_icon (file, size, flags); }
/* This callback returns the text, both the editable part, and the * part below that is not editable. */ static void fm_icon_container_get_icon_text (CajaIconContainer *container, CajaIconData *data, char **editable_text, char **additional_text, gboolean include_invisible) { char *actual_uri; gchar *description; GQuark *attributes; char *text_array[4]; int i, j, num_attributes; FMIconView *icon_view; CajaFile *file; gboolean use_additional; file = CAJA_FILE (data); g_assert (CAJA_IS_FILE (file)); g_assert (editable_text != NULL); icon_view = get_icon_view (container); g_return_if_fail (icon_view != NULL); use_additional = (additional_text != NULL); /* In the smallest zoom mode, no text is drawn. */ if (caja_icon_container_get_zoom_level (container) == CAJA_ZOOM_LEVEL_SMALLEST && !include_invisible) { *editable_text = NULL; } else { /* Strip the suffix for caja object xml files. */ *editable_text = caja_file_get_display_name (file); } if (!use_additional) { return; } if (fm_icon_view_is_compact (icon_view)) { *additional_text = NULL; return; } if (CAJA_IS_DESKTOP_ICON_FILE (file)) { /* Don't show the normal extra information for desktop icons, it doesn't * make sense. */ *additional_text = NULL; return; } /* Handle link files specially. */ if (caja_file_is_caja_link (file)) { /* FIXME bugzilla.gnome.org 42531: Does sync. I/O and works only locally. */ *additional_text = NULL; if (caja_file_is_local (file)) { actual_uri = caja_file_get_uri (file); description = caja_link_local_get_additional_text (actual_uri); if (description) *additional_text = g_strdup_printf (" \n%s\n ", description); g_free (description); g_free (actual_uri); } /* Don't show the normal extra information for desktop files, it doesn't * make sense. */ return; } /* Find out what attributes go below each icon. */ attributes = fm_icon_container_get_icon_text_attribute_names (container, &num_attributes); /* Get the attributes. */ j = 0; for (i = 0; i < num_attributes; ++i) { if (attributes[i] == attribute_none_q) { continue; } text_array[j++] = caja_file_get_string_attribute_with_default_q (file, attributes[i]); } text_array[j] = NULL; /* Return them. */ if (j == 0) { *additional_text = NULL; } else if (j == 1) { /* Only one item, avoid the strdup + free */ *additional_text = text_array[0]; } else { *additional_text = g_strjoinv ("\n", text_array); for (i = 0; i < j; i++) { g_free (text_array[i]); } } }