[gedit/wip/3.14-osx: 11/12] Prevent Cocoa command line argument parsing for files



commit a170078874f93064c9f014492340e344938bb4e6
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sun Mar 23 13:27:01 2014 +0100

    Prevent Cocoa command line argument parsing for files

 gedit/gedit-app-osx.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.c
index 12941b8..9e527f6 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -377,6 +377,13 @@ gedit_app_osx_init (GeditAppOSX *app)
 {
        GtkosxApplication *osxapp;
 
+       /* This is required so that Cocoa is not going to parse the
+          command line arguments by itself and generate OpenFile events.
+          We already parse the command line ourselves, so this is needed
+          to prevent opening files twice, etc. */
+       [[NSUserDefaults standardUserDefaults] setObject:@"NO"
+                                              forKey:@"NSTreatUnknownArgumentsAsOpen"];
+
        /* This is a singleton */
        osxapp = g_object_new (GTKOSX_TYPE_APPLICATION, NULL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]