[no subject]
nm-client.c
nm_client_deactivate_connection()
then through dbus, call:
impl_manager_deactivate_connection (NMManager *manager,
const char *connection_path,
GError **error)
{
return nm_manager_deactivate_connection (manager,
connection_path,
NM_DEVICE_STATE_REASON_USER_REQUESTED,
error);
}
*The reason is "NM_DEVICE_STATE_REASON_USER_REQUESTED" in above function
call.*
Then nm_device_state_changed() will be called. From my previous mail, in
nm_device_state_changed(NMDevice *device,
NMDeviceState state,
NMDeviceStateReason reason):
g_signal_emit_by_name (device, "state-changed", state, old_state, 0);
but not
g_signal_emit_by_name (device, "state-changed", state, old_state, reason);
Then the reason "NM_DEVICE_STATE_REASON_USER_REQUESTED" can't be received b=
y
related device_state_changed() function.
The reason always is 0(NM_DEVICE_STATE_REASON_NONE).
Think MobileBroad band, it has a "Disconnect" item in nm-applet menu. When
click it, nm_client_deactivate_connection() will be called, if the
user(programer) want to check the disconnect reason to do something, e.g.
user disconnected, do not auto connect again. They seems can not.
Thanks!
2009/5/12 Dan Williams <dcbw redhat com>
> On Wed, 2009-05-06 at 11:40 +0800, =B4=FA=B6=FB=D0=C0 wrote:
> > Hi all,
> > I have a question about the NetworkManager-0.7.1 codes.
> > In NetworkManager-0.7.1/src/nm-device.c:
> >
> > void nm_device_state_changed (NMDevice *device,
> > NMDeviceState state,
> > NMDeviceStateReason reason)
> > {
> > ...
> > // Here the fifth parameter is set to 0. I think it should be set
> > to "reason" so that the receiver of the signal "state-changed" can
> > do
>
> The question is what event is causing the reason to be 0. Was it a
> user-requested disconnection? Was it something else? There may
> definitely be some places in NM that don't set the code correctly, but
> we need to identify which scenario you've hit here.
>
> > // something special base on the "state change reason". e.g. When
> > "NM_DEVICE_STATE_DISCONNECTED" state signaled, if
> > // the reason is "NM_DEVICE_STATE_REASON_USER_REQUESTED" then we
> > do not schedule auto connect in
> > // NetworkManagerPolicy.c device_state_changed() or
> > // set a flag in device-related device_state_changed() and reload
> > the can_activate() function to check this flag.
> > g_signal_emit_by_name (device, "state-changed", state, old_state,
> > 0);
> > ...
>
> The reason we probably don't schedule autoconnection on disconnect is
> precisely because the user chose to manually disconnect. If we did
> reschedule the autoconnect, then NM would simply reconnect the
> connection the user just disconnected.
>
> Dan
>
> > }
> >
> > If I'm wrong, please point out. Thanks!
> >
> >
> >
> > _______________________________________________
> > NetworkManager-list mailing list
> > NetworkManager-list gnome org
> > http://mail.gnome.org/mailman/listinfo/networkmanager-list
>
>
--00163646d97fdea3810469b7bf44
Content-Type: text/html; charset=GB2312
Content-Transfer-Encoding: quoted-printable
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]