[gnome-music/wip/jfelder/albumview-rubberband] albumviews: Add rubberband selection
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/albumview-rubberband] albumviews: Add rubberband selection
- Date: Mon, 28 Jan 2019 23:16:01 +0000 (UTC)
commit 568670f9a41f985942b3b02cb71ed649536f9e0d
Author: Jean Felder <jfelder src gnome org>
Date: Thu Jan 24 17:44:25 2019 +0100
albumviews: Add rubberband selection
data/org.gnome.Music.css | 5 +++++
data/ui/AlbumCover.ui | 3 +++
gnomemusic/views/albumsview.py | 20 ++++++++++++++++++--
3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.Music.css b/data/org.gnome.Music.css
index f5ea3b7b..ad86e82e 100644
--- a/data/org.gnome.Music.css
+++ b/data/org.gnome.Music.css
@@ -5,6 +5,11 @@
/* AlbumCover */
.albumcover-artist-label {
font-size: smaller;
+ color: @theme_fg_color;
+}
+
+.albumcover-title-label {
+ color: @theme_fg_color;
}
/* By default in Adwaita dark this is not transparent */
diff --git a/data/ui/AlbumCover.ui b/data/ui/AlbumCover.ui
index 46d21b3c..bbae5682 100644
--- a/data/ui/AlbumCover.ui
+++ b/data/ui/AlbumCover.ui
@@ -51,6 +51,9 @@
<property name="ellipsize">middle</property>
<property name="max_width_chars">20</property>
<property name="lines">2</property>
+ <style>
+ <class name="albumcover-title-label"/>
+ </style>
</object>
</child>
<child>
diff --git a/gnomemusic/views/albumsview.py b/gnomemusic/views/albumsview.py
index 4e0edf4f..c89d2fd6 100644
--- a/gnomemusic/views/albumsview.py
+++ b/gnomemusic/views/albumsview.py
@@ -23,7 +23,7 @@
# delete this exception statement from your version.
from gettext import gettext as _
-from gi.repository import GObject, Gtk
+from gi.repository import GLib, GObject, Gtk
from gnomemusic import log
from gnomemusic.grilo import grilo
@@ -70,12 +70,14 @@ class AlbumsView(BaseView):
def _setup_view(self):
self._view = Gtk.FlowBox(
homogeneous=True, hexpand=True, halign=Gtk.Align.FILL,
- valign=Gtk.Align.START, selection_mode=Gtk.SelectionMode.NONE,
+ valign=Gtk.Align.START, selection_mode=Gtk.SelectionMode.MULTIPLE,
margin=18, row_spacing=12, column_spacing=6,
min_children_per_line=1, max_children_per_line=20)
self._view.get_style_context().add_class('content-view')
self._view.connect('child-activated', self._on_child_activated)
+ self._view.connect(
+ 'selected-children-changed', self._on_selected_children_changed)
scrolledwin = Gtk.ScrolledWindow()
scrolledwin.add(self._view)
@@ -102,6 +104,20 @@ class AlbumsView(BaseView):
self._headerbar.props.subtitle = utils.get_artist_name(item)
self.set_visible_child(self._album_widget)
+ @log
+ def _on_selected_children_changed(self, widget):
+ def select_children():
+ if self._headerbar.props.state == HeaderBar.State.CHILD:
+ return
+
+ if not self.props.selection_mode:
+ self.props.selection_mode = True
+
+ for child in self._view.get_selected_children():
+ child.props.selected = True
+
+ GLib.idle_add(select_children)
+
@log
def populate(self):
self._window.notifications_popup.push_loading()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]