[52666] branches/gsoc09-gui/MPGUI/MPActionLauncher.m

juanger at macports.org juanger at macports.org
Sat Jun 20 16:26:59 PDT 2009


Revision: 52666
          http://trac.macports.org/changeset/52666
Author:   juanger at macports.org
Date:     2009-06-20 16:26:59 -0700 (Sat, 20 Jun 2009)
Log Message:
-----------
Selfupdate and Sync actions implemented. Action toolbar items now disable when an action is in progress.

Modified Paths:
--------------
    branches/gsoc09-gui/MPGUI/MPActionLauncher.m

Modified: branches/gsoc09-gui/MPGUI/MPActionLauncher.m
===================================================================
--- branches/gsoc09-gui/MPGUI/MPActionLauncher.m	2009-06-20 23:20:07 UTC (rev 52665)
+++ branches/gsoc09-gui/MPGUI/MPActionLauncher.m	2009-06-20 23:26:59 UTC (rev 52666)
@@ -16,13 +16,15 @@
 - (void)loadPorts;
 - (void)installPort:(MPPort *)port;
 - (void)uninstallPort:(MPPort *)port;
+- (void)sync;
+- (void)selfupdate;
 
 @end
 
 #pragma mark Implementation
 @implementation MPActionLauncher
 
- at synthesize ports, isLoading;
+ at synthesize ports, isLoading, isBusy;
 
 + (MPActionLauncher*) sharedInstance {
     
@@ -59,6 +61,14 @@
     [self performSelectorInBackground:@selector(uninstallPort:) withObject:port];
 }
 
+- (void)syncInBackground {
+    [self performSelectorInBackground:@selector(sync) withObject:nil];
+}
+
+- (void)selfupdateInBackground {
+    [self performSelectorInBackground:@selector(selfupdate) withObject:nil];
+}
+
 #pragma mark Private Methods implementation
 
 - (void)loadPorts {
@@ -83,14 +93,33 @@
 - (void)installPort:(MPPort *)port {
     NSError * error;
     NSArray *empty = [NSArray arrayWithObject: @""];
+    [self setIsBusy:YES];
     [port installWithOptions:empty variants:empty error:&error];
     [port setState:MPPortStateLearnState];
+    [self setIsBusy:NO];
 }
 
 - (void)uninstallPort:(MPPort *)port {
     NSError * error;
+    [self setIsBusy:YES];
     [port uninstallWithVersion:nil error:&error];
     [port setState:MPPortStateLearnState];
+    [self setIsBusy:NO];
 }
 
+- (void)sync {
+    NSError * error;
+    [self setIsBusy:YES];
+    [[MPMacPorts sharedInstance] sync:&error];
+    [self setIsBusy:NO];
+}
+
+- (void)selfupdate {
+    NSError * error;
+    [self setIsBusy:YES];
+    [[MPMacPorts sharedInstance] selfUpdate:&error];
+    [self setIsBusy:NO];
+}
+
+
 @end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090620/188b1a67/attachment.html>


More information about the macports-changes mailing list