mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +00:00
Abbreviate home directory in window titles.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35627 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7b746ffbbf
commit
d191a23aa4
3 changed files with 35 additions and 39 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2012-10-03 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSWindow.m (titleWithRepresentedFilename,
|
||||||
|
-_hasTitleWithRepresentedFilename, -setTitleWithRepresentedFilename,
|
||||||
|
-orderWindow:relativeTo:, -setExcludedFromWindowsMenu:):
|
||||||
|
* Source/NSApplication.m (-updateWindowsItem:, -setWindowsMenu:):
|
||||||
|
Abbreviate home directory in window titles.
|
||||||
|
|
||||||
2012-09-21 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2012-09-21 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* Source/NSCursor.m (+initialize, +pop, -push, -set): Fix memory
|
* Source/NSCursor.m (+initialize, +pop, -push, -set): Fix memory
|
||||||
|
|
|
@ -383,6 +383,10 @@ struct _NSModalSession {
|
||||||
- (NSMenu *) _dockMenu;
|
- (NSMenu *) _dockMenu;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface NSWindow (TitleWithRepresentedFilename)
|
||||||
|
- (BOOL) _hasTitleWithRepresentedFilename;
|
||||||
|
@end
|
||||||
|
|
||||||
@interface NSWindow (ApplicationPrivate)
|
@interface NSWindow (ApplicationPrivate)
|
||||||
- (void) setAttachedSheet: (id) sheet;
|
- (void) setAttachedSheet: (id) sheet;
|
||||||
@end
|
@end
|
||||||
|
@ -3141,15 +3145,9 @@ image.</p><p>See Also: -applicationIconImage</p>
|
||||||
|
|
||||||
if (found == NO)
|
if (found == NO)
|
||||||
{
|
{
|
||||||
NSString *t = [aWindow title];
|
|
||||||
NSString *f = [aWindow representedFilename];
|
|
||||||
|
|
||||||
f = [NSString stringWithFormat: @"%@ -- %@",
|
|
||||||
[f lastPathComponent],
|
|
||||||
[f stringByDeletingLastPathComponent]];
|
|
||||||
[self changeWindowsItem: aWindow
|
[self changeWindowsItem: aWindow
|
||||||
title: t
|
title: [aWindow title]
|
||||||
filename: [t isEqual: f]];
|
filename: [aWindow _hasTitleWithRepresentedFilename]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3201,15 +3199,9 @@ image.</p><p>See Also: -applicationIconImage</p>
|
||||||
if (([win isExcludedFromWindowsMenu] == NO)
|
if (([win isExcludedFromWindowsMenu] == NO)
|
||||||
&& ([win isVisible] || [win isMiniaturized]))
|
&& ([win isVisible] || [win isMiniaturized]))
|
||||||
{
|
{
|
||||||
NSString *t = [win title];
|
|
||||||
NSString *f = [win representedFilename];
|
|
||||||
|
|
||||||
f = [NSString stringWithFormat: @"%@ -- %@",
|
|
||||||
[f lastPathComponent],
|
|
||||||
[f stringByDeletingLastPathComponent]];
|
|
||||||
[self changeWindowsItem: win
|
[self changeWindowsItem: win
|
||||||
title: t
|
title: [win title]
|
||||||
filename: [t isEqual: f]];
|
filename: [win _hasTitleWithRepresentedFilename]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3867,8 +3859,7 @@ struct _DelegateWrapper
|
||||||
[_listener application: self openFile: filePath];
|
[_listener application: self openFile: filePath];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) _targetForAction: (SEL)aSelector
|
- (id) _targetForAction: (SEL)aSelector window: (NSWindow *)window
|
||||||
window: (NSWindow *)window
|
|
||||||
{
|
{
|
||||||
id resp, delegate;
|
id resp, delegate;
|
||||||
NSDocumentController *sdc;
|
NSDocumentController *sdc;
|
||||||
|
|
|
@ -1273,12 +1273,25 @@ many times.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NSString *
|
||||||
|
titleWithRepresentedFilename(NSString *representedFilename)
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat: @"%@ -- %@",
|
||||||
|
[representedFilename lastPathComponent],
|
||||||
|
[[representedFilename stringByDeletingLastPathComponent]
|
||||||
|
stringByAbbreviatingWithTildeInPath]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) _hasTitleWithRepresentedFilename
|
||||||
|
{
|
||||||
|
NSString *aString = titleWithRepresentedFilename (_representedFilename);
|
||||||
|
return [_windowTitle isEqualToString: aString];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setTitleWithRepresentedFilename: (NSString*)aString
|
- (void) setTitleWithRepresentedFilename: (NSString*)aString
|
||||||
{
|
{
|
||||||
[self setRepresentedFilename: aString];
|
[self setRepresentedFilename: aString];
|
||||||
aString = [NSString stringWithFormat:
|
aString = titleWithRepresentedFilename(aString);
|
||||||
@"%@ -- %@", [aString lastPathComponent],
|
|
||||||
[aString stringByDeletingLastPathComponent]];
|
|
||||||
if ([_windowTitle isEqual: aString] == NO)
|
if ([_windowTitle isEqual: aString] == NO)
|
||||||
{
|
{
|
||||||
ASSIGNCOPY(_windowTitle, aString);
|
ASSIGNCOPY(_windowTitle, aString);
|
||||||
|
@ -1836,17 +1849,9 @@ many times.
|
||||||
_f.has_opened = YES;
|
_f.has_opened = YES;
|
||||||
if (_f.menu_exclude == NO)
|
if (_f.menu_exclude == NO)
|
||||||
{
|
{
|
||||||
BOOL isFileName;
|
|
||||||
NSString *aString;
|
|
||||||
|
|
||||||
aString = [NSString stringWithFormat: @"%@ -- %@",
|
|
||||||
[_representedFilename lastPathComponent],
|
|
||||||
[_representedFilename stringByDeletingLastPathComponent]];
|
|
||||||
isFileName = [_windowTitle isEqual: aString];
|
|
||||||
|
|
||||||
[NSApp addWindowsItem: self
|
[NSApp addWindowsItem: self
|
||||||
title: _windowTitle
|
title: _windowTitle
|
||||||
filename: isFileName];
|
filename: [self _hasTitleWithRepresentedFilename]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ([self isKeyWindow] == YES)
|
if ([self isKeyWindow] == YES)
|
||||||
|
@ -4556,17 +4561,9 @@ current key view.<br />
|
||||||
}
|
}
|
||||||
else if (_f.has_opened == YES && flag == NO)
|
else if (_f.has_opened == YES && flag == NO)
|
||||||
{
|
{
|
||||||
BOOL isFileName;
|
|
||||||
NSString *aString;
|
|
||||||
|
|
||||||
aString = [NSString stringWithFormat: @"%@ -- %@",
|
|
||||||
[_representedFilename lastPathComponent],
|
|
||||||
[_representedFilename stringByDeletingLastPathComponent]];
|
|
||||||
isFileName = [_windowTitle isEqual: aString];
|
|
||||||
|
|
||||||
[NSApp addWindowsItem: self
|
[NSApp addWindowsItem: self
|
||||||
title: _windowTitle
|
title: _windowTitle
|
||||||
filename: isFileName];
|
filename: [self _hasTitleWithRepresentedFilename]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue