mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Fixed my last commit to actually change the menu item in the Windows menu
if the window title has changed git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12616 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
64818a9b0c
commit
6fd8900269
1 changed files with 26 additions and 13 deletions
|
@ -1894,8 +1894,6 @@ delegate.
|
|||
title: (NSString*)aString
|
||||
filename: (BOOL)isFilename
|
||||
{
|
||||
// TODO: This is not fully correct, as we should not change the menu,
|
||||
// if an entry for this window already exists
|
||||
[self changeWindowsItem: aWindow title: aString filename: isFilename];
|
||||
}
|
||||
|
||||
|
@ -1922,12 +1920,6 @@ delegate.
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Can't permit an untitled window in the window menu.
|
||||
*/
|
||||
if (aString == nil || [aString isEqualToString: @""])
|
||||
return;
|
||||
|
||||
/*
|
||||
* If there is no menu and nowhere to put one, we can't do anything.
|
||||
*/
|
||||
|
@ -1935,9 +1927,7 @@ delegate.
|
|||
return;
|
||||
|
||||
/*
|
||||
* If the menu exists and the window is already in the menu -
|
||||
* remove it so it can be re-inserted in the correct place.
|
||||
* If the menu doesn't exist - create it.
|
||||
* Check if the window is already in the menu.
|
||||
*/
|
||||
itemArray = [_windows_menu itemArray];
|
||||
count = [itemArray count];
|
||||
|
@ -1948,12 +1938,35 @@ delegate.
|
|||
if ([item target] == aWindow)
|
||||
{
|
||||
/*
|
||||
* If our menu item already exists we need not continue.
|
||||
* If our menu item already exists and with the correct
|
||||
* title, we need not continue.
|
||||
*/
|
||||
return;
|
||||
if ([[item title] isEqualToString: aString])
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Else, we need to remove the old item and add it again
|
||||
* with the new title. Then new item might be located
|
||||
* somewhere else in the menu than the old one (because
|
||||
* items in the menu are sorted by title) ... this is
|
||||
* why we remove the old one and then insert it again.
|
||||
*/
|
||||
[_windows_menu removeItem: item];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Can't permit an untitled window in the window menu ... so if the
|
||||
* window has not title, we don't add it to the menu.
|
||||
*/
|
||||
if (aString == nil || [aString isEqualToString: @""])
|
||||
return;
|
||||
|
||||
/*
|
||||
* Now we insert a menu item for the window in the correct order.
|
||||
* Make special allowance for menu entries to 'arrangeInFront: '
|
||||
|
|
Loading…
Reference in a new issue