[gthumb/ext: 66/79] check if an ancestor of the current location has been deleted
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext: 66/79] check if an ancestor of the current location has been deleted
- Date: Sun, 2 Aug 2009 20:31:39 +0000 (UTC)
commit 08e9dad731b686f5cd750cc70baa3bbb257fd356
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Jul 25 09:27:32 2009 +0200
check if an ancestor of the current location has been deleted
gthumb/gth-browser.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index b9a1922..d67a7a9 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2123,6 +2123,35 @@ file_attributes_ready_cb (GthFileSource *file_source,
}
+GList *
+_g_file_list_find_file_or_ancestor (GList *l,
+ GFile *file)
+{
+ GList *link = NULL;
+ GList *scan;
+
+ for (scan = l; (link == NULL) && scan; scan = scan->next) {
+ GFile *parent;
+
+ parent = g_object_ref (file);
+ while ((parent != NULL) && ! g_file_equal (parent, (GFile *) scan->data)) {
+ GFile *tmp;
+
+ tmp = g_file_get_parent (parent);
+ g_object_unref (parent);
+ parent = tmp;
+ }
+
+ if (parent != NULL) {
+ link = scan;
+ g_object_unref (parent);
+ }
+ }
+
+ return link;
+}
+
+
static void
folder_changed_cb (GthMonitor *monitor,
GFile *parent,
@@ -2134,7 +2163,7 @@ folder_changed_cb (GthMonitor *monitor,
gboolean update_folder_tree;
gboolean update_file_list;
- if ((event == GTH_MONITOR_EVENT_DELETED) && (_g_file_list_find_file (list, browser->priv->location->file) != NULL)) {
+ if ((event == GTH_MONITOR_EVENT_DELETED) && (_g_file_list_find_file_or_ancestor (list, browser->priv->location->file) != NULL)) {
gth_browser_go_to (browser, parent);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]