[gnome-screenshot/wip/christopherdavis/screenshot-redesign: 26/27] Use accels for quitting application



commit 68f36c37fe124394dc15185b7773986c67d0c748
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 53e855d..572cbd1 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -821,6 +821,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_CLASS (screenshot_application_parent_class)->startup (app);
@@ -832,6 +833,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);
 
 }
 
diff --git a/src/screenshot-interactive-dialog.c b/src/screenshot-interactive-dialog.c
index b87251f..ebc5c6d 100644
--- a/src/screenshot-interactive-dialog.c
+++ b/src/screenshot-interactive-dialog.c
@@ -113,12 +113,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]