Commit 6f3d1f95 authored by Dan Winship's avatar Dan Winship

libnm: merge NMRemoteSettings into NMClient

Make NMRemoteSettings internal and have NMClient wrap all of its APIs,
just like it does with NMManager.
parent c1f1e961
......@@ -4894,7 +4894,7 @@ typedef struct {
} AddConnectionInfo;
static void
add_connection_cb (GObject *settings,
add_connection_cb (GObject *client,
GAsyncResult *result,
gpointer user_data)
{
......@@ -4903,8 +4903,7 @@ add_connection_cb (GObject *settings,
NMRemoteConnection *connection;
GError *error = NULL;
connection = nm_remote_settings_add_connection_finish (NM_REMOTE_SETTINGS (settings),
result, &error);
connection = nm_client_add_connection_finish (NM_CLIENT (client), result, &error);
if (error) {
g_dbus_error_strip_remote_error (error);
g_string_printf (nmc->return_text,
......@@ -4926,13 +4925,13 @@ add_connection_cb (GObject *settings,
static void
add_new_connection (gboolean persistent,
NMRemoteSettings *settings,
NMClient *client,
NMConnection *connection,
GAsyncReadyCallback callback,
gpointer user_data)
{
nm_remote_settings_add_connection_async (settings, connection, persistent,
NULL, callback, user_data);
nm_client_add_connection_async (client, connection, persistent,
NULL, callback, user_data);
}
static void
......@@ -5236,7 +5235,7 @@ do_connection_add (NmCli *nmc, int argc, char **argv)
/* Tell the settings service to add the new connection */
add_new_connection (save_bool,
nmc->system_settings,
nmc->client,
connection,
add_connection_cb,
info);
......@@ -6335,15 +6334,14 @@ set_info_and_signal_editor_thread (GError *error, MonitorACInfo *monitor_ac_info
}
static void
add_connection_editor_cb (GObject *settings,
add_connection_editor_cb (GObject *client,
GAsyncResult *result,
gpointer user_data)
{
NMRemoteConnection *connection;
GError *error = NULL;
connection = nm_remote_settings_add_connection_finish (NM_REMOTE_SETTINGS (settings),
result, &error);
connection = nm_client_add_connection_finish (NM_CLIENT (client), result, &error);
set_info_and_signal_editor_thread (error, NULL);
g_clear_object (&connection);
......@@ -6958,8 +6956,8 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
menu_ctx.valid_props_str = NULL;
/* Get remote connection */
con_tmp = nm_remote_settings_get_connection_by_uuid (nmc->system_settings,
nm_connection_get_uuid (connection));
con_tmp = nm_client_get_connection_by_uuid (nmc->client,
nm_connection_get_uuid (connection));
g_weak_ref_init (&weak, con_tmp);
rem_con = g_weak_ref_get (&weak);
......@@ -7393,7 +7391,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
info->nmc = nmc;
info->con_name = g_strdup (nm_connection_get_id (connection));
add_new_connection (persistent,
nmc->system_settings,
nmc->client,
connection,
add_connection_editor_cb,
info);
......@@ -7423,8 +7421,8 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
nm_connection_get_id (connection),
nm_connection_get_uuid (connection));
con_tmp = nm_remote_settings_get_connection_by_uuid (nmc->system_settings,
nm_connection_get_uuid (connection));
con_tmp = nm_client_get_connection_by_uuid (nmc->client,
nm_connection_get_uuid (connection));
g_weak_ref_set (&weak, con_tmp);
refresh_remote_connection (&weak, &rem_con);
......@@ -8022,8 +8020,8 @@ do_connection_modify (NmCli *nmc,
nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND;
goto finish;
}
rc = nm_remote_settings_get_connection_by_uuid (nmc->system_settings,
nm_connection_get_uuid (connection));
rc = nm_client_get_connection_by_uuid (nmc->client,
nm_connection_get_uuid (connection));
if (!rc) {
g_string_printf (nmc->return_text, _("Error: Unknown connection '%s'."), name);
nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND;
......@@ -8289,7 +8287,7 @@ do_connection_reload (NmCli *nmc, int argc, char **argv)
return nmc->return_value;
}
if (!nm_remote_settings_reload_connections (nmc->system_settings, NULL, &error)) {
if (!nm_client_reload_connections (nmc->client, NULL, &error)) {
g_dbus_error_strip_remote_error (error);
g_string_printf (nmc->return_text, _("Error: failed to reload connections: %s."),
error->message);
......@@ -8327,7 +8325,7 @@ do_connection_load (NmCli *nmc, int argc, char **argv)
filenames[i] = argv[i];
filenames[i] = NULL;
nm_remote_settings_load_connections (nmc->system_settings, filenames, &failures, NULL, &error);
nm_client_load_connections (nmc->client, filenames, &failures, NULL, &error);
g_free (filenames);
if (error) {
g_dbus_error_strip_remote_error (error);
......@@ -8456,28 +8454,8 @@ do_connections (NmCli *nmc, int argc, char **argv)
if (!nmc_versions_match (nmc))
return nmc->return_value;
/* Get NMRemoteSettings object */
if (!(nmc->system_settings = nm_remote_settings_new (NULL, &error))) {
g_dbus_error_strip_remote_error (error);
g_string_printf (nmc->return_text, _("Error: could not get remote settings: %s."),
error->message);
g_error_free (error);
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
nmc->should_wait = FALSE;
return nmc->return_value;
}
/* Find out whether settings service is running */
g_object_get (nmc->system_settings, NM_REMOTE_SETTINGS_NM_RUNNING, &nmc->system_settings_running, NULL);
if (!nmc->system_settings_running) {
g_string_printf (nmc->return_text, _("Error: Can't obtain connections: settings service is not running."));
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
nmc->should_wait = FALSE;
return nmc->return_value;
}
/* Get the connection list */
nmc->connections = nm_remote_settings_list_connections (nmc->system_settings);
nmc->connections = nm_client_list_connections (nmc->client);
/* Now parse the command line and perform the required operation */
if (argc == 0) {
......
......@@ -540,7 +540,7 @@ save_hostname_cb (GObject *object, GAsyncResult *result, gpointer user_data)
NmCli *nmc = (NmCli *) user_data;
GError *error = NULL;
nm_remote_settings_save_hostname_finish (NM_REMOTE_SETTINGS (object), result, &error);
nm_client_save_hostname_finish (NM_CLIENT (object), result, &error);
if (error) {
g_dbus_error_strip_remote_error (error);
g_string_printf (nmc->return_text, _("Error: failed to set hostname: %s"),
......@@ -585,28 +585,16 @@ do_general (NmCli *nmc, int argc, char **argv)
show_nm_status (nmc, NULL, NULL);
}
else if (matches (*argv, "hostname") == 0) {
NMRemoteSettings *rem_settings;
if (nmc_arg_is_help (*(argv+1))) {
usage_general_hostname ();
goto finish;
}
/* get system settings */
if (!(rem_settings = nm_remote_settings_new (NULL, &error))) {
g_dbus_error_strip_remote_error (error);
g_string_printf (nmc->return_text, _("Error: Could not get system settings: %s."),
error->message);
g_clear_error (&error);
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
goto finish;
}
if (next_arg (&argc, &argv) != 0) {
/* no arguments -> get hostname */
char *hostname = NULL;
g_object_get (rem_settings, NM_REMOTE_SETTINGS_HOSTNAME, &hostname, NULL);
g_object_get (nmc->client, NM_CLIENT_HOSTNAME, &hostname, NULL);
if (hostname)
g_print ("%s\n", hostname);
g_free (hostname);
......@@ -618,7 +606,7 @@ do_general (NmCli *nmc, int argc, char **argv)
g_print ("Warning: ignoring extra garbage after '%s' hostname\n", hostname);
nmc->should_wait = TRUE;
nm_remote_settings_save_hostname_async (rem_settings, hostname, NULL, save_hostname_cb, nmc);
nm_client_save_hostname_async (nmc->client, hostname, NULL, save_hostname_cb, nmc);
}
}
else if (matches (*argv, "permissions") == 0) {
......
......@@ -498,8 +498,6 @@ nmc_init (NmCli *nmc)
nmc->timeout = -1;
nmc->system_settings = NULL;
nmc->system_settings_running = FALSE;
nmc->connections = NULL;
nmc->should_wait = FALSE;
......@@ -526,7 +524,6 @@ nmc_cleanup (NmCli *nmc)
g_string_free (nmc->return_text, TRUE);
if (nmc->system_settings) g_object_unref (nmc->system_settings);
g_slist_free (nmc->connections);
g_free (nmc->required_fields);
......
......@@ -110,8 +110,6 @@ typedef struct _NmCli {
int timeout; /* Operation timeout */
NMRemoteSettings *system_settings; /* System settings */
gboolean system_settings_running; /* Is system settings service running? */
GSList *connections; /* List of connections */
gboolean should_wait; /* Indication that nmcli should not end yet */
......
......@@ -254,14 +254,14 @@ nm_editor_utils_get_connection_type_list (void)
}
static char *
get_available_connection_name (const char *format,
NMRemoteSettings *settings)
get_available_connection_name (const char *format,
NMClient *client)
{
GSList *connections, *iter, *names = NULL;
char *cname = NULL;
int i = 0;
connections = nm_remote_settings_list_connections (settings);
connections = nm_client_list_connections (client);
for (iter = connections; iter; iter = iter->next) {
const char *id;
......@@ -297,7 +297,7 @@ get_available_connection_name (const char *format,
* nm_editor_utils_create_connection:
* @type: the type of the connection's primary #NMSetting
* @master: (allow-none): the connection's master, if any
* @settings: an #NMRemoteSettings
* @client: an #NMClient
*
* Creates a new #NMConnection of the given type, automatically
* creating a UUID and an appropriate not-currently-in-use connection
......@@ -309,9 +309,9 @@ get_available_connection_name (const char *format,
* Returns: a new #NMConnection
*/
NMConnection *
nm_editor_utils_create_connection (GType type,
NMConnection *master,
NMRemoteSettings *settings)
nm_editor_utils_create_connection (GType type,
NMConnection *master,
NMClient *client)
{
NMEditorConnectionTypeData **types;
NMEditorConnectionTypeDataReal *type_data = NULL;
......@@ -359,7 +359,7 @@ nm_editor_utils_create_connection (GType type,
}
uuid = nm_utils_uuid_generate ();
id = get_available_connection_name (type_data->id_format, settings);
id = get_available_connection_name (type_data->id_format, client);
g_object_set (s_con,
NM_SETTING_CONNECTION_UUID, uuid,
......
......@@ -34,9 +34,9 @@ typedef struct {
NMEditorConnectionTypeData **nm_editor_utils_get_connection_type_list (void);
NMEditorConnectionTypeData *nm_editor_utils_get_connection_type_data (NMConnection *conn);
NMConnection *nm_editor_utils_create_connection (GType type,
NMConnection *master,
NMRemoteSettings *settings);
NMConnection *nm_editor_utils_create_connection (GType type,
NMConnection *master,
NMClient *client);
G_END_DECLS
......
......@@ -480,7 +480,7 @@ nmt_connect_connection_list_rebuild (NmtConnectConnectionList *list)
devices = nm_client_get_devices (nm_client);
acs = nm_client_get_active_connections (nm_client);
connections = nm_remote_settings_list_connections (nm_settings);
connections = nm_client_list_connections (nm_client);
nmt_devices = NULL;
......@@ -636,9 +636,9 @@ nmt_connect_connection_list_get_connection (NmtConnectConnectionList *list,
g_return_val_if_fail (identifier, FALSE);
if (nm_utils_is_uuid (identifier))
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_uuid (nm_settings, identifier));
conn = NM_CONNECTION (nm_client_get_connection_by_uuid (nm_client, identifier));
if (!conn)
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_id (nm_settings, identifier));
conn = NM_CONNECTION (nm_client_get_connection_by_id (nm_client, identifier));
for (diter = priv->nmt_devices; diter; diter = diter->next) {
nmtdev = diter->data;
......
......@@ -191,7 +191,7 @@ nmt_edit_connection_list_rebuild (NmtEditConnectionList *list)
selected_conn = nmt_newt_listbox_get_active_key (priv->listbox);
free_connections (list);
priv->connections = nm_remote_settings_list_connections (nm_settings);
priv->connections = nm_client_list_connections (nm_client);
for (iter = priv->connections; iter; iter = next) {
conn = iter->data;
next = iter->next;
......@@ -293,7 +293,7 @@ nmt_edit_connection_list_constructed (GObject *object)
if (priv->extra)
nmt_newt_button_box_add_widget_end (priv->buttons, priv->extra);
g_signal_connect (nm_settings, "notify::" NM_REMOTE_SETTINGS_CONNECTIONS,
g_signal_connect (nm_client, "notify::" NM_CLIENT_CONNECTIONS,
G_CALLBACK (rebuild_on_connections_changed), list);
nmt_edit_connection_list_rebuild (list);
......
......@@ -115,15 +115,14 @@ connection_updated (GObject *connection,
}
static void
connection_added (GObject *settings,
connection_added (GObject *client,
GAsyncResult *result,
gpointer op)
{
NMRemoteConnection *connection;
GError *error = NULL;
connection = nm_remote_settings_add_connection_finish (NM_REMOTE_SETTINGS (settings),
result, &error);
connection = nm_client_add_connection_finish (NM_CLIENT (client), result, &error);
nmt_sync_op_complete_boolean (op, error == NULL, error);
g_clear_object (&connection);
g_clear_error (&error);
......@@ -157,8 +156,8 @@ save_connection_and_exit (NmtNewtButton *button,
*/
nm_connection_clear_secrets (priv->orig_connection);
} else {
nm_remote_settings_add_connection_async (nm_settings, priv->orig_connection, TRUE,
NULL, connection_added, &op);
nm_client_add_connection_async (nm_client, priv->orig_connection, TRUE,
NULL, connection_added, &op);
if (!nmt_sync_op_wait_boolean (&op, &error)) {
nmt_newt_message_dialog (_("Unable to add new connection: %s"),
error->message);
......
......@@ -87,7 +87,7 @@ edit_connection_list_filter (NmtEditConnectionList *list,
&& g_strcmp0 (slave_type, NM_SETTING_BRIDGE_SETTING_NAME) != 0)
return TRUE;
conns = nm_remote_settings_list_connections (nm_settings);
conns = nm_client_list_connections (nm_client);
for (iter = conns; iter; iter = iter->next) {
uuid = nm_connection_get_uuid (iter->data);
ifname = nm_connection_get_interface_name (iter->data);
......@@ -180,7 +180,7 @@ create_connection (NmtNewtWidget *widget, gpointer list)
GType type = (GType) GPOINTER_TO_SIZE (nmt_newt_listbox_get_active_key (priv->listbox));
NMConnection *connection;
connection = nm_editor_utils_create_connection (type, priv->master, nm_settings);
connection = nm_editor_utils_create_connection (type, priv->master, nm_client);
nmt_edit_connection (connection);
g_object_unref (connection);
......@@ -473,7 +473,7 @@ connection_deleted_callback (GObject *connection,
}
static void
connection_removed_signal (NMRemoteSettings *settings,
connection_removed_signal (NMClient *client,
NMRemoteConnection *connection,
gpointer user_data)
{
......@@ -496,7 +496,7 @@ remove_one_connection (NMRemoteConnection *connection)
nmt_sync_op_init (&data.op);
data.connection = connection;
g_signal_connect (nm_settings, NM_REMOTE_SETTINGS_CONNECTION_REMOVED,
g_signal_connect (nm_client, NM_CLIENT_CONNECTION_REMOVED,
G_CALLBACK (connection_removed_signal), &data);
nm_remote_connection_delete_async (connection, NULL, connection_deleted_callback, &data);
......@@ -507,7 +507,7 @@ remove_one_connection (NMRemoteConnection *connection)
g_error_free (error);
}
g_signal_handlers_disconnect_by_func (nm_settings, G_CALLBACK (connection_removed_signal), &data);
g_signal_handlers_disconnect_by_func (nm_client, G_CALLBACK (connection_removed_signal), &data);
}
void
......@@ -532,7 +532,7 @@ nmt_remove_connection (NMRemoteConnection *connection)
uuid = nm_connection_get_uuid (NM_CONNECTION (connection));
iface = nm_connection_get_interface_name (NM_CONNECTION (connection));
conns = nm_remote_settings_list_connections (nm_settings);
conns = nm_client_list_connections (nm_client);
for (iter = conns; iter; iter = iter->next) {
slave = iter->data;
s_con = nm_connection_get_setting_connection (NM_CONNECTION (slave));
......@@ -553,9 +553,9 @@ nmtui_edit (int argc, char **argv)
if (argc == 2) {
if (nm_utils_is_uuid (argv[1]))
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_uuid (nm_settings, argv[1]));
conn = NM_CONNECTION (nm_client_get_connection_by_uuid (nm_client, argv[1]));
if (!conn)
conn = NM_CONNECTION (nm_remote_settings_get_connection_by_id (nm_settings, argv[1]));
conn = NM_CONNECTION (nm_client_get_connection_by_id (nm_client, argv[1]));
if (!conn) {
nmt_newt_message_dialog ("%s: no such connection '%s'\n", argv[0], argv[1]);
......
......@@ -71,8 +71,8 @@ nmtui_hostname_run_dialog (void)
ok = nmt_newt_button_box_add_end (bbox, _("OK"));
nmt_newt_widget_set_exit_on_activate (ok, TRUE);
g_object_get (G_OBJECT (nm_settings),
NM_REMOTE_SETTINGS_HOSTNAME, &hostname,
g_object_get (G_OBJECT (nm_client),
NM_CLIENT_HOSTNAME, &hostname,
NULL);
nmt_newt_entry_set_text (entry, hostname);
g_free (hostname);
......@@ -92,7 +92,7 @@ hostname_set (GObject *object,
{
GError *error = NULL;
nm_remote_settings_save_hostname_finish (NM_REMOTE_SETTINGS (object), result, &error);
nm_client_save_hostname_finish (NM_CLIENT (object), result, &error);
nmt_sync_op_complete_boolean (op, error == NULL, error);
g_clear_error (&error);
}
......@@ -112,7 +112,7 @@ nmtui_hostname (int argc, char **argv)
if (hostname) {
nmt_sync_op_init (&op);
nm_remote_settings_save_hostname_async (nm_settings, hostname, NULL, hostname_set, &op);
nm_client_save_hostname_async (nm_client, hostname, NULL, hostname_set, &op);
if (nmt_sync_op_wait_boolean (&op, &error)) {
/* Translators: this indicates the result. ie, "I have set the hostname to ..." */
nmt_newt_message_dialog (_("Set hostname to '%s'"), hostname);
......
......@@ -44,7 +44,6 @@
#include "nmtui-hostname.h"
NMClient *nm_client;
NMRemoteSettings *nm_settings;
static GMainLoop *loop;
typedef NmtNewtForm * (*NmtuiSubprogram) (int argc, char **argv);
......@@ -244,13 +243,6 @@ main (int argc, char **argv)
exit (1);
}
nm_settings = nm_remote_settings_new (NULL, &error);
if (!nm_settings) {
g_printerr (_("Could not contact NetworkManager: %s.\n"), error->message);
g_error_free (error);
exit (1);
}
if (sleep_on_startup)
sleep (5);
......@@ -296,7 +288,6 @@ main (int argc, char **argv)
nmt_newt_finished ();
g_object_unref (nm_client);
g_object_unref (nm_settings);
return 0;
}
......@@ -24,7 +24,6 @@
G_BEGIN_DECLS
extern NMClient *nm_client;
extern NMRemoteSettings *nm_settings;
void nmtui_quit (void);
......
......@@ -34,10 +34,12 @@ IGNORE_HFILES= \
nm-dbus-helpers-private.h \
nm-core-internal.h \
nm-device-private.h \
nm-manager.h \
nm-object-cache.h \
nm-object-private.h \
nm-param-spec-dbus.h \
nm-remote-connection-private.h \
nm-remote-settings.h \
nm-setting-private.h \
nm-types-private.h \
nm-utils-private.h
......
......@@ -66,7 +66,6 @@
<chapter>
<title>Client Object API Reference</title>
<xi:include href="xml/nm-client.xml"/>
<xi:include href="xml/nm-remote-settings.xml"/>
<xi:include href="xml/nm-secret-agent.xml"/>
<xi:include href="xml/nm-object.xml"/>
</chapter>
......
......@@ -31,7 +31,7 @@
#include <NetworkManager.h>
static void
added_cb (GObject *settings,
added_cb (GObject *client,
GAsyncResult *result,
gpointer user_data)
{
......@@ -42,8 +42,7 @@ added_cb (GObject *settings,
/* NM responded to our request; either handle the resulting error or
* print out the object path of the connection we just added.
*/
remote = nm_remote_settings_add_connection_finish (NM_REMOTE_SETTINGS (settings),
result, &error);
remote = nm_client_add_connection_finish (NM_CLIENT (client), result, &error);
if (error) {
g_print ("Error adding connection: %s", error->message);
......@@ -58,7 +57,7 @@ added_cb (GObject *settings,
}
static void
add_connection (NMRemoteSettings *settings, GMainLoop *loop, const char *con_name)
add_connection (NMClient *client, GMainLoop *loop, const char *con_name)
{
NMConnection *connection;
NMSettingConnection *s_con;
......@@ -94,7 +93,7 @@ add_connection (NMRemoteSettings *settings, GMainLoop *loop, const char *con_nam
/* Ask the settings service to add the new connection; we'll quit the
* mainloop and exit when the callback is called.
*/
nm_remote_settings_add_connection_async (settings, connection, TRUE, NULL, added_cb, loop);
nm_client_add_connection_async (client, connection, TRUE, NULL, added_cb, loop);
g_object_unref (connection);
}
......@@ -102,7 +101,7 @@ add_connection (NMRemoteSettings *settings, GMainLoop *loop, const char *con_nam
int
main (int argc, char *argv[])
{
NMRemoteSettings *settings;
NMClient *client;
GMainLoop *loop;
GError *error = NULL;
......@@ -113,21 +112,21 @@ main (int argc, char *argv[])
loop = g_main_loop_new (NULL, FALSE);
/* Create our proxy for NetworkManager's settings service */
settings = nm_remote_settings_new (NULL, &error);
if (!settings) {
g_message ("Error: Could not get system settings: %s.", error->message);
/* Connect to NetworkManager */
client = nm_client_new (NULL, &error);
if (!client) {
g_message ("Error: Could not connect to NetworkManager: %s.", error->message);
g_error_free (error);
return 1;
}
/* Ask the settings service to add the new connection */
add_connection (settings, loop, "__Test connection__");
/* Ask NM to add the new connection */
add_connection (client, loop, "__Test connection__");
/* Wait for the connection to be added */
g_main_loop_run (loop);
/* Clean up */
g_object_unref (settings);
g_object_unref (client);
return 0;
}
......@@ -18,9 +18,9 @@
*/
/*
* The example shows how to list connections from the System Settings service
* using libnm. Contrast this example with list-connections-gdbus.c, which is a
* bit lower level and talks directly to NM using GDBus.
* The example shows how to list connections. Contrast this example with
* list-connections-gdbus.c, which is a bit lower level and talks directly to NM
* using GDBus.
*
* Compile with:
* gcc -Wall `pkg-config --libs --cflags glib-2.0 libnm` list-connections-libnm.c -o list-connections-libnm
......@@ -65,8 +65,7 @@ show_connection (gpointer data, gpointer user_data)
int
main (int argc, char *argv[])
{
NMRemoteSettings *settings;
gboolean settings_running;
NMClient *client;
GError *error = NULL;
GSList *connections;
......@@ -75,30 +74,26 @@ main (int argc, char *argv[])
g_type_init ();
#endif
/* Get system settings */
if (!(settings = nm_remote_settings_new (NULL, &error))) {
g_message ("Error: Could not get system settings: %s.", error->message);
if (!(client = nm_client_new (NULL, &error))) {
g_message ("Error: Could not connect to NetworkManager: %s.", error->message);
g_error_free (error);
return EXIT_FAILURE;
}
/* Find out whether setting service is running */
g_object_get (settings, NM_REMOTE_SETTINGS_NM_RUNNING, &settings_running, NULL);
if (!settings_running) {
g_message ("Error: Can't obtain connections: settings service is not running.");
if (!nm_client_get_nm_running (client)) {
g_message ("Error: Can't obtain connections: NetworkManager is not running.");
return EXIT_FAILURE;
}
/* Now the connections can be listed. */
connections = nm_remote_settings_list_connections (settings);
connections = nm_client_list_connections (client);
printf ("Connections:\n===================\n");
g_slist_foreach (connections, show_connection, NULL);
g_slist_free (connections);
g_object_unref (settings);
g_object_unref (client);
return EXIT_SUCCESS;
}
......@@ -50,7 +50,6 @@ libnminclude_HEADERS = \
nm-ip6-config.h \
nm-object.h \
nm-remote-connection.h \
nm-remote-settings.h \
nm-secret-agent.h \
nm-vpn-connection.h \
nm-vpn-plugin.h \
......@@ -64,7 +63,8 @@ libnm_la_private_headers = \
nm-manager.h \
nm-object-cache.h \
nm-object-private.h \
nm-remote-connection-private.h
nm-remote-connection-private.h \
nm-remote-settings.h
libnm_la_csources = \
nm-access-point.c \
......
......@@ -50,7 +50,6 @@
#include <nm-ip6-config.h>
#include <nm-object.h>
#include <nm-remote-connection.h>
#include <nm-remote-settings.h>
#include <nm-secret-agent.h>
#include <nm-setting-8021x.h>
#include <nm-setting-adsl.h>
......
......@@ -37,6 +37,8 @@ global:
nm_client_activate_connection_finish;
nm_client_add_and_activate_connection_async;
nm_client_add_and_activate_connection_finish;
nm_client_add_connection_async;
nm_client_add_connection_finish;
nm_client_check_connectivity;
nm_client_check_connectivity_async;
nm_client_check_connectivity_finish;
......@@ -47,6 +49,9 @@ global:
nm_client_error_quark;
nm_client_get_activating_connection;
nm_client_get_active_connections;
nm_client_get_connection_by_id;
nm_client_get_connection_by_path;
nm_client_get_connection_by_uuid;
nm_client_get_connectivity;
nm_client_get_device_by_iface;
nm_client_get_device_by_path;
......@@ -59,6 +64,10 @@ global:
nm_client_get_state;
nm_client_get_type;
nm_client_get_version;
nm_client_list_connections;
nm_client_load_connections;
nm_client_load_connections_async;
nm_client_load_connections_finish;
nm_client_networking_get_enabled;
nm_client_networking_set_enabled;
nm_client_new;
......@@ -66,6 +75,12 @@ global:
nm_client_new_finish;
nm_client_permission_get_type;
nm_client_permission_result_get_type;
nm_client_reload_connections;
nm_client_reload_connections_async;
nm_client_reload_connections_finish;
nm_client_save_hostname;
nm_client_save_hostname_async;
nm_client_save_hostname_finish;
nm_client_set_logging;
nm_client_wimax_get_enabled;
nm_client_wimax_hardware_get_enabled;
......@@ -363,27 +378,6 @@ global:
nm_remote_connection_save;
nm_remote_connection_save_async;
nm_remote_connection_save_finish;
nm_remote_settings_add_connection_async;
nm_remote_settings_add_connection_finish;
nm_remote_settings_error_get_type;
nm_remote_settings_error_quark;
nm_remote_settings_get_connection_by_id;
nm_remote_settings_get_connection_by_path;
nm_remote_settings_get_connection_by_uuid;
nm_remote_settings_get_type;
nm_remote_settings_list_connections;
nm_remote_settings_load_connections;
nm_remote_settings_load_connections_async;
nm_remote_settings_load_connections_finish;
nm_remote_settings_new;
nm_remote_settings_new_async;
nm_remote_settings_new_finish;
nm_remote_settings_reload_connections;
nm_remote_settings_reload_connections_async;
nm_remote_settings_reload_connections_finish;
nm_remote_settings_save_hostname;
nm_remote_settings_save_hostname_async;
nm_remote_settings_save_hostname_finish;