[gnome-music/wip/mschraal/window-selection-mode: 20/22] Name HeaderBar variable consistently



commit ae1fc1c14914b038cb9871db5c5cd2f9915298ed
Author: Marinus Schraal <mschraal gnome org>
Date:   Tue Sep 4 12:15:17 2018 +0200

    Name HeaderBar variable consistently
    
    Instead of using 'header_bar' and 'headerbar' mixed throughout the
    codebase, use 'headerbar' consistently.

 gnomemusic/views/albumsview.py           | 14 +++++++-------
 gnomemusic/views/artistsview.py          |  2 +-
 gnomemusic/views/baseview.py             |  6 +++---
 gnomemusic/views/searchview.py           | 22 +++++++++++-----------
 gnomemusic/widgets/artistalbumswidget.py | 10 +++++-----
 5 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 73417833..ba005c5e 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -53,7 +53,7 @@ class AlbumsView(BaseView):
 
     @log
     def _on_changes_pending(self, data=None):
-        if (self._init and not self._header_bar.selection_mode):
+        if (self._init and not self._headerbar.selection_mode):
             self._offset = 0
             self.populate()
             grilo.changes_pending['Albums'] = False
@@ -62,7 +62,7 @@ class AlbumsView(BaseView):
     def _on_selection_mode_changed(self, widget, data=None):
         super()._on_selection_mode_changed(widget, data)
 
-        if (not self._header_bar.selection_mode
+        if (not self._headerbar.selection_mode
                 and grilo.changes_pending['Albums']):
             self._on_changes_pending()
 
@@ -85,7 +85,7 @@ class AlbumsView(BaseView):
 
     @log
     def _back_button_clicked(self, widget, data=None):
-        self._header_bar.state = HeaderBar.State.MAIN
+        self._headerbar.state = HeaderBar.State.MAIN
         self.set_visible_child(self._grid)
 
     @log
@@ -97,9 +97,9 @@ class AlbumsView(BaseView):
         # Update and display the album widget if not in selection mode
         self._album_widget.update(item)
 
-        self._header_bar.props.state = HeaderBar.State.CHILD
-        self._header_bar.props.title = utils.get_album_title(item)
-        self._header_bar.props.subtitle = utils.get_artist_name(item)
+        self._headerbar.props.state = HeaderBar.State.CHILD
+        self._headerbar.props.title = utils.get_album_title(item)
+        self._headerbar.props.subtitle = utils.get_artist_name(item)
         self.set_visible_child(self._album_widget)
 
     @log
@@ -112,7 +112,7 @@ class AlbumsView(BaseView):
     def get_selected_songs(self, callback):
         # FIXME: we call into private objects with full knowledge of
         # what is there
-        if self._header_bar.props.state == HeaderBar.State.CHILD:
+        if self._headerbar.props.state == HeaderBar.State.CHILD:
             callback(self._album_widget._disc_listbox.get_selected_items())
         else:
             self.items_selected = []
diff --git a/gnomemusic/views/artistsview.py b/gnomemusic/views/artistsview.py
index a4205c4e..3b28d03b 100644
--- a/gnomemusic/views/artistsview.py
+++ b/gnomemusic/views/artistsview.py
@@ -124,7 +124,7 @@ class ArtistsView(BaseView):
         self._view.add(new_artist_albums_widget)
 
         artist_albums = ArtistAlbumsWidget(
-            artist, albums, self.player, self._header_bar,
+            artist, albums, self.player, self._headerbar,
             self._selection_toolbar, self._window)
         self._artists[artist.casefold()]['widget'] = artist_albums
         new_artist_albums_widget.add(artist_albums)
diff --git a/gnomemusic/views/baseview.py b/gnomemusic/views/baseview.py
index 0658b062..d47a9cc2 100644
--- a/gnomemusic/views/baseview.py
+++ b/gnomemusic/views/baseview.py
@@ -80,7 +80,7 @@ class BaseView(Gtk.Stack):
 
         self._star_handler = StarHandlerWidget(self, 9)
         self._window = window
-        self._header_bar = window._headerbar
+        self._headerbar = window._headerbar
         self._selection_toolbar = window.selection_toolbar
 
         self.name = name
@@ -114,11 +114,11 @@ class BaseView(Gtk.Stack):
 
     @log
     def _on_grilo_ready(self, data=None):
-        if (self._header_bar.props.stack.props.visible_child == self
+        if (self._headerbar.props.stack.props.visible_child == self
                 and not self._init):
             self._populate()
 
-        self._header_bar.props.stack.connect(
+        self._headerbar.props.stack.connect(
             'notify::visible-child', self._on_headerbar_visible)
 
     @log
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index 9f25c4b6..e452d714 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -102,7 +102,7 @@ class SearchView(BaseView):
 
     @log
     def _back_button_clicked(self, widget, data=None):
-        self._header_bar.searchbar.reveal(True, False)
+        self._headerbar.searchbar.reveal(True, False)
 
         if self.get_visible_child() == self._artist_albums_widget:
             self._artist_albums_widget.destroy()
@@ -112,7 +112,7 @@ class SearchView(BaseView):
                 self._window.views[View.ALBUM]._grid)
 
         self.set_visible_child(self._grid)
-        self._header_bar.props.state = HeaderBar.State.MAIN
+        self._headerbar.props.state = HeaderBar.State.MAIN
 
     @log
     def _on_item_activated(self, treeview, path, column):
@@ -135,26 +135,26 @@ class SearchView(BaseView):
             item = self.model[_iter][5]
 
             self._album_widget.update(item)
-            self._header_bar.props.state = HeaderBar.State.SEARCH
+            self._headerbar.props.state = HeaderBar.State.SEARCH
 
-            self._header_bar.props.title = title
-            self._header_bar.props.subtitle = artist
+            self._headerbar.props.title = title
+            self._headerbar.props.subtitle = artist
             self.set_visible_child(self._album_widget)
-            self._header_bar.searchbar.reveal(False)
+            self._headerbar.searchbar.reveal(False)
         elif self.model[_iter][12] == 'artist':
             artist = self.model[_iter][2]
             albums = self._artists[artist.casefold()]['albums']
 
             self._artist_albums_widget = ArtistAlbumsWidget(
-                artist, albums, self.player, self._header_bar,
+                artist, albums, self.player, self._headerbar,
                 self._selection_toolbar, self._window, True)
             self.add(self._artist_albums_widget)
             self._artist_albums_widget.show()
 
-            self._header_bar.props.state = HeaderBar.State.SEARCH
-            self._header_bar.props.title = artist
+            self._headerbar.props.state = HeaderBar.State.SEARCH
+            self._headerbar.props.title = artist
             self.set_visible_child(self._artist_albums_widget)
-            self._header_bar.searchbar.reveal(False)
+            self._headerbar.searchbar.reveal(False)
         elif self.model[_iter][12] == 'song':
             if self.model[_iter][11] != ValidationStatus.FAILED:
                 c_iter = self._songs_model.convert_child_iter_to_iter(_iter)[1]
@@ -417,7 +417,7 @@ class SearchView(BaseView):
     @log
     def populate(self):
         self._init = True
-        self._header_bar.props.state = HeaderBar.State.MAIN
+        self._headerbar.props.state = HeaderBar.State.MAIN
 
     @log
     def get_selected_songs(self, callback):
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index cba935f5..dc062eaa 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -54,7 +54,7 @@ class ArtistAlbumsWidget(Gtk.Box):
 
     @log
     def __init__(
-            self, artist, albums, player, header_bar, selection_toolbar,
+            self, artist, albums, player, headerbar, selection_toolbar,
             window, selection_mode_allowed=False):
         super().__init__(orientation=Gtk.Orientation.VERTICAL)
         self._player = player
@@ -62,7 +62,7 @@ class ArtistAlbumsWidget(Gtk.Box):
         self._window = window
         self._selection_mode_allowed = selection_mode_allowed
         self._selection_toolbar = selection_toolbar
-        self._header_bar = header_bar
+        self._headerbar = headerbar
 
         self._artist_label.props.label = self._artist
 
@@ -89,7 +89,7 @@ class ArtistAlbumsWidget(Gtk.Box):
             Gtk.SizeGroupMode.HORIZONTAL)
 
         self.bind_property(
-            'selection-mode', self._header_bar, 'selection-mode',
+            'selection-mode', self._headerbar, 'selection-mode',
             GObject.BindingFlags.BIDIRECTIONAL |
             GObject.BindingFlags.SYNC_CREATE)
 
@@ -129,7 +129,7 @@ class ArtistAlbumsWidget(Gtk.Box):
     @log
     def _add_album(self, album):
         widget = ArtistAlbumWidget(
-            album, self._player, self._model, self._header_bar,
+            album, self._player, self._model, self._headerbar,
             self._selection_mode_allowed, self._songs_grid_size_group,
             self._cover_size_group)
 
@@ -200,7 +200,7 @@ class ArtistAlbumsWidget(Gtk.Box):
                 selected_items += 1
 
         self._selection_toolbar.props.items_selected = selected_items
-        self._header_bar.props.items_selected = selected_items
+        self._headerbar.props.items_selected = selected_items
 
     @log
     def select_all(self):


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