[gnome-screenshot/wip/christopherdavis/screenshot-redesign: 4/5] Use accels for quitting application



commit 0d6439f8654511ce1880d5830b85b37ba13912ca
Author: Christopher Davis <brainblasted disroot org>
Date:   Fri Jan 4 01:34:11 2019 -0500

    Use accels for quitting application
    
    Sets an accelerator for the app.quit action instead of relying on the Escape key for the main dialog.

 src/screenshot-application.c        | 2 ++
 src/screenshot-interactive-dialog.c | 6 ------
 2 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index 9735ff0..e6b4b13 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -786,6 +786,7 @@ static GActionEntry action_entries[] = {
 static void
 screenshot_application_startup (GApplication *app)
 {
+  const gchar *quit_accels[2] = { "<Primary>q", NULL };
   ScreenshotApplication *self = SCREENSHOT_APPLICATION (app);
   g_application_set_resource_base_path (app, "/org/gnome/screenshot");
 
@@ -798,6 +799,7 @@ screenshot_application_startup (GApplication *app)
 
   g_action_map_add_action_entries (G_ACTION_MAP (self), action_entries,
                                    G_N_ELEMENTS (action_entries), self);
+  gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", quit_accels);
 }
 
 static void
diff --git a/src/screenshot-interactive-dialog.c b/src/screenshot-interactive-dialog.c
index 3d16070..99cfd0e 100644
--- a/src/screenshot-interactive-dialog.c
+++ b/src/screenshot-interactive-dialog.c
@@ -109,12 +109,6 @@ interactive_dialog_key_press_cb (GtkWidget   *widget,
       return TRUE;
     }
 
-  if (event->keyval == GDK_KEY_Escape)
-    {
-      gtk_widget_destroy (widget);
-      return TRUE;
-    }
-
   return FALSE;
 }
 


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