[gnome-boxes/convert-filter-switcher-to-radio] collection-filter-switcher: Convert buttons to GtkRadioButton



commit 03f069a7ef9ca0766460442045ef53519718839f
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu May 23 14:57:07 2019 +0200

    collection-filter-switcher: Convert buttons to GtkRadioButton
    
    GtkRadioButton is an specialization of GtkToggleButton that allows
    for only one of the group to be selected. This way we avoid the
    bug when a second click in the filter switcher untoggles a button
    and leaves them all untoggled (which is inconsistent with the view
    state indicated by the switcher itself).
    
    Setting "draw-indicator" for each of the buttons allows them to have
    the visual aspect of a normal GtkToggleButton.
    
    Fixes #354

 data/ui/collection-filter-switcher.ui | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/collection-filter-switcher.ui b/data/ui/collection-filter-switcher.ui
index e5d03dfe..b14618f3 100644
--- a/data/ui/collection-filter-switcher.ui
+++ b/data/ui/collection-filter-switcher.ui
@@ -8,8 +8,9 @@
     </style>
 
     <child>
-      <object class="GtkToggleButton" id="all_button">
+      <object class="GtkRadioButton" id="all_button">
         <property name="visible">True</property>
+        <property name="draw-indicator">False</property>
         <property name="label" translatable="yes" comments="Translators: this is a switch to show all boxes 
in main view.">All</property>
         <signal name="toggled" handler="activate_button"/>
       </object>
@@ -21,8 +22,10 @@
     </child>
 
     <child>
-      <object class="GtkToggleButton" id="local_button">
+      <object class="GtkRadioButton" id="local_button">
         <property name="visible">True</property>
+        <property name="group">all_button</property>
+        <property name="draw-indicator">False</property>
         <property name="label" translatable="yes" comments="Translators: this is a switch to show only local 
boxes in main view.">Local</property>
         <signal name="toggled" handler="activate_button"/>
       </object>
@@ -34,8 +37,10 @@
     </child>
 
     <child>
-      <object class="GtkToggleButton" id="remote_button">
+      <object class="GtkRadioButton" id="remote_button">
         <property name="visible">True</property>
+        <property name="group">all_button</property>
+        <property name="draw-indicator">False</property>
         <property name="label" translatable="yes" comments="Translators: this is a switch to show only 
remote boxes in main view.">Remote</property>
         <signal name="toggled" handler="activate_button"/>
       </object>


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