mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Remove the AppStartup delegate
This temporary delegate was primarily used to ensure no message “slipped through” back when a license key was mandatory to run the alpha.
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1070</int>
|
||||
<string key="IBDocument.SystemVersion">12C60</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.34</string>
|
||||
<string key="IBDocument.HIToolboxVersion">625.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">2844</string>
|
||||
<string key="NS.object.0">3084</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -2393,9 +2393,6 @@
|
||||
<object class="NSCustomObject" id="872900754">
|
||||
<string key="NSClassName">OakSubmenuController</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="647725506">
|
||||
<string key="NSClassName">AppStartupController</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="681130894">
|
||||
<string key="NSClassName">NSFontManager</string>
|
||||
</object>
|
||||
@@ -2449,14 +2446,6 @@
|
||||
</object>
|
||||
<int key="connectionID">153</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="25255706"/>
|
||||
<reference key="destination" ref="647725506"/>
|
||||
</object>
|
||||
<int key="connectionID">615</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">dockMenu</string>
|
||||
@@ -2465,6 +2454,14 @@
|
||||
</object>
|
||||
<int key="connectionID">787</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="25255706"/>
|
||||
<reference key="destination" ref="585298010"/>
|
||||
</object>
|
||||
<int key="connectionID">806</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">arrangeInFront:</string>
|
||||
@@ -3721,14 +3718,6 @@
|
||||
</object>
|
||||
<int key="connectionID">597</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">appController</string>
|
||||
<reference key="source" ref="647725506"/>
|
||||
<reference key="destination" ref="585298010"/>
|
||||
</object>
|
||||
<int key="connectionID">612</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">orderFrontFontPanel:</string>
|
||||
@@ -5257,11 +5246,6 @@
|
||||
<reference key="object" ref="303859393"/>
|
||||
<reference key="parent" ref="276589048"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">611</int>
|
||||
<reference key="object" ref="647725506"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">616</int>
|
||||
<reference key="object" ref="692385893"/>
|
||||
@@ -5712,7 +5696,6 @@
|
||||
<string>594.IBPluginDependency</string>
|
||||
<string>595.IBPluginDependency</string>
|
||||
<string>609.IBPluginDependency</string>
|
||||
<string>611.IBPluginDependency</string>
|
||||
<string>616.IBPluginDependency</string>
|
||||
<string>618.IBPluginDependency</string>
|
||||
<string>621.IBPluginDependency</string>
|
||||
@@ -6012,7 +5995,6 @@
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<integer value="1"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<integer value="1"/>
|
||||
@@ -6062,7 +6044,7 @@
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">805</int>
|
||||
<int key="maxID">806</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@@ -6202,25 +6184,6 @@
|
||||
<string key="minorKey">./Classes/AppController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">AppStartupController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">appController</string>
|
||||
<string key="NS.object.0">AppController</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">appController</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">appController</string>
|
||||
<string key="candidateClassName">AppController</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/AppStartupController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">DocumentController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
OAK_DEBUG_VAR(AppController_Documents);
|
||||
|
||||
static NSString* const OakGlobalSessionInfo = @"OakGlobalSessionInfo";
|
||||
|
||||
@implementation AppController (Documents)
|
||||
- (void)newDocument:(id)sender
|
||||
{
|
||||
@@ -202,18 +200,6 @@ static NSString* const OakGlobalSessionInfo = @"OakGlobalSessionInfo";
|
||||
// = Application Termination =
|
||||
// ===========================
|
||||
|
||||
- (void)closeAllWindows:(id)sender
|
||||
{
|
||||
D(DBF_AppController_Documents, bug("\n"););
|
||||
@autoreleasepool {
|
||||
for(NSWindow* window in [NSApp windows])
|
||||
{
|
||||
if(window.isVisible)
|
||||
[window close];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
|
||||
{
|
||||
D(DBF_AppController_Documents, bug("%s\n", [NSApp windows].description.UTF8String););
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
extern NSString* const OakSessionDidChangeNotification;
|
||||
|
||||
@class OakFilterWindowController;
|
||||
|
||||
namespace find_tags
|
||||
{
|
||||
enum
|
||||
@@ -43,8 +39,6 @@ namespace find_tags
|
||||
|
||||
- (IBAction)newDocumentAndActivate:(id)sender;
|
||||
- (IBAction)openDocumentAndActivate:(id)sender;
|
||||
|
||||
- (void)setup;
|
||||
@end
|
||||
|
||||
@interface AppController (Documents)
|
||||
|
||||
@@ -3,21 +3,29 @@
|
||||
#import "AboutWindowController.h"
|
||||
#import "InstallBundleItems.h"
|
||||
#import "TMPlugInController.h"
|
||||
#import <oak/oak.h>
|
||||
#import <oak/debug.h>
|
||||
#import <Find/Find.h>
|
||||
#import <io/path.h>
|
||||
#import <OakFoundation/NSString Additions.h>
|
||||
#import "RMateServer.h"
|
||||
#import <BundleEditor/BundleEditor.h>
|
||||
#import <BundlesManager/BundlesManager.h>
|
||||
#import <CrashReporter/CrashReporter.h>
|
||||
#import <DocumentWindow/DocumentController.h>
|
||||
#import <Find/Find.h>
|
||||
#import <OakAppKit/OakAppKit.h>
|
||||
#import <OakAppKit/OakPasteboard.h>
|
||||
#import <OakFilterList/OakFilterList.h>
|
||||
#import <OakFilterList/BundleItemChooser.h>
|
||||
#import <OakFilterList/OakFilterList.h>
|
||||
#import <OakFoundation/NSString Additions.h>
|
||||
#import <OakTextView/OakDocumentView.h>
|
||||
#import <Preferences/Keys.h>
|
||||
#import <Preferences/Preferences.h>
|
||||
#import <text/types.h>
|
||||
#import <Preferences/TerminalPreferences.h>
|
||||
#import <SoftwareUpdate/SoftwareUpdate.h>
|
||||
#import <document/collection.h>
|
||||
#import <io/path.h>
|
||||
#import <network/tbz.h>
|
||||
#import <ns/ns.h>
|
||||
#import <oak/debug.h>
|
||||
#import <oak/oak.h>
|
||||
#import <text/types.h>
|
||||
|
||||
OAK_DEBUG_VAR(AppController);
|
||||
|
||||
@@ -58,27 +66,142 @@ void OakOpenDocuments (NSArray* paths)
|
||||
document::show(documents);
|
||||
}
|
||||
|
||||
BOOL HasDocumentWindow (NSArray* windows)
|
||||
{
|
||||
for(NSWindow* window in windows)
|
||||
{
|
||||
if([window.delegate isKindOfClass:[DocumentController class]])
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@interface AppController ()
|
||||
@property (nonatomic, retain) OakFilterWindowController* filterWindowController;
|
||||
@property (nonatomic, retain) AboutWindowController* aboutWindowController;
|
||||
@property (nonatomic) OakFilterWindowController* filterWindowController;
|
||||
@property (nonatomic) AboutWindowController* aboutWindowController;
|
||||
@property (nonatomic) BOOL didFinishLaunching;
|
||||
@end
|
||||
|
||||
@implementation AppController
|
||||
- (void)setup
|
||||
- (void)userDefaultsDidChange:(id)sender
|
||||
{
|
||||
BOOL disableRmate = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableRMateServerKey];
|
||||
NSString* rmateInterface = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsRMateServerListenKey];
|
||||
int rmatePort = [[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsRMateServerPortKey];
|
||||
setup_rmate_server(!disableRmate, [rmateInterface isEqualToString:kRMateServerListenRemote] ? INADDR_ANY : INADDR_LOOPBACK, rmatePort);
|
||||
}
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification*)aNotification
|
||||
{
|
||||
D(DBF_AppController, bug("\n"););
|
||||
settings_t::set_default_settings_path([[[NSBundle mainBundle] pathForResource:@"Default" ofType:@"tmProperties"] fileSystemRepresentation]);
|
||||
settings_t::set_global_settings_path(path::join(path::home(), "Library/Application Support/TextMate/Global.tmProperties"));
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@NO, @"ApplePressAndHoldEnabled",
|
||||
@25, @"NSRecentDocumentsLimit",
|
||||
nil]];
|
||||
RegisterDefaults();
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@NO forKey:@"NSQuitAlwaysKeepsWindows"];
|
||||
|
||||
std::string dest = path::join(path::home(), "Library/Application Support/TextMate/Managed");
|
||||
if(!path::exists(dest))
|
||||
{
|
||||
if(NSString* archive = [[NSBundle mainBundle] pathForResource:@"DefaultBundles" ofType:@"tbz"])
|
||||
{
|
||||
int input, output;
|
||||
std::string error;
|
||||
|
||||
path::make_dir(dest);
|
||||
|
||||
pid_t pid = network::launch_tbz(dest, input, output, error);
|
||||
if(pid != -1)
|
||||
{
|
||||
int fd = open([archive fileSystemRepresentation], O_RDONLY);
|
||||
if(fd != -1)
|
||||
{
|
||||
char buf[4096];
|
||||
ssize_t len;
|
||||
while((len = read(fd, buf, sizeof(buf))) > 0)
|
||||
{
|
||||
if(write(input, buf, len) != len)
|
||||
{
|
||||
fprintf(stderr, "*** error wrting bytes to tar\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
if(!network::finish_tbz(pid, input, output, error))
|
||||
fprintf(stderr, "%s\n", error.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", error.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bundles::build_index(path::join(path::home(), "Library/Application Support/TextMate/Cache"));
|
||||
|
||||
[[TMPlugInController sharedInstance] loadAllPlugIns:nil];
|
||||
|
||||
BOOL disableSessionRestoreKeyDown = ([NSEvent modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask;
|
||||
BOOL disableSessionRestorePrefs = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableSessionRestoreKey];
|
||||
if(!disableSessionRestoreKeyDown && !disableSessionRestorePrefs)
|
||||
[DocumentController restoreSession];
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication*)anApplication
|
||||
{
|
||||
D(DBF_AppController, bug("\n"););
|
||||
return self.didFinishLaunching;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification
|
||||
{
|
||||
D(DBF_AppController, bug("\n"););
|
||||
|
||||
BOOL disableUntitledAtStartupPrefs = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableNewDocumentAtStartupKey];
|
||||
disableUntitledAtStartupPrefs = disableUntitledAtStartupPrefs || getenv("OAK_DISABLE_UNTITLED_FILE") != NULL;
|
||||
if(!disableUntitledAtStartupPrefs && !HasDocumentWindow([NSApp orderedWindows]))
|
||||
[self newDocument:self];
|
||||
unsetenv("OAK_DISABLE_UNTITLED_FILE");
|
||||
|
||||
OakSubmitNewCrashReportsInBackground(REST_API @"/crashes");
|
||||
[BundlesManager sharedInstance]; // trigger periodic polling of remote bundle index
|
||||
|
||||
SoftwareUpdate* swUpdate = [SoftwareUpdate sharedInstance];
|
||||
[swUpdate setSignee:key_chain_t::key_t("org.textmate.duff", "Allan Odgaard", "-----BEGIN PUBLIC KEY-----\nMIIBtjCCASsGByqGSM44BAEwggEeAoGBAPIE9PpXPK3y2eBDJ0dnR/D8xR1TiT9m\n8DnPXYqkxwlqmjSShmJEmxYycnbliv2JpojYF4ikBUPJPuerlZfOvUBC99ERAgz7\nN1HYHfzFIxVo1oTKWurFJ1OOOsfg8AQDBDHnKpS1VnwVoDuvO05gK8jjQs9E5LcH\ne/opThzSrI7/AhUAy02E9H7EOwRyRNLofdtPxpa10o0CgYBKDfcBscidAoH4pkHR\nIOEGTCYl3G2Pd1yrblCp0nCCUEBCnvmrWVSXUTVa2/AyOZUTN9uZSC/Kq9XYgqwj\nhgzqa8h/a8yD+ao4q8WovwGeb6Iso3WlPl8waz6EAPR/nlUTnJ4jzr9t6iSH9owS\nvAmWrgeboia0CI2AH++liCDvigOBhAACgYAFWO66xFvmF2tVIB+4E7CwhrSi2uIk\ndeBrpmNcZZ+AVFy1RXJelNe/cZ1aXBYskn/57xigklpkfHR6DGqpEbm6KC/47Jfy\ny5GEx+F/eBWEePi90XnLinytjmXRmS2FNqX6D15XNG1xJfjociA8bzC7s4gfeTUd\nlpQkBq2z71yitA==\n-----END PUBLIC KEY-----\n")];
|
||||
[swUpdate setChannels:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSURL URLWithString:REST_API @"/releases/release"], kSoftwareUpdateChannelRelease,
|
||||
[NSURL URLWithString:REST_API @"/releases/beta"], kSoftwareUpdateChannelBeta,
|
||||
[NSURL URLWithString:REST_API @"/releases/nightly"], kSoftwareUpdateChannelNightly,
|
||||
nil]];
|
||||
|
||||
[TerminalPreferences updateMateIfRequired];
|
||||
|
||||
[self userDefaultsDidChange:nil]; // setup mate/rmate server
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:[NSUserDefaults standardUserDefaults]];
|
||||
|
||||
bundlesMenu.delegate = self;
|
||||
themesMenu.delegate = self;
|
||||
spellingMenu.delegate = self;
|
||||
|
||||
[NSApp setDelegate:self];
|
||||
|
||||
if([AboutWindowController shouldShowChangesWindow])
|
||||
{
|
||||
self.aboutWindowController = [[AboutWindowController alloc] init];
|
||||
[self.aboutWindowController performSelector:@selector(showChangesWindow:) withObject:self afterDelay:0];
|
||||
}
|
||||
|
||||
self.didFinishLaunching = YES;
|
||||
}
|
||||
|
||||
// =========================
|
||||
// = Past Startup Delegate =
|
||||
// =========================
|
||||
|
||||
- (IBAction)newDocumentAndActivate:(id)sender
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
@class AppController;
|
||||
|
||||
@interface AppStartupController : NSObject
|
||||
{
|
||||
IBOutlet AppController* appController;
|
||||
BOOL disableSessionRestore;
|
||||
}
|
||||
@property (nonatomic, retain) NSAppleEventDescriptor* openEvent;
|
||||
@property (nonatomic, retain) NSArray* openDocumentsArray;
|
||||
@end
|
||||
@@ -1,165 +0,0 @@
|
||||
#import "AppStartup.h"
|
||||
#import "AppController.h"
|
||||
#import <DocumentWindow/DocumentController.h>
|
||||
#import "ODBEditorSuite.h"
|
||||
#import "TMPlugInController.h"
|
||||
#import "RMateServer.h"
|
||||
#import <Preferences/Keys.h>
|
||||
#import <Preferences/TerminalPreferences.h>
|
||||
#import <OakFoundation/NSString Additions.h>
|
||||
#import <OakAppKit/NSEvent Additions.h>
|
||||
#import <CrashReporter/CrashReporter.h>
|
||||
#import <SoftwareUpdate/SoftwareUpdate.h>
|
||||
#import <BundlesManager/BundlesManager.h>
|
||||
#import <document/collection.h>
|
||||
#import <io/path.h>
|
||||
#import <bundles/bundles.h>
|
||||
#import <ns/ns.h>
|
||||
#import <network/tbz.h>
|
||||
#import <oak/server.h>
|
||||
#import <oak/debug.h>
|
||||
|
||||
OAK_DEBUG_VAR(AppStartup);
|
||||
|
||||
@implementation AppStartupController
|
||||
- (void)userDefaultsDidChange:(id)sender
|
||||
{
|
||||
BOOL disableRmate = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableRMateServerKey];
|
||||
NSString* rmateInterface = [[NSUserDefaults standardUserDefaults] stringForKey:kUserDefaultsRMateServerListenKey];
|
||||
int rmatePort = [[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsRMateServerPortKey];
|
||||
setup_rmate_server(!disableRmate, [rmateInterface isEqualToString:kRMateServerListenRemote] ? INADDR_ANY : INADDR_LOOPBACK, rmatePort);
|
||||
}
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification*)aNotification
|
||||
{
|
||||
D(DBF_AppStartup, bug("\n"););
|
||||
settings_t::set_default_settings_path([[[NSBundle mainBundle] pathForResource:@"Default" ofType:@"tmProperties"] fileSystemRepresentation]);
|
||||
settings_t::set_global_settings_path(path::join(path::home(), "Library/Application Support/TextMate/Global.tmProperties"));
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@NO, @"ApplePressAndHoldEnabled",
|
||||
@25, @"NSRecentDocumentsLimit",
|
||||
nil]];
|
||||
RegisterDefaults();
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@NO forKey:@"NSQuitAlwaysKeepsWindows"];
|
||||
disableSessionRestore = ([NSEvent modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask;
|
||||
|
||||
std::string dest = path::join(path::home(), "Library/Application Support/TextMate/Managed");
|
||||
if(!path::exists(dest))
|
||||
{
|
||||
if(NSString* archive = [[NSBundle mainBundle] pathForResource:@"DefaultBundles" ofType:@"tbz"])
|
||||
{
|
||||
int input, output;
|
||||
std::string error;
|
||||
|
||||
path::make_dir(dest);
|
||||
|
||||
pid_t pid = network::launch_tbz(dest, input, output, error);
|
||||
if(pid != -1)
|
||||
{
|
||||
int fd = open([archive fileSystemRepresentation], O_RDONLY);
|
||||
if(fd != -1)
|
||||
{
|
||||
char buf[4096];
|
||||
ssize_t len;
|
||||
while((len = read(fd, buf, sizeof(buf))) > 0)
|
||||
{
|
||||
if(write(input, buf, len) != len)
|
||||
{
|
||||
fprintf(stderr, "*** error wrting bytes to tar\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
if(!network::finish_tbz(pid, input, output, error))
|
||||
fprintf(stderr, "%s\n", error.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", error.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bundles::build_index(path::join(path::home(), "Library/Application Support/TextMate/Cache"));
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication*)theApplication openFile:(NSString*)aPath
|
||||
{
|
||||
D(DBF_AppStartup, bug("%s\n", [aPath UTF8String]););
|
||||
self.openEvent = [[NSAppleEventManager sharedAppleEventManager] currentAppleEvent];
|
||||
self.openDocumentsArray = @[ aPath ];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)application:(NSApplication*)sender openFiles:(NSArray*)filenames
|
||||
{
|
||||
D(DBF_AppStartup, bug("%s\n", [[filenames description] UTF8String]););
|
||||
self.openEvent = [[NSAppleEventManager sharedAppleEventManager] currentAppleEvent];
|
||||
self.openDocumentsArray = filenames;
|
||||
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication*)anApplication
|
||||
{
|
||||
D(DBF_AppStartup, bug("\n"););
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification
|
||||
{
|
||||
D(DBF_AppStartup, bug("\n"););
|
||||
|
||||
OakSubmitNewCrashReportsInBackground(REST_API @"/crashes");
|
||||
|
||||
[[TMPlugInController sharedInstance] loadAllPlugIns:nil];
|
||||
[self userDefaultsDidChange:nil]; // setup mate/rmate server
|
||||
|
||||
[BundlesManager sharedInstance]; // trigger periodic polling of remote bundle index
|
||||
|
||||
BOOL disableSessionRestorePrefs = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableSessionRestoreKey];
|
||||
BOOL disableUntitledAtStartupPrefs = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableNewDocumentAtStartupKey];
|
||||
|
||||
BOOL didRestoreSession = !disableSessionRestorePrefs && !disableSessionRestore && [DocumentController restoreSession];
|
||||
BOOL didOpenDocuments = DidHandleODBEditorEvent([self.openEvent aeDesc]) || ([self.openDocumentsArray count] && (OakOpenDocuments(self.openDocumentsArray), YES));
|
||||
if(!disableUntitledAtStartupPrefs && !didRestoreSession && !didOpenDocuments && getenv("OAK_DISABLE_UNTITLED_FILE") == NULL)
|
||||
document::show(document::create());
|
||||
|
||||
SoftwareUpdate* swUpdate = [SoftwareUpdate sharedInstance];
|
||||
[swUpdate setSignee:key_chain_t::key_t("org.textmate.duff", "Allan Odgaard", "-----BEGIN PUBLIC KEY-----\nMIIBtjCCASsGByqGSM44BAEwggEeAoGBAPIE9PpXPK3y2eBDJ0dnR/D8xR1TiT9m\n8DnPXYqkxwlqmjSShmJEmxYycnbliv2JpojYF4ikBUPJPuerlZfOvUBC99ERAgz7\nN1HYHfzFIxVo1oTKWurFJ1OOOsfg8AQDBDHnKpS1VnwVoDuvO05gK8jjQs9E5LcH\ne/opThzSrI7/AhUAy02E9H7EOwRyRNLofdtPxpa10o0CgYBKDfcBscidAoH4pkHR\nIOEGTCYl3G2Pd1yrblCp0nCCUEBCnvmrWVSXUTVa2/AyOZUTN9uZSC/Kq9XYgqwj\nhgzqa8h/a8yD+ao4q8WovwGeb6Iso3WlPl8waz6EAPR/nlUTnJ4jzr9t6iSH9owS\nvAmWrgeboia0CI2AH++liCDvigOBhAACgYAFWO66xFvmF2tVIB+4E7CwhrSi2uIk\ndeBrpmNcZZ+AVFy1RXJelNe/cZ1aXBYskn/57xigklpkfHR6DGqpEbm6KC/47Jfy\ny5GEx+F/eBWEePi90XnLinytjmXRmS2FNqX6D15XNG1xJfjociA8bzC7s4gfeTUd\nlpQkBq2z71yitA==\n-----END PUBLIC KEY-----\n")];
|
||||
[swUpdate setChannels:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSURL URLWithString:REST_API @"/releases/release"], kSoftwareUpdateChannelRelease,
|
||||
[NSURL URLWithString:REST_API @"/releases/beta"], kSoftwareUpdateChannelBeta,
|
||||
[NSURL URLWithString:REST_API @"/releases/nightly"], kSoftwareUpdateChannelNightly,
|
||||
nil]];
|
||||
|
||||
self.openEvent = nil;
|
||||
self.openDocumentsArray = nil;
|
||||
unsetenv("OAK_DISABLE_UNTITLED_FILE");
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:[NSUserDefaults standardUserDefaults]];
|
||||
[TerminalPreferences updateMateIfRequired];
|
||||
|
||||
[appController setup];
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication hasVisibleWindows:(BOOL)flag
|
||||
{
|
||||
D(DBF_AppStartup, bug("%s\n", BSTR(flag)););
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (IBAction)newDocument:(id)sender
|
||||
{
|
||||
// avoid NSDocumentController’s implementation
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem
|
||||
{
|
||||
if([menuItem action] == @selector(newDocument:))
|
||||
return NO;
|
||||
return YES;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user