[gtk+] file chooser: Don't leave out icons by accident
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] file chooser: Don't leave out icons by accident
- Date: Mon, 3 Aug 2015 00:52:24 +0000 (UTC)
commit 14de03cedf74524a952a605eb76d7b445c9a0bad
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 2 20:42:42 2015 -0400
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
gtk/gtkfilechooserwidget.c | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 84dc970..ce54b14 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]