diff options
| author | Peter Eisenmann <p3732@getgoogleoff.me> | 2025-04-05 07:34:11 +0200 |
|---|---|---|
| committer | Peter Eisenmann <p3732@getgoogleoff.me> | 2025-04-05 07:34:11 +0200 |
| commit | c058735e19810252958b151acb8af8467a22dc6c (patch) | |
| tree | 197845b548fc391712c3a78fea353821941bdf01 | |
| parent | c15b819f0ccae038f701ad2c371aa41d914ae8eb (diff) | |
| -rw-r--r-- | src/nautilus-directory.c | 38 | ||||
| -rw-r--r-- | src/nautilus-file.c | 27 |
2 files changed, 29 insertions, 36 deletions
diff --git a/src/nautilus-directory.c b/src/nautilus-directory.c index 618770a5d..4176c0c7a 100644 --- a/src/nautilus-directory.c +++ b/src/nautilus-directory.c @@ -1148,10 +1148,9 @@ nautilus_directory_notify_files_added (GList *files) { GHashTable *added_lists; GList *p; - NautilusDirectory *directory; GHashTable *parent_directories; NautilusFile *file; - GFile *location, *parent; + GFile *parent; /* Make a list of added files in each directory. */ added_lists = g_hash_table_new (NULL, NULL); @@ -1161,10 +1160,10 @@ nautilus_directory_notify_files_added (GList *files) for (p = files; p != NULL; p = p->next) { - location = p->data; + GFile *location = p->data; /* See if the directory is already known. */ - directory = get_parent_directory_if_exists (location); + NautilusDirectory *directory = get_parent_directory_if_exists (location); if (directory == NULL) { /* In case the directory is not being @@ -1190,7 +1189,11 @@ nautilus_directory_notify_files_added (GList *files) continue; } - collect_parent_directories (parent_directories, directory); + if (!g_hash_table_contains (parent_directories, directory)) + { + nautilus_directory_ref (directory); + g_hash_table_add (parent_directories, directory); + } /* If no one is monitoring files in the directory, nothing to do. */ if (!nautilus_directory_is_file_list_monitored (directory)) @@ -1325,12 +1328,16 @@ nautilus_directory_notify_files_removed (GList *files) directory = get_parent_directory_if_exists (location); if (directory != NULL) { - collect_parent_directories (parent_directories, directory); - nautilus_directory_unref (directory); + if (!g_hash_table_contains (parent_directories, directory)) + { + g_hash_table_add (parent_directories, directory); + } } /* Find the file. */ file = nautilus_file_get_existing (location); + /* Find the file. */ + file = nautilus_file_get_existing (location); if (file != NULL && !nautilus_file_rename_in_progress (file)) { directory = nautilus_file_get_directory (file); @@ -1554,7 +1561,11 @@ nautilus_directory_notify_files_moved (GList *file_pairs) /* Mark it gone and prepare to send the changed signal. */ nautilus_file_mark_gone (file); hash_table_list_prepend (changed_lists, directory, file); - collect_parent_directories (parent_directories, directory); + if (!g_hash_table_contains (parent_directories, directory)) + { + nautilus_directory_ref (directory); + g_hash_table_add (parent_directories, directory); + } } /* Update any directory objects that are affected. */ @@ -1586,7 +1597,10 @@ nautilus_directory_notify_files_moved (GList *file_pairs) /* Handle notification in the old directory. */ old_directory = directory; - collect_parent_directories (parent_directories, old_directory); + if (!g_hash_table_contains (parent_directories, old_directory)) + { + g_hash_table_add (parent_directories, g_object_ref (old_directory)); + } /* Cancel loading of attributes in the old directory */ nautilus_directory_cancel_loading_file_attributes @@ -1594,7 +1608,11 @@ nautilus_directory_notify_files_moved (GList *file_pairs) /* Locate the new directory. */ new_directory = get_parent_directory (to_location); - collect_parent_directories (parent_directories, new_directory); + if (!g_hash_table_contains (parent_directories, new_directory)) + { + g_hash_table_add (parent_directories, g_object_ref (new_directory)); + } + /* We can unref now -- new_directory is in the * parent directories list so it will be * around until the end of this function diff --git a/src/nautilus-file.c b/src/nautilus-file.c index 822c520db..58377b749 100644 --- a/src/nautilus-file.c +++ b/src/nautilus-file.c @@ -5800,32 +5800,7 @@ nautilus_file_set_owner (NautilusFile *file, GList * nautilus_get_user_names (void) { - GList *list; - char *real_name, *name; - struct passwd *user; - - list = NULL; - - setpwent (); - - while ((user = getpwent ()) != NULL) - { - real_name = get_real_name (user->pw_name, user->pw_gecos); - if (real_name != NULL && !g_str_equal (real_name, "")) - { - name = g_strconcat (user->pw_name, " – ", real_name, NULL); - } - else - { - name = g_strdup (user->pw_name); - } - g_free (real_name); - list = g_list_prepend (list, name); - } - - endpwent (); - - return g_list_sort (list, (GCompareFunc) g_utf8_collate); + return NULL; } /** |
