mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 03:48:09 +02:00
libnm: drop nm_dbus_new_connection() helper API
We don't need a wrapper around g_bus_get*(). Just use it directly. I guess in the past this had some use when we were using a private socket too. Those days are gone. If we are going to re-introduce private socket support, then we probably should come up with a better solution.
This commit is contained in:
parent
908fadec96
commit
be3712f6fb
3 changed files with 6 additions and 63 deletions
|
|
@ -26,57 +26,6 @@ _nm_dbus_bus_type (void)
|
||||||
return nm_bus;
|
return nm_bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
GDBusConnection *
|
|
||||||
_nm_dbus_new_connection (GCancellable *cancellable, GError **error)
|
|
||||||
{
|
|
||||||
return g_bus_get_sync (_nm_dbus_bus_type (), cancellable, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
new_connection_async_got_system (GObject *source, GAsyncResult *result, gpointer user_data)
|
|
||||||
{
|
|
||||||
GSimpleAsyncResult *simple = user_data;
|
|
||||||
GDBusConnection *connection;
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
connection = g_bus_get_finish (result, &error);
|
|
||||||
if (connection)
|
|
||||||
g_simple_async_result_set_op_res_gpointer (simple, connection, g_object_unref);
|
|
||||||
else
|
|
||||||
g_simple_async_result_take_error (simple, error);
|
|
||||||
|
|
||||||
g_simple_async_result_complete (simple);
|
|
||||||
g_object_unref (simple);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_nm_dbus_new_connection_async (GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GSimpleAsyncResult *simple;
|
|
||||||
|
|
||||||
simple = g_simple_async_result_new (NULL, callback, user_data, _nm_dbus_new_connection_async);
|
|
||||||
if (cancellable)
|
|
||||||
g_simple_async_result_set_check_cancellable (simple, cancellable);
|
|
||||||
|
|
||||||
g_bus_get (_nm_dbus_bus_type (),
|
|
||||||
cancellable,
|
|
||||||
new_connection_async_got_system, simple);
|
|
||||||
}
|
|
||||||
|
|
||||||
GDBusConnection *
|
|
||||||
_nm_dbus_new_connection_finish (GAsyncResult *result,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
|
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (simple, error))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return g_object_ref (g_simple_async_result_get_op_res_gpointer (simple));
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_nm_dbus_is_connection_private (GDBusConnection *connection)
|
_nm_dbus_is_connection_private (GDBusConnection *connection)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,6 @@
|
||||||
|
|
||||||
GBusType _nm_dbus_bus_type (void);
|
GBusType _nm_dbus_bus_type (void);
|
||||||
|
|
||||||
GDBusConnection *_nm_dbus_new_connection (GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
void _nm_dbus_new_connection_async (GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
GDBusConnection *_nm_dbus_new_connection_finish (GAsyncResult *result,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean _nm_dbus_is_connection_private (GDBusConnection *connection);
|
gboolean _nm_dbus_is_connection_private (GDBusConnection *connection);
|
||||||
|
|
||||||
void _nm_dbus_proxy_replace_match (GDBusProxy *proxy);
|
void _nm_dbus_proxy_replace_match (GDBusProxy *proxy);
|
||||||
|
|
|
||||||
|
|
@ -1052,7 +1052,7 @@ init_async_got_bus (GObject *initable, GAsyncResult *result, gpointer user_data)
|
||||||
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (init_data->self);
|
NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (init_data->self);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
priv->bus = _nm_dbus_new_connection_finish (result, &error);
|
priv->bus = g_bus_get_finish (result, &error);
|
||||||
if (!priv->bus) {
|
if (!priv->bus) {
|
||||||
init_async_complete (init_data, error);
|
init_async_complete (init_data, error);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1150,7 +1150,7 @@ 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);
|
||||||
|
|
||||||
priv->bus = _nm_dbus_new_connection (cancellable, error);
|
priv->bus = g_bus_get_sync (_nm_dbus_bus_type (), cancellable, error);
|
||||||
if (!priv->bus)
|
if (!priv->bus)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
@ -1193,7 +1193,10 @@ init_async (GAsyncInitable *initable, int io_priority,
|
||||||
if (cancellable)
|
if (cancellable)
|
||||||
g_simple_async_result_set_check_cancellable (init_data->simple, cancellable);
|
g_simple_async_result_set_check_cancellable (init_data->simple, cancellable);
|
||||||
|
|
||||||
_nm_dbus_new_connection_async (cancellable, init_async_got_bus, init_data);
|
g_bus_get (_nm_dbus_bus_type (),
|
||||||
|
cancellable,
|
||||||
|
init_async_got_bus,
|
||||||
|
init_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue