[banshee] [Podcasting] Refresh feeds when network is reconnected



commit 460d64379630d72ce0a8567344d492977ebda41c
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Thu Jun 3 08:34:46 2010 -0700

    [Podcasting] Refresh feeds when network is reconnected

 .../Banshee.Podcasting/PodcastService.cs           |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
index 128f120..e7bb1ef 100644
--- a/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
+++ b/src/Extensions/Banshee.Podcasting/Banshee.Podcasting/PodcastService.cs
@@ -44,6 +44,7 @@ using Migo.TaskCore;
 using Migo.Syndication;
 using Migo.DownloadCore;
 
+using Banshee.Networking;
 using Banshee.MediaEngine;
 using Banshee.Podcasting.Gui;
 using Banshee.Podcasting.Data;
@@ -272,9 +273,18 @@ namespace Banshee.Podcasting
 
                 // Every 10 minutes try to refresh again
                 refresh_timeout_id = Application.RunTimeout (1000 * 60 * 10, RefreshFeeds);
+
+                ServiceManager.Get<Network> ().StateChanged += OnNetworkStateChanged;
             });
         }
 
+        private void OnNetworkStateChanged (object o, NetworkStateChangedArgs args)
+        {
+            if (args.Connected) {
+                RefreshFeeds ();
+            }
+        }
+
         bool disposing;
         public void Dispose ()
         {
@@ -291,6 +301,7 @@ namespace Banshee.Podcasting
 
             ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);
             ServiceManager.Get<DBusCommandService> ().ArgumentPushed -= OnCommandLineArgument;
+            ServiceManager.Get<Network> ().StateChanged -= OnNetworkStateChanged;
 
             if (download_manager_iface != null) {
                 download_manager_iface.Dispose ();



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