Commit 585a0c27 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson
Browse files

The icon theme changed how the sizes of the emblem icons are used, update

2007-08-22  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-icon-container.c:
        * libnautilus-private/nautilus-icon-factory.c:
        * libnautilus-private/nautilus-icon-factory.h:
        * src/file-manager/fm-list-model.c:
        * src/nautilus-sidebar-title.c:
	The icon theme changed how the sizes of the emblem icons
	are used, update to comply with that.


svn path=/trunk/; revision=13100
parent e253f4b1
2007-08-22 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.c:
* libnautilus-private/nautilus-icon-factory.c:
* libnautilus-private/nautilus-icon-factory.h:
* src/file-manager/fm-list-model.c:
* src/nautilus-sidebar-title.c:
The icon theme changed how the sizes of the emblem icons
are used, update to comply with that.
2007-08-14 Martin Wehner <martin.wehner@gmail.com>
* configure.in:
......
......@@ -87,7 +87,6 @@
/* Maximum size (pixels) allowed for icons at the standard zoom level. */
#define MINIMUM_IMAGE_SIZE 24
#define MAXIMUM_IMAGE_SIZE 96
#define MAXIMUM_EMBLEM_SIZE 48
#define ICON_PAD_LEFT 4
#define ICON_PAD_RIGHT 4
......@@ -5692,6 +5691,7 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
GList *emblem_icon_names, *emblem_pixbufs, *p;
char *editable_text, *additional_text;
char *embedded_text;
guint emblem_size;
GdkRectangle embedded_text_rect;
gboolean large_embedded_text;
gboolean embedded_text_needs_loading;
......@@ -5753,17 +5753,20 @@ nautilus_icon_container_update_icon (NautilusIconContainer *container,
icon_size = MAX (nautilus_get_icon_size_for_zoom_level (container->details->zoom_level)
* icon->scale, NAUTILUS_ICON_SIZE_SMALLEST);
for (p = emblem_icon_names; p != NULL; p = p->next) {
emblem_pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
(p->data,
NULL,
MIN (icon_size, MAXIMUM_EMBLEM_SIZE),
NULL,
NULL,
FALSE, FALSE, NULL);
if (emblem_pixbuf != NULL) {
emblem_pixbufs = g_list_prepend
(emblem_pixbufs, emblem_pixbuf);
emblem_size = nautilus_icon_factory_get_emblem_size_for_icon_size (icon_size);
if (emblem_size != 0) {
for (p = emblem_icon_names; p != NULL; p = p->next) {
emblem_pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
(p->data,
NULL,
emblem_size,
NULL,
NULL,
FALSE, FALSE, NULL);
if (emblem_pixbuf != NULL) {
emblem_pixbufs = g_list_prepend
(emblem_pixbufs, emblem_pixbuf);
}
}
}
emblem_pixbufs = g_list_reverse (emblem_pixbufs);
......
......@@ -1012,6 +1012,21 @@ nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name)
return name_with_prefix;
}
guint
nautilus_icon_factory_get_emblem_size_for_icon_size (guint size)
{
if (size >= 96)
return 48;
if (size >= 64)
return 32;
if (size >= 48)
return 24;
if (size >= 32)
return 16;
return 0; /* no emblems for smaller sizes */
}
GList *
nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file,
EelStringList *exclude)
......
......@@ -110,6 +110,7 @@ NautilusFileAttributes nautilus_icon_factory_get_required_file_attributes (void)
GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file,
EelStringList *exclude);
char * nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name);
guint nautilus_icon_factory_get_emblem_size_for_icon_size (guint size);
guint nautilus_icon_factory_get_larger_icon_size (guint size);
guint nautilus_icon_factory_get_smaller_icon_size (guint size);
......
......@@ -248,6 +248,7 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
char *str;
GdkPixbuf *icon;
int icon_size;
guint emblem_size;
NautilusZoomLevel zoom_level;
char *modifier;
GList *emblem_icons;
......@@ -333,14 +334,23 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
}
nautilus_file_unref (parent_file);
}
emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, emblems_to_ignore);
zoom_level = fm_list_model_get_zoom_level_from_emblem_column_id (column);
icon_size = nautilus_get_icon_size_for_zoom_level (zoom_level);
emblem_size = nautilus_icon_factory_get_emblem_size_for_icon_size (icon_size);
/* Special case default icon size here. This works semi-ok, since we
only show one emblem for the list view anyway */
if (emblem_size == 0 && icon_size >= 24) {
emblem_size = 16;
}
emblem_icons = NULL;
if (emblem_size != 0) {
emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, emblems_to_ignore);
}
eel_string_list_free (emblems_to_ignore);
if (emblem_icons != NULL) {
zoom_level = fm_list_model_get_zoom_level_from_emblem_column_id (column);
icon_size = nautilus_get_icon_size_for_zoom_level (zoom_level);
icon = nautilus_icon_factory_get_pixbuf_for_icon (
emblem_icons->data, NULL, icon_size,
emblem_icons->data, NULL, emblem_size,
NULL, NULL, TRUE, FALSE, NULL);
eel_g_list_free_deep (emblem_icons);
......
......@@ -509,7 +509,7 @@ update_emblems (NautilusSidebarTitle *sidebar_title)
for (p = icons; p != NULL; p = p->next) {
pixbuf = nautilus_icon_factory_get_pixbuf_for_icon
(p->data, NULL,
NAUTILUS_ICON_SIZE_STANDARD,
nautilus_icon_factory_get_emblem_size_for_icon_size (NAUTILUS_ICON_SIZE_STANDARD),
NULL, NULL,
FALSE, FALSE, NULL);
if (pixbuf != NULL) {
......
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