diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2019-12-16 18:03:24 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2019-12-17 00:52:25 +0800 |
commit | d51e3e835ea08b1f51f5f3709ffe7762cb49837d (patch) | |
tree | 5374ded467603039a4ff75f21c18637fad352813 /tests/testclipboard2.c | |
parent | 3d8d4921afc96b53a8db10bf65a80bed381f6a73 (diff) | |
download | gtk+-d51e3e835ea08b1f51f5f3709ffe7762cb49837d.tar.gz |
tests/: Revert bbb56d8 for non-UNIX
The portal bits are only supported on *nix, so use the old code on
non-*nix.
Diffstat (limited to 'tests/testclipboard2.c')
-rw-r--r-- | tests/testclipboard2.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/testclipboard2.c b/tests/testclipboard2.c index f296cd5ac9..432cbfc4bf 100644 --- a/tests/testclipboard2.c +++ b/tests/testclipboard2.c @@ -103,6 +103,8 @@ visible_child_changed_cb (GtkWidget *stack, } } +#ifdef G_OS_UNIX /* portal usage supported on *nix only */ + static GSList * get_file_list (const char *dir) { @@ -129,6 +131,29 @@ get_file_list (const char *dir) return g_slist_reverse (list); } +#else /* G_OS_UNIX -- original non-portal-enabled code */ + +static GList * +get_file_list (const char *dir) +{ + GFileEnumerator *enumerator; + GFile *file; + GList *list = NULL; + + file = g_file_new_for_path (dir); + enumerator = g_file_enumerate_children (file, "standard::name", 0, NULL, NULL); + g_object_unref (file); + if (enumerator == NULL) + return NULL; + + while (g_file_enumerator_iterate (enumerator, NULL, &file, NULL, NULL) && file != NULL) + list = g_list_prepend (list, g_object_ref (file)); + + return g_list_reverse (list); +} + +#endif /* !G_OS_UNIX */ + static void format_list_add_row (GtkWidget *list, const char *format_name, |