OSX: move notification into its own function

This commit is contained in:
Jens Verwiebe
2014-10-23 14:20:06 +02:00
parent dbea73a30f
commit b6dc15278c

View File

@@ -1326,7 +1326,16 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress)
return GHOST_kSuccess;
}
static void postNotification()
{
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"Blender progress notification";
notification.informativeText = @"Calculation is finished";
notification.soundName = NSUserNotificationDefaultSoundName;
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
[notification release];
}
GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
{
if (!m_progressBarVisible) return GHOST_kFailure;
@@ -1346,12 +1355,7 @@ GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
// If Blender is not frontmost window, a message pops up with sound, in any case an entry in notifications
if ([NSUserNotificationCenter respondsToSelector:@selector(defaultUserNotificationCenter)]) {
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"Blender progress notification";
notification.informativeText = @"Calculation ended";
notification.soundName = NSUserNotificationDefaultSoundName;
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
[notification release];
postNotification();
}
[dockIcon release];
@@ -1362,6 +1366,7 @@ GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
#pragma mark Cursor handling
void GHOST_WindowCocoa::loadCursor(bool visible, GHOST_TStandardCursor cursor) const