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
77 lines
2.6 KiB
Objective-C
77 lines
2.6 KiB
Objective-C
//
|
|
// NotificationsListener.m
|
|
// MPGUI
|
|
//
|
|
// Created by Juan Germán Castañeda Echevarría on 8/4/09.
|
|
// Copyright 2009 UNAM. All rights reserved.
|
|
//
|
|
|
|
#import "ActivityController.h"
|
|
|
|
|
|
@implementation ActivityController
|
|
|
|
@synthesize busy;
|
|
|
|
- (void)awakeFromNib {
|
|
[progress setUsesThreadedAnimation:YES];
|
|
[self setBusy:NO];
|
|
[self subscribeToNotifications];
|
|
}
|
|
|
|
- (void)subscribeToNotifications {
|
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
selector:@selector(gotMPMSG:)
|
|
name:MPMSG object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
selector:@selector(gotMPDEFAULT:)
|
|
name:MPDEFAULT object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
selector:@selector(gotMPINFO:)
|
|
name:MPINFO object:nil];
|
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
selector:@selector(gotMPERROR:)
|
|
name:MPERROR object:nil];
|
|
// [[NSNotificationCenter defaultCenter] addObserver:self
|
|
// selector:@selector()
|
|
// name:MPWARN object:nil];
|
|
// [[NSNotificationCenter defaultCenter] addObserver:self
|
|
// selector:@selector()
|
|
// name:MPDEBUG object:nil];
|
|
}
|
|
|
|
- (void)gotMPINFO:(NSNotification *)notification {
|
|
NSString *msg = [[notification userInfo] objectForKey:MPMESSAGE];
|
|
NSLog(@"GOT MPINFO NOTIFICATION: %@", msg);
|
|
// Starting up: A port command has been started
|
|
if ([msg isEqual:@"Starting up"]) {
|
|
[currentTask setStringValue:[[notification userInfo] objectForKey:MPMETHOD]];
|
|
[self setBusy:YES];
|
|
return;
|
|
}
|
|
// Shutting down: The command has finished
|
|
if ([msg isEqual:@"Shutting down"]) {
|
|
[currentTask setStringValue:@"" ];
|
|
[self setBusy:NO];
|
|
return;
|
|
}
|
|
}
|
|
|
|
- (void)gotMPMSG:(NSNotification *)notification {
|
|
NSString *msg = [[notification userInfo] objectForKey:MPMESSAGE];
|
|
NSLog(@"GOT MPMSG NOTIFICATION: %@", msg);
|
|
}
|
|
|
|
- (void)gotMPDEFAULT:(NSNotification *)notification {
|
|
NSString *msg = [[notification userInfo] objectForKey:MPMESSAGE];
|
|
NSLog(@"GOT MPDEFAULT NOTIFICATION: %@", msg);
|
|
}
|
|
|
|
- (void)gotMPERROR:(NSNotification *)notification {
|
|
NSString *msg = [[notification userInfo] objectForKey:MPMESSAGE];
|
|
NSLog(@"GOT ERROR NOTIFICATION: %@", msg);
|
|
//TODO: Display an alert
|
|
}
|
|
|
|
@end
|