[nautilus/wip/razvan/compression-support: 18/23] files-view: use a hashset for newly added locations



commit 9c88e6892e534425043e6b8945af9c17b66b272d
Author: Razvan Chitu <razvan ch95 gmail com>
Date:   Sat Aug 6 14:23:25 2016 +0300

    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 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index e138e1f..a47c2cf 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]