Skip to content

Commit 1fedb06

Browse files
authored
Merge pull request #982 from ychin/option-disable-sparkle
Make Sparkle updater an optional component of MacVim
2 parents ec8d479 + 675cd65 commit 1fedb06

File tree

12 files changed

+283
-176
lines changed

12 files changed

+283
-176
lines changed

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

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

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

Lines changed: 199 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

src/MacVim/MMAppController.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
@class MMWindowController;
1616
@class MMVimController;
17+
@class SUUpdater;
1718

1819

1920
@interface MMAppController : NSObject <MMAppProtocol> {
@@ -30,6 +31,8 @@
3031
int numChildProcesses;
3132
NSMutableDictionary *inputQueues;
3233
int processingFlag;
34+
35+
SUUpdater *updater;
3336

3437
FSEventStreamRef fsEventStream;
3538
}
@@ -52,6 +55,7 @@
5255
- (IBAction)orderFrontPreferencePanel:(id)sender;
5356
- (IBAction)openWebsite:(id)sender;
5457
- (IBAction)showVimHelp:(id)sender;
58+
- (IBAction)checkForUpdates:(id)sender;
5559
- (IBAction)zoomAll:(id)sender;
5660
- (IBAction)stayInFront:(id)sender;
5761
- (IBAction)stayInBack:(id)sender;

src/MacVim/MMAppController.m

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#import "MMWindowController.h"
4444
#import "MMTextView.h"
4545
#import "Miscellaneous.h"
46+
#import "Sparkle.framework/Headers/Sparkle.h"
4647
#import <unistd.h>
4748
#import <CoreServices/CoreServices.h>
4849
// Need Carbon for TIS...() functions
@@ -298,6 +299,12 @@ - (id)init
298299
ASLogCrit(@"Failed to register connection with name '%@'", name);
299300
[connection release]; connection = nil;
300301
}
302+
303+
#if !DISABLE_SPARKLE
304+
// Sparkle is enabled (this is the default). Initialize it. It will
305+
// automatically check for update.
306+
updater = [[SUUpdater alloc] init];
307+
#endif
301308

302309
return self;
303310
}
@@ -315,6 +322,7 @@ - (void)dealloc
315322
[recentFilesMenuItem release]; recentFilesMenuItem = nil;
316323
[defaultMainMenu release]; defaultMainMenu = nil;
317324
[appMenuItemTemplate release]; appMenuItemTemplate = nil;
325+
[updater release]; updater = nil;
318326

319327
[super dealloc];
320328
}
@@ -892,6 +900,14 @@ - (void)setMainMenu:(NSMenu *)mainMenu
892900
// private so this will have to be considered a bit of a hack!)
893901
NSMenu *appMenu = [mainMenu findApplicationMenu];
894902
[NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu];
903+
904+
#if DISABLE_SPARKLE
905+
// If Sparkle is disabled, we want to remove the "Check for Updates" menu
906+
// item since it's no longer useful.
907+
NSMenuItem *checkForUpdatesItem = [appMenu itemAtIndex:
908+
[appMenu indexOfItemWithAction:@selector(checkForUpdates:)]];
909+
checkForUpdatesItem.hidden = true;
910+
#endif
895911

896912
NSMenu *servicesMenu = [mainMenu findServicesMenu];
897913
[NSApp setServicesMenu:servicesMenu];
@@ -1195,6 +1211,15 @@ - (IBAction)showVimHelp:(id)sender
11951211
@"-c", @":h gui_mac", @"-c", @":res", nil]
11961212
workingDirectory:nil];
11971213
}
1214+
1215+
- (IBAction)checkForUpdates:(id)sender
1216+
{
1217+
#if !DISABLE_SPARKLE
1218+
// Check for updates for new versions manually.
1219+
ASLogDebug(@"Check for software updates");
1220+
[updater checkForUpdates:sender];
1221+
#endif
1222+
}
11981223

11991224
- (IBAction)zoomAll:(id)sender
12001225
{

src/MacVim/MMPreferenceController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
// General pane
1919
IBOutlet NSPopUpButton *layoutPopUpButton;
2020
IBOutlet NSButton *autoInstallUpdateButton;
21+
IBOutlet NSView *sparkleUpdaterPane;
2122
}
2223

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

src/MacVim/MMPreferenceController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ static void loadSymbols()
4343

4444
@implementation MMPreferenceController
4545

46+
- (IBAction)showWindow:(id)sender
47+
{
48+
[super showWindow:sender];
49+
#if DISABLE_SPARKLE
50+
// If Sparkle is disabled in config, we don't want to show the preference pane
51+
// which could be confusing as it won't do anything.
52+
[sparkleUpdaterPane setHidden:YES];
53+
#endif
54+
}
55+
4656
- (void)setupToolbar
4757
{
4858
loadSymbols();

src/MacVim/MacVim.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
6767
52818B031C1C08CE00F59085 /* QLStephen.qlgenerator in Copy QuickLookPlugin */ = {isa = PBXBuildFile; fileRef = 52818AFF1C1C075300F59085 /* QLStephen.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
6868
528DA66A1426D4F9003380F1 /* macvim-askpass in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 528DA6691426D4EB003380F1 /* macvim-askpass */; };
69-
52A364731C4A5789005757EC /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; };
69+
52A364731C4A5789005757EC /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
7070
52A364761C4A57C1005757EC /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 52A364721C4A5789005757EC /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7171
52B7ED9B1C4A4D6900AFFF15 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 52B7ED9A1C4A4D6900AFFF15 /* dsa_pub.pem */; };
7272
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };

src/MacVim/README

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ be in when executing these commands):
162162
1. Configure Vim (call "./configure --help" to see a list of flags)
163163
src/$ ./configure
164164

165+
MacVim-specific flags that `./configure` supports:
166+
--disable-sparkle: Disable Sparkle auto-update. This is useful if you want
167+
to manually sync or building this as part of a package
168+
manager.
169+
--with-macsdk: Build MacVim against specific SDK versions.
170+
171+
You can also use environment variable `MACOSX_DEPLOYMENT_TARGET` to specify
172+
minimum target macOS version to deploy (e.g. '10.14'), and `XCODEFLAGS` for
173+
additional command-line arguments to pass to `xcodebuild`.
174+
165175
2. Build
166176
src/$ make
167177

src/auto/configure

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ ac_user_opts='
782782
enable_option_checking
783783
enable_fail_if_missing
784784
enable_darwin
785+
enable_sparkle
785786
with_developer_dir
786787
with_macsdk
787788
with_macarchs
@@ -1476,6 +1477,7 @@ Optional Features:
14761477
--enable-fail-if-missing Fail if dependencies on additional features
14771478
specified on the command line are missing.
14781479
--disable-darwin Disable Darwin (Mac OS X) support.
1480+
--disable-sparkle Disable Sparkle updater (MacVim).
14791481
--disable-smack Do not check for Smack support.
14801482
--disable-selinux Do not check for SELinux support.
14811483
--disable-xsmp Disable XSMP session management
@@ -4591,6 +4593,24 @@ $as_echo "no, Darwin support disabled" >&6; }
45914593
$as_echo "yes, Darwin support excluded" >&6; }
45924594
fi
45934595

4596+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-sparkle argument" >&5
4597+
$as_echo_n "checking --disable-sparkle argument... " >&6; }
4598+
# Check whether --enable-sparkle was given.
4599+
if test "${enable_sparkle+set}" = set; then :
4600+
enableval=$enable_sparkle;
4601+
else
4602+
enable_sparkle="yes"
4603+
fi
4604+
4605+
if test "$enable_sparkle" == "yes"; then
4606+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4607+
$as_echo "no" >&6; }
4608+
else
4609+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4610+
$as_echo "yes" >&6; }
4611+
XCODEFLAGS="$XCODEFLAGS GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS DISABLE_SPARKLE=1'"
4612+
fi
4613+
45944614
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-developer-dir argument" >&5
45954615
$as_echo_n "checking --with-developer-dir argument... " >&6; }
45964616

src/configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
190190
AC_MSG_RESULT([yes, Darwin support excluded])
191191
fi
192192

193+
AC_MSG_CHECKING(--disable-sparkle argument)
194+
AC_ARG_ENABLE(sparkle,
195+
[ --disable-sparkle Disable Sparkle updater (MacVim).],
196+
, [enable_sparkle="yes"])
197+
if test "$enable_sparkle" == "yes"; then
198+
AC_MSG_RESULT(no)
199+
else
200+
AC_MSG_RESULT(yes)
201+
XCODEFLAGS="$XCODEFLAGS GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS DISABLE_SPARKLE=1'"
202+
fi
203+
193204
AC_MSG_CHECKING(--with-developer-dir argument)
194205
AC_ARG_WITH(developer-dir, [ --with-developer-dir=PATH use PATH as location for Xcode developer tools],
195206
DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),

0 commit comments

Comments
 (0)