[nautilus/wip/antoniof/update-starred-uris] fixup! Using GHashTableIter



commit 47ecf64b7100e3b29444574e9fafb622e442f0a6
Author: António Fernandes <antoniojpfernandes gmail com>
Date:   Thu Sep 10 13:04:11 2020 +0000

    fixup! Using GHashTableIter

 src/nautilus-tag-manager.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-tag-manager.c b/src/nautilus-tag-manager.c
index 92121531e..58e2c5535 100644
--- a/src/nautilus-tag-manager.c
+++ b/src/nautilus-tag-manager.c
@@ -734,7 +734,8 @@ nautilus_tag_manager_update_moved_uris (NautilusTagManager *self,
                                         GFile              *src,
                                         GFile              *dest)
 {
-    g_autoptr (GList) starred_files = NULL;
+    GHashTableIter starred_iter;
+    gchar *starred_uri;
     g_autoptr (GString) query = NULL;
     g_autoptr (GList) old_uris = NULL;
     g_autoptr (GList) new_uris = NULL;
@@ -745,17 +746,17 @@ nautilus_tag_manager_update_moved_uris (NautilusTagManager *self,
         return;
     }
 
-    starred_files = nautilus_tag_manager_get_starred_files (self);
-    for (GList *l = starred_files; l != NULL; l = l->next)
+    g_hash_table_iter_init (&starred_iter, self->starred_file_uris);
+    while (g_hash_table_iter_next (&starred_iter, &starred_uri, NULL))
     {
         g_autoptr (GFile) starred_location = NULL;
         g_autofree gchar *relative_path = NULL;
 
-        starred_location = g_file_new_for_uri (l->data);
+        starred_location = g_file_new_for_uri (starred_uri);
 
         if (g_file_equal (starred_location, src))
         {
-            old_uris = g_list_prepend (old_uris, l->data);
+            old_uris = g_list_prepend (old_uris, starred_uri);
             new_uris = g_list_prepend (new_uris, g_file_get_uri (dest));
             continue;
         }
@@ -767,7 +768,7 @@ nautilus_tag_manager_update_moved_uris (NautilusTagManager *self,
 
             new_location = g_file_resolve_relative_path (dest, relative_path);
 
-            old_uris = g_list_prepend (old_uris, l->data);
+            old_uris = g_list_prepend (old_uris, starred_uri);
             new_uris = g_list_prepend (new_uris, g_file_get_uri (new_location));
         }
     }


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