libnm: implement nm_client_reload_connections() by using GDBusConnection directly

This commit is contained in:
Thomas Haller 2019-10-07 09:30:29 +02:00
parent 4af6219226
commit 89c1007f92
3 changed files with 17 additions and 31 deletions

View file

@ -2210,13 +2210,26 @@ nm_client_reload_connections (NMClient *client,
GCancellable *cancellable,
GError **error)
{
g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
gs_unref_variant GVariant *ret = NULL;
if (!_nm_client_check_nm_running (client, error))
g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE);
ret = _nm_object_dbus_call_sync (client,
cancellable,
NM_DBUS_PATH_SETTINGS,
NM_DBUS_INTERFACE_SETTINGS,
"ReloadConnections",
g_variant_new ("()"),
G_VARIANT_TYPE ("(b)"),
G_DBUS_CALL_FLAGS_NONE,
NM_DBUS_DEFAULT_TIMEOUT_MSEC,
TRUE,
error);
if (!ret)
return FALSE;
return nm_remote_settings_reload_connections (NM_CLIENT_GET_PRIVATE (client)->settings,
cancellable, error);
return TRUE;
}
static void

View file

@ -394,28 +394,6 @@ nm_remote_settings_add_connection2 (NMRemoteSettings *self,
}
}
gboolean
nm_remote_settings_reload_connections (NMRemoteSettings *settings,
GCancellable *cancellable,
GError **error)
{
NMRemoteSettingsPrivate *priv;
gboolean success;
g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (!nmdbus_settings_call_reload_connections_sync (priv->proxy, &success,
cancellable, error)) {
if (error && *error)
g_dbus_error_strip_remote_error (*error);
return FALSE;
}
return TRUE;
}
static void
reload_connections_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
{

View file

@ -75,11 +75,6 @@ void nm_remote_settings_add_connection2 (NMRemoteSettings *self,
NMRemoteSettingAddConnection2Callback callback,
gpointer user_data);
_NM_DEPRECATED_SYNC_METHOD_INTERNAL
gboolean nm_remote_settings_reload_connections (NMRemoteSettings *settings,
GCancellable *cancellable,
GError **error);
void nm_remote_settings_reload_connections_async (NMRemoteSettings *settings,
GCancellable *cancellable,
GAsyncReadyCallback callback,