[gthumb] shortcuts: reorganized the categories; added a sort order
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] shortcuts: reorganized the categories; added a sort order
- Date: Sun, 24 Nov 2019 12:31:47 +0000 (UTC)
commit c3b9b4d9fe83904c01904ad97c4bd6b099e8d571
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Nov 13 17:12:29 2019 +0100
shortcuts: reorganized the categories; added a sort order
extensions/edit_metadata/callbacks.c | 4 +--
extensions/file_manager/callbacks.c | 10 +++----
extensions/file_tools/callbacks.c | 15 +++++-----
extensions/image_print/callbacks.c | 2 +-
extensions/image_rotation/callbacks.c | 4 +--
extensions/image_viewer/callbacks.c | 31 +++++++++++----------
extensions/image_viewer/image-viewer.h | 1 +
extensions/image_viewer/main.c | 8 ++++++
extensions/image_viewer/shortcuts.h | 28 +++++++++++++++++++
extensions/selections/callbacks.c | 21 ++++++++------
extensions/selections/main.c | 7 +++++
extensions/selections/shortcuts.h | 27 ++++++++++++++++++
gthumb/gth-browser-actions-entries.h | 50 +++++++++++++++++-----------------
gthumb/gth-main-default-types.c | 14 +++++-----
gthumb/gth-shortcut.h | 11 ++++----
gthumb/gth-window.c | 23 ++++++++++++++--
16 files changed, 174 insertions(+), 82 deletions(-)
---
diff --git a/extensions/edit_metadata/callbacks.c b/extensions/edit_metadata/callbacks.c
index 1614d2a6..46facb36 100644
--- a/extensions/edit_metadata/callbacks.c
+++ b/extensions/edit_metadata/callbacks.c
@@ -42,8 +42,8 @@ static const GActionEntry actions[] = {
static const GthShortcut shortcuts[] = {
- { "edit-metadata", N_("Edit comment"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_EDIT, "c" },
- { "edit-tags", N_("Edit tags"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_FILE_EDIT,
"t" },
+ { "edit-metadata", N_("Edit comment"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "c" },
+ { "edit-tags", N_("Edit tags"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "t" },
};
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 8ee4ae52..b60283d3 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -120,14 +120,14 @@ static const GthMenuEntry vfs_entries[] = {
static const GthShortcut shortcuts[] = {
- { "rename", N_("Rename File"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_FILE_EDIT,
"F2" },
- { "duplicate", N_("Duplicate File"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_FILE_EDIT,
"d" },
- { "remove-from-source", N_("Delete File"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_EDIT, "Delete" },
- { "remove-from-source-permanently", N_("Delete File Permanently"),
GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_FILE_EDIT, "<Shift>Delete" },
- { "open-with-gimp", N_("Open With Gimp"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_EDIT, "g" },
{ "edit-cut", N_("Cut"), GTH_SHORTCUT_CONTEXT_BROWSER | GTH_SHORTCUT_CONTEXT_FIXED,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "<Primary>x" },
{ "edit-copy", N_("Copy"), GTH_SHORTCUT_CONTEXT_BROWSER | GTH_SHORTCUT_CONTEXT_FIXED,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "<Primary>c" },
{ "edit-paste", N_("Paste"), GTH_SHORTCUT_CONTEXT_BROWSER | GTH_SHORTCUT_CONTEXT_FIXED,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "<Primary>v" },
+ { "rename", N_("Rename"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_FILE_MANAGER,
"F2" },
+ { "duplicate", N_("Duplicate"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "d"
},
+ { "remove-from-source", N_("Delete"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "Delete" },
+ { "remove-from-source-permanently", N_("Delete permanently"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "<Shift>Delete" },
+ { "open-with-gimp", N_("Open with Gimp"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "g" },
};
diff --git a/extensions/file_tools/callbacks.c b/extensions/file_tools/callbacks.c
index a0610611..6873f5e4 100644
--- a/extensions/file_tools/callbacks.c
+++ b/extensions/file_tools/callbacks.c
@@ -26,6 +26,7 @@
#include <gdk/gdkkeysyms.h>
#include <gthumb.h>
#include <extensions/image_viewer/gth-image-viewer-page.h>
+#include <extensions/image_viewer/shortcuts.h>
#include "actions.h"
#include "callbacks.h"
#include "gth-file-tool-adjust-contrast.h"
@@ -49,13 +50,13 @@ static const GActionEntry actions[] = {
static const GthShortcut shortcuts[] = {
- { "file-tool-adjust-contrast", N_("Adjust Contrast"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, "a" },
- { "file-tool-flip", N_("Flip"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, "l" },
- { "file-tool-mirror", N_("Mirror"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, "m" },
- { "file-tool-rotate-right", N_("Rotate Right"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, "r" },
- { "file-tool-rotate-left", N_("Rotate Left"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, "<Shift>r" },
- { "file-tool-crop", N_("Crop"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, "<Shift>c" },
- { "file-tool-resize", N_("Resize"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, "<Shift>s" },
+ { "file-tool-adjust-contrast", N_("Adjust contrast"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "a" },
+ { "file-tool-flip", N_("Flip"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "l" },
+ { "file-tool-mirror", N_("Mirror"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "m" },
+ { "file-tool-rotate-right", N_("Rotate right"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "r" },
+ { "file-tool-rotate-left", N_("Rotate left"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "<Shift>r" },
+ { "file-tool-crop", N_("Crop"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "<Shift>c" },
+ { "file-tool-resize", N_("Resize"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, "<Shift>s" },
};
diff --git a/extensions/image_print/callbacks.c b/extensions/image_print/callbacks.c
index 798d3967..6ca06347 100644
--- a/extensions/image_print/callbacks.c
+++ b/extensions/image_print/callbacks.c
@@ -35,7 +35,7 @@ static const GActionEntry actions[] = {
static const GthShortcut shortcuts[] = {
- { "print", N_("Print"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_EDIT,
"<Primary>p" },
+ { "print", N_("Print"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_FILE_MANAGER,
"<Primary>p" },
};
diff --git a/extensions/image_rotation/callbacks.c b/extensions/image_rotation/callbacks.c
index bb53c9d2..dcb6327b 100644
--- a/extensions/image_rotation/callbacks.c
+++ b/extensions/image_rotation/callbacks.c
@@ -43,8 +43,8 @@ static const GActionEntry actions[] = {
static const GthShortcut shortcuts[] = {
- { "rotate-right", N_("Rotate Right"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_EDIT, "bracketright" },
- { "rotate-left", N_("Rotate Left"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_EDIT, "bracketleft" },
+ { "rotate-right", N_("Rotate right"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "bracketright" },
+ { "rotate-left", N_("Rotate left"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "bracketleft" },
};
diff --git a/extensions/image_viewer/callbacks.c b/extensions/image_viewer/callbacks.c
index be4f3f9c..5c04d8cc 100644
--- a/extensions/image_viewer/callbacks.c
+++ b/extensions/image_viewer/callbacks.c
@@ -25,24 +25,25 @@
#include <glib-object.h>
#include <gthumb.h>
#include "callbacks.h"
+#include "shortcuts.h"
static const GthShortcut shortcuts[] = {
- { "image-zoom-in", N_("Zoom In"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"plus" },
- { "image-zoom-out", N_("Zoom Out"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"minus" },
- { "image-zoom-100", N_("Zoom 100%"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"1" },
- { "image-zoom-200", N_("Zoom 200%"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"2" },
- { "image-zoom-300", N_("Zoom 300%"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"3" },
-
- { "image-zoom-fit", N_("Zoom To Fit"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"<Shift>x" },
- { "image-zoom-fit-if-larger", N_("Zoom To Fit If Larger"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "x" },
- { "image-zoom-fit-width", N_("Zoom To Fit Width"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "<Shift>w" },
- { "image-zoom-fit-width-if-larger", N_("Zoom To Fit Width If Larger"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "w" },
- { "image-zoom-fit-height", N_("Zoom To Fit Height"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "<Shift>h" },
- { "image-zoom-fit-height-if-larger", N_("Zoom To Fit Height If Larger"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "h" },
-
- { "image-undo", N_("Undo Edit"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"<Primary>z" },
- { "image-redo", N_("Redo Edit"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEW,
"<Primary><Shift>z" },
+ { "image-zoom-in", N_("Zoom in"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER,
"plus" },
+ { "image-zoom-out", N_("Zoom out"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER,
"minus" },
+ { "image-zoom-100", N_("Zoom 100%"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER,
"1" },
+ { "image-zoom-200", N_("Zoom 200%"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER,
"2" },
+ { "image-zoom-300", N_("Zoom 300%"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER,
"3" },
+
+ { "image-zoom-fit", N_("Zoom to fit"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, "<Shift>x" },
+ { "image-zoom-fit-if-larger", N_("Zoom to fit if larger"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, "x" },
+ { "image-zoom-fit-width", N_("Zoom to fit width"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, "<Shift>w" },
+ { "image-zoom-fit-width-if-larger", N_("Zoom to fit width if larger"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, "w" },
+ { "image-zoom-fit-height", N_("Zoom to fit height"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, "<Shift>h" },
+ { "image-zoom-fit-height-if-larger", N_("Zoom to fit height if larger"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, "h" },
+
+ { "image-undo", N_("Undo edit"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR,
"<Primary>z" },
+ { "image-redo", N_("Redo edit"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR,
"<Primary><Shift>z" },
};
diff --git a/extensions/image_viewer/image-viewer.h b/extensions/image_viewer/image-viewer.h
index efef9dc4..1ca04697 100644
--- a/extensions/image_viewer/image-viewer.h
+++ b/extensions/image_viewer/image-viewer.h
@@ -26,5 +26,6 @@
#include "gth-image-viewer-page-tool.h"
#include "gth-image-viewer-task.h"
#include "preferences.h"
+#include "shortcuts.h"
#endif /* IMAGE_VIEWER_H */
diff --git a/extensions/image_viewer/main.c b/extensions/image_viewer/main.c
index 3335a064..0dd89876 100644
--- a/extensions/image_viewer/main.c
+++ b/extensions/image_viewer/main.c
@@ -28,6 +28,13 @@
#include "gth-metadata-provider-image.h"
#include "callbacks.h"
#include "preferences.h"
+#include "shortcuts.h"
+
+
+static GthShortcutCategory shortcut_categories[] = {
+ { GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER, N_("Image Viewer"), 21 },
+ { GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR, N_("Image Editor"), 22 }
+};
G_MODULE_EXPORT void
@@ -36,6 +43,7 @@ gthumb_extension_activate (void)
gth_main_register_metadata_provider (GTH_TYPE_METADATA_PROVIDER_IMAGE);
gth_main_register_object (GTH_TYPE_VIEWER_PAGE, NULL, GTH_TYPE_IMAGE_VIEWER_PAGE, NULL);
gth_main_register_type ("file-properties", GTH_TYPE_IMAGE_HISTOGRAM);
+ gth_main_register_shortcut_category (shortcut_categories, G_N_ELEMENTS (shortcut_categories));
gth_hook_add_callback ("dlg-preferences-construct", 10, G_CALLBACK
(image_viewer__dlg_preferences_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-construct", 7, G_CALLBACK
(image_viewer__gth_browser_construct_cb), NULL);
}
diff --git a/extensions/image_viewer/shortcuts.h b/extensions/image_viewer/shortcuts.h
new file mode 100644
index 00000000..5409e8e8
--- /dev/null
+++ b/extensions/image_viewer/shortcuts.h
@@ -0,0 +1,28 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * 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 2 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SHORTCUTS_H
+#define SHORTCUTS_H
+
+#define GTH_SHORTCUT_CATEGORY_IMAGE_VIEWER "image-viewer"
+#define GTH_SHORTCUT_CATEGORY_IMAGE_EDITOR "image-editor"
+
+#endif /* SHORTCUTS_H */
diff --git a/extensions/selections/callbacks.c b/extensions/selections/callbacks.c
index 3a7d6623..6fb0ebc8 100644
--- a/extensions/selections/callbacks.c
+++ b/extensions/selections/callbacks.c
@@ -28,6 +28,7 @@
#include "callbacks.h"
#include "gth-file-source-selections.h"
#include "gth-selections-manager.h"
+#include "shortcuts.h"
#define BROWSER_DATA_KEY "selections-browser-data"
@@ -53,17 +54,19 @@ static const GActionEntry actions[] = {
static const GthShortcut shortcuts[] = {
- { "add-to-selection-1", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN, "<Alt>1" },
- { "add-to-selection-2", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN, "<Alt>2" },
- { "add-to-selection-3", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN, "<Alt>3" },
+ { "add-to-selection-1", N_("Add to selection 1"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Alt>1" },
+ { "add-to-selection-2", N_("Add to selection 2"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Alt>2" },
+ { "add-to-selection-3", N_("Add to selection 3"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Alt>3" },
- { "remove-from-selection-1", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN,
"<Shift><Alt>1" },
- { "remove-from-selection-2", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN,
"<Shift><Alt>2" },
- { "remove-from-selection-3", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN,
"<Shift><Alt>3" },
+ { "remove-from-selection-1", N_("Remove from selection 1"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Shift><Alt>1" },
+ { "remove-from-selection-2", N_("Remove from selection 2"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Shift><Alt>2" },
+ { "remove-from-selection-3", N_("Remove from selection 3"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Shift><Alt>3" },
- { "go-to-selection-1", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN, "<Primary>1"
},
- { "go-to-selection-2", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN, "<Primary>2"
},
- { "go-to-selection-3", "", GTH_SHORTCUT_CONTEXT_INTERNAL, GTH_SHORTCUT_CATEGORY_HIDDEN, "<Primary>3"
},
+ { "go-to-selection-1", N_("Show selection 1"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Primary>1" },
+ { "go-to-selection-2", N_("Show selection 2"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Primary>2" },
+ { "go-to-selection-3", N_("Show selection 3"), GTH_SHORTCUT_CONTEXT_INTERNAL,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Primary>3" },
+
+ { "go-to-container-from-selection", N_("Open the file folder"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_SELECTIONS, "<Alt>End" },
};
diff --git a/extensions/selections/main.c b/extensions/selections/main.c
index d007205f..039571a4 100644
--- a/extensions/selections/main.c
+++ b/extensions/selections/main.c
@@ -26,6 +26,12 @@
#include "callbacks.h"
#include "gth-file-source-selections.h"
#include "gth-metadata-provider-selections.h"
+#include "shortcuts.h"
+
+
+static GthShortcutCategory shortcut_categories[] = {
+ { GTH_SHORTCUT_CATEGORY_SELECTIONS, N_("Selections"), 17 },
+};
G_MODULE_EXPORT void
@@ -33,6 +39,7 @@ gthumb_extension_activate (void)
{
gth_main_register_file_source (GTH_TYPE_FILE_SOURCE_SELECTIONS);
gth_main_register_metadata_provider (GTH_TYPE_METADATA_PROVIDER_SELECTIONS);
+ gth_main_register_shortcut_category (shortcut_categories, G_N_ELEMENTS (shortcut_categories));
gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK
(selections__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK
(selections__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("gth-browser-file-list-key-press", 10, G_CALLBACK
(selections__gth_browser_file_list_key_press_cb), NULL);
diff --git a/extensions/selections/shortcuts.h b/extensions/selections/shortcuts.h
new file mode 100644
index 00000000..974cdf0b
--- /dev/null
+++ b/extensions/selections/shortcuts.h
@@ -0,0 +1,27 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2019 Free Software Foundation, Inc.
+ *
+ * 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 2 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SHORTCUTS_H
+#define SHORTCUTS_H
+
+#define GTH_SHORTCUT_CATEGORY_SELECTIONS "selections"
+
+#endif /* SHORTCUTS_H */
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index c655b2f8..0c26f98b 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -3,7 +3,7 @@
/*
* GThumb
*
- * Copyright (C) 2005-2009 Free Software Foundation, Inc.
+ * Copyright (C) 2005-2019 Free Software Foundation, Inc.
*
* 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
@@ -71,34 +71,34 @@ static const GActionEntry gth_browser_actions[] = {
static const GthAccelerator gth_browser_accelerators[] = {
{ "browser-mode", "Escape" },
- { "close", "<Control>w" },
};
static const GthShortcut gth_browser_shortcuts[] = {
- { "close", N_("Close Window"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_UI, "" },
- { "open-location", N_("Open Location"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, "o" },
- { "fullscreen", N_("Fullscreen"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "f" },
- { "revert-to-saved", N_("Revert Image to Saved"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_EDIT, "F4" },
- { "show-sidebar", N_("Sidebar"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_UI, "F9"
},
- { "show-statusbar", N_("Statusbar"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_UI,
"F7" },
- { "show-thumbnail-list", N_("Thumbnails List"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_UI, "F8" },
-
- { "go-back", N_("Load Previuos Location"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, "<Alt>Left" },
- { "go-forward", N_("Load Next Location"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, "<Alt>Right" },
- { "go-up", N_("Load Parent Folder"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, "<Alt>Up" },
- { "go-home", N_("Load Home"), GTH_SHORTCUT_CONTEXT_BROWSER, GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION,
"<Alt>Home" },
- { "reload", N_("Reload Location"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, "r" },
- { "show-hidden-files", N_("Show/Hide Hidden Files"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, "h" },
- { "sort-by", N_("Change Sorting Order"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, "s" },
-
- { "show-previous-image", N_("Show Previous Image"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "BackSpace" },
- { "show-next-image", N_("Show Next Image"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "space" },
- { "show-first-image", N_("Show First Image"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "Home" },
- { "show-last-image", N_("Show Last Image"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, "End" },
-
- { "toggle-edit-file", N_("Edit Image"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_UI, "e" },
- { "toggle-file-properties", N_("File Properties"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_UI, "i" },
+ { "browser-mode", N_("Show browser"), GTH_SHORTCUT_CONTEXT_INTERNAL | GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_GENERAL, "Escape" },
+ { "close", N_("Close window"), GTH_SHORTCUT_CONTEXT_INTERNAL | GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_GENERAL, "<Primary>w" },
+ { "quit", N_("Quit"), GTH_SHORTCUT_CONTEXT_INTERNAL | GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_GENERAL, "<Primary>q" },
+ { "new-window", N_("New Window"), GTH_SHORTCUT_CONTEXT_INTERNAL |
GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_GENERAL, "<Primary>n" },
+
+ { "open-location", N_("Open location"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_NAVIGATION, "o" },
+ { "fullscreen", N_("Fullscreen"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER, GTH_SHORTCUT_CATEGORY_VIEWER,
"f" },
+ { "revert-to-saved", N_("Revert image to saved"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER, "F4" },
+
+ { "go-back", N_("Load previuos location"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_NAVIGATION, "<Alt>Left" },
+ { "go-forward", N_("Load next location"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_NAVIGATION, "<Alt>Right" },
+ { "go-up", N_("Load parent folder"), GTH_SHORTCUT_CONTEXT_BROWSER, GTH_SHORTCUT_CATEGORY_NAVIGATION,
"<Alt>Up" },
+ { "go-home", N_("Load home"), GTH_SHORTCUT_CONTEXT_BROWSER, GTH_SHORTCUT_CATEGORY_NAVIGATION,
"<Alt>Home" },
+ { "reload", N_("Reload location"), GTH_SHORTCUT_CONTEXT_BROWSER, GTH_SHORTCUT_CATEGORY_NAVIGATION,
"r" },
+ { "show-hidden-files", N_("Show/Hide hidden files"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_NAVIGATION, "h" },
+ { "sort-by", N_("Change sorting order"), GTH_SHORTCUT_CONTEXT_BROWSER,
GTH_SHORTCUT_CATEGORY_NAVIGATION, "s" },
+
+ { "show-previous-image", N_("Show previous file"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_VIEWER, "BackSpace" },
+ { "show-next-image", N_("Show next file"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_VIEWER,
"space" },
+ { "show-first-image", N_("Show first file"), GTH_SHORTCUT_CONTEXT_VIEWER,
GTH_SHORTCUT_CATEGORY_VIEWER, "Home" },
+ { "show-last-image", N_("Show last file"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_VIEWER,
"End" },
+
+ { "toggle-edit-file", N_("Image tools"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_UI, "e" },
+ { "toggle-file-properties", N_("File properties"), GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER,
GTH_SHORTCUT_CATEGORY_UI, "i" },
};
diff --git a/gthumb/gth-main-default-types.c b/gthumb/gth-main-default-types.c
index 68ecdad5..fb95e287 100644
--- a/gthumb/gth-main-default-types.c
+++ b/gthumb/gth-main-default-types.c
@@ -33,14 +33,14 @@
#include "pixbuf-io.h"
-GthShortcutCategory shortcut_categories[] = {
+static GthShortcutCategory shortcut_categories[] = {
{ GTH_SHORTCUT_CATEGORY_HIDDEN, NULL },
- { GTH_SHORTCUT_CATEGORY_UI, N_("Show/Hide") },
- { GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION, N_("File Navigation") },
- { GTH_SHORTCUT_CATEGORY_FILE_EDIT, N_("File Edit") },
- { GTH_SHORTCUT_CATEGORY_IMAGE_VIEW, N_("Viewer") },
- { GTH_SHORTCUT_CATEGORY_IMAGE_EDIT, N_("Image Edit") },
- { GTH_SHORTCUT_CATEGORY_SLIDESHOW, N_("Slideshow") },
+ { GTH_SHORTCUT_CATEGORY_GENERAL, N_("General"), 30 },
+ { GTH_SHORTCUT_CATEGORY_UI, N_("Show/Hide"), 31 },
+ { GTH_SHORTCUT_CATEGORY_NAVIGATION, N_("Navigation"), 15 },
+ { GTH_SHORTCUT_CATEGORY_FILE_MANAGER, N_("File Manager"), 10 },
+ { GTH_SHORTCUT_CATEGORY_VIEWER, N_("Viewer"), 20 },
+ { GTH_SHORTCUT_CATEGORY_SLIDESHOW, N_("Slideshow"), 21 }
};
diff --git a/gthumb/gth-shortcut.h b/gthumb/gth-shortcut.h
index a7d9d827..0c01d7e1 100644
--- a/gthumb/gth-shortcut.h
+++ b/gthumb/gth-shortcut.h
@@ -26,20 +26,19 @@
G_BEGIN_DECLS
-#define GTH_SHORTCUT_CONTEXT_INTERNAL -1
-
#define GTH_SHORTCUT_CATEGORY_HIDDEN "hidden"
+#define GTH_SHORTCUT_CATEGORY_GENERAL "general"
#define GTH_SHORTCUT_CATEGORY_UI "ui"
-#define GTH_SHORTCUT_CATEGORY_FILE_NAVIGATION "file-navigation"
-#define GTH_SHORTCUT_CATEGORY_FILE_EDIT "file-edit"
-#define GTH_SHORTCUT_CATEGORY_IMAGE_VIEW "image-view"
-#define GTH_SHORTCUT_CATEGORY_IMAGE_EDIT "image-edit"
+#define GTH_SHORTCUT_CATEGORY_NAVIGATION "file-navigation"
+#define GTH_SHORTCUT_CATEGORY_FILE_MANAGER "file-manager"
+#define GTH_SHORTCUT_CATEGORY_VIEWER "file-viewer"
#define GTH_SHORTCUT_CATEGORY_SLIDESHOW "slideshow"
typedef struct {
char *id;
char *display_name;
+ int sort_order;
} GthShortcutCategory;
diff --git a/gthumb/gth-window.c b/gthumb/gth-window.c
index aee49d8f..c266f1b4 100644
--- a/gthumb/gth-window.c
+++ b/gthumb/gth-window.c
@@ -827,10 +827,27 @@ static int
sort_shortcuts_by_category (gconstpointer a,
gconstpointer b)
{
- const GthShortcut *sa = * (GthShortcut **) a;
- const GthShortcut *sb = * (GthShortcut **) b;
+ const GthShortcut *sa = * (GthShortcut **) a;
+ const GthShortcut *sb = * (GthShortcut **) b;
+ int result;
+ GthShortcutCategory *cat_a;
+ GthShortcutCategory *cat_b;
+
+ result = 0;
+ cat_a = gth_main_get_shortcut_category (sa->category);
+ cat_b = gth_main_get_shortcut_category (sb->category);
+ if ((cat_a != NULL) && (cat_b != NULL)) {
+ if (cat_a->sort_order < cat_b->sort_order)
+ result = -1;
+ else if (cat_a->sort_order > cat_b->sort_order)
+ result = 1;
+ }
+ if (result == 0)
+ result = g_strcmp0 (sa->category, sb->category);
+ if (result == 0)
+ result = g_strcmp0 (sa->description, sb->description);
- return g_strcmp0 (sa->category, sb->category);
+ return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]