summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-02-26 10:09:54 +0100
committerThomas Haller <thaller@redhat.com>2014-10-07 09:37:56 +0200
commit22bbd869afc65ad5801497dba77194cc51969e43 (patch)
tree65d5879de2655fa19f1ffbbe8b2dd07cb9613c3c
parent64167e29445f0a681e15b644ac248da71dcdc310 (diff)
downloadNetworkManager-22bbd869afc65ad5801497dba77194cc51969e43.tar.gz
libnm-util: add _nm_setting_get_property() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--libnm-core/nm-core-internal.h2
-rw-r--r--libnm-core/nm-setting.c21
-rw-r--r--libnm-util/nm-setting-private.h2
-rw-r--r--libnm-util/nm-setting.c21
4 files changed, 46 insertions, 0 deletions
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index 02c1dca70b..f83b486c12 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -62,6 +62,8 @@ gboolean _nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *s
guint32 _nm_setting_get_setting_priority (NMSetting *setting);
+gboolean _nm_setting_get_property (NMSetting *setting, const char *name, GValue *value);
+
GSList * _nm_utils_hash_values_to_slist (GHashTable *hash);
GHashTable *_nm_utils_copy_strdict (GHashTable *strdict);
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index 17a02b9e7f..14c5f404ce 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -884,6 +884,27 @@ _nm_setting_new_from_dbus (GType setting_type,
return setting;
}
+gboolean
+_nm_setting_get_property (NMSetting *setting, const char *property_name, GValue *value)
+{
+ GParamSpec *prop_spec;
+
+ g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
+ g_return_val_if_fail (property_name, FALSE);
+ g_return_val_if_fail (value, FALSE);
+
+ prop_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_name);
+
+ if (!prop_spec) {
+ g_value_unset (value);
+ return FALSE;
+ }
+
+ g_value_init (value, prop_spec->value_type);
+ g_object_get_property (G_OBJECT (setting), property_name, value);
+ return TRUE;
+}
+
static void
duplicate_setting (NMSetting *setting,
const char *name,
diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h
index 904827ff4a..1b271d0c76 100644
--- a/libnm-util/nm-setting-private.h
+++ b/libnm-util/nm-setting-private.h
@@ -60,6 +60,8 @@ GType _nm_setting_lookup_setting_type (const char *name);
GType _nm_setting_lookup_setting_type_by_quark (GQuark error_quark);
gint _nm_setting_compare_priority (gconstpointer a, gconstpointer b);
+gboolean _nm_setting_get_property (NMSetting *setting, const char *name, GValue *value);
+
typedef enum NMSettingUpdateSecretResult {
NM_SETTING_UPDATE_SECRET_ERROR = FALSE,
NM_SETTING_UPDATE_SECRET_SUCCESS_MODIFIED = TRUE,
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c
index 6f68e171ac..5c3dc1e105 100644
--- a/libnm-util/nm-setting.c
+++ b/libnm-util/nm-setting.c
@@ -423,6 +423,27 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash)
return setting;
}
+gboolean
+_nm_setting_get_property (NMSetting *setting, const char *property_name, GValue *value)
+{
+ GParamSpec *prop_spec;
+
+ g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
+ g_return_val_if_fail (property_name, FALSE);
+ g_return_val_if_fail (value, FALSE);
+
+ prop_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_name);
+
+ if (!prop_spec) {
+ g_value_unset (value);
+ return FALSE;
+ }
+
+ g_value_init (value, prop_spec->value_type);
+ g_object_get_property (G_OBJECT (setting), property_name, value);
+ return TRUE;
+}
+
static void
duplicate_setting (NMSetting *setting,
const char *name,