summaryrefslogtreecommitdiff
path: root/tests/testgtk.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 /tests/testgtk.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 'tests/testgtk.c')
-rw-r--r--tests/testgtk.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 50db5c8111..acb14b7615 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5507,22 +5507,26 @@ native_response (GtkNativeDialog *self,
{
static int count = 0;
char *res;
- GSList *uris, *l;
GString *s;
char *response;
GtkFileFilter *filter;
+ GListModel *files;
+ guint i, n;
- uris = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (self));
+ files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (self));
filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (self));
s = g_string_new ("");
- for (l = uris; l != NULL; l = l->next)
+ n = g_list_model_get_n_items (files);
+ for (i = 0; i < n; i++)
{
- char *uri = g_file_get_uri (l->data);
+ GFile *file = g_list_model_get_item (files, i);
+ char *uri = g_file_get_uri (file);
g_string_prepend (s, uri);
g_string_prepend (s, "\n");
g_free (uri);
+ g_object_unref (file);
}
- g_slist_free_full (uris, g_object_unref);
+ g_object_unref (files);
switch (response_id)
{