libnm: change the secret agent to use the generated GDBus bindings

It allows us to drop _nm_dbus_register_proxy_type() and _nm_dbus_new_proxy_*()
once they're not used by the rest of libnm anymore.
This commit is contained in:
Lubomir Rintel
2016-10-18 16:42:53 +02:00
parent bbed63213a
commit ff3eb24c15

View File

@@ -1047,19 +1047,20 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
{ {
NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (initable); NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (initable);
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self); NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self);
GDBusProxy *proxy;
priv->bus = _nm_dbus_new_connection (cancellable, error); priv->bus = _nm_dbus_new_connection (cancellable, error);
if (!priv->bus) if (!priv->bus)
return FALSE; return FALSE;
proxy = _nm_dbus_new_proxy_for_connection (priv->bus, priv->manager_proxy = nmdbus_agent_manager_proxy_new_sync (priv->bus,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
NM_DBUS_SERVICE,
NM_DBUS_PATH_AGENT_MANAGER, NM_DBUS_PATH_AGENT_MANAGER,
NM_DBUS_INTERFACE_AGENT_MANAGER, cancellable,
cancellable, error); error);
if (!proxy) if (!priv->manager_proxy)
return FALSE; return FALSE;
priv->manager_proxy = NMDBUS_AGENT_MANAGER (proxy);
init_common (self); init_common (self);
@@ -1106,15 +1107,13 @@ init_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data)
{ {
NMSecretAgentOldInitData *init_data = user_data; NMSecretAgentOldInitData *init_data = user_data;
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (init_data->self); NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (init_data->self);
GDBusProxy *proxy;
GError *error = NULL; GError *error = NULL;
proxy = _nm_dbus_new_proxy_for_connection_finish (result, &error); priv->manager_proxy = nmdbus_agent_manager_proxy_new_finish (result, &error);
if (!proxy) { if (!priv->manager_proxy) {
init_async_complete (init_data, error); init_async_complete (init_data, error);
return; return;
} }
priv->manager_proxy = NMDBUS_AGENT_MANAGER (proxy);
init_common (init_data->self); init_common (init_data->self);
@@ -1138,9 +1137,11 @@ init_async_got_bus (GObject *initable, GAsyncResult *result, gpointer user_data)
return; return;
} }
_nm_dbus_new_proxy_for_connection_async (priv->bus, nmdbus_agent_manager_proxy_new (priv->bus,
NM_DBUS_PATH_AGENT_MANAGER, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
NM_DBUS_INTERFACE_AGENT_MANAGER, NM_DBUS_INTERFACE_AGENT_MANAGER,
NM_DBUS_PATH_AGENT_MANAGER,
init_data->cancellable, init_data->cancellable,
init_async_got_proxy, init_data); init_async_got_proxy, init_data);
} }
@@ -1340,9 +1341,6 @@ nm_secret_agent_old_class_init (NMSecretAgentOldClass *class)
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS)); G_PARAM_STATIC_STRINGS));
_nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_AGENT_MANAGER,
NMDBUS_TYPE_AGENT_MANAGER_PROXY);
} }
static void static void