Commit e704e827 authored by Thomas Haller's avatar Thomas Haller

settings: add "connection-flags-changed" signal to connection

We will need to subscribe to changes to "flags" from NMManager.
parent c385cc51
......@@ -122,6 +122,7 @@ enum {
CONNECTION_UPDATED,
CONNECTION_REMOVED,
CONNECTION_VISIBILITY_CHANGED,
CONNECTION_FLAGS_CHANGED,
NEW_CONNECTION, /* exported, not used internally */
LAST_SIGNAL
};
......@@ -831,6 +832,17 @@ connection_visibility_changed (NMSettingsConnection *connection,
connection);
}
static void
connection_flags_changed (NMSettingsConnection *connection,
GParamSpec *pspec,
gpointer user_data)
{
g_signal_emit (NM_SETTINGS (user_data),
signals[CONNECTION_FLAGS_CHANGED],
0,
connection);
}
static void
connection_removed (NMSettingsConnection *connection, gpointer user_data)
{
......@@ -850,6 +862,7 @@ connection_removed (NMSettingsConnection *connection, gpointer user_data)
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_removed), self);
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_updated), self);
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_visibility_changed), self);
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_flags_changed), self);
if (!priv->startup_complete)
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (connection_ready_changed), self);
g_object_unref (self);
......@@ -976,6 +989,9 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection)
g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_VISIBLE,
G_CALLBACK (connection_visibility_changed),
self);
g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_FLAGS,
G_CALLBACK (connection_flags_changed),
self);
if (!priv->startup_complete) {
g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_READY,
G_CALLBACK (connection_ready_changed),
......@@ -1995,6 +2011,14 @@ nm_settings_class_init (NMSettingsClass *class)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION);
signals[CONNECTION_FLAGS_CHANGED] =
g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_FLAGS_CHANGED,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION);
signals[NEW_CONNECTION] =
g_signal_new ("new-connection",
G_OBJECT_CLASS_TYPE (object_class),
......
......@@ -47,6 +47,7 @@
#define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED "connection-updated"
#define NM_SETTINGS_SIGNAL_CONNECTION_REMOVED "connection-removed"
#define NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed"
#define NM_SETTINGS_SIGNAL_CONNECTION_FLAGS_CHANGED "connection-flags-changed"
/**
* NMConnectionFilterFunc:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment