[gthumb: 3/9] always use the same height for the thumbnails
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 3/9] always use the same height for the thumbnails
- Date: Sat, 29 Jan 2011 11:01:55 +0000 (UTC)
commit e157c386b368f3736d960e3f7aa64713d7fdf539
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Jan 21 13:10:18 2011 +0100
always use the same height for the thumbnails
this allow to avoid scroll jumps when loading the thumbnails
listed before the currently visible ones.
gthumb/gth-cell-renderer-thumbnail.c | 17 +++++++++++------
gthumb/gth-file-list.c | 11 +++--------
2 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/gthumb/gth-cell-renderer-thumbnail.c b/gthumb/gth-cell-renderer-thumbnail.c
index db5f1c9..2830e6c 100644
--- a/gthumb/gth-cell-renderer-thumbnail.c
+++ b/gthumb/gth-cell-renderer-thumbnail.c
@@ -273,7 +273,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer *cell,
cr = gdk_cairo_create (window);
- image_rect.width = gdk_pixbuf_get_width (pixbuf);
+ image_rect.width = gdk_pixbuf_get_width (pixbuf);
image_rect.height = gdk_pixbuf_get_height (pixbuf);
image_rect.x = thumb_rect.x + (thumb_rect.width - image_rect.width) * .5;
image_rect.y = thumb_rect.y + (thumb_rect.height - image_rect.height) * .5;
@@ -310,12 +310,17 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer *cell,
if (state == GTK_STATE_ACTIVE)
state = GTK_STATE_SELECTED;
- if (! _g_mime_type_is_image (gth_file_data_get_mime_type (self->priv->file)))
- border = 1;
- else
+ if (self->priv->fixed_size && _g_mime_type_is_image (gth_file_data_get_mime_type (self->priv->file))) {
+ frame_rect.width = self->priv->size;
+ frame_rect.height = self->priv->size;
+ frame_rect.x = thumb_rect.x + (thumb_rect.width - frame_rect.width) * .5;
+ frame_rect.y = thumb_rect.y + (thumb_rect.height - frame_rect.height) * .5;
border = 4;
-
- frame_rect = image_rect;
+ }
+ else {
+ frame_rect = image_rect;
+ border = 1;
+ }
cairo_translate (cr, 0.5, 0.5);
cairo_set_line_width (cr, 0.5);
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index d7daa45..bf84db8 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -573,7 +573,7 @@ _gth_file_list_set_type (GthFileList *file_list,
* a time. */
g_object_set (file_list->priv->thumbnail_renderer,
- "fixed_size", (file_list->priv->type == GTH_FILE_LIST_TYPE_H_SIDEBAR),
+ "fixed_size", TRUE /* (file_list->priv->type == GTH_FILE_LIST_TYPE_H_SIDEBAR) */,
NULL);
_gth_file_list_update_orientation (file_list);
@@ -1862,10 +1862,9 @@ _gth_file_list_update_next_thumb (GthFileList *file_list)
file_data = scan->data;
thumb_data = g_hash_table_lookup (file_list->priv->thumb_data, file_data->file);
- /* disabled to avoid thumbnail jumps (bug #603642)
if (pos >= first_pos - N_VIEWAHEAD)
requested_action_performed = thumb_data->thumb_loaded;
- else*/
+ else
requested_action_performed = thumb_data->thumb_created;
if (! requested_action_performed && can_create_file_thumbnail (file_data, thumb_data, ¤t_time, &young_file_found)) {
@@ -1893,11 +1892,7 @@ _gth_file_list_update_next_thumb (GthFileList *file_list)
job->cancellable = g_cancellable_new ();
job->file_data = file_data; /* already ref-ed above */
job->pos = new_pos;
-
- /* disabled to avoid thumbnail jumps (bug #603642)
- job->update_in_view = (new_pos >= (first_pos - N_VIEWAHEAD)) && (new_pos <= (last_pos + N_VIEWAHEAD)); */
-
- job->update_in_view = (new_pos >= first_pos) && (job->pos <= last_pos + N_VIEWAHEAD);
+ job->update_in_view = (new_pos >= (first_pos - N_VIEWAHEAD)) && (new_pos <= (last_pos + N_VIEWAHEAD));
#if 0
g_print ("%d in [%d, %d] => %d\n",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]