[gthumb] shortcuts: added other flags: INTERNAL and FIXED



commit 532a249a001543901a6739aae01b0bd62930702b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Nov 13 16:59:58 2019 +0100

    shortcuts: added other flags: INTERNAL and FIXED

 gthumb/dlg-preferences-shortcuts.c |  6 ++++++
 gthumb/gth-shortcut.c              |  5 ++++-
 gthumb/gth-window.c                |  2 +-
 gthumb/typedefs.h                  | 21 +++++++++++++++++----
 4 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/gthumb/dlg-preferences-shortcuts.c b/gthumb/dlg-preferences-shortcuts.c
index 682336ee..f5d2c33d 100644
--- a/gthumb/dlg-preferences-shortcuts.c
+++ b/gthumb/dlg-preferences-shortcuts.c
@@ -449,6 +449,12 @@ shortcuts__dlg_preferences_construct_cb (GtkWidget  *dialog,
                if (g_strcmp0 (shortcut->category, GTH_SHORTCUT_CATEGORY_HIDDEN) == 0)
                        continue;
 
+               if ((shortcut->context & GTH_SHORTCUT_CONTEXT_INTERNAL) != 0)
+                       continue;
+
+               if ((shortcut->context & GTH_SHORTCUT_CONTEXT_FIXED) != 0)
+                       continue;
+
                if (g_strcmp0 (shortcut->category,last_category) != 0) {
                        last_category = shortcut->category;
                        n_category++;
diff --git a/gthumb/gth-shortcut.c b/gthumb/gth-shortcut.c
index 2e807046..d6ae3eec 100644
--- a/gthumb/gth-shortcut.c
+++ b/gthumb/gth-shortcut.c
@@ -172,7 +172,10 @@ gth_shortcuts_write_to_file (GPtrArray  *shortcuts_v,
        for (i = 0; i < shortcuts_v->len; i++) {
                GthShortcut *shortcut = g_ptr_array_index (shortcuts_v, i);
 
-               if (shortcut->context == GTH_SHORTCUT_CONTEXT_INTERNAL)
+               if ((shortcut->context & GTH_SHORTCUT_CONTEXT_INTERNAL) != 0)
+                       continue;
+
+               if ((shortcut->context & GTH_SHORTCUT_CONTEXT_FIXED) != 0)
                        continue;
 
                dom_element_append_child (shortcuts,
diff --git a/gthumb/gth-window.c b/gthumb/gth-window.c
index f1ed40ef..aee49d8f 100644
--- a/gthumb/gth-window.c
+++ b/gthumb/gth-window.c
@@ -733,7 +733,7 @@ gth_window_add_accelerators (GthWindow                      *window,
 
                shortcut = gth_shortcut_new ();
                shortcut->action_name = g_strdup (acc->action_name);
-               shortcut->context = GTH_SHORTCUT_CONTEXT_INTERNAL;
+               shortcut->context = GTH_SHORTCUT_CONTEXT_INTERNAL | GTH_SHORTCUT_CONTEXT_ANY;
                shortcut->category = GTH_SHORTCUT_CATEGORY_HIDDEN;
                gth_shortcut_set_accelerator (shortcut, acc->accelerator);
                _gth_window_add_shortcut (window, shortcut);
diff --git a/gthumb/typedefs.h b/gthumb/typedefs.h
index 29eb6994..8a2f85fb 100644
--- a/gthumb/typedefs.h
+++ b/gthumb/typedefs.h
@@ -132,11 +132,24 @@ typedef enum /*< skip >*/ {
 
 
 typedef enum /*< skip >*/ {
-       GTH_SHORTCUT_CONTEXT_BROWSER = 1 << 1,
-       GTH_SHORTCUT_CONTEXT_VIEWER = 1 << 2,
-       GTH_SHORTCUT_CONTEXT_SLIDESHOW = 1 << 3,
+       /* Shortcut handled by Gtk, not customizable, specified for
+        * documentation. */
+       GTH_SHORTCUT_CONTEXT_INTERNAL = 1 << 1,
 
-       /* aggregated values */
+       /* Shortcut handled in gth_window_activate_shortcut, not customizable,
+        * specified for documentation. */
+       GTH_SHORTCUT_CONTEXT_FIXED = 1 << 2,
+
+       /* Shortcut available when the window is in browser mode. */
+       GTH_SHORTCUT_CONTEXT_BROWSER = 1 << 3,
+
+       /* Shortcut available when the window is in viewer mode. */
+       GTH_SHORTCUT_CONTEXT_VIEWER = 1 << 4,
+
+       /* Shortcut available in slideshows. */
+       GTH_SHORTCUT_CONTEXT_SLIDESHOW = 1 << 5,
+
+       /* Aggregated values: */
 
        GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER = (GTH_SHORTCUT_CONTEXT_BROWSER | GTH_SHORTCUT_CONTEXT_VIEWER),
        GTH_SHORTCUT_CONTEXT_ANY = (GTH_SHORTCUT_CONTEXT_BROWSER | GTH_SHORTCUT_CONTEXT_VIEWER | 
GTH_SHORTCUT_CONTEXT_SLIDESHOW),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]