mate: disable untitled document via user defaults

This is instead of setting an environment variable. Since there already is a user defaults setting for whether or not we want an untitled document created at startup, it seems nicer to have mate set that, instead of effectively introducing an alias for the setting.
This commit is contained in:
Allan Odgaard
2013-02-03 10:48:43 +01:00
parent d5b3b07f32
commit 84587dccc9
2 changed files with 2 additions and 6 deletions

View File

@@ -165,10 +165,8 @@ BOOL HasDocumentWindow (NSArray* windows)
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

View File

@@ -82,11 +82,9 @@ static void launch_app ()
if(!find_app(&appFSRef, NULL))
abort();
std::map<std::string, std::string> tmp;
tmp["OAK_DISABLE_UNTITLED_FILE"] = "YES";
cf::dictionary_t environment(tmp);
cf::array_t args(std::vector<std::string>{ "-disableNewDocumentAtStartup", "1" });
struct LSApplicationParameters const appParams = { 0, kLSLaunchDontAddToRecents|kLSLaunchDontSwitch|kLSLaunchAndDisplayErrors, &appFSRef, NULL, environment, NULL, NULL };
struct LSApplicationParameters const appParams = { 0, kLSLaunchDontAddToRecents|kLSLaunchDontSwitch|kLSLaunchAndDisplayErrors, &appFSRef, NULL, NULL, args, NULL };
OSStatus err = LSOpenApplication(&appParams, NULL);
if(err != noErr)
{