libnm-util: don't print any warnings during nm_setting_new_from_hash()
Warnings aren't great, especially if they can realistically be triggered by a newer NetworkManager version. Just accept what we can and ignore the rest silently.
This commit is contained in:
@@ -379,9 +379,6 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash)
|
|||||||
const char *prop_name;
|
const char *prop_name;
|
||||||
GValue *src_value;
|
GValue *src_value;
|
||||||
GObjectClass *class;
|
GObjectClass *class;
|
||||||
guint n_params = 0;
|
|
||||||
GParameter *params;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_TYPE_IS_INSTANTIATABLE (setting_type), NULL);
|
g_return_val_if_fail (G_TYPE_IS_INSTANTIATABLE (setting_type), NULL);
|
||||||
g_return_val_if_fail (hash != NULL, NULL);
|
g_return_val_if_fail (hash != NULL, NULL);
|
||||||
@@ -390,11 +387,11 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash)
|
|||||||
* already been used.
|
* already been used.
|
||||||
*/
|
*/
|
||||||
class = g_type_class_ref (setting_type);
|
class = g_type_class_ref (setting_type);
|
||||||
params = g_new0 (GParameter, g_hash_table_size (hash));
|
|
||||||
|
setting = (NMSetting *) g_object_new (setting_type, NULL);
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, hash);
|
g_hash_table_iter_init (&iter, hash);
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer) &prop_name, (gpointer) &src_value)) {
|
while (g_hash_table_iter_next (&iter, (gpointer) &prop_name, (gpointer) &src_value)) {
|
||||||
GValue *dst_value = ¶ms[n_params].value;
|
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
|
|
||||||
param_spec = g_object_class_find_property (class, prop_name);
|
param_spec = g_object_class_find_property (class, prop_name);
|
||||||
@@ -402,21 +399,12 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash)
|
|||||||
/* Assume that any unrecognized property either can be ignored, or
|
/* Assume that any unrecognized property either can be ignored, or
|
||||||
* else has a backward-compatibility equivalent.
|
* else has a backward-compatibility equivalent.
|
||||||
*/
|
*/
|
||||||
g_debug ("Ignoring unrecognized property '%s'", prop_name);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_value_init (dst_value, G_VALUE_TYPE (src_value));
|
nm_g_object_set_property ((GObject *) setting, prop_name, src_value, NULL);
|
||||||
g_value_copy (src_value, dst_value);
|
|
||||||
params[n_params++].name = prop_name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setting = (NMSetting *) g_object_newv (setting_type, n_params, params);
|
|
||||||
|
|
||||||
for (i = 0; i < n_params; i++)
|
|
||||||
g_value_unset (¶ms[i].value);
|
|
||||||
|
|
||||||
g_free (params);
|
|
||||||
g_type_class_unref (class);
|
g_type_class_unref (class);
|
||||||
|
|
||||||
return setting;
|
return setting;
|
||||||
|
Reference in New Issue
Block a user