From 211bfdfd538f098a31bd181fe1ee9e6dfcc1ce46 Mon Sep 17 00:00:00 2001 From: Razvan Chitu Date: Sat, 6 Aug 2016 14:23:25 +0300 Subject: files-view: use a hashset for newly added locations There is no hash set in GLib, so we have to use GHashTable. However there are functions that allow to use the hash table as hash set. Use that instead of the regular hash table functions. https://bugzilla.gnome.org/show_bug.cgi?id=768646 --- src/nautilus-files-view.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index e138e1f74..a47c2cf56 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -1567,11 +1567,11 @@ track_newly_added_locations (NautilusFilesView *view, NautilusDirectory *directory, gpointer user_data) { - NewFolderData *data; + GHashTable *added_locations; - data = user_data; + added_locations = user_data; - g_hash_table_insert (data->added_locations, nautilus_file_get_location (new_file), NULL); + g_hash_table_add (added_locations, nautilus_file_get_location (new_file)); } static void @@ -1595,7 +1595,7 @@ new_folder_done (GFile *new_folder, g_signal_handlers_disconnect_by_func (directory_view, G_CALLBACK (track_newly_added_locations), - (void *) data); + data->added_locations); if (new_folder == NULL) { goto fail; @@ -1632,7 +1632,7 @@ new_folder_done (GFile *new_folder, g_free (target_uri); } - if (g_hash_table_lookup_extended (data->added_locations, new_folder, NULL, NULL)) { + if (g_hash_table_contains (data->added_locations, new_folder)) { /* The file was already added */ nautilus_files_view_select_file (directory_view, file); nautilus_files_view_reveal_selection (directory_view); @@ -1785,7 +1785,7 @@ new_folder_dialog_controller_on_name_accepted (NautilusFileNameWidgetController g_signal_connect_data (view, "add-file", G_CALLBACK (track_newly_added_locations), - data, + data->added_locations, (GClosureNotify)NULL, G_CONNECT_AFTER); @@ -1865,7 +1865,7 @@ setup_new_folder_data (NautilusFilesView *directory_view) g_signal_connect_data (directory_view, "add-file", G_CALLBACK (track_newly_added_locations), - data, + data->added_locations, (GClosureNotify)NULL, G_CONNECT_AFTER); -- cgit v1.2.1