[Xfce4-commits] <thunar:master> Do not freeze on new files outsize this directory (bug #9468).
Nick Schermer
noreply at xfce.org
Thu Nov 8 21:32:01 CET 2012
Updating branch refs/heads/master
to a8019e2b5a90bdc63ae4e2784baa9429e806a521 (commit)
from 331aaee90d111555e4da5fa7f5be52cc5cfb3bd6 (commit)
commit a8019e2b5a90bdc63ae4e2784baa9429e806a521
Author: Nick Schermer <nick at xfce.org>
Date: Thu Nov 8 21:28:48 2012 +0100
Do not freeze on new files outsize this directory (bug #9468).
The ThunarFile was never loaded because it was not created,
so check if the new files belong to this directory,
else do no try to reload later.
Was easy to reproduce to dnd into a folder.
thunar/thunar-gio-extensions.h | 1 -
thunar/thunar-standard-view.c | 14 ++++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h
index 4efbef0..d29b963 100644
--- a/thunar/thunar-gio-extensions.h
+++ b/thunar/thunar-gio-extensions.h
@@ -62,7 +62,6 @@ GType thunar_g_file_list_get_type (void);
GList *thunar_g_file_list_new_from_string (const gchar *string);
gchar **thunar_g_file_list_to_stringv (GList *list);
-gchar *thunar_g_file_list_to_string (GList *list);
/* deep copy jobs for GLists */
#define thunar_g_file_list_append(list,object) g_list_append (list, g_object_ref (G_OBJECT (object)))
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index acb3283..e2050eb 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -2802,6 +2802,8 @@ thunar_standard_view_new_files (ThunarStandardView *standard_view,
GList *file_list = NULL;
GList *lp;
GtkWidget *source_view;
+ GFile *parent_file;
+ gboolean belongs_here;
_thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view));
@@ -2820,12 +2822,18 @@ thunar_standard_view_new_files (ThunarStandardView *standard_view,
}
else if (G_LIKELY (path_list != NULL))
{
+ /* to check if we should reload */
+ parent_file = thunar_file_get_file (standard_view->priv->current_directory);
+ belongs_here = FALSE;
+
/* determine the files for the paths */
for (lp = path_list; lp != NULL; lp = lp->next)
{
file = thunar_file_cache_lookup (lp->data);
if (G_LIKELY (file != NULL))
file_list = g_list_prepend (file_list, file);
+ else if (!belongs_here && g_file_has_parent (lp->data, parent_file))
+ belongs_here = TRUE;
}
/* check if we have any new files here */
@@ -2840,9 +2848,11 @@ thunar_standard_view_new_files (ThunarStandardView *standard_view,
/* grab the focus to the view widget */
gtk_widget_grab_focus (GTK_BIN (standard_view)->child);
}
- else
+ else if (belongs_here)
{
- /* thunar files are not created yet, try again later */
+ /* thunar files are not created yet, try again later because we know
+ * some of them belong in this directory, so eventually they
+ * will get a ThunarFile */
standard_view->priv->new_files_path_list = thunar_g_file_list_copy (path_list);
}
}
More information about the Xfce4-commits
mailing list