After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760164 - Use GtkFlowBox
Use GtkFlowBox
Status: RESOLVED FIXED
Product: gnome-music
Classification: Applications
Component: general
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-music-maint
gnome-music-maint
Depends on:
Blocks: 705854 745651
 
 
Reported: 2016-01-05 16:16 UTC by Allan Day
Modified: 2016-08-22 14:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
view: factor out function to setup the view (2.22 KB, patch)
2016-08-09 18:46 UTC, Georges Basile Stavracas Neto
none Details | Review
view: initialize main box before setup_view (1.57 KB, patch)
2016-08-09 18:46 UTC, Georges Basile Stavracas Neto
none Details | Review
data: add AlbumCover widget (3.82 KB, patch)
2016-08-09 18:46 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: use a GtkFlowBox internally (4.35 KB, patch)
2016-08-09 18:47 UTC, Georges Basile Stavracas Neto
reviewed Details | Review
view: add 'selection-mode' property (2.13 KB, patch)
2016-08-09 18:47 UTC, Georges Basile Stavracas Neto
none Details | Review
toolbar: remove exquisite code (2.69 KB, patch)
2016-08-09 18:47 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: minor tweaks on selection mode (951 bytes, patch)
2016-08-09 18:47 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: readd selection mode (3.06 KB, patch)
2016-08-09 18:47 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: fix select/unselect all (5.36 KB, patch)
2016-08-09 18:47 UTC, Georges Basile Stavracas Neto
none Details | Review
views: unselect all when quitting selection mode (848 bytes, patch)
2016-08-09 18:48 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: show a loading icon while fetching album art (769 bytes, patch)
2016-08-09 18:48 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: allow up to 10 albums per row (1.03 KB, patch)
2016-08-09 18:48 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: bring back selection mode on right click (3.00 KB, patch)
2016-08-09 18:48 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: fix select/unselect all (5.35 KB, patch)
2016-08-09 20:37 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: fix select/unselect all (5.44 KB, patch)
2016-08-11 01:54 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: optimize select/unselect all (2.78 KB, patch)
2016-08-11 01:56 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: optimize select/unselect all (2.99 KB, patch)
2016-08-14 00:05 UTC, Georges Basile Stavracas Neto
none Details | Review
albums: Fix right-click selection mode (1.07 KB, patch)
2016-08-14 08:17 UTC, Marinus Schraal
none Details | Review

Description Allan Day 2016-01-05 16:16:55 UTC
There are various reports regarding performance issues in music (745651 and 759886), for example). I have it on good authority (Michael and Felipe!) that some of this is due to GtkIconView inefficiency, and that porting to GtkFlowBox would be a good step forward.

This will require implementing selection mode for GtkFlowBox. Some relevant work can be found in gnome-todo: https://git.gnome.org/browse/gnome-todo/tree/src/gtd-task-list-item.c
Comment 1 Georges Basile Stavracas Neto 2016-08-09 18:46:35 UTC
Created attachment 333015 [details] [review]
view: factor out function to setup the view

Since the Albums view will handle the internal view
differently, it makes sense to add a new method that
will be overriden in the future.

This patch moves the code related to setting up the
view into a separate function.
Comment 2 Georges Basile Stavracas Neto 2016-08-09 18:46:42 UTC
Created attachment 333016 [details] [review]
view: initialize main box before setup_view

While initializing the Albums view, we will need to
access the main box, which must be initialized when
setup_view() gets called.

This patch moves the code around so the box is initialized
when setup_view() is called.
Comment 3 Georges Basile Stavracas Neto 2016-08-09 18:46:59 UTC
Created attachment 333017 [details] [review]
data: add AlbumCover widget

Now that we're moving away from a cellrenderer-based
rendering, all visible elements are Gtk widgets, forcing
us to customly manage the albums.

This commit introduces the AlbumCover UI definition, which
will be consumend in the future when creating albums
for the flowbox.
Comment 4 Georges Basile Stavracas Neto 2016-08-09 18:47:07 UTC
Created attachment 333018 [details] [review]
albums: use a GtkFlowBox internally

After preparing ground, the move is finally done: the
Albums view moves away from GdMainView to GtkFlowBox.

This patch makes the Albumns class override some methods
to put the flowbox in place rather than the main view,
and is already able to display the albums and interact
with them.

Appearently, it runs incredibly smoother :)
Comment 5 Georges Basile Stavracas Neto 2016-08-09 18:47:15 UTC
Created attachment 333019 [details] [review]
view: add 'selection-mode' property

By adding a new property, we'll be able to skip
manual management of selection mode checkboxes and
simply bind them.
Comment 6 Georges Basile Stavracas Neto 2016-08-09 18:47:24 UTC
Created attachment 333020 [details] [review]
toolbar: remove exquisite code

Toolbar is managing the view's selection mode signal
handling. This is a very bad idea, and makes it impossible
to move to the flowbox.

Fix this by properly letting the views manage their
own business.
Comment 7 Georges Basile Stavracas Neto 2016-08-09 18:47:33 UTC
Created attachment 333021 [details] [review]
albums: minor tweaks on selection mode
Comment 8 Georges Basile Stavracas Neto 2016-08-09 18:47:40 UTC
Created attachment 333022 [details] [review]
albums: readd selection mode

The previous selection mode code wouldn't work as
we move away from a model-based approach. Fix that
by handling selection manually.
Comment 9 Georges Basile Stavracas Neto 2016-08-09 18:47:49 UTC
Created attachment 333023 [details] [review]
albums: fix select/unselect all
Comment 10 Georges Basile Stavracas Neto 2016-08-09 18:48:06 UTC
Created attachment 333024 [details] [review]
views: unselect all when quitting selection mode
Comment 11 Georges Basile Stavracas Neto 2016-08-09 18:48:14 UTC
Created attachment 333025 [details] [review]
albums: show a loading icon while fetching album art
Comment 12 Georges Basile Stavracas Neto 2016-08-09 18:48:23 UTC
Created attachment 333026 [details] [review]
albums: allow up to 10 albums per row

More than that and it'll be cluttered.
Comment 13 Georges Basile Stavracas Neto 2016-08-09 18:48:32 UTC
Created attachment 333027 [details] [review]
albums: bring back selection mode on right click

We used to have this for free when using GdMainView but,
as long as we're not using it anymore, we have to deal with
it manually.

This patch reimplements the selection mode on Albums view
with right-click.
Comment 14 Georges Basile Stavracas Neto 2016-08-09 20:37:17 UTC
Created attachment 333033 [details] [review]
albums: fix select/unselect all

Fix wrong call.
Comment 15 Marinus Schraal 2016-08-10 13:31:23 UTC
Review of attachment 333033 [details] [review]:

::: gnomemusic/view.py
@@ +283,3 @@
+                count += self._set_selection(value, _iter)
+            if self.model[_iter][5]:
+                self.model.set(_iter, [6], [value])

this can be written as 'self.model[_iter][6] = value' now.
Comment 16 Marinus Schraal 2016-08-10 13:35:14 UTC
Review of attachment 333018 [details] [review]:

::: gnomemusic/view.py
@@ +417,3 @@
+        elif remaining == 0:
+                self.window.notification.dismiss()
+                self.view.show()

indent too far

@@ +438,3 @@
+        child.show()
+
+        self.cache.lookup(item, self._iconWidth, self._iconHeight, self._on_lookup_ready,

indent after 3rd argument for pep-8 linelength
Comment 17 Marinus Schraal 2016-08-10 13:46:54 UTC
Looks like awesome work overall, haven't had time to review the patchset as a whole yet. But I can see it works like a charm.

A few things I encountered.

* code style follow pep-8 (it does so fine mostly, just a few nitpicks here and there)
* please add docstrings for public class functions at least, see the readme. For private functions if it adds clarity
* right-click selectionmode needs a fix, just try rightclicking a few times and you will see why. (probably trivial)
* why not use the flowbox selection mode? Was this a design decision (to keep the looks as it was)? We should probably discuss with the designers what is best, but I prefer to use the gtk provided mode if it's there. If we keep the current way, it probably needs styling.
Comment 18 Georges Basile Stavracas Neto 2016-08-11 01:54:58 UTC
Created attachment 333084 [details] [review]
albums: fix select/unselect all

Add docstring for public functions.
Comment 19 Georges Basile Stavracas Neto 2016-08-11 01:56:53 UTC
Created attachment 333085 [details] [review]
albums: optimize select/unselect all

Iterating over all the albums and changing the ::active
property would send hundreds of notify::active signals,
which in turn makes it go in and out of Python to C to
Python in a way that makes the UI freeze for a second.

Fix that by blocking all these signals and updating the
list of selected items manually.
Comment 20 Georges Basile Stavracas Neto 2016-08-11 19:19:03 UTC
(In reply to Marinus Schraal from comment #17)
> Looks like awesome work overall, haven't had time to review the patchset as
> a whole yet. But I can see it works like a charm.

Awsome, thanks.

> * code style follow pep-8 (it does so fine mostly, just a few nitpicks here
> and there)

Fixed.

> * please add docstrings for public class functions at least, see the readme.
> For private functions if it adds clarity

Done.

> * right-click selectionmode needs a fix, just try rightclicking a few times
> and you will see why. (probably trivial)

Fixed.

> * why not use the flowbox selection mode? Was this a design decision (to
> keep the looks as it was)? We should probably discuss with the designers
> what is best, but I prefer to use the gtk provided mode if it's there. If we
> keep the current way, it probably needs styling.

The GtkFlowBox selection mode looks quite different from any other GNOME content app's selection mode. I had direct instructions from Lapo that we should start using checkbuttons with 'osd' styleclass rather than that big bogus checkbutton (which Adwaita doesn't seem to support correctly nowadays).
Comment 21 Georges Basile Stavracas Neto 2016-08-14 00:05:52 UTC
Created attachment 333252 [details] [review]
albums: optimize select/unselect all

Fixed the unblocking of signals, sorry about that
Comment 22 Marinus Schraal 2016-08-14 08:17:52 UTC
Created attachment 333266 [details] [review]
albums: Fix right-click selection mode

Only set the child check active when entering actual selection mode. Let
_on_selection_mode_request handle showing/hiding of the checkmarks.
Comment 23 Marinus Schraal 2016-08-22 14:41:59 UTC
I squashed the commits a bit and added some minor fixups, then pushed it. Now lets get it some testing.

Thanks for the awesome work, this is a big improvement.

This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.