Commit 8f320e6c authored by Marinus Schraal's avatar Marinus Schraal

Remove all old Grilo imports

This disables a few features, but does help with further implementing
CoreGrilo.

* Grilo art disabled
* Initial state checks disabled

Also disables some old Playlist loading in the process.

flake8
parent eab5009b
......@@ -35,7 +35,6 @@ from gi.repository import (Gdk, GdkPixbuf, Gio, GLib, GObject, Gtk, MediaArt,
Gst, GstTag, GstPbutils)
from gnomemusic import log
from gnomemusic.grilo import grilo
import gnomemusic.utils as utils
......@@ -565,18 +564,19 @@ class RemoteArt(GObject.GObject):
self._artist = utils.get_artist_name(media)
self._media = media
if not grilo.props.cover_sources:
self.emit('no-remote-sources')
grilo.connect(
'notify::cover-sources', self._on_grilo_cover_sources_changed)
else:
# FIXME: It seems this Grilo query does not always return,
# especially on queries with little info.
grilo.get_album_art_for_item(media, self._remote_album_art)
def _on_grilo_cover_sources_changed(self, klass, data):
if grilo.props.cover_sources:
grilo.get_album_art_for_item(self._media, self._remote_album_art)
self.emit('no-remote-sources')
# if not grilo.props.cover_sources:
# self.emit('no-remote-sources')
# grilo.connect(
# 'notify::cover-sources', self._on_grilo_cover_sources_changed)
# else:
# FIXME: It seems this Grilo query does not always return,
# especially on queries with little info.
# grilo.get_album_art_for_item(media, self._remote_album_art)
# def _on_grilo_cover_sources_changed(self, klass, data):
# if grilo.props.cover_sources:
# grilo.get_album_art_for_item(self._media, self._remote_album_art)
@log
def _delete_callback(self, src, result, data):
......
......@@ -55,7 +55,6 @@ class Application(Gtk.Application):
super().__init__(
application_id=application_id,
flags=Gio.ApplicationFlags.FLAGS_NONE)
self.props.resource_base_path = "/org/gnome/Music"
GLib.set_application_name(_("Music"))
GLib.set_prgname(application_id)
......
......@@ -25,7 +25,7 @@ class CoreGrilo(GObject.GObject):
self._registry.connect('source-added', self._on_source_added)
self._registry.connect('source-removed', self._on_source_removed)
self._registry.load_all_plugins(False)
self._registry.load_all_plugins(True)
def _on_source_added(self, registry, source):
new_wrapper = None
......
......@@ -61,6 +61,7 @@ class GrlTrackerSource(GObject.GObject):
GrlTrackerPlaylists(source, coremodel, coreselection, grilo)
self._source.notify_change_start()
self._source.connect("content-changed", self._on_content_changed)
@GObject.Property(
......
......@@ -32,7 +32,6 @@ gi.require_version('Grl', '0.3')
from gi.repository import Dazzle, Gio, GLib, GObject, Grl
from gnomemusic import log
from gnomemusic.grilo import grilo
from gnomemusic.query import Query
import gnomemusic.utils as utils
......@@ -199,7 +198,7 @@ class Playlists(GObject.GObject):
self._user_playlists_ready = False
self._ready = False
grilo.connect("ready", self._on_grilo_ready)
# grilo.connect("ready", self._on_grilo_ready)
@log
def _on_grilo_ready(self, data=None):
......@@ -236,7 +235,7 @@ class Playlists(GObject.GObject):
# Search for the playlist id
cursor.next_async(None, playlist_id_fetched_cb, playlist)
self._tracker = grilo.tracker_sparql
# self._tracker = grilo.tracker_sparql
self.notify("ready")
# Start fetching all the smart playlists
......@@ -246,8 +245,8 @@ class Playlists(GObject.GObject):
callback, playlist)
# Gather the available user playlists too
grilo.populate_user_playlists(
0, self._populate_user_playlists_finish_cb)
# grilo.populate_user_playlists(
# 0, self._populate_user_playlists_finish_cb)
@log
def _populate_user_playlists_finish_cb(
......@@ -420,8 +419,8 @@ class Playlists(GObject.GObject):
logger.warning("Error: {}, {}".format(err.__class__, err))
return
playlist_id = cursor.get_integer(0)
grilo.get_playlist_with_id(playlist_id, get_callback)
# playlist_id = cursor.get_integer(0)
# grilo.get_playlist_with_id(playlist_id, get_callback)
def query_callback(conn, res, data):
try:
......@@ -489,9 +488,9 @@ class Playlists(GObject.GObject):
cursor = conn.query_finish(res)
if not cursor or not cursor.next():
return
entry_id = cursor.get_integer(0)
grilo.get_playlist_song_with_id(
playlist.props.pl_id, entry_id, get_callback)
# entry_id = cursor.get_integer(0)
# grilo.get_playlist_song_with_id(
# playlist.props.pl_id, entry_id, get_callback)
def update_callback(conn, res, data):
entry_urn = conn.update_blank_finish(res)[0][0]['entry']
......
......@@ -26,7 +26,6 @@ from gettext import gettext as _
from gi.repository import GObject, Gtk
from gnomemusic import log
from gnomemusic.grilo import grilo
from gnomemusic.views.baseview import BaseView
from gnomemusic.widgets.headerbar import HeaderBar
from gnomemusic.widgets.albumcover import AlbumCover
......@@ -64,8 +63,7 @@ class AlbumsView(BaseView):
def _on_selection_mode_changed(self, widget, data=None):
super()._on_selection_mode_changed(widget, data)
if (not self.props.selection_mode
and grilo.changes_pending['Albums']):
if not self.props.selection_mode:
self._on_changes_pending()
@log
......@@ -141,7 +139,6 @@ class AlbumsView(BaseView):
@log
def _populate(self, data=None):
# self._window.notifications_popup.push_loading()
# grilo.populate_albums(self._offset, self._add_item)
self._init = True
self._view.show()
......
......@@ -27,7 +27,6 @@ from gettext import gettext as _
from gi.repository import Gdk, Gtk
from gnomemusic import log
from gnomemusic.grilo import grilo
from gnomemusic.views.baseview import BaseView
from gnomemusic.widgets.artistalbumswidget import ArtistAlbumsWidget
from gnomemusic.widgets.artisttile import ArtistTile
......@@ -106,7 +105,6 @@ class ArtistsView(BaseView):
self._artists.clear()
self._offset = 0
self._populate()
grilo.changes_pending['Artists'] = False
@log
def _on_artist_activated(self, sidebar, row, data=None):
......
......@@ -25,7 +25,6 @@
from gi.repository import GdkPixbuf, GObject, Gtk
from gnomemusic import log
from gnomemusic.grilo import grilo
from gnomemusic.widgets.starhandlerwidget import StarHandlerWidget
......@@ -90,16 +89,13 @@ class BaseView(Gtk.Stack):
# self._view.hide()
self._init = False
grilo.connect('ready', self._on_grilo_ready)
self.connect('notify::selection-mode', self._on_selection_mode_changed)
grilo.connect('changes-pending', self._on_changes_pending)
self.bind_property(
'selection-mode', self._window, 'selection-mode',
GObject.BindingFlags.BIDIRECTIONAL)
if (grilo.tracker is not None
and not self._init):
if not self._init:
self._on_grilo_ready()
@log
......
......@@ -27,7 +27,6 @@ from gettext import gettext as _
from gi.repository import Gdk, Gtk, Pango
from gnomemusic import log
from gnomemusic.grilo import grilo
from gnomemusic.player import PlayerPlaylist
from gnomemusic.views.baseview import BaseView
import gnomemusic.utils as utils
......@@ -177,7 +176,7 @@ class SongsView(BaseView):
self.model.clear()
self._offset = 0
self._populate()
grilo.changes_pending['Songs'] = False
# grilo.changes_pending['Songs'] = False
@log
def _on_selection_mode_changed(self, widget, data=None):
......@@ -186,8 +185,7 @@ class SongsView(BaseView):
cols = self._view.get_columns()
cols[1].props.visible = self.props.selection_mode
if (not self.props.selection_mode
and grilo.changes_pending['Songs']):
if not self.props.selection_mode:
self._on_changes_pending()
@log
......
......@@ -32,7 +32,7 @@ from gi.repository import Gd, GLib, GObject, Gtk, Pango
from gi.repository.Gd import TaggedEntry # noqa: F401
from gnomemusic import log
from gnomemusic.grilo import grilo
# from gnomemusic.grilo import grilo
from gnomemusic.search import Search
......@@ -118,7 +118,7 @@ class SourceManager(BaseManager):
self.values.append(['grl-tracker-source', _("Local"), ''])
self.props.default_value = 2
grilo.connect('new-source-added', self._add_new_source)
# grilo.connect('new-source-added', self._add_new_source)
@log
def fill_in_values(self, model):
......@@ -144,8 +144,8 @@ class SourceManager(BaseManager):
Adds available Grilo sources to the internal model.
"""
for id_ in grilo.props.sources:
self._add_new_source(None, grilo.props.sources[id_])
# for id_ in grilo.props.sources:
# self._add_new_source(None, grilo.props.sources[id_])
@GObject.Property
def active(self):
......@@ -159,8 +159,8 @@ class SourceManager(BaseManager):
# https://gitlab.gnome.org/GNOME/gnome-music/snippets/31
super(SourceManager, self.__class__).active.fset(self, selected_id)
src = grilo.sources[selected_id] if selected_id != 'all' else None
grilo.search_source = src
# src = grilo.sources[selected_id] if selected_id != 'all' else None
# grilo.search_source = src
@Gtk.Template(resource_path="/org/gnome/Music/ui/FilterView.ui")
......@@ -317,7 +317,8 @@ class DropDown(Gtk.Revealer):
@log
def _is_tracker(self, grilo_id):
return grilo_id == "grl-tracker-source"
return True
# return grilo_id == "grl-tracker-source"
@Gtk.Template(resource_path="/org/gnome/Music/ui/SearchBar.ui")
......
......@@ -150,8 +150,8 @@ class SongWidget(Gtk.EventBox):
self._star_image.props.favorite = favorite
# TODO: Rework and stop updating widgets from here directly.
favorite_playlist = self._playlists.get_smart_playlist("Favorites")
self._playlists.update_smart_playlist(favorite_playlist)
# favorite_playlist = self._playlists.get_smart_playlist("Favorites")
# self._playlists.update_smart_playlist(favorite_playlist)
return True
......
......@@ -26,11 +26,9 @@ from gi.repository import Gtk, Gdk, Gio, GLib, GObject
from gettext import gettext as _
from gnomemusic import log
from gnomemusic.grilo import grilo
from gnomemusic.gstplayer import Playback
from gnomemusic.mediakeys import MediaKeys
from gnomemusic.player import RepeatMode
from gnomemusic.playlists import Playlists
from gnomemusic.query import Query
from gnomemusic.search import Search
from gnomemusic.utils import View
......@@ -51,8 +49,6 @@ from gnomemusic.windowplacement import WindowPlacement
import logging
logger = logging.getLogger(__name__)
playlists = Playlists.get_default()
@Gtk.Template(resource_path="/org/gnome/Music/ui/Window.ui")
class Window(Gtk.ApplicationWindow):
......@@ -106,8 +102,6 @@ class Window(Gtk.ApplicationWindow):
MediaKeys(self._player, self)
grilo.connect('changes-pending', self._on_changes_pending)
@log
def _on_changes_pending(self, data=None):
# FIXME: This is not working right.
......@@ -128,7 +122,8 @@ class Window(Gtk.ApplicationWindow):
self._switch_to_empty_view()
grilo.songs_available(songs_available_cb)
# FIXME: Don't assume available.
songs_available_cb(True)
@log
def _setup_view(self):
......@@ -205,20 +200,22 @@ class Window(Gtk.ApplicationWindow):
self._switch_to_empty_view()
if Query().music_folder:
grilo.songs_available(songs_available_cb)
# FIXME: Do not assume True.
songs_available_cb(True)
else:
self._switch_to_empty_view()
@log
def _switch_to_empty_view(self):
did_initial_state = self._settings.get_boolean('did-initial-state')
# did_initial_state = self._settings.get_boolean('did-initial-state')
if not grilo.props.tracker_available:
self.views[View.EMPTY].props.state = EmptyView.State.NO_TRACKER
elif did_initial_state:
self.views[View.EMPTY].props.state = EmptyView.State.EMPTY
else:
self.views[View.EMPTY].props.state = EmptyView.State.INITIAL
# FIXME: Fix the startup views.
# if not grilo.props.tracker_available:
# self.views[View.EMPTY].props.state = EmptyView.State.NO_TRACKER
# elif did_initial_state:
# self.views[View.EMPTY].props.state = EmptyView.State.EMPTY
# else:
# self.views[View.EMPTY].props.state = EmptyView.State.INITIAL
self._headerbar.props.state = HeaderBar.State.EMPTY
......@@ -498,9 +495,9 @@ class Window(Gtk.ApplicationWindow):
return
playlist_dialog = PlaylistDialog(self)
if playlist_dialog.run() == Gtk.ResponseType.ACCEPT:
playlists.add_to_playlist(
playlist_dialog.get_selected(), selected_songs)
# if playlist_dialog.run() == Gtk.ResponseType.ACCEPT:
# playlists.add_to_playlist(
# playlist_dialog.get_selected(), selected_songs)
self.props.selection_mode = False
playlist_dialog.destroy()
......
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