[gobject-introspection] GIMarshallingTests: Add GStrv property



commit 39fc1013ba84d885272123e954b2aea27d5117cd
Author: Martin Pitt <martinpitt gnome org>
Date:   Sat May 5 14:43:21 2012 -0700

    GIMarshallingTests: Add GStrv property

 tests/gimarshallingtests.c |   14 +++++++++++++-
 tests/gimarshallingtests.h |    1 +
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index f2cfc35..cf54d5e 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -4418,7 +4418,8 @@ enum  {
     SOME_INT64_PROPERTY,
     SOME_UINT64_PROPERTY,
     SOME_FLOAT_PROPERTY,
-    SOME_DOUBLE_PROPERTY
+    SOME_DOUBLE_PROPERTY,
+    SOME_STRV_PROPERTY,
 };
 
 G_DEFINE_TYPE (GIMarshallingTestsPropertiesObject, gi_marshalling_tests_properties_object, G_TYPE_OBJECT);
@@ -4473,6 +4474,9 @@ gi_marshalling_tests_properties_object_get_property (GObject * object, guint pro
         case SOME_DOUBLE_PROPERTY:
             g_value_set_double (value, self->some_double);
             break;
+        case SOME_STRV_PROPERTY:
+            g_value_set_boxed (value, self->some_strv);
+            break;
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
             break;
@@ -4518,6 +4522,10 @@ gi_marshalling_tests_properties_object_set_property (GObject * object, guint pro
         case SOME_DOUBLE_PROPERTY:
             self->some_double = g_value_get_double (value);
             break;
+        case SOME_STRV_PROPERTY:
+            g_strfreev (self->some_strv);
+            self->some_strv = g_strdupv (g_value_get_boxed (value));
+            break;
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
             break;
@@ -4576,6 +4584,10 @@ gi_marshalling_tests_properties_object_class_init (GIMarshallingTestsPropertiesO
     g_object_class_install_property (object_class, SOME_DOUBLE_PROPERTY,
         g_param_spec_double ("some-double", "some-double", "some-double", -1 * G_MAXDOUBLE, G_MAXDOUBLE, 0,
             G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+    g_object_class_install_property (object_class, SOME_STRV_PROPERTY,
+        g_param_spec_boxed ("some-strv", "some-strv", "some-strv", G_TYPE_STRV,
+            G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
 }
 
 GIMarshallingTestsPropertiesObject*
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 2d3e1f6..ba688a9 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -996,6 +996,7 @@ struct _GIMarshallingTestsPropertiesObject {
     guint64 some_uint64;
     gfloat some_float;
     gdouble some_double;
+    gchar **some_strv;
 };
 
 struct _GIMarshallingTestsPropertiesObjectClass {



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