[epiphany] bookmark-properties-grid: Make it properly focusable



commit 44fcc818c3543c0ab6ea709fa726137aa9fc15cc
Author: vanadiae <vanadiae35 gmail com>
Date:   Sun Jun 13 19:16:51 2021 +0200

    bookmark-properties-grid: Make it properly focusable
    
    Currently when using the Add/edit Bookmark popover or editing one
    in the bookmarks list, pressing the Tab key doesn't focus anything
    of the bookmarks properties, instead it closes the popover.
    
    Looking at the UI file and source code, there's a whole lot of places
    where the can-focus property is set, which in general isn't a good
    sign because it's only needed as last resort. For example labels
    had their can-focus to false, which is not needed unless the label
    is made manually selectable. The close buttons of the tags (and the
    tags themselves) both had it too set to False, which is strange
    because they both are supposed to be clicked. This meant that while
    they could be clicked with a mouse, they were never focusable with
    the keyboard at all.
    
    So this commit drops all the places where can-focus is set, which
    makes pretty much everything work fine: all entries and buttons are
    focusable and clickable with the keyboard.
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/978>

 src/bookmarks/ephy-bookmark-properties-grid.c |  2 --
 src/resources/gtk/bookmark-properties-grid.ui | 14 --------------
 2 files changed, 16 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmark-properties-grid.c b/src/bookmarks/ephy-bookmark-properties-grid.c
index 6b3e60304..1b7395f8f 100644
--- a/src/bookmarks/ephy-bookmark-properties-grid.c
+++ b/src/bookmarks/ephy-bookmark-properties-grid.c
@@ -172,7 +172,6 @@ ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *sel
   default_tag = (g_strcmp0 (tag, EPHY_BOOKMARKS_FAVORITES_TAG) == 0);
 
   widget = gtk_flow_box_child_new ();
-  gtk_widget_set_can_focus (widget, FALSE);
 
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
 
@@ -200,7 +199,6 @@ ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *sel
                                                         GTK_ICON_SIZE_MENU));
     gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
     gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-    gtk_widget_set_can_focus (button, FALSE);
     gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE, 0);
     g_signal_connect_object (button, "clicked",
                              G_CALLBACK (ephy_bookmark_properties_grid_tag_widget_button_clicked_cb),
diff --git a/src/resources/gtk/bookmark-properties-grid.ui b/src/resources/gtk/bookmark-properties-grid.ui
index 70f606982..359bbb512 100644
--- a/src/resources/gtk/bookmark-properties-grid.ui
+++ b/src/resources/gtk/bookmark-properties-grid.ui
@@ -4,7 +4,6 @@
   <requires lib="gtk+" version="3.18"/>
   <template class="EphyBookmarkPropertiesGrid" parent="GtkGrid">
     <property name="visible">True</property>
-    <property name="can_focus">True</property>
     <property name="border_width">12</property>
     <property name="orientation">vertical</property>
     <property name="row_spacing">6</property>
@@ -12,7 +11,6 @@
     <child>
       <object class="GtkLabel" id="popover_bookmark_label">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="label" translatable="yes">Bookmark</property>
         <attributes>
           <attribute name="weight" value="bold"/>
@@ -26,7 +24,6 @@
     <child>
       <object class="GtkLabel">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="halign">start</property>
         <property name="label" translatable="yes">Name</property>
         <style>
@@ -41,7 +38,6 @@
     <child>
       <object class="GtkEntry" id="name_entry">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
         <property name="max_width_chars">32</property>
       </object>
       <packing>
@@ -52,7 +48,6 @@
     <child>
       <object class="GtkLabel" id="address_label">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="halign">start</property>
         <property name="valign">center</property>
         <property name="margin_top">6</property>
@@ -69,7 +64,6 @@
     <child>
       <object class="GtkEntry" id="address_entry">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
@@ -79,7 +73,6 @@
     <child>
       <object class="GtkLabel" id="popover_tags_label">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="halign">start</property>
         <property name="valign">center</property>
         <property name="margin_top">12</property>
@@ -96,11 +89,9 @@
     <child>
       <object class="GtkBox">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <child>
           <object class="GtkEntry" id="add_tag_entry">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="activates_default">True</property>
             <property name="placeholder_text" translatable="yes">Add Tag…</property>
@@ -115,7 +106,6 @@
           <object class="GtkButton" id="add_tag_button">
             <property name="label" translatable="yes">_Add</property>
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="can_default">True</property>
             <property name="receives_default">False</property>
             <property name="action_name">grid.add-tag</property>
@@ -139,7 +129,6 @@
     <child>
       <object class="GtkScrolledWindow" id="tags_scrolled_window">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
         <property name="vexpand">True</property>
         <property name="min_content_height">38</property>
         <property name="max_content_width">270</property>
@@ -149,11 +138,9 @@
         <child>
           <object class="GtkViewport">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <child>
               <object class="GtkFlowBox" id="tags_box">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="homogeneous">True</property>
                 <property name="valign">start</property>
                 <property name="column_spacing">6</property>
@@ -175,7 +162,6 @@
       <object class="GtkButton" id="remove_bookmark_button">
         <property name="label" translatable="yes">_Remove</property>
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
         <property name="receives_default">False</property>
         <property name="halign">end</property>
         <property name="action_name">grid.remove-bookmark</property>


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