Commit 83c50221 authored by Marinus Schraal's avatar Marinus Schraal

Move grilo.tracker checks to grilo

We were checking for a grilo.tracker instance all around the codebase,
while this could be just as well be done inside grilo.
parent 2601c2d9
......@@ -232,19 +232,27 @@ class Grilo(GObject.GObject):
@log
def populate_artists(self, offset, callback, count=-1):
self.populate_items(Query.all_artists(), offset, callback, count)
if self.tracker:
GLib.idle_add(self.populate_items, Query.all_artists(), offset,
callback, count)
@log
def populate_albums(self, offset, callback, count=-1):
self.populate_items(Query.all_albums(), offset, callback, count)
if self.tracker:
GLib.idle_add(self.populate_items, Query.all_albums(), offset,
callback, count)
@log
def populate_songs(self, offset, callback, count=-1):
self.populate_items(Query.all_songs(), offset, callback, count)
if self.tracker:
GLib.idle_add(self.populate_items, Query.all_songs(), offset,
callback, count)
@log
def populate_playlists(self, offset, callback, count=-1):
self.populate_items(Query.all_playlists(), offset, callback, count)
if self.tracker:
GLib.idle_add(self.populate_items, Query.all_playlists(), offset,
callback, count)
@log
def populate_album_songs(self, album, callback, count=-1):
......
......@@ -384,10 +384,7 @@ class MediaPlayer2Service(Server):
else:
callback(playlists)
if grilo.tracker:
GLib.idle_add(grilo.populate_playlists, 0, populate_callback)
else:
callback(playlists)
grilo.populate_playlists(0, populate_callback)
@log
def _get_active_playlist(self):
......
......@@ -123,9 +123,8 @@ class AlbumsView(BaseView):
@log
def populate(self):
if grilo.tracker:
self.window._init_loading_notification()
GLib.idle_add(grilo.populate_albums, self._offset, self._add_item)
self.window._init_loading_notification()
GLib.idle_add(grilo.populate_albums, self._offset, self._add_item)
@log
def get_selected_tracks(self, callback):
......
......@@ -167,9 +167,8 @@ class ArtistsView(BaseView):
@log
def populate(self):
if grilo.tracker:
self.window._init_loading_notification()
GLib.idle_add(grilo.populate_artists, self._offset, self._add_item)
self.window._init_loading_notification()
GLib.idle_add(grilo.populate_artists, self._offset, self._add_item)
@log
def _on_header_bar_toggled(self, button):
......
......@@ -524,10 +524,9 @@ class PlaylistView(BaseView):
@log
def populate(self):
if grilo.tracker:
self.playlists_model.clear()
GLib.idle_add(grilo.populate_playlists, self._offset,
self._add_playlist_item)
self.playlists_model.clear()
GLib.idle_add(grilo.populate_playlists, self._offset,
self._add_playlist_item)
@log
def get_selected_tracks(self, callback):
......
......@@ -222,9 +222,8 @@ class SongsView(BaseView):
@log
def populate(self):
self._init = True
if grilo.tracker:
self.window._init_loading_notification()
GLib.idle_add(grilo.populate_songs, self._offset, self._add_item)
self.window._init_loading_notification()
GLib.idle_add(grilo.populate_songs, self._offset, self._add_item)
@log
def get_selected_tracks(self, callback):
......
......@@ -100,8 +100,7 @@ class PlaylistDialog():
@log
def populate(self):
if grilo.tracker:
GLib.idle_add(grilo.populate_playlists, 0, self._add_item)
grilo.populate_playlists(0, self._add_item)
@log
def _add_item(self, source, param, item, remaining=0, data=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment