Skip to content

Commit

Permalink
Update recent
Browse files Browse the repository at this point in the history
  • Loading branch information
geigi committed Mar 9, 2018
1 parent b7027db commit 3ce0aa6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cozy/book_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ class BookElement(Gtk.FlowBoxChild):
selected = False
wait_to_seek = False
playing = False
popover_created = False
track_box = None
current_track_element = None

Expand Down Expand Up @@ -241,6 +240,9 @@ def set_playing(self, is_playing):
else:
self.art.play_button.set_from_icon_name("media-playback-start-symbolic", self.art.icon_size)

def refresh_book_object(self):
self.book = db.Book.get_by_id(self.book.id)


class TrackElement(Gtk.EventBox):
"""
Expand Down
11 changes: 11 additions & 0 deletions cozy/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,16 @@ def refresh_content(self):

return False

def refresh_recent(self):
if self.titlebar.current_book is not None:
book_element = next(filter(
lambda x: x.book.id == self.titlebar.current_book.id,
self.book_box.get_children()), None)
book_element.refresh_book_object()

if self.sort_stack.props.visible_child_name == "recent":
self.book_box.invalidate_sort()

def get_playback_start_position(self):
"""
Returns the position where to start playback of the current track.
Expand Down Expand Up @@ -565,6 +575,7 @@ def __player_changed(self, event, message):
self.titlebar.play()
self.sleep_timer.start()
self.book_overview.select_track(None, True)
self.refresh_recent()
elif event == "pause":
self.is_playing = False
self.pause()
Expand Down
2 changes: 1 addition & 1 deletion data/com.github.geigi.cozy.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<description></description>
</key>
<key type="b" name="dark-mode">
<default>true</default>
<default>false</default>
<summary>Enable Dark Mode.</summary>
<description></description>
</key>
Expand Down

0 comments on commit 3ce0aa6

Please sign in to comment.