[gnome-builder/wip/gtk4-port] libide/gui: add string type name helper



commit a7f5a474f82a5a0adfe0c96b2c652bcd18b569f3
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 18 17:54:41 2022 -0700

    libide/gui: add string type name helper
    
    This can be useful when you don't have Introspection data available for
    a particular type, such as in plugins. Your keybindings.json can do
    something like this for the "when":
    
     "when" : "inPageWithTypeName(\"GbpSysprofPage\")",

 src/libide/gui/gtk/keybindings.gsl | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/libide/gui/gtk/keybindings.gsl b/src/libide/gui/gtk/keybindings.gsl
index 5d41f2f96..2d53d4baa 100644
--- a/src/libide/gui/gtk/keybindings.gsl
+++ b/src/libide/gui/gtk/keybindings.gsl
@@ -76,3 +76,7 @@ end
 def hasSelection()
   inEditor() && page.get_buffer().get_has_selection()
 end
+
+def inPageWithTypeName(name)
+  (page != null) && (typeof(page).name() == name) && (focus != null) && focus.is_ancestor(page)
+end


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