mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 20:10:10 +01:00
nmcli: invoke ReloadConnections() D-Bus method asynchronously
This commit is contained in:
parent
1d82c39bfa
commit
9d0aca6757
1 changed files with 29 additions and 14 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include <readline/history.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "libnm-glib-aux/nm-dbus-aux.h"
|
||||
#include "libnmc-base/nm-client-utils.h"
|
||||
#include "libnmc-base/nm-vpn-helpers.h"
|
||||
#include "libnmc-setting/nm-meta-setting-access.h"
|
||||
|
|
@ -9187,28 +9188,42 @@ do_connection_monitor(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c
|
|||
}
|
||||
|
||||
static void
|
||||
do_connection_reload(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv)
|
||||
connection_reload_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
gs_unref_variant GVariant *result = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
NmCli * nmc = user_data;
|
||||
gs_free_error GError *error = NULL;
|
||||
gs_unref_variant GVariant *ret = NULL;
|
||||
|
||||
next_arg(nmc, &argc, &argv, NULL);
|
||||
if (nmc->complete)
|
||||
return;
|
||||
|
||||
result = nmc_dbus_call_sync(nmc,
|
||||
"/org/freedesktop/NetworkManager/Settings",
|
||||
"org.freedesktop.NetworkManager.Settings",
|
||||
"ReloadConnections",
|
||||
g_variant_new("()"),
|
||||
G_VARIANT_TYPE("(b)"),
|
||||
&error);
|
||||
ret = nm_dbus_call_finish(result, &error);
|
||||
if (error) {
|
||||
g_string_printf(nmc->return_text,
|
||||
_("Error: failed to reload connections: %s."),
|
||||
nmc_error_get_simple_message(error));
|
||||
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
quit();
|
||||
}
|
||||
|
||||
static void
|
||||
do_connection_reload(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *argv)
|
||||
{
|
||||
next_arg(nmc, &argc, &argv, NULL);
|
||||
if (nmc->complete)
|
||||
return;
|
||||
|
||||
nmc->should_wait++;
|
||||
nm_dbus_call(G_BUS_TYPE_SYSTEM,
|
||||
NM_DBUS_SERVICE,
|
||||
NM_DBUS_PATH_SETTINGS,
|
||||
NM_DBUS_INTERFACE_SETTINGS,
|
||||
"ReloadConnections",
|
||||
g_variant_new("()"),
|
||||
G_VARIANT_TYPE("(b)"),
|
||||
NULL,
|
||||
(nmc->timeout == -1 ? 90 : nmc->timeout) * 1000,
|
||||
connection_reload_cb,
|
||||
nmc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue