[gnome-builder/wip/gtk4-port] libide/gui: add an example to try to implement



commit 17404c241db9317a009beb7dc15ea6e7cd1647d5
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 2 22:24:14 2022 -0700

    libide/gui: add an example to try to implement

 src/libide/gui/gtk/keybindings.json  | 2 ++
 src/libide/gui/ide-shortcut-bundle.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/gui/gtk/keybindings.json b/src/libide/gui/gtk/keybindings.json
new file mode 100644
index 000000000..c3cca7e5a
--- /dev/null
+++ b/src/libide/gui/gtk/keybindings.json
@@ -0,0 +1,2 @@
+{ "key" : "<Ctrl>Enter", "action" : "workbench.global-search", "when" : "!inWorkspaceTyped(greeter)", 
"phase" : "capture" },
+
diff --git a/src/libide/gui/ide-shortcut-bundle.c b/src/libide/gui/ide-shortcut-bundle.c
index d03924484..5efd5438a 100644
--- a/src/libide/gui/ide-shortcut-bundle.c
+++ b/src/libide/gui/ide-shortcut-bundle.c
@@ -39,6 +39,7 @@ typedef struct
   const char *when;
   const char *command;
   const char *action;
+  const char *phase;
 } Shortcut;
 
 static guint
@@ -168,7 +169,8 @@ populate_from_object (IdeShortcutBundle  *self,
   if (!get_string_member (obj, "key", &shortcut.key, error) ||
       !get_string_member (obj, "when", &shortcut.when, error) ||
       !get_string_member (obj, "command", &shortcut.command, error) ||
-      !get_string_member (obj, "action", &shortcut.action, error))
+      !get_string_member (obj, "action", &shortcut.action, error) ||
+      !get_string_member (obj, "phase", &shortcut.phase, error))
     return FALSE;
 
   g_ptr_array_add (self->items, g_slice_dup (Shortcut, &shortcut));


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