Commit 5f9d3423 authored by Christopher Davis's avatar Christopher Davis 🌱 Committed by Alexander Mikhaylenko
Browse files

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.
parent 93f65912
Pipeline #159748 passed with stage
in 4 minutes and 8 seconds
......@@ -786,6 +786,7 @@ static GActionEntry action_entries[] = {
static void
screenshot_application_startup (GApplication *app)
{
const gchar *help_accels[2] = { "F1", NULL };
const gchar *quit_accels[2] = { "<Primary>q", NULL };
ScreenshotApplication *self = SCREENSHOT_APPLICATION (app);
g_application_set_resource_base_path (app, "/org/gnome/screenshot");
......@@ -799,6 +800,8 @@ 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.help", help_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", quit_accels);
}
......
......@@ -142,12 +142,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);
......
......@@ -98,20 +98,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)
{
......@@ -275,9 +261,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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment