[gobject-introspection] gimarshallingtests: Add some-string property to PropertiesObject



commit 1482ab986e51c098c7225b31cc7126ce0ee2f1a4
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Apr 9 05:14:06 2021 +0200

    gimarshallingtests: Add some-string property to PropertiesObject
    
    It's the only basic type missing, better to have for consistency.

 tests/gimarshallingtests.c | 16 ++++++++++++++++
 tests/gimarshallingtests.h |  1 +
 2 files changed, 17 insertions(+)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index fe265303..37960ea5 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -5524,6 +5524,7 @@ enum
   SOME_INT64_PROPERTY,
   SOME_UINT64_PROPERTY,
   SOME_FLOAT_PROPERTY,
+  SOME_STRING_PROPERTY,
   SOME_DOUBLE_PROPERTY,
   SOME_STRV_PROPERTY,
   SOME_BOXED_STRUCT_PROPERTY,
@@ -5554,6 +5555,7 @@ gi_marshalling_tests_properties_object_finalize (GObject *obj)
     self->some_gvalue = NULL;
   }
 
+  g_clear_pointer (&self->some_string, g_free);
   g_clear_pointer (&self->some_strv, g_strfreev);
   g_clear_pointer (&self->some_boxed_struct, gi_marshalling_tests_boxed_struct_free);
   g_clear_pointer (&self->some_variant, g_variant_unref);
@@ -5604,6 +5606,9 @@ gi_marshalling_tests_properties_object_get_property (GObject *object,
     case SOME_DOUBLE_PROPERTY:
       g_value_set_double (value, self->some_double);
       break;
+    case SOME_STRING_PROPERTY:
+      g_value_set_string (value, self->some_string);
+      break;
     case SOME_STRV_PROPERTY:
       g_value_set_boxed (value, self->some_strv);
       break;
@@ -5681,6 +5686,10 @@ gi_marshalling_tests_properties_object_set_property (GObject *object,
     case SOME_DOUBLE_PROPERTY:
       self->some_double = g_value_get_double (value);
       break;
+    case SOME_STRING_PROPERTY:
+      g_clear_pointer (&self->some_string, g_free);
+      self->some_string = g_value_dup_string (value);
+      break;
     case SOME_STRV_PROPERTY:
       g_strfreev (self->some_strv);
       self->some_strv = g_strdupv (g_value_get_boxed (value));
@@ -5813,6 +5822,13 @@ static void gi_marshalling_tests_properties_object_class_init (GIMarshallingTest
                                                         G_MAXDOUBLE, 0,
                                                         G_PARAM_READABLE | G_PARAM_WRITABLE | 
G_PARAM_CONSTRUCT));
 
+  g_object_class_install_property (object_class, SOME_STRING_PROPERTY,
+                                   g_param_spec_string ("some-string",
+                                                        "some-string",
+                                                        "some-string",
+                                                        NULL,
+                                                        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",
diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h
index 66f476d5..2a8279e6 100644
--- a/tests/gimarshallingtests.h
+++ b/tests/gimarshallingtests.h
@@ -2026,6 +2026,7 @@ struct _GIMarshallingTestsPropertiesObject {
     guint64 some_uint64;
     gfloat some_float;
     gdouble some_double;
+    gchar *some_string;
     gchar **some_strv;
     GIMarshallingTestsBoxedStruct* some_boxed_struct;
     GList* some_boxed_glist;


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