capuchin r92 - trunk/src/libcapuchin



Author: sebp
Date: Tue Aug 12 15:37:56 2008
New Revision: 92
URL: http://svn.gnome.org/viewvc/capuchin?rev=92&view=rev

Log:
Emit Status and InstallFinished when calling AppObject.Update. 'INDEX' is used as plugin id.

Modified:
   trunk/src/libcapuchin/AppObject.cs
   trunk/src/libcapuchin/DownloadManager.cs

Modified: trunk/src/libcapuchin/AppObject.cs
==============================================================================
--- trunk/src/libcapuchin/AppObject.cs	(original)
+++ trunk/src/libcapuchin/AppObject.cs	Tue Aug 12 15:37:56 2008
@@ -60,7 +60,6 @@
         
         private const int SLEEP_TIME = 500;
         private bool disposed = false;
-        private int repo_dlid = -1;
         
         /// <param name="repository_url">URL to repository's XML file</param>
         public AppObject (string repository_url)
@@ -567,7 +566,7 @@
             
         private void OnDownloadStatus (int dlid, double progress, int speed)
         {
-            if (dlid == this.repo_dlid)
+            if (dlid == DownloadManager.BLOCKING_DOWNLOAD_ID)
             {
                 this.OnStatus (ActionType.UpdatingRepo, "", progress, speed);
             } else {
@@ -582,7 +581,8 @@
         
         private void OnDownloadFinished (int dlid)
         {
-            if (dlid == this.repo_dlid) {
+            if (dlid == DownloadManager.BLOCKING_DOWNLOAD_ID) {
+                this.OnInstallFinished("INDEX");
                 return;
             }
             

Modified: trunk/src/libcapuchin/DownloadManager.cs
==============================================================================
--- trunk/src/libcapuchin/DownloadManager.cs	(original)
+++ trunk/src/libcapuchin/DownloadManager.cs	Tue Aug 12 15:37:56 2008
@@ -44,7 +44,6 @@
         internal Dictionary<int, Download> Downloads;
         
         private int downloadsIndex;
-        private int blockingDownloadId;
         
         public DownloadManager()
         {
@@ -198,19 +197,19 @@
             Log.Info("Finished downloading file with id '{0}'", id);
             
             // Don't report finished signal when download is called blocking
-            if (id == BLOCKING_DOWNLOAD_ID) return;
-            
-            lock (this) {
-                // Remove Download
-                this.Downloads.Remove(id);
-            
-                // TODO: Maybe dangerous when disconnecting while other download
-                // is still running?
-                // Disconnect signals
-                downloader.Status -= new Downloaders.StatusHandler( this.OnDownloadStatus );
-                downloader.Finished -= new Downloaders.FinishedHandler( this.DownloadFinishedCallback );
+            if (id != BLOCKING_DOWNLOAD_ID) {
+                lock (this) {
+                    // Remove Download
+                    this.Downloads.Remove(id);
+                }
             }
             
+            // TODO: Maybe dangerous when disconnecting while other download
+            // is still running?
+            // Disconnect signals
+            downloader.Status -= new Downloaders.StatusHandler( this.OnDownloadStatus );
+            downloader.Finished -= new Downloaders.FinishedHandler( this.DownloadFinishedCallback );
+            
             this.OnDownloadFinished(id);
         }
         



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