From 9d318e9fae475fb010030704bfb22dd0a514e0fe Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 7 Oct 2007 23:33:28 +0000 Subject: 2007-10-07 Dan Williams * src/nm-manager.c src/nm-manager.h - Add a 'connections-added' signal to batch together updates of large numbers of connections, like when reading from a settings service the first time. Otherwise, the policy would just activate the first suitable connection it saw rather than waiting for the full list to arrive. - (nm_manager_class_init): register new signal - (get_type_for_proxy, connection_get_settings_cb, get_connection_for_proxy): centralize places where a proxy's setting service is determined - (free_get_settings_info): if the call being freed is the last call in a pending call group, fire off the connections-added signal - (internal_new_connection_cb): add call to a pending call group if requested - (list_connections_cb): always create a call group here, because this call results in a batch of new connections - (initial_get_connections): start getting system connections first - (nm_manager_connections_destroy, emit_removed): actually emit the removed signal when destroying connections * src/NetworkManagerPolicy.c - (nm_policy_new, connections_added): handle connections-added signal from the manager git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2951 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- src/NetworkManagerPolicy.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/NetworkManagerPolicy.c') diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index dc3601b1b9..3b7ae68724 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -475,6 +475,16 @@ state_changed (NMManager *manager, NMState state, gpointer user_data) } } +static void +connections_added (NMManager *manager, + NMConnectionType connection_type, + gpointer user_data) +{ + NMPolicy *policy = (NMPolicy *) user_data; + + schedule_change_check (policy); +} + static void connection_added (NMManager *manager, NMConnection *connection, @@ -544,6 +554,13 @@ nm_policy_new (NMManager *manager) g_signal_connect (manager, "state-change", G_CALLBACK (state_changed), policy); + /* Large batch of connections added, manager doesn't want us to + * process each one individually. + */ + g_signal_connect (manager, "connections-added", + G_CALLBACK (connections_added), policy); + + /* Single connection added */ g_signal_connect (manager, "connection-added", G_CALLBACK (connection_added), policy); -- cgit v1.2.1