1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

feat: add "Show Toolbar" toggle (#4419)

This commit is contained in:
Cœur 2023-04-15 02:09:12 +08:00 committed by GitHub
parent 1851b80d8c
commit febc5b7ef4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -516,7 +516,7 @@
</menuItem>
<menuItem title="Hide Toolbar" id="1222">
<connections>
<action selector="toggleToolbarShown:" target="-1" id="1251"/>
<action selector="toggleToolbarShown:" target="206" id="1251"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="545">

View file

@ -153,6 +153,7 @@ typedef NS_ENUM(unsigned int, addType) { //
- (IBAction)toggleStatusBar:(id)sender;
- (IBAction)toggleFilterBar:(id)sender;
- (IBAction)toggleToolbarShown:(id)sender;
- (void)focusFilterField;
- (void)allToolbarClicked:(id)sender;

View file

@ -4125,6 +4125,11 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
[self updateMainWindow];
}
- (IBAction)toggleToolbarShown:(id)sender
{
[self.fWindow toggleToolbarShown:sender];
}
- (void)focusFilterField
{
if (!self.fFilterBar)
@ -4814,6 +4819,16 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
return self.fWindow.visible;
}
// enable toggle toolbar
if (action == @selector(toggleToolbarShown:))
{
NSString* title = !self.fWindow.toolbar.isVisible ? NSLocalizedString(@"Show Toolbar", "View menu -> Toolbar") :
NSLocalizedString(@"Hide Toolbar", "View menu -> Toolbar");
menuItem.title = title;
return self.fWindow.visible;
}
//enable prev/next filter button
if (action == @selector(switchFilter:))
{