Minor tidyup - use NSBundle to get info dictionary.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4113 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-04-22 12:18:08 +00:00
parent 5c47b2b844
commit dc098d16e6

View file

@ -140,7 +140,7 @@ NSApplication *NSApp = nil;
//
// Instance methods
//
- init
- (id) init
{
if (NSApp != self)
{
@ -161,12 +161,10 @@ NSApplication *NSApp = nil;
current_event = [NSEvent new]; // no current event
null_event = [NSEvent new]; // create dummy event
[self setNextResponder:NULL]; // We are the end of
[self setNextResponder: nil]; // We are the end of
// the responder chain
// Set up the run loop
// object for the
// current thread
// Set up the run loop object for the current thread
[self setupRunLoopInputSourcesForMode: NSDefaultRunLoopMode];
[self setupRunLoopInputSourcesForMode: NSConnectionReplyMode];
[self setupRunLoopInputSourcesForMode: NSModalPanelRunLoopMode];
@ -179,13 +177,9 @@ NSApplication *NSApp = nil;
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSBundle *mainBundle = [NSBundle mainBundle];
NSString* resourcePath = [mainBundle resourcePath];
NSString* infoFilePath = [resourcePath
stringByAppendingPathComponent:@"Info-gnustep.plist"];
NSDictionary* infoDict;
NSDictionary *infoDict = [mainBundle infoDictionary];
NSString *mainModelFile;
infoDict = [[NSString stringWithContentsOfFile:infoFilePath] propertyList];
mainModelFile = [infoDict objectForKey: @"NSMainNibFile"];
if (mainModelFile && ![mainModelFile isEqual: @""])
@ -194,18 +188,15 @@ NSString* mainModelFile;
owner: [NSApplication sharedApplication]])
NSLog (@"Cannot load the main model file '%@", mainModelFile);
}
// post notification that
// launch will finish
/* post notification that launch will finish */
[nc postNotificationName: NSApplicationWillFinishLaunchingNotification
object: self];
// Register our listener to
// handle incoming services
// requests etc.
/* Register our listener to incoming services requests etc. */
[listener registerAsServiceProvider];
// finish the launching
// post notification that
// launching has finished
/* finish the launching post notification that launching has finished */
[nc postNotificationName: NSApplicationDidFinishLaunchingNotification
object: self];
}
@ -213,16 +204,18 @@ NSString* mainModelFile;
- (void) dealloc
{
NSDebugLog(@"Freeing NSApplication\n");
// Let ourselves know we
gnustep_gui_app_is_in_dealloc = YES; // are within dealloc
/* Let ourselves know we are within dealloc */
gnustep_gui_app_is_in_dealloc = YES;
[listener release];
[event_queue release];
[current_event release];
while (session != 0) // We may need to tidy up
{ // nested modal session
NSModalSession tmp = session; // structures.
/* We may need to tidy up nested modal session structures. */
while (session != 0)
{
NSModalSession tmp = session;
session = tmp->previous;
NSZoneFree(NSDefaultMallocZone(), tmp);
@ -615,7 +608,7 @@ NSString* mainModelFile;
- (void) discardEventsMatchingMask: (unsigned int)mask
beforeEvent: (NSEvent *)lastEvent
{
int i = 0, count, loop;
unsigned i = 0, count, loop;
NSEvent *event = nil;
BOOL match;
// if queue contains
@ -717,7 +710,7 @@ BOOL match;
- (NSEvent*) _eventMatchingMask: (unsigned int)mask dequeue: (BOOL)flag
{
NSEvent *event; // return the next
int i, count; // event in the queue
unsigned i, count; // event in the queue
BOOL match = NO; // which matches mask
[self _nextEvent];