diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-12-29 14:28:47 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-12-29 14:28:47 +0000 |
commit | 8fe3e09cfc25dfd36a4b93842715df804fc35e10 (patch) | |
tree | d1ebef4bec3ef06b1a4c0dd3c0a4a00fe45bdc58 | |
parent | 8352dee082db9e5ae989a2ed2c38e1060044bada (diff) | |
parent | cbd9715c3ce2f4887948e397e32cfd6773ee29d6 (diff) | |
download | gtk+-8fe3e09cfc25dfd36a4b93842715df804fc35e10.tar.gz |
Merge branch 'gtk-3-24-macos-dock-quit' into 'gtk-3-24'
macOS: Dock "Quit" invokes "app.quit" action
See merge request GNOME/gtk!4299
-rw-r--r-- | gtk/gtkapplication-quartz.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gtk/gtkapplication-quartz.c b/gtk/gtkapplication-quartz.c index f614dea296..efa88b4b5d 100644 --- a/gtk/gtkapplication-quartz.c +++ b/gtk/gtkapplication-quartz.c @@ -80,13 +80,19 @@ G_DEFINE_TYPE (GtkApplicationImplQuartz, gtk_application_impl_quartz, GTK_TYPE_A -(NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender { - /* We have no way to give our message other than to pop up a dialog - * ourselves, which we should not do since the OS will already show - * one when we return NSTerminateNow. - * - * Just let the OS show the generic message... - */ - return quartz->quit_inhibit == 0 ? NSTerminateNow : NSTerminateCancel; + const gchar *quit_action_name = "quit"; + GActionGroup *action_group = G_ACTION_GROUP (quartz->impl.application); + + if (quartz->quit_inhibit != 0) + return NSTerminateCancel; + + if (g_action_group_has_action (action_group, quit_action_name)) + { + g_action_group_activate_action (action_group, quit_action_name, NULL); + return NSTerminateCancel; + } + + return NSTerminateNow; } -(void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames |