mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 21:10:08 +01:00
core: add has_connections_loaded method to NMConnectionProvider
This method returns true, if the connections are already loaded (and the connection_loaded signal already emited). Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
008453e61f
commit
3b12d9ae6e
3 changed files with 32 additions and 0 deletions
|
|
@ -40,6 +40,15 @@ 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);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ struct _NMConnectionProvider {
|
|||
|
||||
const GSList * (*get_connections) (NMConnectionProvider *self);
|
||||
|
||||
gboolean (*has_connections_loaded) (NMConnectionProvider *self);
|
||||
|
||||
/* Signals */
|
||||
void (*connection_added) (NMConnectionProvider *self, NMConnection *connection);
|
||||
|
||||
|
|
@ -103,4 +105,16 @@ 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);
|
||||
|
||||
#endif /* NM_CONNECTION_PROVIDER_H */
|
||||
|
|
|
|||
|
|
@ -1635,6 +1635,14 @@ get_connections (NMConnectionProvider *provider)
|
|||
return g_slist_reverse (list);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
has_connections_loaded (NMConnectionProvider *provider)
|
||||
{
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (provider);
|
||||
|
||||
return priv->connections_loaded;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
NMSettings *
|
||||
|
|
@ -1667,6 +1675,7 @@ 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;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue