diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-08-02 20:42:42 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-08-02 20:51:12 -0400 |
commit | 14de03cedf74524a952a605eb76d7b445c9a0bad (patch) | |
tree | 9969be73dcbe468b7a5e852cffccd2b2ed17d773 /gtk/gtkfilechooserwidget.c | |
parent | 9cbd9c41870ca09e2fae0f02fc0544909b105223 (diff) | |
download | gtk+-14de03cedf74524a952a605eb76d7b445c9a0bad.tar.gz |
file chooser: Don't leave out icons by accident
We only load thumbnails when we find that the row is in the visible
range of the treeview. It seems that animated scrolling makes it so
that the bottommost row stays out of the visible range until it is
too late. To work around this, extend the range by one row in each
direction.
http://bugzilla.gnome.org/show_bug.cgi?id=753142
Diffstat (limited to 'gtk/gtkfilechooserwidget.c')
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 84dc970833..ce54b14475 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -4911,8 +4911,9 @@ file_system_model_set (GtkFileSystemModel *model, else { GtkTreeModel *tree_model; - GtkTreePath *path, *start, *end; + GtkTreePath *start, *end; GtkTreeIter iter; + gboolean visible; if (priv->browse_files_tree_view == NULL || g_file_info_has_attribute (info, "filechooser::queried")) @@ -4922,15 +4923,25 @@ file_system_model_set (GtkFileSystemModel *model, if (tree_model != GTK_TREE_MODEL (model)) return FALSE; - if (!_gtk_file_system_model_get_iter_for_file (model, - &iter, - file)) + if (!_gtk_file_system_model_get_iter_for_file (model, &iter, file)) g_assert_not_reached (); - if (!gtk_tree_view_get_visible_range (GTK_TREE_VIEW (priv->browse_files_tree_view), &start, &end)) - return FALSE; - path = gtk_tree_model_get_path (tree_model, &iter); - if (gtk_tree_path_compare (start, path) != 1 && - gtk_tree_path_compare (path, end) != 1) + + if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (priv->browse_files_tree_view), &start, &end)) + { + GtkTreePath *path; + + gtk_tree_path_prev (start); + gtk_tree_path_next (end); + path = gtk_tree_model_get_path (tree_model, &iter); + visible = gtk_tree_path_compare (start, path) != 1 && + gtk_tree_path_compare (path, end) != 1; + gtk_tree_path_free (path); + gtk_tree_path_free (start); + gtk_tree_path_free (end); + } + else + visible = TRUE; + if (visible) { g_file_info_set_attribute_boolean (info, "filechooser::queried", TRUE); g_file_query_info_async (file, @@ -4943,9 +4954,6 @@ file_system_model_set (GtkFileSystemModel *model, file_system_model_got_thumbnail, model); } - gtk_tree_path_free (path); - gtk_tree_path_free (start); - gtk_tree_path_free (end); return FALSE; } } |