From: Georges Basile Stavracas Neto Date: Sun, 9 Oct 2022 20:41:33 +0000 (-0300) Subject: filechooserutils: Add helper to get GFile from info X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~9^2~143^2~40 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b26222b6ba3715c4564ff395b62d7e1d39d676f7;p=gtk4.git filechooserutils: Add helper to get GFile from info This will be used extensively starting from next commit! --- 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__ */