[gnome-music/wip/jfelder/baseview-model-reorder: 24/25] searchview: Change discovery field position in model



commit a0671d0b5a4f83fe115533797fbc9b2ab1c7f907
Author: Jean Felder <jean felder gmail com>
Date:   Sun Feb 18 00:38:30 2018 +0100

    searchview: Change discovery field position in model
    
    Swap columns 11 and 12.
    All others MainViews use column 11 from the model to store the
    discovery_status field. This information is used by the player.
    This should prevent confusion and allow to simplify player.py code.
    
    Closes: #160

 gnomemusic/views/searchview.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 647636a8..cc4cb8b0 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -112,7 +112,7 @@ class SearchView(BaseView):
             return
 
         _iter = self.model.get_iter(child_path)
-        if self.model[_iter][11] == 'album':
+        if self.model[_iter][12] == 'album':
             title = self.model[_iter][2]
             artist = self.model[_iter][3]
             item = self.model[_iter][5]
@@ -125,7 +125,7 @@ class SearchView(BaseView):
             self._header_bar.header_bar.sub_title = artist
             self.set_visible_child(self._album_widget)
             self._header_bar.searchbar.reveal(False)
-        elif self.model[_iter][11] == 'artist':
+        elif self.model[_iter][12] == 'artist':
             artist = self.model[_iter][2]
             albums = self._artists[artist.casefold()]['albums']
 
@@ -139,11 +139,11 @@ class SearchView(BaseView):
             self._header_bar.header_bar.set_title(artist)
             self.set_visible_child(self._artist_albums_widget)
             self._header_bar.searchbar.reveal(False)
-        elif self.model[_iter][11] == 'song':
-            if self.model[_iter][12] != DiscoveryStatus.FAILED:
+        elif self.model[_iter][12] == 'song':
+            if self.model[_iter][11] != DiscoveryStatus.FAILED:
                 c_iter = self._songs_model.convert_child_iter_to_iter(_iter)[1]
                 self.player.set_playlist(
-                    'Search Results', None, self._songs_model, c_iter, 12)
+                    'Search Results', None, self._songs_model, c_iter)
                 self.player.set_playing(True)
         else:  # Headers
             if self._view.get_generic_view().row_expanded(path):
@@ -241,7 +241,7 @@ class SearchView(BaseView):
         _iter = None
         if category == 'album':
             _iter = self.model.insert_with_values(
-                self._head_iters[group], -1, [0, 2, 3, 5, 9, 11],
+                self._head_iters[group], -1, [0, 2, 3, 5, 9, 12],
                 [str(item.get_id()), title, artist, item, 2,
                  category])
         elif category == 'song':
@@ -251,13 +251,13 @@ class SearchView(BaseView):
             else:
                 fav = item.get_favourite()
             _iter = self.model.insert_with_values(
-                self._head_iters[group], -1, [0, 2, 3, 5, 9, 11],
+                self._head_iters[group], -1, [0, 2, 3, 5, 9, 12],
                 [str(item.get_id()), title, artist, item, fav,
                  category])
         else:
             if not artist.casefold() in self._artists:
                 _iter = self.model.insert_with_values(
-                    self._head_iters[group], -1, [0, 2, 5, 9, 11],
+                    self._head_iters[group], -1, [0, 2, 5, 9, 12],
                     [str(item.get_id()), artist, item, 2,
                      category])
                 self._artists[artist.casefold()] = {
@@ -374,7 +374,7 @@ class SearchView(BaseView):
         self._albums_selected = [
             self.model[child_path][5]
             for child_path in paths
-            if self.model[child_path][11] == 'album']
+            if self.model[child_path][12] == 'album']
 
         if len(self._albums_selected):
             self._get_selected_albums_songs()
@@ -406,7 +406,7 @@ class SearchView(BaseView):
             for child_path in [
                 self._filter_model.convert_path_to_child_path(path)
                 for path in self._view.get_selection()]
-            if self.model[child_path][11] == 'artist']
+            if self.model[child_path][12] == 'artist']
 
         self._artists_albums_selected = []
         for artist in artists_selected:
@@ -443,7 +443,7 @@ class SearchView(BaseView):
             for child_path in [
                 self._filter_model.convert_path_to_child_path(path)
                 for path in self._view.get_selection()]
-            if self.model[child_path][11] == 'song'])
+            if self.model[child_path][12] == 'song'])
         self._items_selected_callback(self._items_selected)
 
     @log
@@ -491,8 +491,8 @@ class SearchView(BaseView):
             GObject.TYPE_STRING,
             GObject.TYPE_INT,
             GObject.TYPE_BOOLEAN,
-            GObject.TYPE_STRING,    # type
             GObject.TYPE_INT,
+            GObject.TYPE_STRING,    # type
             object                  # album art surface
         )
 


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