[no subject]



                    =
 &nbsp; &nbsp;&nbsp; NMDeviceState state,<br>
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp;&nbsp; NMDeviceStateReason reason):<br><br>g_signal_emit_by_n=
ame (device, &quot;state-changed&quot;, state, old_state,&nbsp; 0);<br><br>=
but not<br><br>g_signal_emit_by_name (device, &quot;state-changed&quot;, st=
ate, old_state,&nbsp; reason);<br>

<br>Then the reason &quot;NM_DEVICE_STATE_REASON_USER_REQUESTED&quot; can&#=
39;t be received by <br>related device_state_changed() function. <br>The re=
ason always is 0(NM_DEVICE_STATE_REASON_NONE).<br><br>Think MobileBroad ban=
d, it has a &quot;Disconnect&quot; item in nm-applet menu. When click it,&n=
bsp; nm_client_deactivate_connection() will be called, if the user(programe=
r) want to check the disconnect reason to do something, e.g. user disconnec=
ted, do not auto connect again. They seems can not. <br>
<br>Thanks!<br>&nbsp;<br><div class=3D"gmail_quote">2009/5/12 Dan Williams =
<span dir=3D"ltr">&lt;<a href=3D"mailto:dcbw redhat com">dcbw redhat com</a=
>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D"border-left: 1px=
 solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class=3D"im">On Wed, 2009-05-06 at 11:40 +0800, =B4=FA=B6=FB=D0=C0 wro=
te:<br>
&gt; Hi all,<br>
&gt; &nbsp; &nbsp; &nbsp;I have a question about the NetworkManager-0.7.1 c=
odes.<br>
&gt; &nbsp; &nbsp; &nbsp;In NetworkManager-0.7.1/src/nm-device.c:<br>
&gt;<br>
&gt; void nm_device_state_changed (NMDevice *device,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp;NMDeviceState state,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp;NMDeviceStateReason reason)<br>
&gt; {<br>
&gt; ...<br>
&gt; &nbsp; &nbsp; // Here the fifth parameter is set to 0. I think it shou=
ld be set<br>
&gt; to &quot;reason&quot; so that the receiver of the signal &quot;state-c=
hanged&quot; can<br>
&gt; do<br>
<br>
</div>The question is what event is causing the reason to be 0. &nbsp;Was i=
t a<br>
user-requested disconnection? &nbsp;Was it something else? &nbsp;There may<=
br>
definitely be some places in NM that don&#39;t set the code correctly, but<=
br>
we need to identify which scenario you&#39;ve hit here.<br>
<div class=3D"im"><br>
&gt; &nbsp; &nbsp; // something special base on the &quot;state change reas=
on&quot;. e.g. When<br>
&gt; &quot;NM_DEVICE_STATE_DISCONNECTED&quot; state signaled, if<br>
&gt; &nbsp; &nbsp; // the reason is &quot;NM_DEVICE_STATE_REASON_USER_REQUE=
STED&quot; then we<br>
&gt; do not schedule auto connect in<br>
&gt; &nbsp; &nbsp; // NetworkManagerPolicy.c device_state_changed() or<br>
&gt; &nbsp; &nbsp; // set a flag in device-related device_state_changed() a=
nd reload<br>
&gt; the can_activate() function to check this flag.<br>
&gt; &nbsp; &nbsp; g_signal_emit_by_name (device, &quot;state-changed&quot;=
, state, old_state,<br>
&gt; 0);<br>
&gt; ...<br>
<br>
</div>The reason we probably don&#39;t schedule autoconnection on disconnec=
t is<br>
precisely because the user chose to manually disconnect. &nbsp;If we did<br=
>
reschedule the autoconnect, then NM would simply reconnect the<br>
connection the user just disconnected.<br>
<br>
Dan<br>
<div class=3D"im"><br>
&gt; }<br>
&gt;<br>
&gt; If I&#39;m wrong, please point out. Thanks!<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div>&gt; _______________________________________________<br>
&gt; NetworkManager-list mailing list<br>
&gt; <a href=3D"mailto:NetworkManager-list gnome org">NetworkManager-list g=
nome.org</a><br>
&gt; <a href=3D"http://mail.gnome.org/mailman/listinfo/networkmanager-list"=
 target=3D"_blank">http://mail.gnome.org/mailman/listinfo/networkmanager-li=
st</a><br>
<br>
</blockquote></div><br>

--00163646d97fdea3810469b7bf44--


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]