diff --git a/data/gcolor3.gresource.xml b/data/gcolor3.gresource.xml index afad380..bfd38bd 100644 --- a/data/gcolor3.gresource.xml +++ b/data/gcolor3.gresource.xml @@ -1,6 +1,7 @@ + shortcuts.ui menus.ui color-row.ui diff --git a/data/menus.ui b/data/menus.ui index 78e1690..c94e219 100644 --- a/data/menus.ui +++ b/data/menus.ui @@ -2,6 +2,10 @@
+ + app.shortcuts + _Keyboard Shortcuts + app.about _About diff --git a/data/shortcuts.ui b/data/shortcuts.ui new file mode 100644 index 0000000..0d38c06 --- /dev/null +++ b/data/shortcuts.ui @@ -0,0 +1,60 @@ + + + + + 1 + + + 1 + shortcuts + 12 + + + 1 + General + + + 1 + F9 + Change page + + + + + + + 1 + Palette shortcuts + + + 1 + <ctrl>s + Save currently selected color + + + + + + + 1 + Saved color management + + + 1 + <ctrl>c + Copy highlighted color's hex value + + + + + 1 + Delete + Delete highlighted color + + + + + + + + diff --git a/meson.build b/meson.build index a66418b..322489b 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,7 @@ project('gcolor3', 'c', version: '2.2', ] ) -dep_gtk = dependency('gtk+-3.0', version: '>= 3.12.0', required: true) +dep_gtk = dependency('gtk+-3.0', version: '>= 3.20.0', required: true) cc = meson.get_compiler('c') dep_lm = cc.find_library('m', required: true) diff --git a/po/POTFILES b/po/POTFILES index 0ed8fd8..98b243b 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -4,6 +4,7 @@ data/nl.hjdskes.gcolor3.desktop.in data/nl.hjdskes.gcolor3.appdata.xml.in data/color-row.ui data/menus.ui +data/shortcuts.ui data/window.ui src/main.c src/gcolor3-application.c diff --git a/src/gcolor3-application.c b/src/gcolor3-application.c index a3d16cb..f602e30 100644 --- a/src/gcolor3-application.c +++ b/src/gcolor3-application.c @@ -34,6 +34,34 @@ struct _Gcolor3ApplicationPrivate { G_DEFINE_TYPE_WITH_PRIVATE (Gcolor3Application, gcolor3_application, GTK_TYPE_APPLICATION); +static void +gcolor3_application_action_shortcuts (UNUSED GSimpleAction *action, + UNUSED GVariant *parameter, + gpointer user_data) +{ + static GtkWindow *overlay = NULL; + GtkBuilder *builder; + GtkWindow *window; + + if (!overlay) { + builder = gtk_builder_new_from_resource ("/nl/hjdskes/gcolor3/shortcuts.ui"); + overlay = GTK_WINDOW (gtk_builder_get_object (builder, "shortcuts-gcolor3")); + g_object_unref (builder); + g_object_set (overlay, "view-name", NULL, NULL); + + g_signal_connect (overlay, "delete-event", + G_CALLBACK (gtk_widget_hide_on_delete), NULL); + + window = gtk_application_get_active_window (GTK_APPLICATION (user_data)); + + gtk_window_set_modal (overlay, TRUE); + gtk_window_set_transient_for (overlay, window); + gtk_window_set_destroy_with_parent (overlay, TRUE); + } + + gtk_window_present (overlay); +} + static void gcolor3_application_action_about (UNUSED GSimpleAction *action, UNUSED GVariant *parameter, @@ -79,6 +107,7 @@ gcolor3_application_action_quit (UNUSED GSimpleAction *action, } static GActionEntry app_entries[] = { + { "shortcuts", gcolor3_application_action_shortcuts, NULL, NULL, NULL }, { "about", gcolor3_application_action_about, NULL, NULL, NULL }, { "quit", gcolor3_application_action_quit, NULL, NULL, NULL }, };