summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechoosernative.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-09 01:29:20 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-07-09 01:29:20 -0400
commit89bf8af8784513cf95b31812a1c7fb68753b9b87 (patch)
tree92c7686892bfda393ee5242eafdfceb358b80d13 /gtk/gtkfilechoosernative.c
parentf3744c991ad65b48a3556d141d2c70d5479baaf8 (diff)
downloadgtk+-89bf8af8784513cf95b31812a1c7fb68753b9b87.tar.gz
filechooser: Make get_files return a list model
Like the other list getters in this interface, make gtk_file_chooser_get_files() return a list model.
Diffstat (limited to 'gtk/gtkfilechoosernative.c')
-rw-r--r--gtk/gtkfilechoosernative.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/gtkfilechoosernative.c b/gtk/gtkfilechoosernative.c
index 4eb46e4a4e..d4c6563d25 100644
--- a/gtk/gtkfilechoosernative.c
+++ b/gtk/gtkfilechoosernative.c
@@ -683,7 +683,7 @@ gtk_file_chooser_native_set_current_name (GtkFileChooser *chooser,
g_clear_object (&self->current_file);
}
-static GSList *
+static GListModel *
gtk_file_chooser_native_get_files (GtkFileChooser *chooser)
{
GtkFileChooserNative *self = GTK_FILE_CHOOSER_NATIVE (chooser);
@@ -693,7 +693,16 @@ gtk_file_chooser_native_get_files (GtkFileChooser *chooser)
case MODE_PORTAL:
case MODE_WIN32:
case MODE_QUARTZ:
- return g_slist_copy_deep (self->custom_files, (GCopyFunc)g_object_ref, NULL);
+ {
+ GListStore *store;
+ GSList *l;
+
+ store = g_list_store_new (G_TYPE_FILE);
+ for (l = self->custom_files; l; l = l->next)
+ g_list_store_append (store, l->data);
+
+ return G_LIST_MODEL (store);
+ }
case MODE_FALLBACK:
default: