[gedit/wip/3.10.4-osx] Prevent Cocoa command line argument parsing for files



commit d11fb8e7ed45ca926d73bcbbb9c7b6120033038e
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 bbc375f..7f608e1 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -376,6 +376,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]