diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 9c51220310..689eaaa085 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -7007,9 +7007,7 @@ search_engine_hits_added_cb (GtkSearchEngine *engine, for (l = hits; l; l = l->next) { GtkSearchHit *hit = (GtkSearchHit *)l->data; - file = g_file_new_for_uri (hit->uri); - if (!file) - continue; + file = g_object_ref (hit->file); if (hit->info) { files_with_info = g_list_prepend (files_with_info, file); diff --git a/gtk/gtksearchengine.c b/gtk/gtksearchengine.c index eff96923aa..fbbb80b0d0 100644 --- a/gtk/gtksearchengine.c +++ b/gtk/gtksearchengine.c @@ -311,7 +311,7 @@ search_hit_equal (gconstpointer a, gconstpointer b) const GtkSearchHit *ha = (const GtkSearchHit *)a; const GtkSearchHit *hb = (const GtkSearchHit *)b; - return g_str_equal (ha->uri, hb->uri); + return g_file_equal (ha->file, hb->file); } @@ -320,7 +320,7 @@ search_hit_hash (gconstpointer a) { const GtkSearchHit *ha = (const GtkSearchHit *)a; - return g_str_hash (ha->uri); + return g_file_hash (ha->file); } GtkSearchHit * @@ -329,7 +329,7 @@ _gtk_search_hit_dup (GtkSearchHit *hit) GtkSearchHit *dup; dup = g_new (GtkSearchHit, 1); - dup->uri = g_strdup (hit->uri); + dup->file = g_object_ref (hit->file); if (hit->info) dup->info = g_object_ref (hit->info); else @@ -341,7 +341,7 @@ _gtk_search_hit_dup (GtkSearchHit *hit) void _gtk_search_hit_free (GtkSearchHit *hit) { - g_free (hit->uri); + g_clear_object (&hit->file); g_clear_object (&hit->info); g_free (hit); } diff --git a/gtk/gtksearchengine.h b/gtk/gtksearchengine.h index e49eeb8c79..c3d181274d 100644 --- a/gtk/gtksearchengine.h +++ b/gtk/gtksearchengine.h @@ -42,7 +42,7 @@ typedef struct _GtkSearchHit GtkSearchHit; struct _GtkSearchHit { - gchar *uri; + GFile *file; GFileInfo *info; /* may be NULL */ }; diff --git a/gtk/gtksearchenginemodel.c b/gtk/gtksearchenginemodel.c index a7f00eec4d..f245e1aa21 100644 --- a/gtk/gtksearchenginemodel.c +++ b/gtk/gtksearchenginemodel.c @@ -99,7 +99,7 @@ do_search (gpointer data) file = _gtk_file_system_model_get_file (model->model, &iter); hit = g_new (GtkSearchHit, 1); - hit->uri = g_file_get_uri (file); + hit->file = g_object_ref (file); hit->info = g_object_ref (info); hits = g_list_prepend (hits, hit); } diff --git a/gtk/gtksearchenginesimple.c b/gtk/gtksearchenginesimple.c index 4db84ce784..1b5a31be96 100644 --- a/gtk/gtksearchenginesimple.c +++ b/gtk/gtksearchenginesimple.c @@ -248,7 +248,7 @@ visit_directory (GFile *dir, SearchThreadData *data) GtkSearchHit *hit; hit = g_new (GtkSearchHit, 1); - hit->uri = g_file_get_uri (child); + hit->file = g_object_ref (child); hit->info = g_object_ref (info); data->hits = g_list_prepend (data->hits, hit); } diff --git a/gtk/gtksearchenginetracker.c b/gtk/gtksearchenginetracker.c index 7c4e063282..bac7a09afd 100644 --- a/gtk/gtksearchenginetracker.c +++ b/gtk/gtksearchenginetracker.c @@ -300,7 +300,7 @@ query_callback (GObject *object, v = g_variant_iter_next_value (&iter); strv = g_variant_get_strv (v, NULL); - hit[i].uri = (gchar*)strv[0]; + hit[i].file = g_file_new_for_uri (strv[0]); hit[i].info = NULL; g_free (strv); hits = g_list_prepend (hits, &hit[i]);