[libpanel/libpanel-1.0] frametabbar: disable ctrl+home/end variants by default



commit a482abe8025f42bad4acde872f2aa286a84f1719
Author: Christian Hergert <chergert redhat com>
Date:   Sat Oct 1 17:35:37 2022 -0700

    frametabbar: disable ctrl+home/end variants by default
    
    Currently we're mostly just used from Builder, and we don't have a way
    to really plumb this API through. So do the right thing for the places
    where we need it.
    
    Eventually, we'll probably want to just expose the tab view as part of
    the PanelFrame since AdwTabView is final.

 src/panel-frame-tab-bar.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/panel-frame-tab-bar.c b/src/panel-frame-tab-bar.c
index d8c6f66..51fcbb1 100644
--- a/src/panel-frame-tab-bar.c
+++ b/src/panel-frame-tab-bar.c
@@ -28,6 +28,12 @@
 #include "panel-frame-tab-bar.h"
 #include "panel-widget.h"
 
+#define REMOVED_SHORTCUTS \
+  (ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME \
+  | ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_HOME \
+  | ADW_TAB_VIEW_SHORTCUT_CONTROL_END \
+  | ADW_TAB_VIEW_SHORTCUT_CONTROL_SHIFT_END)
+
 struct _PanelFrameTabBar
 {
   GtkWidget          parent_instance;
@@ -95,6 +101,10 @@ panel_frame_tab_bar_set_frame (PanelFrameTabBar *self,
 
   if (self->frame)
     {
+      AdwTabView *tab_view = _panel_frame_get_tab_view (self->frame);
+
+      adw_tab_view_add_shortcuts (tab_view, REMOVED_SHORTCUTS);
+
       g_signal_handlers_disconnect_by_func (self->frame,
                                             G_CALLBACK (on_notify_closeable_cb),
                                             self);
@@ -111,6 +121,8 @@ panel_frame_tab_bar_set_frame (PanelFrameTabBar *self,
       AdwTabView *tab_view = _panel_frame_get_tab_view (self->frame);
       GMenuModel *menu_model = _panel_frame_get_tab_menu (self->frame);
 
+      adw_tab_view_remove_shortcuts (tab_view, REMOVED_SHORTCUTS);
+
       g_signal_connect_object (self->frame,
                                "notify::closeable",
                                G_CALLBACK (on_notify_closeable_cb),


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