116 lines
3.5 KiB
C
116 lines
3.5 KiB
C
/* PIKA - Photo and Image Kooker Application
|
|
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
|
|
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
|
|
*
|
|
* Original copyright, applying to most contents (license remains unchanged):
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <gegl.h>
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "libpikawidgets/pikawidgets.h"
|
|
|
|
#include "dialogs-types.h"
|
|
|
|
#include "core/pika.h"
|
|
|
|
#include "widgets/pikaactioneditor.h"
|
|
#include "widgets/pikahelp-ids.h"
|
|
|
|
#include "menus/menus.h"
|
|
|
|
#include "keyboard-shortcuts-dialog.h"
|
|
|
|
#include "pika-intl.h"
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
static void keyboard_shortcuts_dialog_response (GtkWidget *dialog,
|
|
gint response,
|
|
Pika *pika);
|
|
|
|
|
|
/* public functions */
|
|
|
|
GtkWidget *
|
|
keyboard_shortcuts_dialog_new (Pika *pika)
|
|
{
|
|
GtkWidget *dialog;
|
|
GtkWidget *vbox;
|
|
GtkWidget *editor;
|
|
GtkWidget *box;
|
|
GtkWidget *button;
|
|
|
|
g_return_val_if_fail (PIKA_IS_PIKA (pika), NULL);
|
|
|
|
dialog = pika_dialog_new (_("Configure Keyboard Shortcuts"),
|
|
"pika-keyboard-shortcuts-dialog",
|
|
NULL, 0,
|
|
pika_standard_help_func,
|
|
PIKA_HELP_KEYBOARD_SHORTCUTS,
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
|
|
|
NULL);
|
|
|
|
g_signal_connect (dialog, "response",
|
|
G_CALLBACK (keyboard_shortcuts_dialog_response),
|
|
pika);
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
|
vbox, TRUE, TRUE, 0);
|
|
gtk_widget_show (vbox);
|
|
|
|
editor = pika_action_editor_new (pika, NULL, TRUE);
|
|
gtk_box_pack_start (GTK_BOX (vbox), editor, TRUE, TRUE, 0);
|
|
gtk_widget_show (editor);
|
|
|
|
box = pika_hint_box_new (_("To edit a shortcut key, click on the "
|
|
"corresponding row and type a new "
|
|
"accelerator, or press backspace to "
|
|
"clear."));
|
|
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
|
|
gtk_widget_show (box);
|
|
|
|
button = pika_prop_check_button_new (G_OBJECT (pika->config), "save-accels",
|
|
_("S_ave keyboard shortcuts on exit"));
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
return dialog;
|
|
}
|
|
|
|
|
|
/* private functions */
|
|
|
|
static void
|
|
keyboard_shortcuts_dialog_response (GtkWidget *dialog,
|
|
gint response,
|
|
Pika *pika)
|
|
{
|
|
switch (response)
|
|
{
|
|
default:
|
|
gtk_widget_destroy (dialog);
|
|
break;
|
|
}
|
|
}
|