Commit 8ce06b81 authored by Dan Winship's avatar Dan Winship

libnm: synchronize NMClient and NMRemoteSettings "is NM running" properties

Rename NMClient:manager-running and NMRemoteSettings:service-running
to both be :nm-running.
parent 7e791ce3
......@@ -1285,7 +1285,7 @@ do_connections_show (NmCli *nmc, gboolean active_only, int argc, char **argv)
nmc->should_wait = FALSE;
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto finish;
......@@ -2009,7 +2009,7 @@ do_connection_up (NmCli *nmc, int argc, char **argv)
/* create NMClient */
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -2069,7 +2069,7 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
/* create NMClient */
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -8046,7 +8046,7 @@ do_connection_modify (NmCli *nmc,
/* create NMClient */
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto finish;
......@@ -8254,7 +8254,7 @@ do_connection_delete (NmCli *nmc, int argc, char **argv)
/* create NMClient */
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto finish;
......@@ -8347,7 +8347,7 @@ do_connection_reload (NmCli *nmc, int argc, char **argv)
nmc->return_value = NMC_RESULT_SUCCESS;
nmc->should_wait = FALSE;
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
return nmc->return_value;
......@@ -8375,7 +8375,7 @@ do_connection_load (NmCli *nmc, int argc, char **argv)
nmc->return_value = NMC_RESULT_SUCCESS;
nmc->should_wait = FALSE;
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
return nmc->return_value;
......@@ -8665,7 +8665,7 @@ do_connections (NmCli *nmc, int argc, char **argv)
}
/* find out whether settings service is running */
g_object_get (nmc->system_settings, NM_REMOTE_SETTINGS_SERVICE_RUNNING, &nmc->system_settings_running, NULL);
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."));
......
......@@ -1183,7 +1183,7 @@ do_devices_status (NmCli *nmc, int argc, char **argv)
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -1231,7 +1231,7 @@ do_devices_show (NmCli *nmc, int argc, char **argv)
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -1394,7 +1394,7 @@ do_device_connect (NmCli *nmc, int argc, char **argv)
}
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -1528,7 +1528,7 @@ do_device_disconnect (NmCli *nmc, int argc, char **argv)
}
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -1622,7 +1622,7 @@ do_device_delete (NmCli *nmc, int argc, char **argv)
}
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -1765,7 +1765,7 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -2209,7 +2209,7 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......@@ -2508,7 +2508,7 @@ do_device_wimax_list (NmCli *nmc, int argc, char **argv)
nmc->get_client (nmc);
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
goto error;
......
......@@ -335,7 +335,7 @@ show_nm_status (NmCli *nmc, const char *pretty_header_name, const char *print_fl
nmc->get_client (nmc); /* create NMClient */
nm_running = nm_client_get_manager_running (nmc->client);
nm_running = nm_client_get_nm_running (nmc->client);
if (nm_running) {
if (!nmc_versions_match (nmc))
return FALSE;
......@@ -478,7 +478,7 @@ show_nm_permissions (NmCli *nmc)
nmc->get_client (nmc); /* create NMClient */
if (!nm_client_get_manager_running (nmc->client)) {
if (!nm_client_get_nm_running (nmc->client)) {
g_string_printf (nmc->return_text, _("Error: NetworkManager is not running."));
nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING;
return FALSE;
......
......@@ -62,7 +62,7 @@ client_properties_changed (GObject *object,
NMState state;
gboolean wait_startup = GPOINTER_TO_UINT (g_object_get_data (object, WAIT_STARTUP_TAG));
if (!nm_client_get_manager_running (client))
if (!nm_client_get_nm_running (client))
return;
if (wait_startup) {
......@@ -203,7 +203,7 @@ main (int argc, char *argv[])
g_object_set_data (G_OBJECT (client), WAIT_STARTUP_TAG, GUINT_TO_POINTER (wait_startup));
state = nm_client_get_state (client);
if (!nm_client_get_manager_running (client)) {
if (!nm_client_get_nm_running (client)) {
if (exit_no_nm) {
g_object_unref (client);
return 1;
......
......@@ -249,7 +249,7 @@ main (int argc, char **argv)
g_error_free (error);
exit (1);
}
if (!nm_client_get_manager_running (nm_client)) {
if (!nm_client_get_nm_running (nm_client)) {
g_printerr ("%s\n", _("NetworkManager is not running."));
exit (1);
}
......
......@@ -128,7 +128,7 @@ list_connections (gpointer data)
}
/* Find out whether setting service is running */
g_object_get (settings, NM_REMOTE_SETTINGS_SERVICE_RUNNING, &settings_running, NULL);
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.");
......
......@@ -48,7 +48,7 @@ global:
nm_client_get_device_by_path;
nm_client_get_devices;
nm_client_get_logging;
nm_client_get_manager_running;
nm_client_get_nm_running;
nm_client_get_permission_result;
nm_client_get_primary_connection;
nm_client_get_startup;
......
......@@ -52,7 +52,7 @@ G_DEFINE_TYPE_WITH_CODE (NMClient, nm_client, NM_TYPE_OBJECT,
typedef struct {
DBusGProxy *client_proxy;
DBusGProxy *bus_proxy;
gboolean manager_running;
gboolean nm_running;
char *version;
NMState state;
gboolean startup;
......@@ -86,7 +86,7 @@ enum {
PROP_VERSION,
PROP_STATE,
PROP_STARTUP,
PROP_MANAGER_RUNNING,
PROP_NM_RUNNING,
PROP_NETWORKING_ENABLED,
PROP_WIRELESS_ENABLED,
PROP_WIRELESS_HARDWARE_ENABLED,
......@@ -213,7 +213,7 @@ init_dbus (NMObject *object)
NULL);
if (_nm_object_is_connection_private (NM_OBJECT (object)))
priv->manager_running = TRUE;
priv->nm_running = TRUE;
else {
priv->bus_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
DBUS_SERVICE_DBUS,
......@@ -660,7 +660,7 @@ nm_client_activate_connection (NMClient *client,
priv = NM_CLIENT_GET_PRIVATE (client);
priv->pending_activations = g_slist_prepend (priv->pending_activations, info);
if (priv->manager_running == FALSE) {
if (priv->nm_running == FALSE) {
info->idle_id = g_idle_add (activate_nm_not_running, info);
return;
}
......@@ -747,7 +747,7 @@ nm_client_add_and_activate_connection (NMClient *client,
priv = NM_CLIENT_GET_PRIVATE (client);
priv->pending_activations = g_slist_prepend (priv->pending_activations, info);
if (priv->manager_running) {
if (priv->nm_running) {
dbus_g_proxy_begin_call (priv->client_proxy, "AddAndActivateConnection",
add_activate_cb, info, NULL,
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, hash,
......@@ -791,7 +791,7 @@ nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active)
g_return_if_fail (NM_IS_ACTIVE_CONNECTION (active));
priv = NM_CLIENT_GET_PRIVATE (client);
if (!priv->manager_running)
if (!priv->nm_running)
return;
path = nm_object_get_path (NM_OBJECT (active));
......@@ -822,7 +822,7 @@ nm_client_get_active_connections (NMClient *client)
g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
priv = NM_CLIENT_GET_PRIVATE (client);
if (!priv->manager_running)
if (!priv->nm_running)
return NULL;
return handle_ptr_array_return (priv->active_connections);
......@@ -858,7 +858,7 @@ nm_client_wireless_set_enabled (NMClient *client, gboolean enabled)
g_return_if_fail (NM_IS_CLIENT (client));
if (!NM_CLIENT_GET_PRIVATE (client)->manager_running)
if (!NM_CLIENT_GET_PRIVATE (client)->nm_running)
return;
g_value_init (&value, G_TYPE_BOOLEAN);
......@@ -916,7 +916,7 @@ nm_client_wwan_set_enabled (NMClient *client, gboolean enabled)
g_return_if_fail (NM_IS_CLIENT (client));
if (!NM_CLIENT_GET_PRIVATE (client)->manager_running)
if (!NM_CLIENT_GET_PRIVATE (client)->nm_running)
return;
g_value_init (&value, G_TYPE_BOOLEAN);
......@@ -974,7 +974,7 @@ nm_client_wimax_set_enabled (NMClient *client, gboolean enabled)
g_return_if_fail (NM_IS_CLIENT (client));
if (!NM_CLIENT_GET_PRIVATE (client)->manager_running)
if (!NM_CLIENT_GET_PRIVATE (client)->nm_running)
return;
g_value_init (&value, G_TYPE_BOOLEAN);
......@@ -1019,7 +1019,7 @@ nm_client_get_version (NMClient *client)
priv = NM_CLIENT_GET_PRIVATE (client);
return priv->manager_running ? priv->version : NULL;
return priv->nm_running ? priv->version : NULL;
}
/**
......@@ -1087,7 +1087,7 @@ nm_client_networking_set_enabled (NMClient *client, gboolean enable)
g_return_if_fail (NM_IS_CLIENT (client));
if (!NM_CLIENT_GET_PRIVATE (client)->manager_running)
if (!NM_CLIENT_GET_PRIVATE (client)->nm_running)
return;
if (!dbus_g_proxy_call (NM_CLIENT_GET_PRIVATE (client)->client_proxy, "Enable", &err,
......@@ -1100,7 +1100,7 @@ nm_client_networking_set_enabled (NMClient *client, gboolean enable)
}
/**
* nm_client_get_manager_running:
* nm_client_get_nm_running:
* @client: a #NMClient
*
* Determines whether the daemon is running.
......@@ -1108,11 +1108,11 @@ nm_client_networking_set_enabled (NMClient *client, gboolean enable)
* Returns: %TRUE if the daemon is running
**/
gboolean
nm_client_get_manager_running (NMClient *client)
nm_client_get_nm_running (NMClient *client)
{
g_return_val_if_fail (NM_IS_CLIENT (client), FALSE);
return NM_CLIENT_GET_PRIVATE (client)->manager_running;
return NM_CLIENT_GET_PRIVATE (client)->nm_running;
}
/**
......@@ -1160,7 +1160,7 @@ nm_client_get_logging (NMClient *client, char **level, char **domains, GError **
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
priv = NM_CLIENT_GET_PRIVATE (client);
if (!priv->manager_running) {
if (!priv->nm_running) {
g_set_error_literal (error,
NM_CLIENT_ERROR,
NM_CLIENT_ERROR_MANAGER_NOT_RUNNING,
......@@ -1199,7 +1199,7 @@ nm_client_set_logging (NMClient *client, const char *level, const char *domains,
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
priv = NM_CLIENT_GET_PRIVATE (client);
if (!priv->manager_running) {
if (!priv->nm_running) {
g_set_error_literal (error,
NM_CLIENT_ERROR,
NM_CLIENT_ERROR_MANAGER_NOT_RUNNING,
......@@ -1323,7 +1323,7 @@ updated_properties (GObject *object, GAsyncResult *result, gpointer user_data)
g_error_free (error);
}
_nm_object_queue_notify (NM_OBJECT (client), NM_CLIENT_MANAGER_RUNNING);
_nm_object_queue_notify (NM_OBJECT (client), NM_CLIENT_NM_RUNNING);
}
static void
......@@ -1347,14 +1347,14 @@ proxy_name_owner_changed (DBusGProxy *proxy,
else if (old_good && !new_good)
new_running = FALSE;
if (new_running == priv->manager_running)
if (new_running == priv->nm_running)
return;
priv->manager_running = new_running;
if (!priv->manager_running) {
priv->nm_running = new_running;
if (!priv->nm_running) {
priv->state = NM_STATE_UNKNOWN;
priv->startup = FALSE;
_nm_object_queue_notify (NM_OBJECT (client), NM_CLIENT_MANAGER_RUNNING);
_nm_object_queue_notify (NM_OBJECT (client), NM_CLIENT_NM_RUNNING);
_nm_object_suppress_property_updates (NM_OBJECT (client), TRUE);
poke_wireless_devices_with_rf_status (client);
free_devices (client, TRUE);
......@@ -1752,12 +1752,12 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
"NameHasOwner", error,
G_TYPE_STRING, NM_DBUS_SERVICE,
G_TYPE_INVALID,
G_TYPE_BOOLEAN, &priv->manager_running,
G_TYPE_BOOLEAN, &priv->nm_running,
G_TYPE_INVALID))
return FALSE;
}
if (priv->manager_running && !get_permissions_sync (client, error))
if (priv->nm_running && !get_permissions_sync (client, error))
return FALSE;
return TRUE;
......@@ -1828,22 +1828,22 @@ finish_init (NMClientInitData *init_data)
}
static void
init_async_got_manager_running (DBusGProxy *proxy, DBusGProxyCall *call,
gpointer user_data)
init_async_got_nm_running (DBusGProxy *proxy, DBusGProxyCall *call,
gpointer user_data)
{
NMClientInitData *init_data = user_data;
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (init_data->client);
GError *error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error,
G_TYPE_BOOLEAN, &priv->manager_running,
G_TYPE_BOOLEAN, &priv->nm_running,
G_TYPE_INVALID)) {
g_simple_async_result_take_error (init_data->result, error);
init_async_complete (init_data);
return;
}
if (!priv->manager_running) {
if (!priv->nm_running) {
init_async_complete (init_data);
return;
}
......@@ -1877,7 +1877,7 @@ init_async (GAsyncInitable *initable, int io_priority,
else {
/* Check if NM is running */
dbus_g_proxy_begin_call (priv->bus_proxy, "NameHasOwner",
init_async_got_manager_running,
init_async_got_nm_running,
init_data, NULL,
G_TYPE_STRING, NM_DBUS_SERVICE,
G_TYPE_INVALID);
......@@ -1994,8 +1994,8 @@ get_property (GObject *object,
case PROP_STARTUP:
g_value_set_boolean (value, nm_client_get_startup (self));
break;
case PROP_MANAGER_RUNNING:
g_value_set_boolean (value, priv->manager_running);
case PROP_NM_RUNNING:
g_value_set_boolean (value, priv->nm_running);
break;
case PROP_NETWORKING_ENABLED:
g_value_set_boolean (value, nm_client_networking_get_enabled (self));
......@@ -2096,13 +2096,13 @@ nm_client_class_init (NMClientClass *client_class)
G_PARAM_STATIC_STRINGS));
/**
* NMClient:manager-running:
* NMClient:nm-running:
*
* Whether the daemon is running.
**/
g_object_class_install_property
(object_class, PROP_MANAGER_RUNNING,
g_param_spec_boolean (NM_CLIENT_MANAGER_RUNNING, "", "",
(object_class, PROP_NM_RUNNING,
g_param_spec_boolean (NM_CLIENT_NM_RUNNING, "", "",
FALSE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
......
......@@ -48,7 +48,7 @@ G_BEGIN_DECLS
#define NM_CLIENT_VERSION "version"
#define NM_CLIENT_STATE "state"
#define NM_CLIENT_STARTUP "startup"
#define NM_CLIENT_MANAGER_RUNNING "manager-running"
#define NM_CLIENT_NM_RUNNING "nm-running"
#define NM_CLIENT_NETWORKING_ENABLED "networking-enabled"
#define NM_CLIENT_WIRELESS_ENABLED "wireless-enabled"
#define NM_CLIENT_WIRELESS_HARDWARE_ENABLED "wireless-hardware-enabled"
......@@ -222,7 +222,7 @@ gboolean nm_client_wimax_hardware_get_enabled (NMClient *client);
const char *nm_client_get_version (NMClient *client);
NMState nm_client_get_state (NMClient *client);
gboolean nm_client_get_startup (NMClient *client);
gboolean nm_client_get_manager_running (NMClient *client);
gboolean nm_client_get_nm_running (NMClient *client);
const GPtrArray *nm_client_get_active_connections (NMClient *client);
NMClientPermissionResult nm_client_get_permission_result (NMClient *client,
......
......@@ -135,7 +135,7 @@ typedef struct {
DBusGProxy *proxy;
GHashTable *connections;
GHashTable *pending; /* Connections we don't have settings for yet */
gboolean service_running;
gboolean nm_running;
guint32 init_left;
/* AddConnectionInfo objects that are waiting for the connection to become initialized */
......@@ -153,7 +153,7 @@ typedef struct {
enum {
PROP_0,
PROP_BUS,
PROP_SERVICE_RUNNING,
PROP_NM_RUNNING,
PROP_HOSTNAME,
PROP_CAN_MODIFY,
......@@ -254,7 +254,7 @@ nm_remote_settings_get_connection_by_id (NMRemoteSettings *settings, const char
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (priv->service_running) {
if (priv->nm_running) {
GHashTableIter iter;
NMConnection *candidate;
......@@ -289,7 +289,7 @@ nm_remote_settings_get_connection_by_path (NMRemoteSettings *settings, const cha
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
return priv->service_running ? g_hash_table_lookup (priv->connections, path) : NULL;
return priv->nm_running ? g_hash_table_lookup (priv->connections, path) : NULL;
}
/**
......@@ -314,7 +314,7 @@ nm_remote_settings_get_connection_by_uuid (NMRemoteSettings *settings, const cha
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (priv->service_running) {
if (priv->nm_running) {
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &candidate)) {
if (g_strcmp0 (uuid, nm_connection_get_uuid (NM_CONNECTION (candidate))) == 0)
......@@ -532,7 +532,7 @@ fetch_connections_done (DBusGProxy *proxy,
G_TYPE_INVALID)) {
if ( !g_error_matches (error, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN)
&& !g_error_matches (error, DBUS_GERROR, DBUS_GERROR_NAME_HAS_NO_OWNER)
&& priv->service_running) {
&& priv->nm_running) {
g_warning ("%s: error fetching connections: (%d) %s.",
__func__,
error->code,
......@@ -584,7 +584,7 @@ nm_remote_settings_list_connections (NMRemoteSettings *settings)
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (priv->service_running) {
if (priv->nm_running) {
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, &value))
list = g_slist_prepend (list, NM_REMOTE_CONNECTION (value));
......@@ -647,7 +647,7 @@ nm_remote_settings_add_connection (NMRemoteSettings *settings,
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (!priv->service_running)
if (!priv->nm_running)
return FALSE;
info = g_malloc0 (sizeof (AddConnectionInfo));
......@@ -700,7 +700,7 @@ nm_remote_settings_add_connection_unsaved (NMRemoteSettings *settings,
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (!priv->service_running)
if (!priv->nm_running)
return FALSE;
info = g_malloc0 (sizeof (AddConnectionInfo));
......@@ -760,7 +760,7 @@ nm_remote_settings_load_connections (NMRemoteSettings *settings,
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (!priv->service_running) {
if (!priv->nm_running) {
g_set_error_literal (error, NM_REMOTE_SETTINGS_ERROR,
NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE,
"NetworkManager is not running.");
......@@ -807,7 +807,7 @@ nm_remote_settings_reload_connections (NMRemoteSettings *settings,
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (!priv->service_running) {
if (!priv->nm_running) {
g_set_error_literal (error, NM_REMOTE_SETTINGS_ERROR,
NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE,
"NetworkManager is not running.");
......@@ -894,7 +894,7 @@ nm_remote_settings_save_hostname (NMRemoteSettings *settings,
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
if (!priv->service_running)
if (!priv->nm_running)
return FALSE;
info = g_malloc0 (sizeof (SaveHostnameInfo));
......@@ -966,7 +966,7 @@ name_owner_changed (DBusGProxy *proxy,
if (!strcmp (name, sname)) {
if (new_owner && strlen (new_owner) > 0) {
priv->service_running = TRUE;
priv->nm_running = TRUE;
priv->listcon_call = dbus_g_proxy_begin_call (priv->proxy, "ListConnections",
fetch_connections_done, self, NULL,
......@@ -977,7 +977,7 @@ name_owner_changed (DBusGProxy *proxy,
G_TYPE_STRING, NM_DBUS_INTERFACE_SETTINGS,
G_TYPE_INVALID);
} else {
priv->service_running = FALSE;
priv->nm_running = FALSE;
clear_one_hash (priv->pending);
clear_one_hash (priv->connections);
......@@ -995,7 +995,7 @@ name_owner_changed (DBusGProxy *proxy,
priv->listcon_call = NULL;
}
}
g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_SERVICE_RUNNING);
g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_NM_RUNNING);
}
}
......@@ -1177,19 +1177,19 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", error,
G_TYPE_STRING, NM_DBUS_SERVICE,
G_TYPE_INVALID,
G_TYPE_BOOLEAN, &priv->service_running,
G_TYPE_BOOLEAN, &priv->nm_running,
G_TYPE_INVALID)) {
priv->service_running = FALSE;
priv->nm_running = FALSE;
return FALSE;
}
/* If NM isn't running we'll grab properties from name_owner_changed()
* when it starts.
*/
if (!priv->service_running)
if (!priv->nm_running)
return TRUE;
} else
priv->service_running = TRUE;
priv->nm_running = TRUE;
priv->listcon_call = dbus_g_proxy_begin_call (priv->proxy, "ListConnections",
fetch_connections_done, NM_REMOTE_SETTINGS (initable), NULL,
......@@ -1277,14 +1277,14 @@ init_async_got_manager_running (DBusGProxy *proxy, DBusGProxyCall *call,
GError *error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error,
G_TYPE_BOOLEAN, &priv->service_running,
G_TYPE_BOOLEAN, &priv->nm_running,
G_TYPE_INVALID)) {
g_simple_async_result_take_error (init_data->result, error);
init_async_complete (init_data);
return;
}
if (!priv->service_running) {
if (!priv->nm_running) {
g_simple_async_result_set_op_res_gboolean (init_data->result, TRUE);
init_async_complete (init_data);
return;
......@@ -1396,8 +1396,8 @@ get_property (GObject *object, guint prop_id,
case PROP_BUS:
g_value_set_boxed (value, priv->bus);
break;
case PROP_SERVICE_RUNNING:
g_value_set_boolean (value, priv->service_running);
case PROP_NM_RUNNING:
g_value_set_boolean (value, priv->nm_running);
break;
case PROP_HOSTNAME:
g_value_set_string (value, priv->hostname);
......@@ -1440,13 +1440,13 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class)
G_PARAM_STATIC_STRINGS));
/**
* NMRemoteSettings:service-running:
* NMRemoteSettings:nm-running:
*
* Whether the settings service is running.
* Whether the NetworkManager settings service is running.
*/
g_object_class_install_property
(object_class, PROP_SERVICE_RUNNING,
g_param_spec_boolean (NM_REMOTE_SETTINGS_SERVICE_RUNNING, "", "",
(object_class, PROP_NM_RUNNING,
g_param_spec_boolean (NM_REMOTE_SETTINGS_NM_RUNNING, "", "",
FALSE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
......
......@@ -63,7 +63,7 @@ GQuark nm_remote_settings_error_quark (void);
#define NM_REMOTE_SETTINGS_BUS "bus"
#define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running"
#define NM_REMOTE_SETTINGS_NM_RUNNING "nm-running"
#define NM_REMOTE_SETTINGS_HOSTNAME "hostname"
#define NM_REMOTE_SETTINGS_CAN_MODIFY "can-modify"
......
......@@ -808,9 +808,9 @@ test_devices_array (void)
}
static void
manager_running_changed (GObject *client,
GParamSpec *pspec,
gpointer user_data)
nm_running_changed (GObject *client,
GParamSpec *pspec,
gpointer user_data)
{
int *running_changed = user_data;
......@@ -819,7 +819,7 @@ manager_running_changed (GObject *client,
}
static void
test_client_manager_running (void)
test_client_nm_running (void)
{
NMClient *client1, *client2;
guint quit_id;
......@@ -828,7 +828,7 @@ test_client_manager_running (void)
client1 = test_client_new ();
g_assert (!nm_client_get_manager_running (client1));
g_assert (!nm_client_get_nm_running (client1));
g_assert_cmpstr (nm_client_get_version (client1), ==, NULL);
g_assert (!nm_client_networking_get_enabled (client1));
......@@ -848,26 +848,26 @@ test_client_manager_running (void)
/* client2 should know that NM is running, but the previously-created
* client1 hasn't gotten the news yet.
*/
g_assert (!nm_client_get_manager_running (client1));
g_assert (nm_client_get_manager_running (client2));
g_assert (!nm_client_get_nm_running (client1));
g_assert (nm_client_get_nm_running (client2));
g_signal_connect (client1, "notify::" NM_CLIENT_MANAGER_RUNNING,
G_CALLBACK (manager_running_changed), &running_changed);
g_signal_connect (client1, "notify::" NM_CLIENT_NM_RUNNING,
G_CALLBACK (nm_running_changed), &running_changed);
quit_id = g_timeout_add_seconds (5, loop_quit, loop);
g_main_loop_run (loop);
g_assert_cmpint (running_changed, ==, 1);
g_assert (nm_client_get_manager_running (client1));
g_assert (nm_client_get_nm_running (client1));
g_source_remove (quit_id);
/* And kill it */
g_clear_pointer (&sinfo, nm_test_service_cleanup);
g_assert (nm_client_get_manager_running (client1));
g_assert (nm_client_get_nm_running (client1));
quit_id = g_timeout_add_seconds (5, loop_quit, loop);
g_main_loop_run (loop);
g_assert_cmpint (running_changed, ==, 2);
g_assert (!nm_client_get_manager_running (client1));
g_assert (!nm_client_get_nm_running (client1));
g_source_remove (quit_id);
g_object_unref (client1);
......@@ -891,7 +891,7 @@ main (int argc, char **argv)
g_test_add_func ("/libnm/wifi-ap-added-removed", test_wifi_ap_added_removed);
g_test_add_func ("/libnm/wimax-nsp-added-removed", test_wimax_nsp_added_removed);
g_test_add_func ("/libnm/devices-array", test_devices_array);
g_test_add_func ("/libnm/client-manager-running", test_client_manager_running);