[gimp/gimp-2-10] libgimpbase: add gimp_installation_directory_file().
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] libgimpbase: add gimp_installation_directory_file().
- Date: Sun, 3 Feb 2019 13:57:13 +0000 (UTC)
commit 53de34230f4845b7fbbd11327cc81966727b48da
Author: Jehan <jehan girinstud io>
Date: Sat Feb 2 18:47:58 2019 +0100
libgimpbase: add gimp_installation_directory_file().
Fix previous commit.
Ahahah! Mitch, you didn't test your code before pushing! Bad boy! :P
(cherry picked from commit db00616888856dce1558fa5f68c77807cf27b3b9)
(Bad Jehan didn't pick this to 2.10)
libgimpbase/gimpenv.c | 30 +++++++++++++++++++++++++
libgimpbase/gimpenv.h | 62 ++++++++++++++++++++++++++-------------------------
2 files changed, 62 insertions(+), 30 deletions(-)
---
diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c
index 46158739b3..65ea8201d0 100644
--- a/libgimpbase/gimpenv.c
+++ b/libgimpbase/gimpenv.c
@@ -760,6 +760,36 @@ gimp_directory_file (const gchar *first_element,
return file;
}
+/**
+ * gimp_installation_directory_file:
+ * @first_element: the first element of a path to a file in the
+ * top installation directory, or %NULL.
+ * @...: a %NULL terminated list of the remaining elements of the path
+ * to the file.
+ *
+ * Returns a #GFile in the installation directory, or the installation
+ * directory itself if @first_element is %NULL.
+ *
+ * See also: gimp_installation_directory().
+ *
+ * Since: 2.10.10
+ *
+ * Returns: a new @GFile for the path, Free with g_object_unref().
+ **/
+GFile *
+gimp_installation_directory_file (const gchar *first_element,
+ ...)
+{
+ GFile *file;
+ va_list args;
+
+ va_start (args, first_element);
+ file = gimp_child_file (gimp_installation_directory (), first_element, args);
+ va_end (args);
+
+ return file;
+}
+
/**
* gimp_data_directory_file:
* @first_element: the first element of a path to a file in the
diff --git a/libgimpbase/gimpenv.h b/libgimpbase/gimpenv.h
index 5ce67617cd..4a7506a6c7 100644
--- a/libgimpbase/gimpenv.h
+++ b/libgimpbase/gimpenv.h
@@ -47,46 +47,48 @@ GIMPVAR const guint gimp_minor_version;
GIMPVAR const guint gimp_micro_version;
-const gchar * gimp_directory (void) G_GNUC_CONST;
-const gchar * gimp_installation_directory (void) G_GNUC_CONST;
-const gchar * gimp_data_directory (void) G_GNUC_CONST;
-const gchar * gimp_locale_directory (void) G_GNUC_CONST;
-const gchar * gimp_sysconf_directory (void) G_GNUC_CONST;
-const gchar * gimp_plug_in_directory (void) G_GNUC_CONST;
-const gchar * gimp_cache_directory (void) G_GNUC_CONST;
-const gchar * gimp_temp_directory (void) G_GNUC_CONST;
-
-GFile * gimp_directory_file (const gchar *first_element,
- ...) G_GNUC_MALLOC;
-GFile * gimp_data_directory_file (const gchar *first_element,
- ...) G_GNUC_MALLOC;
-GFile * gimp_locale_directory_file (const gchar *first_element,
- ...) G_GNUC_MALLOC;
-GFile * gimp_sysconf_directory_file (const gchar *first_element,
- ...) G_GNUC_MALLOC;
-GFile * gimp_plug_in_directory_file (const gchar *first_element,
- ...) G_GNUC_MALLOC;
+const gchar * gimp_directory (void) G_GNUC_CONST;
+const gchar * gimp_installation_directory (void) G_GNUC_CONST;
+const gchar * gimp_data_directory (void) G_GNUC_CONST;
+const gchar * gimp_locale_directory (void) G_GNUC_CONST;
+const gchar * gimp_sysconf_directory (void) G_GNUC_CONST;
+const gchar * gimp_plug_in_directory (void) G_GNUC_CONST;
+const gchar * gimp_cache_directory (void) G_GNUC_CONST;
+const gchar * gimp_temp_directory (void) G_GNUC_CONST;
+
+GFile * gimp_directory_file (const gchar *first_element,
+ ...) G_GNUC_MALLOC;
+GFile * gimp_installation_directory_file (const gchar *first_element,
+ ...) G_GNUC_MALLOC;
+GFile * gimp_data_directory_file (const gchar *first_element,
+ ...) G_GNUC_MALLOC;
+GFile * gimp_locale_directory_file (const gchar *first_element,
+ ...) G_GNUC_MALLOC;
+GFile * gimp_sysconf_directory_file (const gchar *first_element,
+ ...) G_GNUC_MALLOC;
+GFile * gimp_plug_in_directory_file (const gchar *first_element,
+ ...) G_GNUC_MALLOC;
#ifndef GIMP_DISABLE_DEPRECATED
GIMP_DEPRECATED_FOR(g_get_user_special_dir)
-const gchar * gimp_user_directory (GimpUserDirectory type) G_GNUC_CONST;
+const gchar * gimp_user_directory (GimpUserDirectory type) G_GNUC_CONST;
#endif /* !GIMP_DISABLE_DEPRECATED */
-const gchar * gimp_gtkrc (void) G_GNUC_CONST;
-gchar * gimp_personal_rc_file (const gchar *basename) G_GNUC_MALLOC;
+const gchar * gimp_gtkrc (void) G_GNUC_CONST;
+gchar * gimp_personal_rc_file (const gchar *basename) G_GNUC_MALLOC;
-GList * gimp_path_parse (const gchar *path,
- gint max_paths,
- gboolean check,
- GList **check_failed);
-gchar * gimp_path_to_str (GList *path) G_GNUC_MALLOC;
-void gimp_path_free (GList *path);
+GList * gimp_path_parse (const gchar *path,
+ gint max_paths,
+ gboolean check,
+ GList **check_failed);
+gchar * gimp_path_to_str (GList *path) G_GNUC_MALLOC;
+void gimp_path_free (GList *path);
-gchar * gimp_path_get_user_writable_dir (GList *path) G_GNUC_MALLOC;
+gchar * gimp_path_get_user_writable_dir (GList *path) G_GNUC_MALLOC;
/* should be considered private, don't use! */
-void gimp_env_init (gboolean plug_in);
+void gimp_env_init (gboolean plug_in);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]