[gthumb] edit metadata: converted accelerators to customizable shortcuts
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] edit metadata: converted accelerators to customizable shortcuts
- Date: Sun, 24 Nov 2019 12:29:21 +0000 (UTC)
commit 1329bdbe241ad6b47c7602bfb144658db7de1295
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Nov 9 18:22:13 2019 +0100
edit metadata: converted accelerators to customizable shortcuts
extensions/edit_metadata/callbacks.c | 36 +++++++++---------------------------
extensions/edit_metadata/callbacks.h | 2 --
extensions/edit_metadata/main.c | 1 -
3 files changed, 9 insertions(+), 30 deletions(-)
---
diff --git a/extensions/edit_metadata/callbacks.c b/extensions/edit_metadata/callbacks.c
index 8d33d464..f65c52c0 100644
--- a/extensions/edit_metadata/callbacks.c
+++ b/extensions/edit_metadata/callbacks.c
@@ -41,6 +41,12 @@ 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" },
+};
+
+
static const GthMenuEntry tools_actions[] = {
{ N_("Delete Metadata"), "win.delete-metadata" }
};
@@ -61,6 +67,9 @@ edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
actions,
G_N_ELEMENTS (actions),
browser);
+ gth_window_add_shortcuts (GTH_WINDOW (browser),
+ shortcuts,
+ G_N_ELEMENTS (shortcuts));
if (gth_main_extension_is_active ("list_tools"))
gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser,
GTH_BROWSER_MENU_MANAGER_MORE_TOOLS),
@@ -101,30 +110,3 @@ edit_metadata__gth_browser_update_sensitivity_cb (GthBrowser *browser)
g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "edit-tags"), "enabled", sensitive,
NULL);
g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "delete-metadata"), "enabled",
sensitive, NULL);
}
-
-
-gpointer
-edit_metadata__gth_browser_file_list_key_press_cb (GthBrowser *browser,
- GdkEventKey *event)
-{
- gpointer result = NULL;
- guint modifiers;
-
- modifiers = gtk_accelerator_get_default_mod_mask ();
- if ((event->state & modifiers) != 0)
- return NULL;
-
- switch (gdk_keyval_to_lower (event->keyval)) {
- case GDK_KEY_c:
- gth_browser_activate_edit_metadata (NULL, NULL, browser);
- result = GINT_TO_POINTER (1);
- break;
-
- case GDK_KEY_t:
- gth_browser_activate_edit_tags (NULL, NULL, browser);
- result = GINT_TO_POINTER (1);
- break;
- }
-
- return result;
-}
diff --git a/extensions/edit_metadata/callbacks.h b/extensions/edit_metadata/callbacks.h
index 99d94b4d..ec7d314c 100644
--- a/extensions/edit_metadata/callbacks.h
+++ b/extensions/edit_metadata/callbacks.h
@@ -26,7 +26,5 @@
void edit_metadata__gth_browser_construct_cb (GthBrowser *browser);
void edit_metadata__gth_browser_update_sensitivity_cb (GthBrowser *browser);
-gpointer edit_metadata__gth_browser_file_list_key_press_cb (GthBrowser *browser,
- GdkEventKey *event);
#endif /* CALLBACKS_H */
diff --git a/extensions/edit_metadata/main.c b/extensions/edit_metadata/main.c
index d10f2b5c..743afb2e 100644
--- a/extensions/edit_metadata/main.c
+++ b/extensions/edit_metadata/main.c
@@ -42,7 +42,6 @@ gthumb_extension_activate (void)
gth_main_register_type ("edit-comment-dialog-page", GTH_TYPE_EDIT_GENERAL_PAGE);
gth_hook_add_callback ("gth-browser-construct", 7, G_CALLBACK
(edit_metadata__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK
(edit_metadata__gth_browser_update_sensitivity_cb), NULL);
- gth_hook_add_callback ("gth-browser-file-list-key-press", 10, G_CALLBACK
(edit_metadata__gth_browser_file_list_key_press_cb), NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]