[dia] [gtk-osx] Don't quit without asking to save files first



commit 3b8fe0dc3b7366997d60410d85c55ab3fe9e27a7
Author: Hans Breuer <hans breuer org>
Date:   Sat Nov 15 15:41:48 2014 +0100

    [gtk-osx] Don't quit without asking to save files first
    
    i.e. connect the exisiting method to an OS X specific signal

 app/interface.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/app/interface.c b/app/interface.c
index 26b2b04..80d9ab2 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -909,6 +909,12 @@ app_set_icon (GtkWindow *window)
 }
 
 #ifdef HAVE_MAC_INTEGRATION
+static gboolean
+_osx_app_exit (GtkosxApplication *app,
+              gpointer           user_data)
+{
+  return !app_exit ();
+}
 static void
 _create_mac_integration (GtkWidget *menubar)
 {
@@ -952,6 +958,9 @@ _create_mac_integration (GtkWidget *menubar)
     gtkosx_application_set_dock_icon_pixbuf (theOsxApp,
        gdk_pixbuf_new_from_inline (-1, dia_app_icon, FALSE, NULL));
   }
+  /* Don't quit without asking to save files first */
+  g_signal_connect (theOsxApp, "NSApplicationBlockTermination",
+                   G_CALLBACK (_osx_app_exit), NULL);
   /* without this all the above wont have any effect */
   gtkosx_application_ready(theOsxApp);
 }


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