[gedit/gnome-3-2-osx] Fix application termination for OS X



commit a4fc9df566ecd47e1feddcdc625339366ec8dfe1
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Mon Jan 30 14:08:58 2012 +0100

    Fix application termination for OS X

 gedit/gedit-app-osx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.c
index 1c0f652..bf434b0 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -362,6 +362,26 @@ on_osx_will_terminate (GtkOSXApplication *osxapp,
 }
 
 static gboolean
+on_osx_block_termination (GtkOSXApplication *osxapp,
+                          GeditAppOSX       *app)
+{
+	GtkUIManager *manager;
+	GtkAction *action;
+	GeditWindow *window;
+
+	window = gedit_app_get_active_window (GEDIT_APP (app));
+
+	// Synthesize quit-all
+	manager = gedit_window_get_ui_manager (window);
+
+	action = gtk_ui_manager_get_action (manager,
+	                                    "/ui/MenuBar/FileMenu/FileQuitMenu");
+
+	_gedit_cmd_file_quit (action, window);
+	return TRUE;
+}
+
+static gboolean
 on_osx_open_files (GtkOSXApplication  *osxapp,
                    gchar const       **paths,
                    GeditAppOSX        *app)
@@ -414,6 +434,11 @@ gedit_app_osx_init (GeditAppOSX *app)
 	                  app);
 
 	g_signal_connect (osxapp,
+	                  "NSApplicationBlockTermination",
+	                  G_CALLBACK (on_osx_block_termination),
+	                  app);
+
+	g_signal_connect (osxapp,
 	                  "NSApplicationOpenFiles",
 	                  G_CALLBACK (on_osx_open_files),
 	                  app);



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