mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 22:00:46 +00:00
Fixup response of services menu to set_show_service
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25698 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4e99e90d5c
commit
a13872e4c5
2 changed files with 32 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2007-12-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSServicesManager.m: Fixup to add/remove menu items
|
||||||
|
when the available items have changed.
|
||||||
|
|
||||||
2007-12-06 Fred Kiefer <FredKiefer@gmx.de>
|
2007-12-06 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSView.m (-initWithCoder:): Handle NSFrameSize.
|
* Source/NSView.m (-initWithCoder:): Handle NSFrameSize.
|
||||||
|
|
|
@ -858,7 +858,12 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
}
|
}
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
[self rebuildServices];
|
/* If we have changed the enabled/disabled services,
|
||||||
|
* or there have been services added/removed
|
||||||
|
* then we must rebuild the services menu to add/remove
|
||||||
|
* items as appropriate.
|
||||||
|
*/
|
||||||
|
[self rebuildServicesMenu];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,6 +886,10 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
return _port;
|
return _port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the current set of usable services consistent with the
|
||||||
|
* data types currently available.
|
||||||
|
*/
|
||||||
- (void) rebuildServices
|
- (void) rebuildServices
|
||||||
{
|
{
|
||||||
NSDictionary *services;
|
NSDictionary *services;
|
||||||
|
@ -955,6 +964,9 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Adds or removes items in the services menu in response to a change
|
||||||
|
* in the services which are available to the app.
|
||||||
|
*/
|
||||||
- (void) rebuildServicesMenu
|
- (void) rebuildServicesMenu
|
||||||
{
|
{
|
||||||
if (_servicesMenu != nil)
|
if (_servicesMenu != nil)
|
||||||
|
@ -967,9 +979,10 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
NSMenu *submenu = nil;
|
NSMenu *submenu = nil;
|
||||||
|
|
||||||
[_servicesMenu setAutoenablesItems: NO];
|
[_servicesMenu setAutoenablesItems: NO];
|
||||||
pos = [_servicesMenu numberOfItems];
|
for (pos = [_servicesMenu numberOfItems]; pos > 0; pos--)
|
||||||
for (; pos; pos--)
|
{
|
||||||
[_servicesMenu removeItemAtIndex: 0];
|
[_servicesMenu removeItemAtIndex: 0];
|
||||||
|
}
|
||||||
[_servicesMenu setAutoenablesItems: YES];
|
[_servicesMenu setAutoenablesItems: YES];
|
||||||
|
|
||||||
keyEquivalents = [NSMutableSet setWithCapacity: 4];
|
keyEquivalents = [NSMutableSet setWithCapacity: 4];
|
||||||
|
@ -977,17 +990,23 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
{
|
{
|
||||||
NSString *title = [_menuTitles objectAtIndex: pos];
|
NSString *title = [_menuTitles objectAtIndex: pos];
|
||||||
NSString *equiv = @"";
|
NSString *equiv = @"";
|
||||||
NSDictionary *info = [_title2info objectForKey: title];
|
NSDictionary *info;
|
||||||
NSDictionary *titles;
|
NSDictionary *titles;
|
||||||
NSDictionary *equivs;
|
NSDictionary *equivs;
|
||||||
NSRange r;
|
NSRange r;
|
||||||
unsigned lang;
|
unsigned lang;
|
||||||
id<NSMenuItem> item;
|
id<NSMenuItem> item;
|
||||||
|
|
||||||
|
if (NSShowsServicesMenuItem(title) == NO)
|
||||||
|
{
|
||||||
|
continue; // We don't want to show this one.
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the key equivalent corresponding to this menu title
|
* Find the key equivalent corresponding to this menu title
|
||||||
* in the service definition.
|
* in the service definition.
|
||||||
*/
|
*/
|
||||||
|
info = [_title2info objectForKey: title];
|
||||||
titles = [info objectForKey: @"NSMenuItem"];
|
titles = [info objectForKey: @"NSMenuItem"];
|
||||||
equivs = [info objectForKey: @"NSKeyEquivalent"];
|
equivs = [info objectForKey: @"NSKeyEquivalent"];
|
||||||
for (lang = 0; lang < [_languages count]; lang++)
|
for (lang = 0; lang < [_languages count]; lang++)
|
||||||
|
@ -1216,6 +1235,9 @@ static NSString *disabledName = @".GNUstepDisabled";
|
||||||
|
|
||||||
if (didChange)
|
if (didChange)
|
||||||
{
|
{
|
||||||
|
/* Types have changed, so we need to enable/disable items in the
|
||||||
|
* services menu depending on what types they support.
|
||||||
|
*/
|
||||||
[self rebuildServices];
|
[self rebuildServices];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue