[gegl/property-keys] added gegl_param_spec_file_path_from_varargs



commit 5e8aef7f2b669f7b70935e82ecdc829ce73103b3
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed May 14 18:40:26 2014 +0200

    added gegl_param_spec_file_path_from_varargs

 gegl/property-types/gegl-paramspecs.c |   44 +++++++++++++++++++++++++++++++++
 gegl/property-types/gegl-paramspecs.h |    1 +
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/gegl/property-types/gegl-paramspecs.c b/gegl/property-types/gegl-paramspecs.c
index 6ff8b76..09eef1d 100644
--- a/gegl/property-types/gegl-paramspecs.c
+++ b/gegl/property-types/gegl-paramspecs.c
@@ -975,6 +975,50 @@ gegl_param_spec_string_from_vararg (const char *name, ...)
 }
 
 GParamSpec *
+gegl_param_spec_file_path_from_vararg (const char *name, ...)
+{
+  const gchar *nick  = name,
+              *blurb = "";
+  const gchar *default_value = "";
+
+  GParamSpec *pspec;
+  GHashTable *ht;
+
+  va_list var_args;
+  const gchar *key;
+
+  ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+  va_start (var_args, name);
+  key = va_arg (var_args, const char*);
+  while (key)
+  {
+    if (g_str_equal (key, "default"))
+      default_value = va_arg (var_args, const gchar *);
+    else if (g_str_equal (key, "blurb"))
+      blurb = va_arg (var_args, const gchar *);
+    else if (g_str_equal (key, "nick"))
+      nick = va_arg (var_args, const gchar *);
+    else
+    {
+      const char *value = va_arg (var_args, const gchar*);
+      g_hash_table_insert (ht, g_strdup (key), g_strdup (value));
+    }
+    key = va_arg (var_args, const char*);
+  }
+  va_end (var_args);
+  pspec = gegl_param_spec_file_path (name, nick, blurb,
+                            FALSE, FALSE, /* XXX: take from varargs? */
+                            default_value,
+                            (GParamFlags) (
+                            G_PARAM_READWRITE |
+                            G_PARAM_CONSTRUCT |
+                            GEGL_PARAM_PAD_INPUT));
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
+                               ht, (GDestroyNotify)g_hash_table_destroy);
+  return pspec;
+}
+
+GParamSpec *
 gegl_param_spec_enum_from_vararg (const char *name, GType enum_type, ...)
 {
   const gchar *nick  = name,
diff --git a/gegl/property-types/gegl-paramspecs.h b/gegl/property-types/gegl-paramspecs.h
index dc6d30c..ea657b9 100644
--- a/gegl/property-types/gegl-paramspecs.h
+++ b/gegl/property-types/gegl-paramspecs.h
@@ -388,6 +388,7 @@ GParamSpec * gegl_param_spec_object_from_vararg (const char *name, ...);
 GParamSpec * gegl_param_spec_format_from_vararg (const char *name, ...);
 GParamSpec * gegl_param_spec_curve_from_vararg (const char *name, ...);
 GParamSpec * gegl_param_spec_path_from_vararg (const char *name, ...);
+GParamSpec * gegl_param_spec_file_path_from_vararg (const char *name, ...);
 
 
 G_END_DECLS


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