[gnome-builder] make <ctrl>period always work for global search



commit 436f4bc88576eaf0e2f6f77c535fe413c080bfbf
Author: Christian Hergert <christian hergert me>
Date:   Sun Mar 22 14:03:50 2015 -0700

    make <ctrl>period always work for global search

 src/app/gb-application.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/app/gb-application.c b/src/app/gb-application.c
index 08639a8..253de77 100644
--- a/src/app/gb-application.c
+++ b/src/app/gb-application.c
@@ -200,6 +200,11 @@ gb_application_load_keybindings (GbApplication *self)
 {
   g_autoptr(GSettings) settings = NULL;
   g_autofree gchar *name = NULL;
+  static const struct { gchar *name; gchar *binding; } shared_bindings[] = {
+    { "workbench.global-search", "<ctrl>period" },
+    { NULL }
+  };
+  gsize i;
 
   g_assert (GB_IS_APPLICATION (self));
 
@@ -207,6 +212,14 @@ gb_application_load_keybindings (GbApplication *self)
   name = g_settings_get_string (settings, "keybindings");
   self->keybindings = gb_keybindings_new (GTK_APPLICATION (self), name);
   g_settings_bind (settings, "keybindings", self->keybindings, "mode", G_SETTINGS_BIND_GET);
+
+  for (i = 0; shared_bindings [i].name; i++)
+    {
+      const gchar *accels[2] = { shared_bindings [i].binding, NULL };
+      gtk_application_set_accels_for_action (GTK_APPLICATION (self),
+                                             shared_bindings [i].name,
+                                             accels);
+    }
 }
 
 static GbWorkbench *


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