Use the menu items with "terminate:" call deferredEndTesting: instead of terminate. This prevents the test mode from being able to quit the application.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23158 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-07-12 04:33:25 +00:00
parent 4025566690
commit 040a0850dc
2 changed files with 31 additions and 15 deletions

View file

@ -1,3 +1,8 @@
2006-07-12 00:31 Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: in testInterface, make the item with terminate:
the "Quit Test" item, if none is found add one.
2006-07-10 01:32 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormGormWrapperLoader.m: in loadFileWrapper:withDocument:
@ -632,15 +637,10 @@
* Palettes/1Windows/GormWindowAttributesInspector.m: Correction
for bug#15236. In ok: method the newStyleMask variable wasn't
<<<<<<< .working
properly initialized, this was causing the flags to be set
2006-01-08 14:03 Gregory John Casamento <greg_casamento@yahoo.com>
=======
properly initialized, this was causing the flags to be set
>>>>>>> .merge-right.r22963
* GormCore/GormPrivate.m: Removed deprecated templates.
* GormCore/GormViewEditor.m: Removed problem which was causing
a notification loop.

36
Gorm.m
View file

@ -29,6 +29,7 @@
#include <GormCore/GormPrivate.h>
#include <GormCore/GormFontViewController.h>
#include <GormCore/GormSetNameController.h>
#include <GormCore/GormFunctions.h>
#include <GNUstepBase/GSObjCRuntime.h>
#include <GormPrefs/GormPrefController.h>
@ -504,19 +505,34 @@
}
else
{
NSMenu *testMenu = [self mainMenu];
id item;
NSMenu *testMenu = [self mainMenu];
NSString *newTitle = [[testMenu title] stringByAppendingString: @" (Gorm)"];
NSArray *items = findAll(testMenu);
NSEnumerator *en = [items objectEnumerator];
id item;
BOOL found = NO;
while((item = [en nextObject]) != nil)
{
if([item isKindOfClass: [NSMenuItem class]])
{
SEL action = [item action];
if(sel_eq(action, @selector(terminate:)))
{
found = YES;
[item setTitle: _(@"Quit Test")];
[item setTarget: self];
[item setAction: @selector(deferredEndTesting:)];
}
}
}
// releast the items...
RELEASE(items);
// set the menu up so that it's easy to tell we're testing and how to quit.
[testMenu setTitle: newTitle];
item = [testMenu itemWithTitle: _(@"Quit")];
if (item != nil)
{
[item setTitle: _(@"Quit Test")];
[item setAction: @selector(deferredEndTesting:)];
}
else
if(found == NO)
{
[testMenu addItemWithTitle: _(@"Quit Test")
action: @selector(deferredEndTesting:)