]> git.saurik.com Git - cydia.git/commitdiff
Do not display errors during cancel.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 23 Feb 2011 11:12:28 +0000 (03:12 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 23 Feb 2011 11:12:28 +0000 (03:12 -0800)
MobileCydia.mm

index 8227e358729fb7c3bb07ae931719f63a197c8571..5a54a05d8f74df6d7f6073d5e40e71298b73ae8e 100644 (file)
@@ -1207,10 +1207,12 @@ class Status :
 {
   private:
     _transient NSObject<ProgressDelegate> *delegate_;
+    bool cancelled_;
 
   public:
     Status() :
-        delegate_(nil)
+        delegate_(nil),
+        cancelled_(false)
     {
     }
 
@@ -1266,7 +1268,16 @@ class Status :
         );
 
         [delegate_ performSelectorOnMainThread:@selector(setProgressPercent:) withObject:[NSNumber numberWithFloat:percent] waitUntilDone:YES];
-        return ![delegate_ isProgressCancelled] && value;
+        if (value && ![delegate_ isProgressCancelled])
+            return true;
+        else {
+            cancelled_ = true;
+            return false;
+        }
+    }
+
+    _finline bool WasCancelled() const {
+        return cancelled_;
     }
 
     virtual void Start() {
@@ -3843,9 +3854,11 @@ static NSString *Warning_;
     if ([self popErrorWithTitle:title])
         return;
 
-    if ([self popErrorWithTitle:title forOperation:ListUpdate(status, list, PulseInterval_)])
-        /* XXX: ignore this because users suck and don't understand why refreshing is important: return */
-        /* XXX: why the hell is an empty if statement a clang error? */ (void) 0;
+    bool success(ListUpdate(status, list, PulseInterval_));
+    if (status.WasCancelled())
+        _error->Discard();
+    else
+        [self popErrorWithTitle:title forOperation:success];
 
     [Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"];
     Changed_ = true;