banshee r4493 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Networking
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4493 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Networking
- Date: Mon, 8 Sep 2008 21:57:44 +0000 (UTC)
Author: gburt
Date: Mon Sep 8 21:57:44 2008
New Revision: 4493
URL: http://svn.gnome.org/viewvc/banshee?rev=4493&view=rev
Log:
2008-09-08 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Networking/Network.cs: Have the
disable-network-features preference take effect immediately.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Networking/Network.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Networking/Network.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Networking/Network.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Networking/Network.cs Mon Sep 8 21:57:44 2008
@@ -97,24 +97,33 @@
{
try {
if(new_state != current_state && (new_state == State.Connected || new_state == State.Disconnected)) {
+ bool was_connected = Connected;
current_state = new_state;
-
- NetworkStateChangedHandler handler = StateChanged;
- if(handler != null) {
- NetworkStateChangedArgs state_changed_args = new NetworkStateChangedArgs();
- state_changed_args.Connected = Connected;
- handler(this, state_changed_args);
+
+ if (Connected != was_connected) {
+ OnStateChanged ();
}
- if(Connected) {
- Log.Debug("Network Connection Established", "Connected");
- } else {
- Log.Debug("Network Connection Unavailable", "Disconnected");
- }
}
} catch(Exception) {
}
}
+
+ private void OnStateChanged ()
+ {
+ NetworkStateChangedHandler handler = StateChanged;
+ if(handler != null) {
+ NetworkStateChangedArgs state_changed_args = new NetworkStateChangedArgs();
+ state_changed_args.Connected = Connected;
+ handler(this, state_changed_args);
+ }
+
+ if(Connected) {
+ Log.Debug("Network Connection Established", "Connected");
+ } else {
+ Log.Debug("Network Connection Unavailable", "Disconnected");
+ }
+ }
public bool Connected {
get { return disable_internet_access ? false : (nm_manager == null ? true : current_state == State.Connected); }
@@ -140,7 +149,13 @@
disable_internet_access_preference = service["general"]["misc"].Add (new SchemaPreference<bool> (DisableInternetAccess,
Catalog.GetString ("_Disable features requiring Internet access"),
Catalog.GetString ("Some features require a broadband Internet connection such as Last.fm or cover art fetching"),
- delegate { disable_internet_access = DisableInternetAccess.Get (); }
+ delegate {
+ bool was_connected = Connected;
+ disable_internet_access = DisableInternetAccess.Get ();
+ if (Connected != was_connected) {
+ OnStateChanged ();
+ }
+ }
));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]