Skip to content

Commit 03e13e7

Browse files
committed
Expose "automatically install updates" option in preference pane
Currently the updater (Sparkle) supports an option to automatically download and install updates in the background. The only user-visible way to turn it on/off is by checking the checkbox in the new update dialog box but that dialog box only shows up if auto-update is off, meaning that there's no way to undo setting that setting. Fix this by exposing the setting in user preference panel. Also, previously auto-update would even still keep on working even if "check for updates" is off, since it has precedence. Make the preference pane un-check auto-update if "check for updates" is turned off. Fix macvim-dev#808
1 parent b397052 commit 03e13e7

File tree

4 files changed

+60
-26
lines changed

4 files changed

+60
-26
lines changed

src/MacVim/English.lproj/Preferences.nib/designable.nib

+44-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

src/MacVim/MMPreferenceController.h

+2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
// General pane
1919
IBOutlet NSPopUpButton *layoutPopUpButton;
20+
IBOutlet NSButton *autoInstallUpdateButton;
2021
}
2122

2223
// General pane
2324
- (IBAction)openInCurrentWindowSelectionChanged:(id)sender;
25+
- (IBAction)checkForUpdatesChanged:(id)sender;
2426

2527
@end

src/MacVim/MMPreferenceController.m

+14-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,20 @@ - (IBAction)openInCurrentWindowSelectionChanged:(id)sender
8686
BOOL openInCurrentWindowSelected = ([[sender selectedCell] tag] != 0);
8787
BOOL useWindowsLayout =
8888
([[layoutPopUpButton selectedItem] tag] == MMLayoutWindows);
89-
if (openInCurrentWindowSelected && useWindowsLayout)
90-
[layoutPopUpButton selectItemWithTag:MMLayoutTabs];
89+
if (openInCurrentWindowSelected && useWindowsLayout) {
90+
[[NSUserDefaults standardUserDefaults] setInteger:MMLayoutTabs forKey:MMOpenLayoutKey];
91+
}
92+
}
93+
94+
- (IBAction)checkForUpdatesChanged:(id)sender
95+
{
96+
// Sparkle's auto-install update preference trumps "check for update", so
97+
// need to make sure to unset that if the user unchecks "check for update".
98+
NSButton *button = (NSButton *)sender;
99+
BOOL checkForUpdates = ([button state] != 0);
100+
if (!checkForUpdates) {
101+
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"SUAutomaticallyUpdate"];
102+
}
91103
}
92104

93105
@end

0 commit comments

Comments
 (0)