Commit 1cc7b8d0 authored by Thomas Haller's avatar Thomas Haller

libnm-util: add _nm_setting_get_property() function

Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent 1464c5a1
......@@ -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);
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment