mirror of
https://github.com/macports/pallet.git
synced 2026-07-12 18:18:47 -07:00
fcff5ee4e9
git-svn-id: https://svn.macports.org/repository/macports/contrib/Pallet@65496 d073be05-634f-4543-b044-5fe20cf6d1d6
82 lines
1.9 KiB
Objective-C
82 lines
1.9 KiB
Objective-C
//
|
|
// MPActionLauncher.m
|
|
// MPGUI
|
|
//
|
|
// Created by Juan Germán Castañeda Echevarría on 6/15/09.
|
|
// Copyright 2009 UNAM. All rights reserved.
|
|
//
|
|
|
|
#import "MPActionLauncher.h"
|
|
|
|
static MPActionLauncher *sharedActionLauncher = nil;
|
|
|
|
#pragma mark Implementation
|
|
@implementation MPActionLauncher
|
|
|
|
@synthesize ports, isLoading, actionTool;
|
|
|
|
+ (MPActionLauncher*) sharedInstance {
|
|
|
|
if (sharedActionLauncher == nil) {
|
|
[[self alloc] init]; // assignment not done here
|
|
}
|
|
|
|
return sharedActionLauncher;
|
|
}
|
|
|
|
- (id)init {
|
|
if (sharedActionLauncher == nil) {
|
|
ports = [NSMutableArray arrayWithCapacity:1];
|
|
sharedActionLauncher = self;
|
|
}
|
|
return sharedActionLauncher;
|
|
}
|
|
|
|
- (void)loadPorts {
|
|
[self setIsLoading:YES];
|
|
NSDictionary *allPorts = [[MPMacPorts sharedInstance] search:MPPortsAll];
|
|
NSDictionary *installedPorts = [[MPRegistry sharedRegistry] installed];
|
|
|
|
[self willChangeValueForKey:@"ports"];
|
|
for (id port in installedPorts) {
|
|
[[allPorts objectForKey:port] setStateFromReceipts:[installedPorts objectForKey:port]];
|
|
}
|
|
ports = [allPorts allValues];
|
|
[self didChangeValueForKey:@"ports"];
|
|
|
|
[self setIsLoading:NO];
|
|
}
|
|
|
|
- (void)installPort:(MPPort *)port {
|
|
NSError * error;
|
|
NSArray *empty = [NSArray arrayWithObject: @""];
|
|
[port installWithOptions:empty variants:empty error:&error];
|
|
}
|
|
|
|
- (void)uninstallPort:(MPPort *)port {
|
|
NSError * error;
|
|
[port uninstallWithVersion:@"" error:&error];
|
|
}
|
|
|
|
- (void)upgradePort:(MPPort *)port {
|
|
NSError * error;
|
|
[port upgradeWithError:&error];
|
|
}
|
|
|
|
- (void)sync {
|
|
NSError * error;
|
|
[[MPMacPorts sharedInstance] sync:&error];
|
|
}
|
|
|
|
- (void)selfupdate {
|
|
NSError * error;
|
|
[[MPMacPorts sharedInstance] selfUpdate:&error];
|
|
}
|
|
|
|
- (void)cancelPortProcess {
|
|
// TODO: display confirmation dialog
|
|
[[MPMacPorts sharedInstance] cancelCurrentCommand];
|
|
}
|
|
|
|
@end
|