diff options
Diffstat (limited to 'libnautilus-extensions/nautilus-directory.c')
-rw-r--r-- | libnautilus-extensions/nautilus-directory.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c index 44c311288..60b2056c4 100644 --- a/libnautilus-extensions/nautilus-directory.c +++ b/libnautilus-extensions/nautilus-directory.c @@ -787,6 +787,7 @@ nautilus_directory_notify_files_added (GList *uris) } hash_table_list_prepend (added_lists, directory, vfs_uri); nautilus_directory_unref (directory); + /* FIXME: do we need to ref here if the file is added to a monitored directory? */ } @@ -839,6 +840,7 @@ nautilus_directory_notify_files_removed (GList *uris) hash_table_list_prepend (changed_lists, file->details->directory, file); + /* FIXME: do we need to unref here if the file is in a monitored directory? */ } /* Now send out the changed signals. */ @@ -858,7 +860,7 @@ nautilus_directory_notify_files_moved (GList *uri_pairs) NautilusFile *file; NautilusDirectory *old_directory, *new_directory; GHashTable *parent_directories; - GList *new_files_list, *unref_list; + GList *new_files_list, *unref_list, *ref_list; GHashTable *added_lists, *changed_lists; GList **files; char *name; @@ -868,6 +870,7 @@ nautilus_directory_notify_files_moved (GList *uri_pairs) added_lists = g_hash_table_new (g_direct_hash, g_direct_equal); changed_lists = g_hash_table_new (g_direct_hash, g_direct_equal); unref_list = NULL; + ref_list = NULL; /* Make a list of parent directories that will need their counts updated. */ parent_directories = g_hash_table_new (g_direct_hash, g_direct_equal); @@ -878,7 +881,12 @@ nautilus_directory_notify_files_moved (GList *uri_pairs) /* Move an existing file. */ file = nautilus_file_get (pair->from_uri); if (file == NULL) { - /* Handle this as it it was a new file. */ + /* FIXME: + * nautilus_file_get will never return NULL + * what is this really trying to do? + */ + + /* Handle this as if it was a new file. */ new_files_list = g_list_prepend (new_files_list, pair->to_uri); } else { @@ -927,14 +935,21 @@ nautilus_directory_notify_files_moved (GList *uri_pairs) hash_table_list_prepend (added_lists, new_directory, file); - } - /* If the old directory was monitoring files, then it - * may have been the only one with a ref to the file. - */ - if (nautilus_directory_is_file_list_monitored (old_directory)) { - unref_list = g_list_prepend (unref_list, file); + /* If the old directory was monitoring files, then it + * may have been the only one with a ref to the file. + */ + if (nautilus_directory_is_file_list_monitored (old_directory)) { + unref_list = g_list_prepend (unref_list, file); + } + /* If the new directory is monitored, need to ref the file + * as it would get if it was in the directory when we started the monitor + */ + if (nautilus_directory_is_file_list_monitored (new_directory)) { + ref_list = g_list_prepend (ref_list, file); + } } + /* Done with the old directory. */ nautilus_directory_unref (old_directory); @@ -950,6 +965,10 @@ nautilus_directory_notify_files_moved (GList *uri_pairs) g_hash_table_foreach (added_lists, call_files_added_free_list, NULL); g_hash_table_destroy (added_lists); + /* Ref the files we need. */ + nautilus_file_list_ref (ref_list); + g_list_free (ref_list); + /* Let the file objects go. */ nautilus_file_list_free (unref_list); |