[gtk/file-list-get] Add getter to GdkFileList
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/file-list-get] Add getter to GdkFileList
- Date: Fri, 8 Oct 2021 10:42:51 +0000 (UTC)
commit f63be7b41a2ba7517ce61f95b8c960fde6f561a9
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Oct 8 11:41:56 2021 +0100
Add getter to GdkFileList
Language bindings don't really have any mean of accessing the list of
files for GdkFileList.
gdk/gdkcontentformats.c | 19 +++++++++++++++++--
gdk/gdkcontentformats.h | 6 +++++-
2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkcontentformats.c b/gdk/gdkcontentformats.c
index 662ff1b825..998110da62 100644
--- a/gdk/gdkcontentformats.c
+++ b/gdk/gdkcontentformats.c
@@ -808,8 +808,7 @@ gdk_content_formats_builder_add_mime_type (GdkContentFormatsBuilder *builder,
builder->n_mime_types++;
}
-/* G_DEFINE_BOXED wants this */
-typedef gpointer GdkFileList;
+/* {{{ GdkFileList */
static gpointer
gdk_file_list_copy (gpointer list)
@@ -824,3 +823,19 @@ gdk_file_list_free (gpointer list)
}
G_DEFINE_BOXED_TYPE (GdkFileList, gdk_file_list, gdk_file_list_copy, gdk_file_list_free)
+
+/**
+ * gdk_file_list_get_files:
+ * @file_list: the file list
+ *
+ * Retrieves the list of files inside a `GdkFileList`.
+ *
+ * Returns: (transfer container) (element-type GFile): the files inside the list
+ *
+ * Since: 4.6
+ */
+GSList *
+gdk_file_list_get_files (GdkFileList file_list)
+{
+ return g_slist_copy (file_list);
+}
diff --git a/gdk/gdkcontentformats.h b/gdk/gdkcontentformats.h
index 143a669340..89972e88da 100644
--- a/gdk/gdkcontentformats.h
+++ b/gdk/gdkcontentformats.h
@@ -109,8 +109,12 @@ void gdk_content_formats_builder_add_gtype (GdkContentForma
/* dunno where else to put this */
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
GDK_AVAILABLE_IN_ALL
-GType gdk_file_list_get_type (void) G_GNUC_CONST;
+GType gdk_file_list_get_type (void) G_GNUC_CONST;
+typedef gpointer GdkFileList;
+
+GDK_AVAILABLE_IN_4_6
+GSList * gdk_file_list_get_files (GdkFileList file_list);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]