diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-09 01:29:20 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-09 01:29:20 -0400 |
commit | 89bf8af8784513cf95b31812a1c7fb68753b9b87 (patch) | |
tree | 92c7686892bfda393ee5242eafdfceb358b80d13 /gtk/gtkfilechoosernative.c | |
parent | f3744c991ad65b48a3556d141d2c70d5479baaf8 (diff) | |
download | gtk+-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.c | 13 |
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: |