mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 19:10:17 +01:00
libnm-util: add a missing GValue transform needed by nmtui
This commit is contained in:
parent
c1017d04df
commit
4c0ac46a99
4 changed files with 21 additions and 35 deletions
|
|
@ -54,6 +54,24 @@ _nm_utils_convert_strv_to_slist (const GValue *src_value, GValue *dest_value)
|
|||
g_value_take_boxed (dest_value, g_slist_reverse (list));
|
||||
}
|
||||
|
||||
static void
|
||||
_nm_utils_convert_slist_to_strv (const GValue *src_value, GValue *dest_value)
|
||||
{
|
||||
GSList *slist;
|
||||
char **strv;
|
||||
int len, i = 0;
|
||||
|
||||
slist = g_value_get_boxed (src_value);
|
||||
len = g_slist_length (slist);
|
||||
|
||||
strv = g_new (char *, len + 1);
|
||||
for (i = 0; slist; slist = slist->next, i++)
|
||||
strv[i] = g_strdup (slist->data);
|
||||
strv[i] = NULL;
|
||||
|
||||
g_value_take_boxed (dest_value, strv);
|
||||
}
|
||||
|
||||
static void
|
||||
_nm_utils_convert_strv_to_ptrarray (const GValue *src_value, GValue *dest_value)
|
||||
{
|
||||
|
|
@ -529,6 +547,9 @@ _nm_value_transforms_register (void)
|
|||
g_value_register_transform_func (G_TYPE_STRV,
|
||||
DBUS_TYPE_G_LIST_OF_STRING,
|
||||
_nm_utils_convert_strv_to_slist);
|
||||
g_value_register_transform_func (DBUS_TYPE_G_LIST_OF_STRING,
|
||||
G_TYPE_STRV,
|
||||
_nm_utils_convert_slist_to_strv);
|
||||
g_value_register_transform_func (G_TYPE_STRV,
|
||||
DBUS_TYPE_G_ARRAY_OF_STRING,
|
||||
_nm_utils_convert_strv_to_ptrarray);
|
||||
|
|
|
|||
|
|
@ -1634,33 +1634,3 @@ nm_editor_bind_vlan_name (NMSettingVlan *s_vlan)
|
|||
binding->last_ifname_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define DBUS_TYPE_G_LIST_OF_STRING (dbus_g_type_get_collection ("GSList", G_TYPE_STRING))
|
||||
|
||||
static void
|
||||
convert_slist_to_strv (const GValue *src_value, GValue *dest_value)
|
||||
{
|
||||
GSList *slist;
|
||||
char **strv;
|
||||
int len, i = 0;
|
||||
|
||||
slist = g_value_get_boxed (src_value);
|
||||
len = g_slist_length (slist);
|
||||
|
||||
strv = g_new (char *, len + 1);
|
||||
for (i = 0; slist; slist = slist->next, i++)
|
||||
strv[i] = g_strdup (slist->data);
|
||||
strv[i] = NULL;
|
||||
|
||||
g_value_take_boxed (dest_value, strv);
|
||||
}
|
||||
|
||||
void
|
||||
nm_editor_bindings_init (void)
|
||||
{
|
||||
/* FIXME: libnm registers strv->list, but not list->strv */
|
||||
g_value_register_transform_func (DBUS_TYPE_G_LIST_OF_STRING,
|
||||
G_TYPE_STRV,
|
||||
convert_slist_to_strv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void nm_editor_bindings_init (void);
|
||||
|
||||
void nm_editor_bind_ip4_addresses_with_prefix_to_strv (gpointer source,
|
||||
const gchar *source_property,
|
||||
gpointer target,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@
|
|||
#include "nmtui-edit.h"
|
||||
#include "nmtui-connect.h"
|
||||
#include "nmtui-hostname.h"
|
||||
#include "nm-editor-bindings.h"
|
||||
|
||||
NMClient *nm_client;
|
||||
NMRemoteSettings *nm_settings;
|
||||
|
|
@ -240,8 +239,6 @@ main (int argc, char **argv)
|
|||
if (sleep_on_startup)
|
||||
sleep (5);
|
||||
|
||||
nm_editor_bindings_init ();
|
||||
|
||||
startup_data.subprogram = NULL;
|
||||
prgname = g_get_prgname ();
|
||||
if (g_str_has_prefix (prgname, "lt-"))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue