summaryrefslogtreecommitdiff
path: root/src/nautilus-query-editor.c
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2018-11-29 14:24:29 +0000
committerErnestas Kulik <ernestask@gnome.org>2018-12-12 15:15:42 +0000
commitddded19a7852a5f002ceed561ac9e0310b69b637 (patch)
treea8c9e9b8671ca01f3d661812033a4ea12bb4d6d6 /src/nautilus-query-editor.c
parent3feda7826615a93613502d9679a8bc3c24c01342 (diff)
downloadnautilus-ddded19a7852a5f002ceed561ac9e0310b69b637.tar.gz
query: Port MIME type filter to GPtrArray
We have been using doubly-linked lists to store MIME type names strings. But this is not a great container for strings, and we are copying the lists multiple times. So, use GPtrArray instead. This avoids copies thanks to reference counting, and enables autocleanup thanks to built-in data freeing.
Diffstat (limited to 'src/nautilus-query-editor.c')
-rw-r--r--src/nautilus-query-editor.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index f4e380a1e..0f284b5b3 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -445,7 +445,7 @@ search_popover_mime_type_changed_cb (NautilusSearchPopover *popover,
gpointer user_data)
{
NautilusQueryEditor *editor;
- g_autoptr (GList) mimetypes = NULL;
+ g_autoptr (GPtrArray) mimetypes = NULL;
editor = NAUTILUS_QUERY_EDITOR (user_data);
@@ -473,7 +473,8 @@ search_popover_mime_type_changed_cb (NautilusSearchPopover *popover,
{
g_autofree gchar *display_name = NULL;
- mimetypes = g_list_append (NULL, (gpointer) mimetype);
+ mimetypes = g_ptr_array_new_full (1, g_free);
+ g_ptr_array_add (mimetypes, g_strdup (mimetype));
display_name = g_content_type_get_description (mimetype);
gd_tagged_entry_tag_set_label (editor->mime_types_tag, display_name);
gd_tagged_entry_add_tag (GD_TAGGED_ENTRY (editor->entry),