[gtk/matthiasc/for-master: 26/26] docs: Mention shortcuts in the migration guide



commit 8c6bbcdc2ef60b63e3f6788dd9f8955075b5f1a8
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon May 25 21:27:58 2020 -0400

    docs: Mention shortcuts in the migration guide
    
    Add a few paragraphs about GtkAccelGroup, GtkBindingSet
    and GtkAccelMap to the migration guide.
    
    Fixes: #2778

 docs/reference/gtk/migrating-3to4.md | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md
index 55fc99a710..c3514e87a1 100644
--- a/docs/reference/gtk/migrating-3to4.md
+++ b/docs/reference/gtk/migrating-3to4.md
@@ -378,6 +378,20 @@ with gtk_container_set_focus_vadjustment() has been removed together with
 GtkContainer, and is provided by scrollable widgets instead. In the common
 case that the scrollable is a #GtkViewport, use #GtkViewport:scroll-to-focus.
 
+### Use the new apis for keyboard shortcuts
+
+The APIs for keyboard shortcuts and accelerators have changed in GTK 4.
+
+Instead of GtkAccelGroup, you now use a #GtkShortcutController with global
+scope, and instead of GtkBindingSet, you now use gtk_widget_class_add_shortcut(),
+gtk_widget_class_add_binding() and its variants. In both cases, you probably
+want to add actions that can be triggered by your shortcuts.
+
+There is no direct replacement for loading and saving accelerators with
+GtkAccelMap. But since #GtkShortcutController implements #GListModel and
+both #GtkShortcutTrigger and #GtkShortcutAction can be serialized to
+strings, it is relatively easy to implement saving and loading yourself. 
+
 ### Stop using GtkEventBox
 
 GtkEventBox is no longer needed and has been removed.


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