[gimp] libgimpbase: add gimp_personal_rc_gfile()



commit 78f797a3e4fb85fd78014af7ecfd5d9b844bdea5
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jul 1 16:06:51 2014 +0200

    libgimpbase: add gimp_personal_rc_gfile()

 libgimpbase/gimpbase.def |    1 +
 libgimpbase/gimpenv.c    |   37 ++++++++++++++++++++++++++++++++-----
 libgimpbase/gimpenv.h    |    1 +
 3 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def
index efc4f58..1d39321 100644
--- a/libgimpbase/gimpbase.def
+++ b/libgimpbase/gimpbase.def
@@ -112,6 +112,7 @@ EXPORTS
        gimp_pdb_proc_type_get_type
        gimp_pdb_status_type_get_type
        gimp_personal_rc_file
+       gimp_personal_rc_gfile
        gimp_pixels_to_units
        gimp_pixpipe_params_build
        gimp_pixpipe_params_init
diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c
index b8a9580..9c0c040 100644
--- a/libgimpbase/gimpenv.c
+++ b/libgimpbase/gimpenv.c
@@ -32,7 +32,7 @@
 #include <AppKit/AppKit.h>
 #endif
 
-#include <glib-object.h>
+#include <gio/gio.h>
 #include <glib/gstdio.h>
 
 #undef GIMP_DISABLE_DEPRECATED
@@ -612,10 +612,10 @@ gimp_plug_in_directory (void)
  *
  * Returns the name of a file in the user-specific GIMP settings directory.
  *
- * The returned string is allocated dynamically and *SHOULD* be freed
- * with g_free() after use. The returned string is in the encoding
- * used for filenames by GLib, which isn't necessarily
- * UTF-8. (On Windows it always is UTF-8.)
+ * The returned string is newly allocated and should be freed with
+ * g_free() after use. The returned string is in the encoding used for
+ * filenames by GLib, which isn't necessarily UTF-8. (On Windows it
+ * always is UTF-8.)
  *
  * Returns: The name of a file in the user-specific GIMP settings directory.
  **/
@@ -626,6 +626,33 @@ gimp_personal_rc_file (const gchar *basename)
 }
 
 /**
+ * gimp_personal_rc_gfile:
+ * @basename: The basename of a rc_file.
+ *
+ * Returns a #GFile in the user-specific GIMP settings directory.
+ *
+ * The returned #GFile is newly allocated and should be freed with
+ * g_object_unref() after use.
+ *
+ * See gimp_personal_rc_file().
+ *
+ * Since: GIMP 2.10
+ *
+ * Returns: A #GFile in the user-specific GIMP settings directory.
+ **/
+GFile *
+gimp_personal_rc_gfile (const gchar *basename)
+{
+  gchar *path = gimp_personal_rc_file (basename);
+  GFile *file;
+
+  file = g_file_new_for_path (path);
+  g_free (path);
+
+  return file;
+}
+
+/**
  * gimp_gtkrc:
  *
  * Returns the name of GIMP's application-specific gtkrc file.
diff --git a/libgimpbase/gimpenv.h b/libgimpbase/gimpenv.h
index 747c560..12770bc 100644
--- a/libgimpbase/gimpenv.h
+++ b/libgimpbase/gimpenv.h
@@ -61,6 +61,7 @@ const gchar * gimp_user_directory             (GimpUserDirectory   type) G_GNUC_
 
 const gchar * gimp_gtkrc                      (void) G_GNUC_CONST;
 gchar       * gimp_personal_rc_file           (const gchar        *basename) G_GNUC_MALLOC;
+GFile       * gimp_personal_rc_gfile          (const gchar        *basename);
 
 GList       * gimp_path_parse                 (const gchar        *path,
                                                gint                max_paths,


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