gtk/adw: conditional tab keybindings

adw_tab_view_remove_shortcuts (and related APIs) was added in libadwaita
1.2.0.
This commit is contained in:
Jeffrey C. Ollie
2024-09-23 10:31:01 -05:00
parent 599934d5de
commit 2805657213

View File

@ -66,9 +66,11 @@ pub const Notebook = union(enum) {
const tab_view: *c.AdwTabView = c.adw_tab_view_new().?;
// Adwaita enables all of the shortcuts by default.
// We want to manage keybindings ourselves.
c.adw_tab_view_remove_shortcuts(tab_view, c.ADW_TAB_VIEW_SHORTCUT_ALL_SHORTCUTS);
if (comptime adwaita.versionAtLeast(1, 2, 0)) {
// Adwaita enables all of the shortcuts by default.
// We want to manage keybindings ourselves.
c.adw_tab_view_remove_shortcuts(tab_view, c.ADW_TAB_VIEW_SHORTCUT_ALL_SHORTCUTS);
}
_ = c.g_signal_connect_data(tab_view, "page-attached", c.G_CALLBACK(&adwPageAttached), window, null, c.G_CONNECT_DEFAULT);
_ = c.g_signal_connect_data(tab_view, "create-window", c.G_CALLBACK(&adwTabViewCreateWindow), window, null, c.G_CONNECT_DEFAULT);