[calls/wip/cdavis/keyboard-focus-tweaks: 10/10] ui: Remove explicit can-focus




commit 50847dfe436c3b19c03b190a6245e90ccaf5e8cb
Author: Christopher Davis <christopherdavis gnome org>
Date:   Tue Nov 30 11:52:36 2021 -0800

    ui: Remove explicit can-focus
    
    Glade misleads us into thinking we need these, but the
    property is somewhat confusing in GTK3. In general we don't
    want `can-focus` to be true for containers, as that will
    break keynav for the children. For non-containers, the
    defaults are appropriate.
    
    Instead of manually setting `can-focus`, we should just
    use the default values. GTK has sane defaults.
    
    Fixes https://gitlab.gnome.org/GNOME/calls/-/issues/366

 src/ui/call-record-row.ui     |  6 ------
 src/ui/call-selector-item.ui  |  6 ------
 src/ui/call-window.ui         | 13 -------------
 src/ui/contacts-box.ui        |  9 ---------
 src/ui/history-box.ui         |  3 ---
 src/ui/in-app-notification.ui |  4 ----
 src/ui/main-window.ui         | 13 -------------
 src/ui/new-call-box.ui        |  3 ---
 src/ui/new-call-header-bar.ui |  2 --
 9 files changed, 59 deletions(-)
---
diff --git a/src/ui/call-record-row.ui b/src/ui/call-record-row.ui
index 29d73b5f..15a28a16 100644
--- a/src/ui/call-record-row.ui
+++ b/src/ui/call-record-row.ui
@@ -4,7 +4,6 @@
   <requires lib="gtk+" version="3.20"/>
   <template class="CallsCallRecordRow" parent="GtkListBoxRow">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
     <property name="activatable">False</property>
     <property name="selectable">False</property>
     <child>
@@ -13,11 +12,9 @@
         <child>
           <object class="GtkBox">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <child>
               <object class="HdyAvatar" id="avatar">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="margin_left">8</property>
                 <property name="margin_top">8</property>
                 <property name="margin_bottom">8</property>
@@ -32,7 +29,6 @@
             <child>
               <object class="GtkImage" id="type">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="margin_left">8</property>
               </object>
               <packing>
@@ -42,7 +38,6 @@
             <child>
               <object class="GtkLabel" id="target">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="margin_left">10</property>
                 <property name="ellipsize">middle</property>
               </object>
@@ -83,7 +78,6 @@
             <child>
               <object class="GtkLabel" id="time">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="margin_left">8</property>
                 <property name="justify">right</property>
                 <style>
diff --git a/src/ui/call-selector-item.ui b/src/ui/call-selector-item.ui
index 9a9c3ff9..bc1aa214 100644
--- a/src/ui/call-selector-item.ui
+++ b/src/ui/call-selector-item.ui
@@ -4,29 +4,24 @@
   <requires lib="gtk+" version="3.20"/>
   <template class="CallsCallSelectorItem" parent="GtkEventBox">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
     <property name="visible_window">False</property>
     <property name="above_child">True</property>
     <child>
       <object class="GtkFrame">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="label_xalign">0</property>
         <property name="label_yalign">0</property>
         <property name="shadow_type">out</property>
         <child>
           <object class="GtkBox" id="main_box">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
             <child>
               <object class="GtkBox">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <child>
                   <object class="GtkLabel" id="name">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="margin_left">3</property>
                     <property name="label">+441234567890</property>
                   </object>
@@ -39,7 +34,6 @@
                 <child>
                   <object class="GtkLabel" id="status">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="margin_right">3</property>
                     <property name="label" translatable="yes">On hold</property>
                   </object>
diff --git a/src/ui/call-window.ui b/src/ui/call-window.ui
index b9274d56..332163d4 100644
--- a/src/ui/call-window.ui
+++ b/src/ui/call-window.ui
@@ -3,7 +3,6 @@
 <interface>
   <requires lib="gtk+" version="3.20"/>
   <template class="CallsCallWindow" parent="GtkApplicationWindow">
-    <property name="can_focus">False</property>
     <!-- <property name="decorated">False</property> -->
     <property name="hide_titlebar_when_maximized">True</property>
     <property name="show_menubar">False</property>
@@ -12,30 +11,24 @@
     <child>
       <object class="GtkOverlay">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <child type="overlay">
           <object class="CallsInAppNotification" id="in_app_notification">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
           </object>
         </child>
         <child>
           <object class="GtkStack" id="main_stack">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <child>
               <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
                 <property name="hscrollbar_policy">never</property>
                 <child>
                   <object class="GtkViewport">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <child>
                       <object class="GtkFlowBox" id="call_selector">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <property name="orientation">vertical</property>
                         <property name="homogeneous">True</property>
                         <property name="column_spacing">12</property>
@@ -54,7 +47,6 @@
             <child>
               <object class="GtkStack" id="call_stack">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="expand">True</property>
               </object>
               <packing>
@@ -68,12 +60,10 @@
     <child type="titlebar">
       <object class="GtkStack" id="header_bar_stack">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="visible_child_name" bind-source="main_stack" bind-property="visible_child_name" 
bind-flags="bidirectional|sync-create"/>
         <child>
           <object class="GtkHeaderBar">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
           </object>
           <packing>
             <property name="name">calls</property>
@@ -82,18 +72,15 @@
         <child>
           <object class="GtkHeaderBar">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <child>
               <object class="GtkButton" id="show_calls">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="no_show_all">True</property>
                 <signal name="clicked" handler="show_calls_clicked_cb" swapped="no"/>
                 <child>
                   <object class="GtkImage">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="icon_name">system-switch-user-symbolic</property>
                   </object>
                 </child>
diff --git a/src/ui/contacts-box.ui b/src/ui/contacts-box.ui
index 44d685e1..761868ab 100644
--- a/src/ui/contacts-box.ui
+++ b/src/ui/contacts-box.ui
@@ -5,20 +5,16 @@
   <requires lib="libhandy" version="0.0"/>
   <template class="CallsContactsBox" parent="GtkBin">
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
     <child>
       <object class="GtkScrolledWindow">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
         <property name="expand">True</property>
         <child>
           <object class="HdyClamp">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <child>
               <object class="GtkBox">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <property name="margin-top">12</property>
@@ -28,7 +24,6 @@
                 <child>
                   <object class="GtkSearchEntry" id="search_entry">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
                   </object>
                 </child>
                 <child>
@@ -37,11 +32,9 @@
                     <child>
                       <object class="GtkListBox" id="contacts_listbox">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
                         <child type="placeholder">
                           <object class="GtkBox" id="placeholder_empty">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
                             <property name="halign">center</property>
                             <property name="valign">center</property>
                             <property name="orientation">vertical</property>
@@ -51,7 +44,6 @@
                             <child>
                               <object class="GtkImage">
                                 <property name="visible">True</property>
-                                <property name="can_focus">False</property>
                                 <property name="pixel_size">128</property>
                                 <property name="icon_name">edit-find-symbolic</property>
                                 <style>
@@ -62,7 +54,6 @@
                             <child>
                               <object class="GtkLabel">
                                 <property name="visible">True</property>
-                                <property name="can_focus">False</property>
                                 <property name="wrap">True</property>
                                 <property name="wrap-mode">word-char</property>
                                 <property name="justify">center</property>
diff --git a/src/ui/history-box.ui b/src/ui/history-box.ui
index e5e78ba6..ff221642 100644
--- a/src/ui/history-box.ui
+++ b/src/ui/history-box.ui
@@ -16,16 +16,13 @@
 
     <child>
       <object class="GtkScrolledWindow">
-        <property name="can_focus">False</property>
         <property name="visible">True</property>
         <property name="hscrollbar-policy">never</property>
         <child>
           <object class="HdyClamp">
-            <property name="can_focus">False</property>
             <property name="visible">True</property>
             <child>
               <object class="GtkListBox" id="history">
-                <property name="can_focus">False</property>
                 <property name="visible">True</property>
                 <property name="margin">12</property>
                 <property name="valign">start</property>
diff --git a/src/ui/in-app-notification.ui b/src/ui/in-app-notification.ui
index da98c467..1cf5d759 100644
--- a/src/ui/in-app-notification.ui
+++ b/src/ui/in-app-notification.ui
@@ -9,17 +9,14 @@
     <child>
       <object class="GtkBox">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <child>
           <object class="GtkButton">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
             <property name="receives_default">True</property>
             <signal name="clicked" handler="calls_in_app_notification_hide" swapped="yes"/>
             <child>
               <object class="GtkImage">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="icon_name">window-close-symbolic</property>
               </object>
             </child>
@@ -34,7 +31,6 @@
         <child>
           <object class="GtkLabel" id="label">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="wrap">True</property>
             <property name="margin-left">24</property>
             <property name="margin-right">24</property>
diff --git a/src/ui/main-window.ui b/src/ui/main-window.ui
index 568390cb..7c481488 100644
--- a/src/ui/main-window.ui
+++ b/src/ui/main-window.ui
@@ -4,7 +4,6 @@
   <requires lib="gtk+" version="3.20"/>
   <requires lib="libhandy" version="1.0"/>
   <template class="CallsMainWindow" parent="HdyApplicationWindow">
-    <property name="can_focus">False</property>
     <property name="title" translatable="yes">Calls</property>
     <property name="hide_titlebar_when_maximized">True</property>
     <property name="show_menubar">False</property>
@@ -17,13 +16,11 @@
           <object class="HdyHeaderBar">
             <property name="visible">True</property>
             <property name="centering_policy">strict</property>
-            <property name="can_focus">False</property>
             <property name="show_close_button">True</property>
             <property name="title" bind-source="CallsMainWindow" bind-property="title" 
bind-flags="sync-create"/>
             <child type="title">
               <object class="HdyViewSwitcherTitle" id="title_switcher">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="stack">main_stack</property>
                 <property name="title" bind-source="CallsMainWindow" bind-property="title" 
bind-flags="sync-create"/>
               </object>
@@ -31,12 +28,10 @@
             <child>
               <object class="GtkMenuButton">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="popover">menu_popover</property>
                 <child>
                   <object class="GtkImage">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="icon_name">open-menu-symbolic</property>
                   </object>
                 </child>
@@ -50,29 +45,24 @@
         <child>
           <object class="GtkOverlay">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <child type="overlay">
               <object class="CallsInAppNotification" id="in_app_notification">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
               </object>
             </child>
             <child>
               <object class="GtkBox">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkRevealer" id="permanent_error_revealer">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="reveal_child">True</property>
                     <child>
                       <object class="GtkLabel" id="permanent_error_label">
                         <property name="justify">center</property>
                         <property name="wrap">True</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <style>
                           <class name="error-state-message"/>
                         </style>
@@ -83,7 +73,6 @@
                 <child>
                   <object class="GtkStack" id="main_stack">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="homogeneous">False</property>
                     <property name="expand">True</property>
                   </object>
@@ -91,7 +80,6 @@
                 <child>
                   <object class="HdyViewSwitcherBar" id="switcher_bar">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="stack">main_stack</property>
                     <property name="reveal" bind-source="title_switcher" bind-property="title-visible" 
bind-flags="sync-create"/>
                   </object>
@@ -218,7 +206,6 @@
       <object class="GtkBox">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
-        <property name="can_focus">False</property>
         <property name="margin">12</property>
         <property name="spacing">6</property>
         <child>
diff --git a/src/ui/new-call-box.ui b/src/ui/new-call-box.ui
index 367dad0d..8c7b76eb 100644
--- a/src/ui/new-call-box.ui
+++ b/src/ui/new-call-box.ui
@@ -4,7 +4,6 @@
   <requires lib="gtk+" version="3.22"/>
   <requires lib="libhandy" version="1.0"/>
   <template class="CallsNewCallBox" parent="GtkBox">
-    <property name="can_focus">False</property>
     <property name="margin_bottom">16</property>
     <property name="margin_left">24</property>
     <property name="margin_right">24</property>
@@ -81,12 +80,10 @@
                 <child>
                   <object class="GtkBox">
                     <property name="visible" bind-source="CallsNewCallBox" 
bind-property="numeric-input-only" bind-flags="sync-create"/>
-                    <property name="can_focus">False</property>
                     <property name="orientation">horizontal</property>
                     <child type="center">
                       <object class="GtkButton" id="dial">
                         <property name="always_show_image">True</property>
-                        <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="visible">True</property>
                         <signal name="clicked" handler="dial_clicked_cb" swapped="yes"/>
diff --git a/src/ui/new-call-header-bar.ui b/src/ui/new-call-header-bar.ui
index 94e68de4..5e3c2ff5 100644
--- a/src/ui/new-call-header-bar.ui
+++ b/src/ui/new-call-header-bar.ui
@@ -2,7 +2,6 @@
 <interface>
   <requires lib="gtk+" version="3.22"/>
   <template class="CallsNewCallHeaderBar" parent="GtkHeaderBar">
-    <property name="can_focus">False</property>
     <property name="show-close-button">True</property>
     <property name="title" translatable="yes">New Call</property>
     <property name="visible">True</property>
@@ -34,7 +33,6 @@
     </child>
     <child type="title">
       <object class="GtkStackSwitcher" id="stack_switcher">
-        <property name="can_focus">False</property>
         <property name="visible">True</property>
       </object>
     </child>


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