core: remove useless NMSettings::connections-loaded signal
NMSettings (and NMConnectionProvider) had a signal to indicate when it had loaded the connections, but in reality this always happened before nm_settings_new() returned (as a side effect of calling unmanaged_specs_changed()) and so no one else would ever actually see the signal. So just kill it.
This commit is contained in:
@@ -180,11 +180,6 @@ pan_connection_check_create (NMBluezDevice *self)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nm_connection_provider_has_connections_loaded (priv->provider)) {
|
||||
/* do not try to create any connections until the connection provider is ready. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Only try once to create a connection. If it does not succeed, we do not try again. Also,
|
||||
* if the connection gets deleted later, do not create another one for this device. */
|
||||
priv->pan_connection_no_autocreate = TRUE;
|
||||
@@ -387,13 +382,14 @@ cp_connection_updated (NMConnectionProvider *provider,
|
||||
}
|
||||
|
||||
static void
|
||||
cp_connections_loaded (NMConnectionProvider *provider, NMBluezDevice *self)
|
||||
load_connections (NMBluezDevice *self)
|
||||
{
|
||||
NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
|
||||
const GSList *connections, *iter;
|
||||
|
||||
connections = nm_connection_provider_get_connections (provider);
|
||||
connections = nm_connection_provider_get_connections (priv->provider);
|
||||
for (iter = connections; iter; iter = g_slist_next (iter))
|
||||
cp_connection_added (provider, NM_CONNECTION (iter->data), self);
|
||||
cp_connection_added (priv->provider, NM_CONNECTION (iter->data), self);
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
@@ -832,7 +828,7 @@ get_properties_cb_4 (GObject *source_object, GAsyncResult *res, gpointer user_da
|
||||
g_variant_unref (v_properties);
|
||||
|
||||
/* Check if any connections match this device */
|
||||
cp_connections_loaded (priv->provider, self);
|
||||
load_connections (self);
|
||||
|
||||
priv->initialized = TRUE;
|
||||
g_signal_emit (self, signals[INITIALIZED], 0, TRUE);
|
||||
@@ -883,7 +879,7 @@ query_properties (NMBluezDevice *self)
|
||||
}
|
||||
|
||||
/* Check if any connections match this device */
|
||||
cp_connections_loaded (priv->provider, self);
|
||||
load_connections (self);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -970,11 +966,6 @@ nm_bluez_device_new (const char *path, NMConnectionProvider *provider, int bluez
|
||||
G_CALLBACK (cp_connection_updated),
|
||||
self);
|
||||
|
||||
g_signal_connect (priv->provider,
|
||||
NM_CP_SIGNAL_CONNECTIONS_LOADED,
|
||||
G_CALLBACK (cp_connections_loaded),
|
||||
self);
|
||||
|
||||
g_bus_get (G_BUS_TYPE_SYSTEM,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) on_bus_acquired,
|
||||
@@ -1027,7 +1018,6 @@ dispose (GObject *object)
|
||||
g_signal_handlers_disconnect_by_func (priv->provider, cp_connection_added, self);
|
||||
g_signal_handlers_disconnect_by_func (priv->provider, cp_connection_removed, self);
|
||||
g_signal_handlers_disconnect_by_func (priv->provider, cp_connection_updated, self);
|
||||
g_signal_handlers_disconnect_by_func (priv->provider, cp_connections_loaded, self);
|
||||
|
||||
g_slist_free_full (priv->connections, g_object_unref);
|
||||
priv->connections = NULL;
|
||||
|
@@ -351,7 +351,6 @@ static const char *reason_to_string (NMDeviceStateReason reason);
|
||||
static void ip_check_gw_ping_cleanup (NMDevice *self);
|
||||
|
||||
static void cp_connection_added (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data);
|
||||
static void cp_connections_loaded (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data);
|
||||
static void cp_connection_removed (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data);
|
||||
static void cp_connection_updated (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data);
|
||||
|
||||
@@ -907,11 +906,6 @@ nm_device_set_connection_provider (NMDevice *device,
|
||||
G_CALLBACK (cp_connection_added),
|
||||
device);
|
||||
|
||||
priv->cp_loaded_id = g_signal_connect (priv->con_provider,
|
||||
NM_CP_SIGNAL_CONNECTIONS_LOADED,
|
||||
G_CALLBACK (cp_connections_loaded),
|
||||
device);
|
||||
|
||||
priv->cp_removed_id = g_signal_connect (priv->con_provider,
|
||||
NM_CP_SIGNAL_CONNECTION_REMOVED,
|
||||
G_CALLBACK (cp_connection_removed),
|
||||
@@ -7042,20 +7036,6 @@ cp_connection_added (NMConnectionProvider *cp, NMConnection *connection, gpointe
|
||||
_signal_available_connections_changed (NM_DEVICE (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
cp_connections_loaded (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data)
|
||||
{
|
||||
const GSList *connections, *iter;
|
||||
gboolean added = FALSE;
|
||||
|
||||
connections = nm_connection_provider_get_connections (cp);
|
||||
for (iter = connections; iter; iter = g_slist_next (iter))
|
||||
added |= _try_add_available_connection (NM_DEVICE (user_data), NM_CONNECTION (iter->data));
|
||||
|
||||
if (added)
|
||||
_signal_available_connections_changed (NM_DEVICE (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
cp_connection_removed (NMConnectionProvider *cp, NMConnection *connection, gpointer user_data)
|
||||
{
|
||||
|
@@ -41,15 +41,6 @@ nm_connection_provider_get_connections (NMConnectionProvider *self)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_connection_provider_has_connections_loaded (NMConnectionProvider *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_CONNECTION_PROVIDER (self), FALSE);
|
||||
|
||||
g_assert (NM_CONNECTION_PROVIDER_GET_INTERFACE (self)->has_connections_loaded);
|
||||
return NM_CONNECTION_PROVIDER_GET_INTERFACE (self)->has_connections_loaded (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_connection_provider_add_connection:
|
||||
* @self: the #NMConnectionProvider
|
||||
@@ -131,14 +122,6 @@ nm_connection_provider_init (gpointer g_iface)
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
g_signal_new (NM_CP_SIGNAL_CONNECTIONS_LOADED,
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMConnectionProvider, connections_loaded),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
GType
|
||||
|
@@ -29,7 +29,6 @@ typedef struct _NMConnectionProvider NMConnectionProvider;
|
||||
#define NM_CP_SIGNAL_CONNECTION_ADDED "cp-connection-added"
|
||||
#define NM_CP_SIGNAL_CONNECTION_UPDATED "cp-connection-updated"
|
||||
#define NM_CP_SIGNAL_CONNECTION_REMOVED "cp-connection-removed"
|
||||
#define NM_CP_SIGNAL_CONNECTIONS_LOADED "cp-connections-loaded"
|
||||
|
||||
|
||||
/**
|
||||
@@ -58,8 +57,6 @@ struct _NMConnectionProvider {
|
||||
|
||||
const GSList * (*get_connections) (NMConnectionProvider *self);
|
||||
|
||||
gboolean (*has_connections_loaded) (NMConnectionProvider *self);
|
||||
|
||||
NMConnection * (*add_connection) (NMConnectionProvider *self,
|
||||
NMConnection *connection,
|
||||
gboolean save_to_disk,
|
||||
@@ -75,7 +72,6 @@ struct _NMConnectionProvider {
|
||||
|
||||
void (*connection_removed) (NMConnectionProvider *self, NMConnection *connection);
|
||||
|
||||
void (*connections_loaded) (NMConnectionProvider *self);
|
||||
};
|
||||
|
||||
GType nm_connection_provider_get_type (void);
|
||||
@@ -113,19 +109,6 @@ GSList *nm_connection_provider_get_best_connections (NMConnectionProvider *self,
|
||||
*/
|
||||
const GSList *nm_connection_provider_get_connections (NMConnectionProvider *self);
|
||||
|
||||
/**
|
||||
* nm_connection_provider_has_connections_loaded:
|
||||
* @self: the #NMConnectionProvider
|
||||
*
|
||||
* Returns: TRUE or FALSE indicating whether the connections of the provider are already
|
||||
* loaded. If they are not yet loaded, the provider will not emit the signals
|
||||
* NM_CP_SIGNAL_CONNECTION_ADDED, NM_CP_SIGNAL_CONNECTION_UPDATED and
|
||||
* NM_CP_SIGNAL_CONNECTION_REMOVED until NM_CP_SIGNAL_CONNECTIONS_LOADED gets
|
||||
* emited.
|
||||
*/
|
||||
gboolean nm_connection_provider_has_connections_loaded (NMConnectionProvider *self);
|
||||
|
||||
|
||||
/**
|
||||
* nm_connection_provider_add_connection:
|
||||
* @self: the #NMConnectionProvider
|
||||
|
@@ -1834,19 +1834,6 @@ connection_added (NMSettings *settings,
|
||||
schedule_activate_all ((NMPolicy *) user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
connections_loaded (NMSettings *settings, gpointer user_data)
|
||||
{
|
||||
// FIXME: "connections-loaded" signal is emmitted *before* we connect to it
|
||||
// in nm_policy_new(). So this function is never called. Currently we work around
|
||||
// that by calling reset_retries_all() in nm_policy_new()
|
||||
|
||||
/* Initialize connections' auto-retries */
|
||||
reset_retries_all (settings, NULL);
|
||||
|
||||
schedule_activate_all ((NMPolicy *) user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
add_or_change_zone_cb (GError *error, gpointer user_data)
|
||||
{
|
||||
@@ -2099,7 +2086,6 @@ nm_policy_new (NMManager *manager, NMSettings *settings)
|
||||
_connect_manager_signal (policy, NM_MANAGER_ACTIVE_CONNECTION_ADDED, active_connection_added);
|
||||
_connect_manager_signal (policy, NM_MANAGER_ACTIVE_CONNECTION_REMOVED, active_connection_removed);
|
||||
|
||||
_connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED, connections_loaded);
|
||||
_connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, connection_added);
|
||||
_connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, connection_updated);
|
||||
_connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, connection_updated_by_user);
|
||||
|
@@ -152,7 +152,6 @@ enum {
|
||||
CONNECTION_UPDATED_BY_USER,
|
||||
CONNECTION_REMOVED,
|
||||
CONNECTION_VISIBILITY_CHANGED,
|
||||
CONNECTIONS_LOADED,
|
||||
AGENT_REGISTERED,
|
||||
|
||||
NEW_CONNECTION, /* exported, not used internally */
|
||||
@@ -183,9 +182,6 @@ load_connections (NMSettings *self)
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
if (priv->connections_loaded)
|
||||
return;
|
||||
|
||||
for (iter = priv->plugins; iter; iter = g_slist_next (iter)) {
|
||||
NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data);
|
||||
GSList *plugin_connections;
|
||||
@@ -214,9 +210,6 @@ load_connections (NMSettings *self)
|
||||
|
||||
unmanaged_specs_changed (NULL, self);
|
||||
unrecognized_specs_changed (NULL, self);
|
||||
|
||||
g_signal_emit (self, signals[CONNECTIONS_LOADED], 0);
|
||||
g_signal_emit_by_name (self, NM_CP_SIGNAL_CONNECTIONS_LOADED);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -233,8 +226,6 @@ nm_settings_for_each_connection (NMSettings *self,
|
||||
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
load_connections (self);
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->connections);
|
||||
while (g_hash_table_iter_next (&iter, NULL, &data))
|
||||
for_each_func (self, NM_SETTINGS_CONNECTION (data), user_data);
|
||||
@@ -249,8 +240,6 @@ impl_settings_list_connections (NMSettings *self,
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
|
||||
load_connections (self);
|
||||
|
||||
*connections = g_ptr_array_sized_new (g_hash_table_size (priv->connections) + 1);
|
||||
g_hash_table_iter_init (&iter, priv->connections);
|
||||
while (g_hash_table_iter_next (&iter, &key, NULL))
|
||||
@@ -270,8 +259,6 @@ nm_settings_get_connection_by_uuid (NMSettings *self, const char *uuid)
|
||||
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
load_connections (self);
|
||||
|
||||
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)
|
||||
@@ -361,8 +348,6 @@ nm_settings_get_connection_by_path (NMSettings *self, const char *path)
|
||||
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
load_connections (self);
|
||||
|
||||
return (NMSettingsConnection *) g_hash_table_lookup (priv->connections, path);
|
||||
}
|
||||
|
||||
@@ -416,7 +401,6 @@ nm_settings_get_unmanaged_specs (NMSettings *self)
|
||||
{
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
load_connections (self);
|
||||
return priv->unmanaged_specs;
|
||||
}
|
||||
|
||||
@@ -861,9 +845,7 @@ claim_connection (NMSettings *self,
|
||||
g_object_ref (connection));
|
||||
|
||||
/* Only emit the individual connection-added signal after connections
|
||||
* have been initially loaded. While getting the first list of connections
|
||||
* we suppress it, then send the connections-loaded signal after we're all
|
||||
* done to minimize processing.
|
||||
* have been initially loaded.
|
||||
*/
|
||||
if (priv->connections_loaded) {
|
||||
/* Internal added signal */
|
||||
@@ -1314,15 +1296,11 @@ impl_settings_reload_connections (NMSettings *self,
|
||||
if (!ensure_root (priv->dbus_mgr, context))
|
||||
return;
|
||||
|
||||
if (!priv->connections_loaded) {
|
||||
load_connections (self);
|
||||
} else {
|
||||
for (iter = priv->plugins; iter; iter = g_slist_next (iter)) {
|
||||
NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data);
|
||||
|
||||
nm_system_config_interface_reload_connections (plugin);
|
||||
}
|
||||
}
|
||||
|
||||
dbus_g_method_return (context, TRUE);
|
||||
}
|
||||
@@ -1770,14 +1748,6 @@ get_connections (NMConnectionProvider *provider)
|
||||
return list;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
has_connections_loaded (NMConnectionProvider *provider)
|
||||
{
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (provider);
|
||||
|
||||
return priv->connections_loaded;
|
||||
}
|
||||
|
||||
static NMConnection *
|
||||
cp_get_connection_by_uuid (NMConnectionProvider *provider, const char *uuid)
|
||||
{
|
||||
@@ -1805,8 +1775,7 @@ nm_settings_new (GError **error)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unmanaged_specs_changed (NULL, self);
|
||||
unrecognized_specs_changed (NULL, self);
|
||||
load_connections (self);
|
||||
|
||||
nm_dbus_manager_register_object (priv->dbus_mgr, NM_DBUS_PATH_SETTINGS, self);
|
||||
return self;
|
||||
@@ -1817,7 +1786,6 @@ connection_provider_init (NMConnectionProvider *cp_class)
|
||||
{
|
||||
cp_class->get_best_connections = get_best_connections;
|
||||
cp_class->get_connections = get_connections;
|
||||
cp_class->has_connections_loaded = has_connections_loaded;
|
||||
cp_class->add_connection = _nm_connection_provider_add_connection;
|
||||
cp_class->get_connection_by_uuid = cp_get_connection_by_uuid;
|
||||
}
|
||||
@@ -1996,15 +1964,6 @@ nm_settings_class_init (NMSettingsClass *class)
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
signals[CONNECTIONS_LOADED] =
|
||||
g_signal_new (NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSettingsClass, connections_loaded),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
signals[AGENT_REGISTERED] =
|
||||
g_signal_new (NM_SETTINGS_SIGNAL_AGENT_REGISTERED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
@@ -49,7 +49,6 @@
|
||||
#define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER "connection-updated-by-user"
|
||||
#define NM_SETTINGS_SIGNAL_CONNECTION_REMOVED "connection-removed"
|
||||
#define NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed"
|
||||
#define NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED "connections-loaded"
|
||||
#define NM_SETTINGS_SIGNAL_AGENT_REGISTERED "agent-registered"
|
||||
|
||||
typedef struct {
|
||||
@@ -70,8 +69,6 @@ typedef struct {
|
||||
|
||||
void (*connection_visibility_changed) (NMSettings *self, NMSettingsConnection *connection);
|
||||
|
||||
void (*connections_loaded) (NMSettings *self);
|
||||
|
||||
void (*agent_registered) (NMSettings *self, NMSecretAgent *agent);
|
||||
} NMSettingsClass;
|
||||
|
||||
|
Reference in New Issue
Block a user