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