diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2014-09-07 21:46:15 -0700 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2014-09-08 22:07:27 -0700 |
commit | a6b88ebde1eb82cf7692bf1c0a161ff6184e9188 (patch) | |
tree | cbbe3481218ec0c2aace265924250bf8c0211e7f /src | |
parent | 150cfb7a325e7b3668cf4c386a043593a8361ce0 (diff) | |
download | nautilus-a6b88ebde1eb82cf7692bf1c0a161ff6184e9188.tar.gz |
file: apply emblems in nautilus_file_get_gicon()
We have duplicated code between the views - consolidate it inside
nautilus_file_get_gicon().
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-canvas-view-container.c | 32 | ||||
-rw-r--r-- | src/nautilus-list-model.c | 34 |
2 files changed, 4 insertions, 62 deletions
diff --git a/src/nautilus-canvas-view-container.c b/src/nautilus-canvas-view-container.c index e8a6efd86..09e3ce6c3 100644 --- a/src/nautilus-canvas-view-container.c +++ b/src/nautilus-canvas-view-container.c @@ -58,10 +58,6 @@ nautilus_canvas_view_container_get_icon_images (NautilusCanvasContainer *contain NautilusFile *file; NautilusFileIconFlags flags; NautilusIconInfo *icon_info; - GdkPixbuf *pixbuf; - GIcon *emblemed_icon; - GEmblem *emblem; - GList *emblem_icons, *l; gint scale; file = (NautilusFile *) data; @@ -81,34 +77,6 @@ nautilus_canvas_view_container_get_icon_images (NautilusCanvasContainer *contain scale = gtk_widget_get_scale_factor (GTK_WIDGET (canvas_view)); icon_info = nautilus_file_get_icon (file, size, scale, flags); - emblem_icons = nautilus_file_get_emblem_icons (file); - - /* apply emblems */ - if (emblem_icons != NULL) { - l = emblem_icons; - - emblem = g_emblem_new (l->data); - pixbuf = nautilus_icon_info_get_pixbuf (icon_info); - 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 = nautilus_icon_info_lookup (emblemed_icon, size, scale); - - g_object_unref (pixbuf); - g_object_unref (emblemed_icon); - } - - if (emblem_icons != NULL) { - g_list_free_full (emblem_icons, g_object_unref); - } return icon_info; } diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c index bf4b120bd..7da51501a 100644 --- a/src/nautilus-list-model.c +++ b/src/nautilus-list-model.c @@ -259,10 +259,6 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int NautilusFile *file; char *str; GdkPixbuf *icon, *rendered_icon; - GIcon *gicon, *emblemed_icon, *emblem_icon; - NautilusIconInfo *icon_info; - GEmblem *emblem; - GList *emblem_icons, *l; int icon_size, icon_scale; NautilusZoomLevel zoom_level; NautilusFileIconFlags flags; @@ -303,7 +299,9 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int flags = NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS | NAUTILUS_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE | - NAUTILUS_FILE_ICON_FLAGS_USE_EMBLEMS; + NAUTILUS_FILE_ICON_FLAGS_USE_EMBLEMS | + NAUTILUS_FILE_ICON_FLAGS_USE_ONE_EMBLEM; + if (model->details->drag_view != NULL) { GtkTreePath *path_a, *path_b; @@ -322,31 +320,7 @@ nautilus_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int } } - gicon = G_ICON (nautilus_file_get_icon_pixbuf (file, icon_size, TRUE, icon_scale, flags)); - emblem_icons = nautilus_file_get_emblem_icons (file); - - /* pick only the first emblem we can render for the list view */ - for (l = emblem_icons; l != NULL; l = l->next) { - emblem_icon = l->data; - if (nautilus_icon_theme_can_render (G_THEMED_ICON (emblem_icon))) { - emblem = g_emblem_new (emblem_icon); - emblemed_icon = g_emblemed_icon_new (gicon, emblem); - - g_object_unref (gicon); - g_object_unref (emblem); - gicon = emblemed_icon; - - break; - } - } - - g_list_free_full (emblem_icons, g_object_unref); - - icon_info = nautilus_icon_info_lookup (gicon, icon_size, icon_scale); - icon = nautilus_icon_info_get_pixbuf_at_size (icon_info, icon_size); - - g_object_unref (icon_info); - g_object_unref (gicon); + icon = nautilus_file_get_icon_pixbuf (file, icon_size, TRUE, icon_scale, flags); if (model->details->highlight_files != NULL && g_list_find_custom (model->details->highlight_files, |