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



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

    [osx] 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 5076b72..b00fd5b 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -418,6 +418,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 (GTK_TYPE_OSX_APPLICATION, NULL);
 


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