summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-23 16:01:24 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-11-23 18:43:48 +0100
commit5befde7d7d56ac3d893cc75c0ee1e633a105f7fb (patch)
treedea0f38c19309eb8a44227516b9f831b857d360b /shared
parent901520af85492b947e9a1a392b739e1c69c6e5c4 (diff)
downloadNetworkManager-5befde7d7d56ac3d893cc75c0ee1e633a105f7fb.tar.gz
shared: add nm_g_object_set_property_*() helper
Diffstat (limited to 'shared')
-rw-r--r--shared/nm-utils/nm-shared-utils.c26
-rw-r--r--shared/nm-utils/nm-shared-utils.h10
2 files changed, 36 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c
index 79d1e6aa9c..2e42dc0cac 100644
--- a/shared/nm-utils/nm-shared-utils.c
+++ b/shared/nm-utils/nm-shared-utils.c
@@ -845,6 +845,32 @@ nm_g_object_set_property (GObject *object,
return TRUE;
}
+gboolean
+nm_g_object_set_property_boolean (GObject *object,
+ const gchar *property_name,
+ gboolean value,
+ GError **error)
+{
+ nm_auto_unset_gvalue GValue gvalue = { 0 };
+
+ g_value_init (&gvalue, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&gvalue, !!value);
+ return nm_g_object_set_property (object, property_name, &gvalue, error);
+}
+
+gboolean
+nm_g_object_set_property_uint (GObject *object,
+ const gchar *property_name,
+ guint value,
+ GError **error)
+{
+ nm_auto_unset_gvalue GValue gvalue = { 0 };
+
+ g_value_init (&gvalue, G_TYPE_UINT);
+ g_value_set_uint (&gvalue, value);
+ return nm_g_object_set_property (object, property_name, &gvalue, error);
+}
+
GParamSpec *
nm_g_object_class_find_property_from_gtype (GType gtype,
const char *property_name)
diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h
index 1e80b35a93..d6d829cd57 100644
--- a/shared/nm-utils/nm-shared-utils.h
+++ b/shared/nm-utils/nm-shared-utils.h
@@ -386,6 +386,16 @@ gboolean nm_g_object_set_property (GObject *object,
const GValue *value,
GError **error);
+gboolean nm_g_object_set_property_boolean (GObject *object,
+ const gchar *property_name,
+ gboolean value,
+ GError **error);
+
+gboolean nm_g_object_set_property_uint (GObject *object,
+ const gchar *property_name,
+ guint value,
+ GError **error);
+
GParamSpec *nm_g_object_class_find_property_from_gtype (GType gtype,
const char *property_name);