NetworkManager r3584 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3584 - in trunk: . src
- Date: Tue, 22 Apr 2008 03:40:48 +0100 (BST)
Author: dcbw
Date: Tue Apr 22 02:40:47 2008
New Revision: 3584
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3584&view=rev
Log:
2008-04-21 Dan Williams <dcbw redhat com>
* src/nm-activation-request.c
src/nm-activation-request.h
- (dispose): ensure to disconnect from the device's state-changed signal
when appropriate so the signal doesn't get handled by an already
disposed NMActRequest
- (device_state_changed): update is_default here too just to make sure
default is only True when the child device is activated
- (nm_act_request_set_default): new function
* src/NetworkManagerPolicy.c
- (update_routing_and_dns): set 'default' on the active connection which
has the default route and DNS
Modified:
trunk/ChangeLog
trunk/src/NetworkManagerPolicy.c
trunk/src/nm-activation-request.c
trunk/src/nm-activation-request.h
Modified: trunk/src/NetworkManagerPolicy.c
==============================================================================
--- trunk/src/NetworkManagerPolicy.c (original)
+++ trunk/src/NetworkManagerPolicy.c Tue Apr 22 02:40:47 2008
@@ -116,6 +116,7 @@
{
NMDevice *best = NULL;
guint32 best_prio = 0;
+ NMActRequest *best_req = NULL;
GSList *devices, *iter;
NMNamedManager *named_mgr;
NMIP4Config *config;
@@ -146,6 +147,7 @@
if (prio > best_prio) {
best = dev;
best_prio = prio;
+ best_req = req;
}
}
@@ -155,6 +157,16 @@
goto out;
update_default_route (policy, best);
+
+ /* Update the default active connection */
+ for (iter = devices; iter; iter = g_slist_next (iter)) {
+ NMDevice *dev = NM_DEVICE (iter->data);
+ NMActRequest *req;
+
+ req = nm_device_get_act_request (dev);
+ if (req)
+ nm_act_request_set_default (req, (req == best_req) ? TRUE : FALSE);
+ }
named_mgr = nm_named_manager_get ();
config = nm_device_get_ip4_config (best);
Modified: trunk/src/nm-activation-request.c
==============================================================================
--- trunk/src/nm-activation-request.c (original)
+++ trunk/src/nm-activation-request.c Tue Apr 22 02:40:47 2008
@@ -141,6 +141,10 @@
if (!priv->connection)
goto out;
+ g_signal_handlers_disconnect_by_func (G_OBJECT (priv->device),
+ G_CALLBACK (device_state_changed),
+ NM_ACT_REQUEST (object));
+
proxy = g_object_get_data (G_OBJECT (priv->connection),
NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
call = g_object_get_data (G_OBJECT (priv->connection),
@@ -333,6 +337,7 @@
NMActRequest *self = NM_ACT_REQUEST (user_data);
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
NMActiveConnectionState new_state;
+ gboolean new_default = FALSE;
/* Set NMActiveConnection state based on the device's state */
switch (state) {
@@ -344,6 +349,7 @@
break;
case NM_DEVICE_STATE_ACTIVATED:
new_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
+ new_default = priv->is_default;
break;
default:
new_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
@@ -354,6 +360,11 @@
priv->state = new_state;
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE);
}
+
+ if (new_default != priv->is_default) {
+ priv->is_default = new_default;
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT);
+ }
}
typedef struct GetSecretsInfo {
@@ -618,3 +629,18 @@
return NM_ACT_REQUEST_GET_PRIVATE (req)->ac_path;
}
+void
+nm_act_request_set_default (NMActRequest *req, gboolean is_default)
+{
+ NMActRequestPrivate *priv;
+
+ g_return_if_fail (NM_IS_ACT_REQUEST (req));
+
+ priv = NM_ACT_REQUEST_GET_PRIVATE (req);
+ if (priv->is_default == is_default)
+ return;
+
+ priv->is_default = is_default;
+ g_object_notify (G_OBJECT (req), NM_ACTIVE_CONNECTION_DEFAULT);
+}
+
Modified: trunk/src/nm-activation-request.h
==============================================================================
--- trunk/src/nm-activation-request.h (original)
+++ trunk/src/nm-activation-request.h Tue Apr 22 02:40:47 2008
@@ -72,4 +72,6 @@
const char * nm_act_request_get_active_connection_path (NMActRequest *req);
+void nm_act_request_set_default (NMActRequest *req, gboolean is_default);
+
#endif /* NM_ACTIVATION_REQUEST_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]