[gnome-screenshot/wip/christopherdavis/screenshot-redesign: 12/12] screenshot-application: Use accel for help
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screenshot/wip/christopherdavis/screenshot-redesign: 12/12] screenshot-application: Use accel for help
- Date: Fri, 4 Jan 2019 07:20:41 +0000 (UTC)
commit 9a8acb3fb25319a3eaf910536ca3826cee7de55c
Author: Christopher Davis <brainblasted disroot org>
Date: Fri Jan 4 02:09:30 2019 -0500
screenshot-application: Use accel for help
Code was duplicated across both dialogs to handle the F1 shortcut for help. This is now handled as an
accel for the app.help action.
src/screenshot-application.c | 6 +++++-
src/screenshot-dialog.c | 6 ------
src/screenshot-interactive-dialog.c | 17 -----------------
3 files changed, 5 insertions(+), 24 deletions(-)
---
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index 572cbd1..16c394c 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -821,7 +821,6 @@ 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);
@@ -833,6 +832,11 @@ screenshot_application_startup (GApplication *app)
g_action_map_add_action_entries (G_ACTION_MAP (self), action_entries,
G_N_ELEMENTS (action_entries), self);
+
+ const gchar *help_accels[2] = { "F1", NULL };
+ const gchar *quit_accels[2] = { "<Primary>q", NULL };
+
+ gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.help", help_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", quit_accels);
}
diff --git a/src/screenshot-dialog.c b/src/screenshot-dialog.c
index 306ebe3..8369747 100644
--- a/src/screenshot-dialog.c
+++ b/src/screenshot-dialog.c
@@ -91,12 +91,6 @@ dialog_key_press_cb (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data)
{
- if (event->keyval == GDK_KEY_F1)
- {
- screenshot_display_help (GTK_WINDOW (widget));
- return TRUE;
- }
-
if (event->keyval == GDK_KEY_Escape)
{
gtk_widget_destroy (widget);
diff --git a/src/screenshot-interactive-dialog.c b/src/screenshot-interactive-dialog.c
index ebc5c6d..ef9c37a 100644
--- a/src/screenshot-interactive-dialog.c
+++ b/src/screenshot-interactive-dialog.c
@@ -102,20 +102,6 @@ use_shadow_toggled_cb (GtkSwitch *toggle,
gtk_switch_set_state (toggle, gtk_switch_get_active (toggle));
}
-static gint
-interactive_dialog_key_press_cb (GtkWidget *widget,
- GdkEventKey *event,
- gpointer user_data)
-{
- if (event->keyval == GDK_KEY_F1)
- {
- screenshot_display_help (GTK_WINDOW (widget));
- return TRUE;
- }
-
- return FALSE;
-}
-
static void
connect_effects_frame (GtkBuilder *ui)
{
@@ -290,9 +276,6 @@ screenshot_interactive_dialog_new (CaptureClickedCallback f, gpointer user_data)
g_signal_connect (capture_button, "clicked", G_CALLBACK (capture_button_clicked_cb), data);
gtk_widget_set_can_default (capture_button, TRUE);
gtk_widget_grab_default (capture_button);
- g_signal_connect (dialog, "key-press-event",
- G_CALLBACK (interactive_dialog_key_press_cb),
- NULL);
gtk_widget_show_all (dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]