[gtk/gbsneto/filechooser-column-view: 40/47] filechooserutils: Add helper to get GFile from info




commit c775d6c82e03b78755e73dd55f28129758ec670a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Oct 9 17:41:33 2022 -0300

    filechooserutils: Add helper to get GFile from info
    
    This will be used extensively starting from next commit!

 gtk/gtkfilechooserutils.c | 9 +++++++++
 gtk/gtkfilechooserutils.h | 2 ++
 2 files changed, 11 insertions(+)
---
diff --git a/gtk/gtkfilechooserutils.c b/gtk/gtkfilechooserutils.c
index 1722ced87b..d75a12b0b4 100644
--- a/gtk/gtkfilechooserutils.c
+++ b/gtk/gtkfilechooserutils.c
@@ -479,3 +479,12 @@ _gtk_file_info_get_icon (GFileInfo    *info,
   icon = g_themed_icon_new ("text-x-generic");
   return icon;
 }
+
+GFile *
+_gtk_file_info_get_file (GFileInfo *info)
+{
+  g_assert (G_IS_FILE_INFO (info));
+  g_assert (g_file_info_has_attribute (info, "standard::file"));
+
+  return G_FILE (g_file_info_get_attribute_object (info, "standard::file"));
+}
diff --git a/gtk/gtkfilechooserutils.h b/gtk/gtkfilechooserutils.h
index 9481704ad9..3a41403802 100644
--- a/gtk/gtkfilechooserutils.h
+++ b/gtk/gtkfilechooserutils.h
@@ -58,6 +58,8 @@ GIcon *         _gtk_file_info_get_icon    (GFileInfo    *info,
                                             int           scale,
                                             GtkIconTheme *icon_theme);
 
+GFile *         _gtk_file_info_get_file (GFileInfo *info);
+
 G_END_DECLS
 
 #endif /* __GTK_FILE_CHOOSER_UTILS_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]