summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-10-06 22:50:29 +0200
committerThomas Haller <thaller@redhat.com>2019-10-16 08:56:00 +0200
commitd795bcd7305390386610ce70ab29971f7413b555 (patch)
tree9732348c22965fb7a005713d68bb79bb9bdddad7
parentc1046dd803ed9c6dc99fbee079caed1a18c75497 (diff)
downloadNetworkManager-d795bcd7305390386610ce70ab29971f7413b555.tar.gz
libnm: implement nm_client_load_connections() by using GDBusConnection directly
-rw-r--r--libnm/nm-client.c29
-rw-r--r--libnm/nm-remote-settings.c28
-rw-r--r--libnm/nm-remote-settings.h7
3 files changed, 24 insertions, 40 deletions
diff --git a/libnm/nm-client.c b/libnm/nm-client.c
index 83aa149159..ad3482bc81 100644
--- a/libnm/nm-client.c
+++ b/libnm/nm-client.c
@@ -2082,15 +2082,34 @@ nm_client_load_connections (NMClient *client,
GCancellable *cancellable,
GError **error)
{
+ gs_unref_variant GVariant *ret = NULL;
+
g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (filenames != NULL, FALSE);
+ g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE);
- if (!_nm_client_check_nm_running (client, error))
+ ret = _nm_object_dbus_call_sync (client,
+ cancellable,
+ NM_DBUS_PATH_SETTINGS,
+ NM_DBUS_INTERFACE_SETTINGS,
+ "LoadConnections",
+ g_variant_new ("(^as)",
+ filenames ?: NM_PTRARRAY_EMPTY (char *)),
+ G_VARIANT_TYPE ("(bas)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ NM_DBUS_DEFAULT_TIMEOUT_MSEC,
+ TRUE,
+ error);
+ if (!ret) {
+ *failures = NULL;
return FALSE;
+ }
- return nm_remote_settings_load_connections (NM_CLIENT_GET_PRIVATE (client)->settings,
- filenames, failures,
- cancellable, error);
+ g_variant_get (ret,
+ "(b^as)",
+ NULL,
+ &failures);
+
+ return TRUE;
}
static void
diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c
index 1b218c3005..bfad53ea52 100644
--- a/libnm/nm-remote-settings.c
+++ b/libnm/nm-remote-settings.c
@@ -394,34 +394,6 @@ nm_remote_settings_add_connection2 (NMRemoteSettings *self,
}
}
-gboolean
-nm_remote_settings_load_connections (NMRemoteSettings *settings,
- char **filenames,
- char ***failures,
- GCancellable *cancellable,
- GError **error)
-{
- NMRemoteSettingsPrivate *priv;
- gboolean success;
-
- g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
- g_return_val_if_fail (filenames != NULL, FALSE);
-
- priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
-
- if (!nmdbus_settings_call_load_connections_sync (priv->proxy,
- (const char * const *) filenames,
- &success,
- failures,
- cancellable, error)) {
- if (error && *error)
- g_dbus_error_strip_remote_error (*error);
- return FALSE;
- }
-
- return TRUE;
-}
-
static void
load_connections_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
{
diff --git a/libnm/nm-remote-settings.h b/libnm/nm-remote-settings.h
index 6006a53b56..020930f54b 100644
--- a/libnm/nm-remote-settings.h
+++ b/libnm/nm-remote-settings.h
@@ -75,13 +75,6 @@ void nm_remote_settings_add_connection2 (NMRemoteSettings *self,
NMRemoteSettingAddConnection2Callback callback,
gpointer user_data);
-_NM_DEPRECATED_SYNC_METHOD_INTERNAL
-gboolean nm_remote_settings_load_connections (NMRemoteSettings *settings,
- char **filenames,
- char ***failures,
- GCancellable *cancellable,
- GError **error);
-
void nm_remote_settings_load_connections_async (NMRemoteSettings *settings,
char **filenames,
GCancellable *cancellable,