Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Icon View can't be sorted and filtered at the same time #5

Closed
Letiliel opened this issue Dec 9, 2013 · 4 comments · Fixed by #41
Closed

The Icon View can't be sorted and filtered at the same time #5

Letiliel opened this issue Dec 9, 2013 · 4 comments · Fixed by #41
Milestone

Comments

@Letiliel
Copy link
Contributor

Letiliel commented Dec 9, 2013

Making the store both filtered and sortable works for the TreeView but not the IconView which gets glitchy when using the search field. The error reported is
"Gtk-CRITICAL **: gtk_cell_area_render: assertion `GTK_IS_CELL_AREA_CONTEXT (context)' failed"

But in this tutorial it reads "Instead of using cell renderers, Gtk.IconView requires (blablabla)". So, is your use of a cell renderer in the IconView at fault? Well, not so sure. I've got rid of that text label using a cell renderer and it didn't change a thing.

Maybe it's just that sortable and filtered IconViews are not meant to exist...

A workaround is to only apply the TreeModelSort model to the TreeView. But we'll certainly want to sort the IconView too in the future (e.g. sort by 'last played' would be relevant for the icon view).

[strycore replied: I still haven't had the time to have a look at this but the CellRenderer is, if I remember correctly, the way to fix the extra large padding between icons. This trick comes from Rhythmbox's Cover Art browser plugin, it also uses an icon view so there may be some more code snippets to pick from this project.]

@strycore
Copy link
Member

strycore commented Dec 9, 2013

For the record, I have a project which could be useful for these kind of tasks :
https://github.com/strycore/pygobject-demos
You can try coding a minimal solution: one that does only filtering and sorting, and nothing else.
That's how I coded some features in the UI, it's easier to take the experimentation outside the project and integrate it after it as been proved to work.

@Letiliel
Copy link
Contributor Author

Letiliel commented Dec 9, 2013

It can be handy, thanks.
I'll check the Rhythmbox plugin, it seems they found a way.

@Letiliel
Copy link
Contributor Author

I've had a better look at the coverart-browser plugin. If I'm correct, their solution is what I was thinking about doing : they made a sort function from scratch, thus didn't wrap the ListStore in a TreeModelSort.
You can see this in their AlbumsModel. It looks too complicated for me, I'm afraid...

@Letiliel
Copy link
Contributor Author

Letiliel commented Feb 7, 2014

In fact, I was simply stupid. The IconView was already sorted and filtered. It's just not the same model layout as for TreeViews.

@Letiliel Letiliel closed this as completed Feb 7, 2014
@lutris lutris locked as resolved and limited conversation to collaborators Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants