mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-21 13:20:39 +01:00
libnm-glib: don't use client-side generated dbus-glib bindings
Most of the code was using dbus_g_proxy_call() directly, but there were some leftover uses of the generated bindings. Make things more consistent by using dbus_g_proxy_call() everywhere, and stop building the -bindings.h files.
This commit is contained in:
parent
ba4731dafd
commit
8ad3ff24ad
13 changed files with 128 additions and 154 deletions
|
|
@ -7,24 +7,7 @@ INCLUDES = \
|
|||
-I$(top_builddir)/marshallers
|
||||
|
||||
BUILT_SOURCES = \
|
||||
nm-access-point-bindings.h \
|
||||
nm-client-bindings.h \
|
||||
nm-device-bindings.h \
|
||||
nm-device-ethernet-bindings.h \
|
||||
nm-device-infiniband-bindings.h \
|
||||
nm-device-wifi-bindings.h \
|
||||
nm-device-bt-bindings.h \
|
||||
nm-settings-connection-bindings.h \
|
||||
nm-device-wimax-bindings.h \
|
||||
nm-device-modem-bindings.h \
|
||||
nm-settings-bindings.h \
|
||||
nm-vpn-connection-bindings.h \
|
||||
nm-vpn-plugin-glue.h \
|
||||
nm-active-connection-bindings.h \
|
||||
nm-ip4-config-bindings.h \
|
||||
nm-dhcp4-config-bindings.h \
|
||||
nm-ip6-config-bindings.h \
|
||||
nm-dhcp6-config-bindings.h \
|
||||
nm-secret-agent-glue.h
|
||||
|
||||
|
||||
|
|
@ -182,63 +165,12 @@ libnm_glib_test_la_LIBADD = \
|
|||
|
||||
#####################################################
|
||||
|
||||
nm-client-bindings.h: $(top_srcdir)/introspection/nm-manager.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_client --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-device-bindings.h: $(top_srcdir)/introspection/nm-device.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_device --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-device-ethernet-bindings.h: $(top_srcdir)/introspection/nm-device-ethernet.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_device_ethernet --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-device-infiniband-bindings.h: $(top_srcdir)/introspection/nm-device-infiniband.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_device_infiniband --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-device-wifi-bindings.h: $(top_srcdir)/introspection/nm-device-wifi.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_device_wifi --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-device-bt-bindings.h: $(top_srcdir)/introspection/nm-device-bt.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_device_bt --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-access-point-bindings.h: $(top_srcdir)/introspection/nm-access-point.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_access_point --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-settings-bindings.h: $(top_srcdir)/introspection/nm-settings.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-settings-connection-bindings.h: $(top_srcdir)/introspection/nm-settings-connection.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_settings_connection --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-vpn-connection-bindings.h: $(top_srcdir)/introspection/nm-vpn-connection.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_connection --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-vpn-plugin-glue.h: $(top_srcdir)/introspection/nm-vpn-plugin.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_plugin --mode=glib-server --output=$@ $<
|
||||
|
||||
nm-active-connection-bindings.h: $(top_srcdir)/introspection/nm-active-connection.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_active_connection --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-ip4-config-bindings.h: $(top_srcdir)/introspection/nm-ip4-config.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_ip4_config --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-dhcp4-config-bindings.h: $(top_srcdir)/introspection/nm-dhcp4-config.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_dhcp4_config --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-ip6-config-bindings.h: $(top_srcdir)/introspection/nm-ip6-config.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_ip6_config --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-dhcp6-config-bindings.h: $(top_srcdir)/introspection/nm-dhcp6-config.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_dhcp6_config --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-secret-agent-glue.h: $(top_srcdir)/introspection/nm-secret-agent.xml
|
||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_secret_agent --mode=glib-server --output=$@ $<
|
||||
|
||||
nm-device-wimax-bindings.h: $(top_srcdir)/introspection/nm-device-wimax.xml
|
||||
dbus-binding-tool --prefix=nm_device_wimax --mode=glib-client --output=$@ $<
|
||||
|
||||
nm-device-modem-bindings.h: $(top_srcdir)/introspection/nm-device-modem.xml
|
||||
dbus-binding-tool --prefix=nm_device_modem --mode=glib-client --output=$@ $<
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libnm-glib.pc libnm-glib-vpn.pc
|
||||
|
||||
|
|
@ -246,7 +178,7 @@ DISTCLEANFILES = libnm-glib.pc libnm-glib.pc
|
|||
|
||||
EXTRA_DIST = libnm-glib.pc.in libnm-glib-vpn.pc.in libnm-glib.ver libnm-glib-vpn.ver
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES) *-bindings.h *-glue.h
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
INTROSPECTION_GIRS =
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@
|
|||
#include "nm-types-private.h"
|
||||
#include "nm-object-private.h"
|
||||
|
||||
#include "nm-access-point-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMAccessPoint, nm_access_point, NM_TYPE_OBJECT)
|
||||
|
||||
#define NM_ACCESS_POINT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACCESS_POINT, NMAccessPointPrivate))
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@
|
|||
#include "nm-device.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
#include "nm-active-connection-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT)
|
||||
|
||||
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate))
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@
|
|||
#include "nm-object-cache.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
|
||||
#include "nm-client-bindings.h"
|
||||
|
||||
void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled);
|
||||
|
||||
G_DEFINE_TYPE (NMClient, nm_client, NM_TYPE_OBJECT)
|
||||
|
|
@ -461,14 +459,19 @@ get_permissions_sync (NMClient *self)
|
|||
|
||||
static void
|
||||
get_permissions_reply (DBusGProxy *proxy,
|
||||
GHashTable *permissions,
|
||||
GError *error,
|
||||
DBusGProxyCall *call,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMClient *self = NM_CLIENT (user_data);
|
||||
GHashTable *permissions;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, call, &error,
|
||||
DBUS_TYPE_G_MAP_OF_STRING, &permissions,
|
||||
G_TYPE_INVALID);
|
||||
NM_CLIENT_GET_PRIVATE (self)->perm_call = NULL;
|
||||
update_permissions (NM_CLIENT (user_data), error ? NULL : permissions);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -478,9 +481,9 @@ client_recheck_permissions (DBusGProxy *proxy, gpointer user_data)
|
|||
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (self);
|
||||
|
||||
if (!priv->perm_call) {
|
||||
priv->perm_call = org_freedesktop_NetworkManager_get_permissions_async (NM_CLIENT_GET_PRIVATE (self)->client_proxy,
|
||||
get_permissions_reply,
|
||||
self);
|
||||
priv->perm_call = dbus_g_proxy_begin_call (NM_CLIENT_GET_PRIVATE (self)->client_proxy, "GetPermissions",
|
||||
get_permissions_reply, self, NULL,
|
||||
G_TYPE_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -508,7 +511,10 @@ nm_client_get_devices (NMClient *client)
|
|||
if (priv->devices)
|
||||
return handle_ptr_array_return (priv->devices);
|
||||
|
||||
if (!org_freedesktop_NetworkManager_get_devices (priv->client_proxy, &temp, &error)) {
|
||||
if (!dbus_g_proxy_call (priv->client_proxy, "GetDevices", &error,
|
||||
G_TYPE_INVALID,
|
||||
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &temp,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("%s: error getting devices: %s\n", __func__, error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
|
|
@ -664,17 +670,22 @@ recheck_pending_activations (NMClient *self)
|
|||
|
||||
static void
|
||||
activate_cb (DBusGProxy *proxy,
|
||||
char *path,
|
||||
GError *error,
|
||||
DBusGProxyCall *call,
|
||||
gpointer user_data)
|
||||
{
|
||||
ActivateInfo *info = user_data;
|
||||
char *path;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, call, &error,
|
||||
DBUS_TYPE_G_OBJECT_PATH, &path,
|
||||
G_TYPE_INVALID);
|
||||
if (error) {
|
||||
activate_info_complete (info, NULL, error);
|
||||
activate_info_free (info);
|
||||
g_clear_error (&error);
|
||||
} else {
|
||||
info->active_path = g_strdup (path);
|
||||
info->active_path = path;
|
||||
recheck_pending_activations (info->client);
|
||||
}
|
||||
}
|
||||
|
|
@ -726,29 +737,34 @@ nm_client_activate_connection (NMClient *client,
|
|||
priv = NM_CLIENT_GET_PRIVATE (client);
|
||||
priv->pending_activations = g_slist_prepend (priv->pending_activations, info);
|
||||
|
||||
org_freedesktop_NetworkManager_activate_connection_async (priv->client_proxy,
|
||||
nm_connection_get_path (connection),
|
||||
device ? nm_object_get_path (NM_OBJECT (device)) : "/",
|
||||
specific_object ? specific_object : "/",
|
||||
activate_cb,
|
||||
info);
|
||||
dbus_g_proxy_begin_call (priv->client_proxy, "ActivateConnection",
|
||||
activate_cb, info, NULL,
|
||||
DBUS_TYPE_G_OBJECT_PATH, nm_connection_get_path (connection),
|
||||
DBUS_TYPE_G_OBJECT_PATH, device ? nm_object_get_path (NM_OBJECT (device)) : "/",
|
||||
DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/",
|
||||
G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
static void
|
||||
add_activate_cb (DBusGProxy *proxy,
|
||||
char *connection_path,
|
||||
char *active_path,
|
||||
GError *error,
|
||||
DBusGProxyCall *call,
|
||||
gpointer user_data)
|
||||
{
|
||||
ActivateInfo *info = user_data;
|
||||
char *connection_path;
|
||||
char *active_path;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, call, &error,
|
||||
DBUS_TYPE_G_OBJECT_PATH, &connection_path,
|
||||
DBUS_TYPE_G_OBJECT_PATH, &active_path,
|
||||
G_TYPE_INVALID);
|
||||
if (error) {
|
||||
activate_info_complete (info, NULL, error);
|
||||
activate_info_free (info);
|
||||
} else {
|
||||
info->new_connection_path = g_strdup (connection_path);
|
||||
info->active_path = g_strdup (active_path);
|
||||
info->new_connection_path = connection_path;
|
||||
info->active_path = active_path;
|
||||
recheck_pending_activations (info->client);
|
||||
}
|
||||
}
|
||||
|
|
@ -803,12 +819,12 @@ nm_client_add_and_activate_connection (NMClient *client,
|
|||
priv = NM_CLIENT_GET_PRIVATE (client);
|
||||
priv->pending_activations = g_slist_prepend (priv->pending_activations, info);
|
||||
|
||||
org_freedesktop_NetworkManager_add_and_activate_connection_async (priv->client_proxy,
|
||||
hash,
|
||||
nm_object_get_path (NM_OBJECT (device)),
|
||||
specific_object ? specific_object : "/",
|
||||
add_activate_cb,
|
||||
info);
|
||||
dbus_g_proxy_begin_call (priv->client_proxy, "AddAndActivateConnection",
|
||||
add_activate_cb, info, NULL,
|
||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, hash,
|
||||
DBUS_TYPE_G_OBJECT_PATH, nm_object_get_path (NM_OBJECT (device)),
|
||||
DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/",
|
||||
G_TYPE_INVALID);
|
||||
g_hash_table_unref (hash);
|
||||
}
|
||||
|
||||
|
|
@ -838,7 +854,10 @@ nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active)
|
|||
// FIXME: return errors
|
||||
priv = NM_CLIENT_GET_PRIVATE (client);
|
||||
path = nm_object_get_path (NM_OBJECT (active));
|
||||
if (!org_freedesktop_NetworkManager_deactivate_connection (priv->client_proxy, path, &error)) {
|
||||
if (!dbus_g_proxy_call (priv->client_proxy, "DeactivateConnection", &error,
|
||||
DBUS_TYPE_G_OBJECT_PATH, path,
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("Could not deactivate connection '%s': %s", path, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
|
@ -1151,7 +1170,10 @@ nm_client_networking_set_enabled (NMClient *client, gboolean enable)
|
|||
|
||||
g_return_if_fail (NM_IS_CLIENT (client));
|
||||
|
||||
if (!org_freedesktop_NetworkManager_enable (NM_CLIENT_GET_PRIVATE (client)->client_proxy, enable, &err)) {
|
||||
if (!dbus_g_proxy_call (NM_CLIENT_GET_PRIVATE (client)->client_proxy, "Enable", &err,
|
||||
G_TYPE_BOOLEAN, enable,
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("Error enabling/disabling networking: %s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
#include "nm-device-private.h"
|
||||
#include "nm-object-private.h"
|
||||
|
||||
#include "nm-device-bt-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceBt, nm_device_bt, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_BT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BT, NMDeviceBtPrivate))
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@
|
|||
#include "nm-device-private.h"
|
||||
#include "nm-object-private.h"
|
||||
|
||||
#include "nm-device-ethernet-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate))
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@
|
|||
#include "nm-device-private.h"
|
||||
#include "nm-object-private.h"
|
||||
|
||||
#include "nm-device-infiniband-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceInfiniband, nm_device_infiniband, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandPrivate))
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@
|
|||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-types-private.h"
|
||||
|
||||
#include "nm-device-wifi-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceWifi, nm_device_wifi, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_WIFI, NMDeviceWifiPrivate))
|
||||
|
|
@ -335,7 +333,10 @@ nm_device_wifi_get_access_points (NMDeviceWifi *device)
|
|||
if (priv->aps)
|
||||
return handle_ptr_array_return (priv->aps);
|
||||
|
||||
if (!org_freedesktop_NetworkManager_Device_Wireless_get_access_points (priv->proxy, &temp, &error)) {
|
||||
if (!dbus_g_proxy_call (priv->proxy, "GetAccessPoints", &error,
|
||||
G_TYPE_INVALID,
|
||||
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &temp,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("%s: error getting access points: %s", __func__, error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@
|
|||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-types-private.h"
|
||||
|
||||
#include "nm-device-wimax-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDeviceWimax, nm_device_wimax, NM_TYPE_DEVICE)
|
||||
|
||||
#define NM_DEVICE_WIMAX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_WIMAX, NMDeviceWimaxPrivate))
|
||||
|
|
@ -217,7 +215,10 @@ nm_device_wimax_get_nsps (NMDeviceWimax *wimax)
|
|||
if (priv->nsps)
|
||||
return handle_ptr_array_return (priv->nsps);
|
||||
|
||||
if (!org_freedesktop_NetworkManager_Device_WiMax_get_nsp_list (priv->proxy, &temp, &error)) {
|
||||
if (!dbus_g_proxy_call (priv->proxy, "GetNspList", &error,
|
||||
G_TYPE_INVALID,
|
||||
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &temp,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("%s: error getting NSPs: %s", __func__, error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@
|
|||
#include "nm-marshal.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
|
||||
#include "nm-device-bindings.h"
|
||||
|
||||
G_DEFINE_TYPE (NMDevice, nm_device, NM_TYPE_OBJECT)
|
||||
|
||||
#define NM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE, NMDevicePrivate))
|
||||
|
|
@ -1518,11 +1516,14 @@ typedef struct {
|
|||
|
||||
static void
|
||||
deactivate_cb (DBusGProxy *proxy,
|
||||
GError *error,
|
||||
DBusGProxyCall *call,
|
||||
gpointer user_data)
|
||||
{
|
||||
DeactivateInfo *info = user_data;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, call, &error,
|
||||
G_TYPE_INVALID);
|
||||
if (info->fn)
|
||||
info->fn (info->device, error, info->user_data);
|
||||
else if (error) {
|
||||
|
|
@ -1532,6 +1533,7 @@ deactivate_cb (DBusGProxy *proxy,
|
|||
error ? error->code : -1,
|
||||
error && error->message ? error->message : "(unknown)");
|
||||
}
|
||||
g_clear_error (&error);
|
||||
|
||||
g_object_unref (info->device);
|
||||
g_slice_free (DeactivateInfo, info);
|
||||
|
|
@ -1562,9 +1564,9 @@ nm_device_disconnect (NMDevice *device,
|
|||
info->user_data = user_data;
|
||||
info->device = g_object_ref (device);
|
||||
|
||||
org_freedesktop_NetworkManager_Device_disconnect_async (NM_DEVICE_GET_PRIVATE (device)->proxy,
|
||||
deactivate_cb,
|
||||
info);
|
||||
dbus_g_proxy_begin_call (NM_DEVICE_GET_PRIVATE (device)->proxy, "Disconnect",
|
||||
deactivate_cb, info, NULL,
|
||||
G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include "nm-remote-connection.h"
|
||||
#include "nm-remote-connection-private.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-settings-connection-bindings.h"
|
||||
|
||||
#define NM_REMOTE_CONNECTION_BUS "bus"
|
||||
|
||||
|
|
@ -89,13 +88,17 @@ remote_call_complete (NMRemoteConnection *self, RemoteCall *call)
|
|||
}
|
||||
|
||||
static void
|
||||
update_cb (DBusGProxy *proxy, GError *error, gpointer user_data)
|
||||
update_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_data)
|
||||
{
|
||||
RemoteCall *call = user_data;
|
||||
NMRemoteConnectionCommitFunc func = (NMRemoteConnectionCommitFunc) call->callback;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, proxy_call, &error,
|
||||
G_TYPE_INVALID);
|
||||
if (func != NULL)
|
||||
(*func)(call->self, error, call->user_data);
|
||||
g_clear_error (&error);
|
||||
remote_call_complete (call->self, call);
|
||||
}
|
||||
|
||||
|
|
@ -131,10 +134,10 @@ nm_remote_connection_commit_changes (NMRemoteConnection *self,
|
|||
|
||||
settings = nm_connection_to_hash (NM_CONNECTION (self), NM_SETTING_HASH_FLAG_ALL);
|
||||
|
||||
call->call = org_freedesktop_NetworkManager_Settings_Connection_update_async (priv->proxy,
|
||||
settings,
|
||||
update_cb,
|
||||
call);
|
||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "Update",
|
||||
update_cb, call, NULL,
|
||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, settings,
|
||||
G_TYPE_INVALID);
|
||||
g_assert (call->call);
|
||||
priv->calls = g_slist_append (priv->calls, call);
|
||||
|
||||
|
|
@ -142,13 +145,17 @@ nm_remote_connection_commit_changes (NMRemoteConnection *self,
|
|||
}
|
||||
|
||||
static void
|
||||
delete_cb (DBusGProxy *proxy, GError *error, gpointer user_data)
|
||||
delete_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_data)
|
||||
{
|
||||
RemoteCall *call = user_data;
|
||||
NMRemoteConnectionDeleteFunc func = (NMRemoteConnectionDeleteFunc) call->callback;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, proxy_call, &error,
|
||||
G_TYPE_INVALID);
|
||||
if (func != NULL)
|
||||
(*func)(call->self, error, call->user_data);
|
||||
g_clear_error (&error);
|
||||
remote_call_complete (call->self, call);
|
||||
}
|
||||
|
||||
|
|
@ -178,20 +185,26 @@ nm_remote_connection_delete (NMRemoteConnection *self,
|
|||
call->callback = (GFunc) callback;
|
||||
call->user_data = user_data;
|
||||
|
||||
call->call = org_freedesktop_NetworkManager_Settings_Connection_delete_async (priv->proxy,
|
||||
delete_cb,
|
||||
call);
|
||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "Delete",
|
||||
delete_cb, call, NULL,
|
||||
G_TYPE_INVALID);
|
||||
g_assert (call->call);
|
||||
priv->calls = g_slist_append (priv->calls, call);
|
||||
}
|
||||
|
||||
static void
|
||||
get_secrets_cb (DBusGProxy *proxy, GHashTable *secrets, GError *error, gpointer user_data)
|
||||
get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_data)
|
||||
{
|
||||
RemoteCall *call = user_data;
|
||||
NMRemoteConnectionGetSecretsFunc func = (NMRemoteConnectionGetSecretsFunc) call->callback;
|
||||
GHashTable *secrets;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, proxy_call, &error,
|
||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &secrets,
|
||||
G_TYPE_INVALID);
|
||||
(*func)(call->self, error ? NULL : secrets, error, call->user_data);
|
||||
g_clear_error (&error);
|
||||
remote_call_complete (call->self, call);
|
||||
}
|
||||
|
||||
|
|
@ -225,10 +238,10 @@ nm_remote_connection_get_secrets (NMRemoteConnection *self,
|
|||
call->callback = (GFunc) callback;
|
||||
call->user_data = user_data;
|
||||
|
||||
call->call = org_freedesktop_NetworkManager_Settings_Connection_get_secrets_async (priv->proxy,
|
||||
setting_name,
|
||||
get_secrets_cb,
|
||||
call);
|
||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "GetSecrets",
|
||||
get_secrets_cb, call, NULL,
|
||||
G_TYPE_STRING, setting_name,
|
||||
G_TYPE_INVALID);
|
||||
g_assert (call->call);
|
||||
priv->calls = g_slist_append (priv->calls, call);
|
||||
}
|
||||
|
|
@ -256,14 +269,20 @@ replace_settings (NMRemoteConnection *self, GHashTable *new_settings)
|
|||
|
||||
static void
|
||||
init_get_settings_cb (DBusGProxy *proxy,
|
||||
GHashTable *new_settings,
|
||||
GError *error,
|
||||
DBusGProxyCall *call,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMRemoteConnection *self = user_data;
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
||||
GHashTable *new_settings;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, call, &error,
|
||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &new_settings,
|
||||
G_TYPE_INVALID);
|
||||
if (error) {
|
||||
g_error_free (error);
|
||||
|
||||
/* Connection doesn't exist, or isn't visible to this user */
|
||||
if (dbus_g_error_has_name (error, "org.freedesktop.NetworkManager.Settings.PermissionDenied"))
|
||||
priv->init_result = NM_REMOTE_CONNECTION_INIT_RESULT_INVISIBLE;
|
||||
|
|
@ -282,16 +301,22 @@ init_get_settings_cb (DBusGProxy *proxy,
|
|||
|
||||
static void
|
||||
updated_get_settings_cb (DBusGProxy *proxy,
|
||||
GHashTable *new_settings,
|
||||
GError *error,
|
||||
DBusGProxyCall *call,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMRemoteConnection *self = user_data;
|
||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
||||
GHashTable *new_settings;
|
||||
GError *error = NULL;
|
||||
|
||||
dbus_g_proxy_end_call (proxy, call, &error,
|
||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &new_settings,
|
||||
G_TYPE_INVALID);
|
||||
if (error) {
|
||||
GHashTable *hash;
|
||||
|
||||
g_error_free (error);
|
||||
|
||||
/* Connection is no longer visible to this user. Let the settings
|
||||
* service handle this via 'visible'. The settings service will emit
|
||||
* the "removed" signal for us since it handles the lifetime of this
|
||||
|
|
@ -322,9 +347,9 @@ updated_cb (DBusGProxy *proxy, gpointer user_data)
|
|||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
/* The connection got updated; request the replacement settings */
|
||||
org_freedesktop_NetworkManager_Settings_Connection_get_settings_async (priv->proxy,
|
||||
updated_get_settings_cb,
|
||||
self);
|
||||
dbus_g_proxy_begin_call (priv->proxy, "GetSettings",
|
||||
updated_get_settings_cb, self, NULL,
|
||||
G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -386,9 +411,9 @@ constructor (GType type,
|
|||
dbus_g_proxy_add_signal (priv->proxy, "Removed", G_TYPE_INVALID);
|
||||
dbus_g_proxy_connect_signal (priv->proxy, "Removed", G_CALLBACK (removed_cb), object, NULL);
|
||||
|
||||
org_freedesktop_NetworkManager_Settings_Connection_get_settings_async (priv->proxy,
|
||||
init_get_settings_cb,
|
||||
object);
|
||||
dbus_g_proxy_begin_call (priv->proxy, "GetSettings",
|
||||
init_get_settings_cb, object, NULL,
|
||||
G_TYPE_INVALID);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "nm-marshal.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-remote-settings.h"
|
||||
#include "nm-settings-bindings.h"
|
||||
#include "nm-remote-connection-private.h"
|
||||
|
||||
G_DEFINE_TYPE (NMRemoteSettings, nm_remote_settings, G_TYPE_OBJECT)
|
||||
|
|
@ -392,15 +391,18 @@ new_connection_cb (DBusGProxy *proxy, const char *path, gpointer user_data)
|
|||
|
||||
static void
|
||||
fetch_connections_done (DBusGProxy *proxy,
|
||||
GPtrArray *connections,
|
||||
GError *error,
|
||||
DBusGProxyCall *call,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
|
||||
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
|
||||
GPtrArray *connections;
|
||||
GError *error = NULL;
|
||||
int i;
|
||||
|
||||
if (error) {
|
||||
if (!dbus_g_proxy_end_call (proxy, call, &error,
|
||||
DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &connections,
|
||||
G_TYPE_INVALID)) {
|
||||
/* Ignore settings service spawn errors */
|
||||
if ( !g_error_matches (error, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN)
|
||||
&& !g_error_matches (error, DBUS_GERROR, DBUS_GERROR_NAME_HAS_NO_OWNER)) {
|
||||
|
|
@ -440,9 +442,9 @@ fetch_connections (gpointer user_data)
|
|||
|
||||
priv->fetch_id = 0;
|
||||
|
||||
org_freedesktop_NetworkManager_Settings_list_connections_async (priv->proxy,
|
||||
fetch_connections_done,
|
||||
self);
|
||||
dbus_g_proxy_begin_call (priv->proxy, "ListConnections",
|
||||
fetch_connections_done, self, NULL,
|
||||
G_TYPE_INVALID);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "nm-vpn-connection.h"
|
||||
#include "NetworkManager.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-vpn-connection-bindings.h"
|
||||
#include "nm-marshal.h"
|
||||
#include "nm-object-private.h"
|
||||
#include "nm-active-connection.h"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue