[gnome-music] disclistboxwidget: Turn into a GtkBox subclass



commit 32ec740307d3351231340dd42b108ade56e59678
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Dec 10 11:32:02 2016 -0200

    disclistboxwidget: Turn into a GtkBox subclass
    
    The current disc list implementation uses a GtkListBox as
    the parent class. This brings some issues with it, as the
    listbox widget has selectable, focusable rows that break
    the keyboard navigation. The listbox rows also handle clicks
    and add a strange effect to the disc list when clicking
    outside the songs list.
    
    Fix this by using GtkBox as the base class of DiscListBox,
    and the keyboard and clicking issues are all gone. Remove a css
    workaround as well.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775929

 data/ArtistAlbumWidget.ui               |    1 -
 data/application.css                    |    5 -----
 gnomemusic/widgets/disclistboxwidget.py |    9 ++++-----
 3 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/data/ArtistAlbumWidget.ui b/data/ArtistAlbumWidget.ui
index 7174764..5dce000 100644
--- a/data/ArtistAlbumWidget.ui
+++ b/data/ArtistAlbumWidget.ui
@@ -79,7 +79,6 @@
           <object class="DiscListBox" id="disclistbox">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="selection_mode">none</property>
           </object>
           <packing>
             <property name="expand">False</property>
diff --git a/data/application.css b/data/application.css
index 090c98e..f4bbdc2 100644
--- a/data/application.css
+++ b/data/application.css
@@ -11,11 +11,6 @@ flowbox, treeview, widget {
     -gtk-key-bindings: unbind-ctrl-space;
 }
 
-/* Workaround the black border bug (#773459). */
-list, row {
-    background: transparent;
-}
-
 .discsongsflowbox > flowboxchild {
     padding: 0px;
 }
diff --git a/gnomemusic/widgets/disclistboxwidget.py b/gnomemusic/widgets/disclistboxwidget.py
index f1f9df2..1e09acb 100644
--- a/gnomemusic/widgets/disclistboxwidget.py
+++ b/gnomemusic/widgets/disclistboxwidget.py
@@ -422,7 +422,7 @@ class DiscBox(Gtk.Box):
         return True
 
 
-class DiscListBox(Gtk.ListBox):
+class DiscListBox(Gtk.Box):
     """A ListBox widget containing all discs of a particular
     album
     """
@@ -438,8 +438,7 @@ class DiscListBox(Gtk.ListBox):
     @log
     def __init__(self):
         """Initialize"""
-        super().__init__()
-        super().set_selection_mode(Gtk.SelectionMode.NONE)
+        super().__init__(orientation=Gtk.Orientation.VERTICAL)
 
         self._selection_mode = False
         self._selection_mode_allowed = False
@@ -465,7 +464,7 @@ class DiscListBox(Gtk.ListBox):
         self._selected_items = []
 
         def get_child_selected_items(child):
-            self._selected_items += child.get_child().get_selected_items()
+            self._selected_items += child.get_selected_items()
 
         self.foreach(get_child_selected_items)
 
@@ -499,7 +498,7 @@ class DiscListBox(Gtk.ListBox):
         self._selection_mode = selection_mode
 
         def set_child_selection_mode(child):
-            child.get_child().set_selection_mode(self._selection_mode)
+            child.set_selection_mode(self._selection_mode)
 
         self.foreach(set_child_selection_mode)
 


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