summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-10 13:09:43 -0400
committerDan Winship <danw@gnome.org>2014-10-10 13:09:43 -0400
commitdccaffe143410c9f5379f1d92e2a95d4de2072c0 (patch)
treebffa6c50529d46377f71da8907dcd734a8e7a366 /clients
parenta6b4d544996ad565cb0e175e78f0670618243d0c (diff)
parent6f3d1f95262abbf5101d6f88ecfa292d575e0d4f (diff)
downloadNetworkManager-dccaffe143410c9f5379f1d92e2a95d4de2072c0.tar.gz
libnm: merge NMRemoteSettings into NMClient (bgo #738103)
Diffstat (limited to 'clients')
-rw-r--r--clients/cli/connections.c102
-rw-r--r--clients/cli/general.c18
-rw-r--r--clients/cli/nmcli.c7
-rw-r--r--clients/cli/nmcli.h4
-rw-r--r--clients/cli/settings.c4
-rw-r--r--clients/tui/nm-editor-utils.c16
-rw-r--r--clients/tui/nm-editor-utils.h6
-rw-r--r--clients/tui/nmt-connect-connection-list.c6
-rw-r--r--clients/tui/nmt-edit-connection-list.c4
-rw-r--r--clients/tui/nmt-editor.c9
-rw-r--r--clients/tui/nmtui-edit.c16
-rw-r--r--clients/tui/nmtui-hostname.c8
-rw-r--r--clients/tui/nmtui.c9
-rw-r--r--clients/tui/nmtui.h1
14 files changed, 80 insertions, 130 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index 5dc8b36815..cfaa669b06 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -820,7 +820,7 @@ fill_output_active_connection (NMActiveConnection *active,
GString *dev_str;
NMActiveConnectionState state;
int i;
- GSList *con_list = nmc->system_connections;
+ GSList *con_list = nmc->connections;
NmcOutputField *tmpl, *arr;
size_t tmpl_len;
int idx_start = with_group ? 0 : 1;
@@ -1097,7 +1097,7 @@ nmc_active_connection_details (NMActiveConnection *acon, NmCli *nmc)
char **vpn_data_array = NULL;
guint32 items_num;
- con = get_connection_for_active (nmc->system_connections, acon);
+ con = get_connection_for_active (nmc->connections, acon);
s_con = nm_connection_get_setting_connection (con);
g_assert (s_con != NULL);
@@ -1307,7 +1307,7 @@ do_connections_show (NmCli *nmc, gboolean active_only, int argc, char **argv)
g_ptr_array_add (nmc->output_data, arr);
/* Add values */
- for (iter = nmc->system_connections; iter; iter = g_slist_next (iter)) {
+ for (iter = nmc->connections; iter; iter = g_slist_next (iter)) {
NMConnection *con = NM_CONNECTION (iter->data);
fill_output_connection (con, nmc, active_only);
}
@@ -1346,11 +1346,11 @@ do_connections_show (NmCli *nmc, gboolean active_only, int argc, char **argv)
}
/* Find connection by id, uuid, path or apath */
- con = nmc_find_connection (nmc->system_connections, selector, *argv, &pos);
+ con = nmc_find_connection (nmc->connections, selector, *argv, &pos);
if (!con) {
- acon = find_active_connection (active_cons, nmc->system_connections, selector, *argv, NULL);
+ acon = find_active_connection (active_cons, nmc->connections, selector, *argv, NULL);
if (acon)
- con = get_connection_for_active (nmc->system_connections, acon);
+ con = get_connection_for_active (nmc->connections, acon);
}
/* Print connection details */
@@ -1954,7 +1954,7 @@ do_connection_up (NmCli *nmc, int argc, char **argv)
}
if (name)
- connection = nmc_find_connection (nmc->system_connections, selector, name, NULL);
+ connection = nmc_find_connection (nmc->connections, selector, name, NULL);
while (argc > 0) {
if (strcmp (*argv, "ifname") == 0) {
@@ -2063,7 +2063,7 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
}
}
- active = find_active_connection (active_cons, nmc->system_connections, selector, *arg_ptr, &idx);
+ active = find_active_connection (active_cons, nmc->connections, selector, *arg_ptr, &idx);
if (active) {
nm_client_deactivate_connection (nmc->client, active, NULL, NULL);
} else {
@@ -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
@@ -4996,14 +4995,14 @@ gen_func_master_ifnames (const char *text, int state)
NMSettingConnection *s_con;
const char *con_type, *ifname;
- if (!nm_cli.system_connections)
+ if (!nm_cli.connections)
return NULL;
/* Disable appending space after completion */
rl_completion_append_character = '\0';
ifnames = g_ptr_array_sized_new (20);
- for (iter = nm_cli.system_connections; iter; iter = g_slist_next (iter)) {
+ for (iter = nm_cli.connections; iter; iter = g_slist_next (iter)) {
con = NM_CONNECTION (iter->data);
s_con = nm_connection_get_setting_connection (con);
g_assert (s_con);
@@ -5201,7 +5200,7 @@ do_connection_add (NmCli *nmc, int argc, char **argv)
char *try_name = ifname ?
g_strdup_printf ("%s-%s", get_name_alias (setting_name, nmc_valid_connection_types), ifname)
: g_strdup (get_name_alias (setting_name, nmc_valid_connection_types));
- default_name = unique_connection_name (nmc->system_connections, try_name);
+ default_name = unique_connection_name (nmc->connections, try_name);
g_free (try_name);
}
g_object_set (s_con,
@@ -5217,7 +5216,7 @@ do_connection_add (NmCli *nmc, int argc, char **argv)
if (!complete_connection_by_type (connection,
setting_name,
- nmc->system_connections,
+ nmc->connections,
nmc->ask,
argc,
argv,
@@ -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);
@@ -5269,7 +5268,7 @@ uuid_display_hook (char **array, int len, int max_len)
const char *id;
for (i = 1; i <= len; i++) {
- con = nmc_find_connection (nmc_tab_completion.nmc->system_connections, "uuid", array[i], NULL);
+ con = nmc_find_connection (nmc_tab_completion.nmc->connections, "uuid", array[i], NULL);
id = con ? nm_connection_get_id (con) : NULL;
if (id) {
tmp = g_strdup_printf ("%s (%s)", array[i], id);
@@ -5522,12 +5521,12 @@ gen_vpn_uuids (const char *text, int state)
const char **uuids;
char *ret;
- len = g_slist_length (nmc_tab_completion.nmc->system_connections);
+ len = g_slist_length (nmc_tab_completion.nmc->connections);
if (len < 1)
return NULL;
uuids = g_new (const char *, len + 1);
- for (iter = nmc_tab_completion.nmc->system_connections; iter; iter = g_slist_next (iter)) {
+ for (iter = nmc_tab_completion.nmc->connections; iter; iter = g_slist_next (iter)) {
const char *type = nm_connection_get_connection_type (NM_CONNECTION (iter->data));
if (g_strcmp0 (type, NM_SETTING_VPN_SETTING_NAME) == 0)
@@ -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);
@@ -7831,7 +7829,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
/* Existing connection */
NMConnection *found_con;
- found_con = nmc_find_connection (nmc->system_connections, selector, con, NULL);
+ found_con = nmc_find_connection (nmc->connections, selector, con, NULL);
if (!found_con) {
g_string_printf (nmc->return_text, _("Error: Unknown connection '%s'."), con);
nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND;
@@ -7886,7 +7884,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
if (con_name)
default_name = g_strdup (con_name);
else
- default_name = unique_connection_name (nmc->system_connections,
+ default_name = unique_connection_name (nmc->connections,
get_name_alias (connection_type, nmc_valid_connection_types));
g_object_set (s_con,
@@ -8016,14 +8014,14 @@ do_connection_modify (NmCli *nmc,
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
goto finish;
}
- connection = nmc_find_connection (nmc->system_connections, selector, name, NULL);
+ connection = nmc_find_connection (nmc->connections, selector, name, NULL);
if (!connection) {
g_string_printf (nmc->return_text, _("Error: Unknown connection '%s'."), name);
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;
@@ -8227,7 +8225,7 @@ do_connection_delete (NmCli *nmc, int argc, char **argv)
}
}
- connection = nmc_find_connection (nmc->system_connections, selector, *arg_ptr, &pos);
+ connection = nmc_find_connection (nmc->connections, selector, *arg_ptr, &pos);
if (!connection) {
if (nmc->print_output != NMC_PRINT_TERSE)
g_print (_("Error: unknown connection: %s\n"), *arg_ptr);
@@ -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);
@@ -8383,11 +8381,11 @@ gen_func_connection_names (const char *text, int state)
const char **connections;
char *ret;
- if (!nm_cli.system_connections)
+ if (!nm_cli.connections)
return NULL;
- connections = g_new (const char *, g_slist_length (nm_cli.system_connections) + 1);
- for (iter = nm_cli.system_connections; iter; iter = g_slist_next (iter)) {
+ connections = g_new (const char *, g_slist_length (nm_cli.connections) + 1);
+ for (iter = nm_cli.connections; iter; iter = g_slist_next (iter)) {
NMConnection *con = NM_CONNECTION (iter->data);
const char *id = nm_connection_get_id (con);
connections[i++] = id;
@@ -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->system_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) {
diff --git a/clients/cli/general.c b/clients/cli/general.c
index 381a330ca2..1da3803fc9 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -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) {
diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c
index e89b150f6a..f6ca11e935 100644
--- a/clients/cli/nmcli.c
+++ b/clients/cli/nmcli.c
@@ -498,9 +498,7 @@ nmc_init (NmCli *nmc)
nmc->timeout = -1;
- nmc->system_settings = NULL;
- nmc->system_settings_running = FALSE;
- nmc->system_connections = NULL;
+ nmc->connections = NULL;
nmc->should_wait = FALSE;
nmc->nowait_flag = TRUE;
@@ -526,8 +524,7 @@ 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->system_connections);
+ g_slist_free (nmc->connections);
g_free (nmc->required_fields);
nmc_empty_output_fields (nmc);
diff --git a/clients/cli/nmcli.h b/clients/cli/nmcli.h
index 5582b1d2ad..2d67320cbd 100644
--- a/clients/cli/nmcli.h
+++ b/clients/cli/nmcli.h
@@ -110,9 +110,7 @@ typedef struct _NmCli {
int timeout; /* Operation timeout */
- NMRemoteSettings *system_settings; /* System settings */
- gboolean system_settings_running; /* Is system settings service running? */
- GSList *system_connections; /* List of system connections */
+ GSList *connections; /* List of connections */
gboolean should_wait; /* Indication that nmcli should not end yet */
gboolean nowait_flag; /* '--nowait' option; used for passing to callbacks */
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index d64ca6b288..b7137560de 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -2507,7 +2507,7 @@ nmc_property_connection_set_secondaries (NMSetting *setting, const char *prop, c
continue;
if (nm_utils_is_uuid (*iter)) {
- con = nmc_find_connection (nm_cli.system_connections,
+ con = nmc_find_connection (nm_cli.connections,
"uuid", *iter, NULL);
if (!con)
g_print (_("Warning: %s is not an UUID of any existing connection profile\n"), *iter);
@@ -2520,7 +2520,7 @@ nmc_property_connection_set_secondaries (NMSetting *setting, const char *prop, c
}
}
} else {
- con = nmc_find_connection (nm_cli.system_connections,
+ con = nmc_find_connection (nm_cli.connections,
"id", *iter, NULL);
if (!con) {
g_set_error (error, 1, 0, _("'%s' is not a name of any exiting profile"), *iter);
diff --git a/clients/tui/nm-editor-utils.c b/clients/tui/nm-editor-utils.c
index 54efbf8ea1..e7b47e1a0d 100644
--- a/clients/tui/nm-editor-utils.c
+++ b/clients/tui/nm-editor-utils.c
@@ -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,
diff --git a/clients/tui/nm-editor-utils.h b/clients/tui/nm-editor-utils.h
index 8d61d7525a..5e402ce715 100644
--- a/clients/tui/nm-editor-utils.h
+++ b/clients/tui/nm-editor-utils.h
@@ -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
diff --git a/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c
index a596364533..f4dc0cf98e 100644
--- a/clients/tui/nmt-connect-connection-list.c
+++ b/clients/tui/nmt-connect-connection-list.c
@@ -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;
diff --git a/clients/tui/nmt-edit-connection-list.c b/clients/tui/nmt-edit-connection-list.c
index 508f204c39..9afe44164f 100644
--- a/clients/tui/nmt-edit-connection-list.c
+++ b/clients/tui/nmt-edit-connection-list.c
@@ -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);
diff --git a/clients/tui/nmt-editor.c b/clients/tui/nmt-editor.c
index 93e36d7919..bd1c77e339 100644
--- a/clients/tui/nmt-editor.c
+++ b/clients/tui/nmt-editor.c
@@ -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);
diff --git a/clients/tui/nmtui-edit.c b/clients/tui/nmtui-edit.c
index c0354784fe..d32da817cd 100644
--- a/clients/tui/nmtui-edit.c
+++ b/clients/tui/nmtui-edit.c
@@ -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]);
diff --git a/clients/tui/nmtui-hostname.c b/clients/tui/nmtui-hostname.c
index 92e493d92b..23de95b854 100644
--- a/clients/tui/nmtui-hostname.c
+++ b/clients/tui/nmtui-hostname.c
@@ -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);
diff --git a/clients/tui/nmtui.c b/clients/tui/nmtui.c
index ee63ccf280..0fac98ebc4 100644
--- a/clients/tui/nmtui.c
+++ b/clients/tui/nmtui.c
@@ -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;
}
diff --git a/clients/tui/nmtui.h b/clients/tui/nmtui.h
index 10b9c06ade..aada9719f7 100644
--- a/clients/tui/nmtui.h
+++ b/clients/tui/nmtui.h
@@ -24,7 +24,6 @@
G_BEGIN_DECLS
extern NMClient *nm_client;
-extern NMRemoteSettings *nm_settings;
void nmtui_quit (void);