[gnome-photos/wip/rishi/double-buffering: 4/7] utils: Add photos_utils_parameter_{new, free}



commit 1ab3beb252f5b5374dc1f1be07c1539cbf3a154a
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jan 20 19:25:07 2017 +0100

    utils: Add photos_utils_parameter_{new, free}

 src/photos-utils.c |   21 +++++++++++++++++++++
 src/photos-utils.h |    4 ++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-utils.c b/src/photos-utils.c
index 3f49db0..8814540 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -1445,6 +1445,27 @@ photos_utils_make_directory_with_parents (GFile *file, GCancellable *cancellable
 }
 
 
+GParameter *
+photos_utils_parameter_new (GParamSpec *pspec, const gchar *name)
+{
+  GParameter *parameter;
+
+  parameter = g_slice_new0 (GParameter);
+  parameter->name = name; /* Should be a string literal. */
+  g_value_init (&parameter->value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+
+  return parameter;
+}
+
+
+void
+photos_utils_parameter_free (GParameter *parameter)
+{
+  g_value_unset (&parameter->value);
+  g_slice_free (GParameter, parameter);
+}
+
+
 void
 photos_utils_object_list_free_full (GList *objects)
 {
diff --git a/src/photos-utils.h b/src/photos-utils.h
index fcb88b8..ad4b5db 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -181,6 +181,10 @@ gboolean         photos_utils_make_directory_with_parents (GFile *file, GCancell
 
 void             photos_utils_object_list_free_full       (GList *objects);
 
+GParameter      *photos_utils_parameter_new               (GParamSpec *pspec, const gchar *name);
+
+void             photos_utils_parameter_free              (GParameter *parameter);
+
 GQuark           photos_utils_orientation_bottom_quark    (void);
 
 GQuark           photos_utils_orientation_left_quark      (void);


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