Fixed deletion of favorites on OS X 10.9

This commit is contained in:
Hendrik Holtmann
2014-02-23 17:13:43 +01:00
parent 1b51b7d952
commit 8b1127b5b6
2 changed files with 13 additions and 8 deletions

View File

@ -290,13 +290,11 @@ NSUserDefaults *defaults;
} }
} }
- (IBAction)delete_favorite:(id)sender{
int pressesButton=NSRunCriticalAlertPanelRelativeToWindow(
NSLocalizedString(@"Delete favorite",nil), - (void) deleteAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
[NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the favorite %@?",nil), [ [ [FavoritesController arrangedObjects] objectAtIndex:[FavoritesController selectionIndex]] objectForKey:@"Title"] ], {
NSLocalizedString(@"No",nil), if (returnCode==0) {
NSLocalizedString(@"Yes",nil),nil,mainwindow);
if (pressesButton==0) {
//delete favorite, but resets presets before //delete favorite, but resets presets before
[self check_deletion:@"selbatt"]; [self check_deletion:@"selbatt"];
[self check_deletion:@"selac"]; [self check_deletion:@"selac"];
@ -305,6 +303,13 @@ NSUserDefaults *defaults;
} }
} }
- (IBAction)delete_favorite:(id)sender{
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Delete favorite",nil) defaultButton:NSLocalizedString(@"No",nil) alternateButton:NSLocalizedString(@"Yes",nil) otherButton:nil informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the favorite %@?",nil), [ [ [FavoritesController arrangedObjects] objectAtIndex:[FavoritesController selectionIndex]] objectForKey:@"Title"] ]];
[alert beginSheetModalForWindow:mainwindow modalDelegate:self didEndSelector:@selector(deleteAlertDidEnd:returnCode:contextInfo:) contextInfo:NULL];
}
// Called via a timer mechanism. This is where all the temp / RPM reading is done. // Called via a timer mechanism. This is where all the temp / RPM reading is done.
//reads fan data and updates the gui //reads fan data and updates the gui