Created
August 13, 2013 12:41
-
-
Save shivanipods/6220718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gnomemusic/view.py b/gnomemusic/view.py | |
index 1239f2f..1df36d9 100644 | |
--- a/gnomemusic/view.py | |
+++ b/gnomemusic/view.py | |
@@ -57,7 +57,6 @@ class ViewContainer(Stack): | |
self.view.set_view_type(Gd.MainViewType.ICON) | |
self.view.set_model(self._model) | |
self.selection_toolbar = selection_toolbar | |
- self._get_remaining_item_count = Widgets._get_remaining_item_count | |
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) | |
box.pack_start(self.view, True, True, 0) | |
if useStack: | |
@@ -72,7 +71,7 @@ class ViewContainer(Stack): | |
else: | |
self._grid.add(box) | |
- self._loadMore = Widgets.LoadMoreButton(self._get_remaining_item_count(self.countQuery, self._offset)) | |
+ self._loadMore = Widgets.LoadMoreButton(self._get_remaining_item_count) | |
box.pack_end(self._loadMore.widget, False, False, 0) | |
self._loadMore.widget.connect('clicked', self._populate) | |
self.view.connect('item-activated', self._on_item_activated) | |
@@ -101,6 +100,9 @@ class ViewContainer(Stack): | |
self.view.connect('view-selection-changed', | |
self._on_view_selection_changed) | |
+ def _get_remaining_item_count(self): | |
+ return Widgets._get_remaining_item_count_(self.countQuery, self._offset) | |
+ | |
def _on_header_bar_toggled(self, button): | |
if button.get_active(): | |
self.view.set_selection_mode(True) | |
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py | |
index fad3a2d..6af9328 100644 | |
--- a/gnomemusic/widgets.py | |
+++ b/gnomemusic/widgets.py | |
@@ -17,7 +17,7 @@ else: | |
ERROR_ICON_NAME = 'dialog-error-symbolic' | |
-def _get_remaining_item_count(countQuery, _offset): | |
+def _get_remaining_item_count_(countQuery, _offset): | |
count = -1 | |
if countQuery: | |
cursor = tracker.query(countQuery, None) | |
@@ -29,7 +29,7 @@ def _get_remaining_item_count(countQuery, _offset): | |
class LoadMoreButton: | |
def __init__(self, counter): | |
self._block = False | |
- self._counter = counter | |
+ self._counter = counter() | |
child = Gtk.Grid(column_spacing=10, | |
hexpand=False, | |
halign=Gtk.Align.CENTER, | |
@@ -53,7 +53,7 @@ class LoadMoreButton: | |
self._spinner.start() | |
def _on_item_count_changed(self): | |
- remaining_docs = self._counter | |
+ remaining_docs = self._counter() | |
visible = remaining_docs >= 0 and not self._block | |
self.widget.set_visible(visible) | |
@@ -397,12 +397,15 @@ class AllArtistsAlbums(ArtistAlbums): | |
ArtistAlbums.__init__(self, _("All Artists"), [], player) | |
self._offset = 0 | |
self.countQuery = Query.ALBUMS_COUNT | |
- self._load_more = LoadMoreButton(_get_remaining_item_count(self.countQuery, self._offset)) | |
+ self._load_more = LoadMoreButton(self._get_remaining_item_count) | |
self.pack_end(self._load_more.widget, False, False, 0) | |
self._load_more.widget.connect('clicked', self._populate) | |
self._connect_view() | |
self._populate() | |
+ def _get_remaining_item_count(self): | |
+ return _get_remaining_item_count_(self.countQuery, self._offset) | |
+ | |
def _connect_view(self): | |
self._adjustmentValueId =\ | |
self._scrolledWindow.get_vadjustment()\ | |
diff --git a/libgd b/libgd | |
--- a/libgd | |
+++ b/libgd | |
@@ -1 +1 @@ | |
-Subproject commit f3822bc9fa387076a8005fb2665cc13390055156 | |
+Subproject commit f3822bc9fa387076a8005fb2665cc13390055156-dirty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment