[gnome-tweaks/fix-row-activatable: 5/5] general: Don't set rows as activatable by default



commit 84579a14f5a49dbf2bb2ad7366d747889cbf1eb7
Author: Carlos Soriano <csoriano redhat com>
Date:   Wed Sep 5 16:17:05 2018 +0200

    general: Don't set rows as activatable by default
    
    The GtkListBox widgets were created by having all rows being
    activatable, which resulted in a visual glitch when clicked on them.
    
    Most of the rows in Tweaks shouldn't be activatable, so this commit
    provides a way for each tweak group to define whether rows should be
    activatable or not, defaulting to False.
    
    This fixes the visual glitch.

 gtweak/tweaks/tweak_group_shell_extensions.py | 3 ++-
 gtweak/widgets.py                             | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_shell_extensions.py b/gtweak/tweaks/tweak_group_shell_extensions.py
index 8ef4bf8..19e059a 100644
--- a/gtweak/tweaks/tweak_group_shell_extensions.py
+++ b/gtweak/tweaks/tweak_group_shell_extensions.py
@@ -236,7 +236,8 @@ class ShellExtensionTweakGroup(ListBoxTweakGroup):
 
         ListBoxTweakGroup.__init__(self,
                                    _("Extensions"),
-                                   *extension_tweaks)
+                                   *extension_tweaks,
+                                   activatable=True)
 
         if shell is None:
             return # we're done
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index f1d607c..05932c9 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -178,6 +178,10 @@ class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
     def __init__(self, name, *tweaks, **options):
         if 'uid' not in options:
             options['uid'] = self.__class__.__name__
+        if 'activatable' not in options:
+            activatable = False
+        else:
+            activatable = options['activatable']
         Gtk.ListBox.__init__(self,
                         selection_mode=Gtk.SelectionMode.NONE,
                         name=options['uid'])
@@ -193,12 +197,12 @@ class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
         TweakGroup.__init__(self, name, **options)
 
         for t in tweaks:
-            self.add_tweak_row(t)
+            self.add_tweak_row(t, activatable)
 
     #FIXME: need to add remove_tweak_row and remove_tweak (which clears
     #the search cache etc)
 
-    def add_tweak_row(self, t, position=None):
+    def add_tweak_row(self, t, activatable=False, position=None):
         if self.add_tweak(t):
             if isinstance(t, Gtk.ListBoxRow):
                 row = t
@@ -208,6 +212,7 @@ class ListBoxTweakGroup(Gtk.ListBox, TweakGroup):
                 if isinstance(t, Title):
                     row.get_style_context().add_class("title")
                 row.add(t)
+            row.set_activatable(activatable)
             if position is None:
                 self.add(row)
             else:


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