gio: Add g_file_info_set/get_file

Attaching the original GFile to a GFileInfo created
from it useful to avoid having to carry around the
(file, info) pair. In particular, it allows to store
just a self-contained GFileInfo in a list model. This
is going to be used in the GTK file chooser.
diff --git a/docs/reference/gio/gio-sections-common.txt b/docs/reference/gio/gio-sections-common.txt
index 9e606a1..fc9beeb 100644
--- a/docs/reference/gio/gio-sections-common.txt
+++ b/docs/reference/gio/gio-sections-common.txt
@@ -400,6 +400,7 @@
 g_file_info_get_etag
 g_file_info_get_sort_order
 g_file_info_get_deletion_date
+g_file_info_get_file
 g_file_info_set_attribute_mask
 g_file_info_unset_attribute_mask
 g_file_info_set_file_type
@@ -416,6 +417,7 @@
 g_file_info_set_modification_date_time
 g_file_info_set_symlink_target
 g_file_info_set_sort_order
+g_file_info_set_file
 g_file_attribute_matcher_new
 g_file_attribute_matcher_ref
 g_file_attribute_matcher_subtract
diff --git a/gio/gfileinfo.c b/gio/gfileinfo.c
index c871809..ef9bc4e 100644
--- a/gio/gfileinfo.c
+++ b/gio/gfileinfo.c
@@ -73,6 +73,8 @@
 {
   GObject parent_instance;
 
+  GFile *file;
+
   GArray *attributes;
   GFileAttributeMatcher *mask;
 };
@@ -323,6 +325,8 @@
 
   info = G_FILE_INFO (object);
 
+  g_clear_object (&info->file);
+
   attrs = (GFileAttribute *)info->attributes->data;
   for (i = 0; i < info->attributes->len; i++)
     _g_file_attribute_value_clear (&attrs[i].value);
@@ -381,6 +385,8 @@
   g_return_if_fail (G_IS_FILE_INFO (src_info));
   g_return_if_fail (G_IS_FILE_INFO (dest_info));
 
+  g_set_object (&dest_info->file, src_info->file);
+
   dest = (GFileAttribute *)dest_info->attributes->data;
   for (i = 0; i < dest_info->attributes->len; i++)
     _g_file_attribute_value_clear (&dest[i].value);
@@ -2283,6 +2289,41 @@
     _g_file_attribute_value_set_int32 (value, sort_order);
 }
 
+/**
+ * g_file_info_set_file:
+ * @info: a #GFileInfo
+ * @file: the #GFile that @info is for
+ *
+ * Sets the file that @info belongs to.
+ *
+ * Since: 2.66
+ */
+void
+g_file_info_set_file (GFileInfo *info,
+                      GFile     *file)
+{
+  g_return_if_fail (G_IS_FILE_INFO (info));
+
+  g_set_object (&info->file, file);
+}
+
+/**
+ * g_file_info_get_file:
+ * @info: a #GFileInfo
+ *
+ * Gets the file that @info belongs to.
+ *
+ * Returns: (transfer none): the #GFile
+ *
+ * Since: 2.66
+ */
+GFile *
+g_file_info_get_file (GFileInfo *info)
+{
+  g_return_val_if_fail (G_IS_FILE_INFO (info), NULL);
+
+  return info->file;
+}
 
 typedef struct {
   guint32 id;
diff --git a/gio/gfileinfo.h b/gio/gfileinfo.h
index e642d31..70f0a95 100644
--- a/gio/gfileinfo.h
+++ b/gio/gfileinfo.h
@@ -1113,6 +1113,11 @@
 GLIB_AVAILABLE_IN_ALL
 void              g_file_info_set_sort_order         (GFileInfo         *info,
 						      gint32             sort_order);
+GLIB_AVAILABLE_IN_2_66
+void              g_file_info_set_file               (GFileInfo         *info,
+                                                      GFile             *file);
+GLIB_AVAILABLE_IN_2_66
+GFile *           g_file_info_get_file               (GFileInfo         *info);
 
 #define G_TYPE_FILE_ATTRIBUTE_MATCHER (g_file_attribute_matcher_get_type ())
 GLIB_AVAILABLE_IN_ALL