diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-23 16:34:59 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-04-25 08:20:03 +0200 |
commit | 020c4c81d82ad314f1998b271a4fdfbf96e1b7c3 (patch) | |
tree | e318f653736e07582a4bd9cda4e0067ac4e10f61 /clients/cli | |
parent | e55a45faa25eaa282d8dc96e9d1ffa5d049977d3 (diff) | |
download | NetworkManager-020c4c81d82ad314f1998b271a4fdfbf96e1b7c3.tar.gz |
cli: drop GValue transform functions for strdict and implement it in _get_fcn_gobject_impl()
The only remaining GValue transform function was from GHashTable (of (str,str) type)
to string. Drop that too, and implement the conversion in _get_fcn_gobject_impl().
Note that there are few GObject properties of type GHashTable and most
of them implement their own logic. This only applies to
"802-3-ethernet.s390-options".
Also, always sort the keys. Otherwise, the output is not stable.
Diffstat (limited to 'clients/cli')
-rw-r--r-- | clients/cli/nmcli.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index 9076e13d7c..ad45f179a5 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -915,40 +915,6 @@ signal_handler (gpointer user_data) return G_SOURCE_CONTINUE; } -static void -nmc_convert_string_hash_to_string (const GValue *src_value, GValue *dest_value) -{ - GHashTable *hash; - GHashTableIter iter; - const char *key, *value; - GString *string; - - hash = (GHashTable *) g_value_get_boxed (src_value); - - string = g_string_new (NULL); - if (hash) { - g_hash_table_iter_init (&iter, hash); - while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value)) { - if (string->len) - g_string_append_c (string, ','); - g_string_append_printf (string, "%s=%s", key, value); - } - } - - g_value_take_string (dest_value, g_string_free (string, FALSE)); -} - -static void -nmc_value_transforms_register (void) -{ - /* This depends on the fact that all of the hash-table-valued properties - * in libnm-core are string->string. - */ - g_value_register_transform_func (G_TYPE_HASH_TABLE, - G_TYPE_STRING, - nmc_convert_string_hash_to_string); -} - void nm_cli_spawn_pager (NmCli *nmc) { @@ -1006,8 +972,6 @@ main (int argc, char *argv[]) /* Save terminal settings */ tcgetattr (STDIN_FILENO, &termios_orig); - nmc_value_transforms_register (); - nm_cli.return_text = g_string_new (_("Success")); loop = g_main_loop_new (NULL, FALSE); |