summaryrefslogtreecommitdiff
path: root/gtk/gtkfilethumbnail.c
Commit message (Collapse)AuthorAgeFilesLines
* filethumbnail: Set filechooser::queried after queryingGeorges Basile Stavracas Neto2023-02-281-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting this attribute after querying, but before receiving the results, can lead to inappropriate behaviour. This can be reproduced by dragging the scrollbar very quickly in a large directory; after going up and down a few times, some thumbnails will be wrong. Without this branch, "wrong" means they'll show the completely wrong icon or thumbnail, e.g. a folder icon in a video file. With previous commit, "wrong" means they'll be empty even when there is a thumbnail available. The sequence of events that triggers this is as follows: 1. GtkListItem receives a GFileInfo object and passes it to GtkFileThumbnail via expressions 2. `get_thumbnail()` is called, doesn't find a thumbnail 3. `filechooser::queried` is not set yet, so it is set to TRUE and we call `g_file_query_info_async()` 4. **Before `thumbnail_queried_cb` is called**, a new GFileInfo is set, and we cancel the query initiated in the previous step 5. We now have a GFileInfo with `filechooser::queried` set to TRUE, and no thumbnail! This commit fixes that by only setting the `filechooser::queried` attribute after the icon is queried. We need to set it in two situations: when the query is successful, or when the error is not G_IO_ERROR_CANCELLED. That's because the query was cancelled, we didn't really perform it!
* filethumbnail: Clear image on failureGeorges Basile Stavracas Neto2023-02-281-2/+8
| | | | | | Unset the image if we fail to find the appropriate icon, regardless of the reason of the failure. Prevents the thumbnail to misrepresent the GFileInfo it's supposed to represent.
* filethumbnail: CosmeticsGeorges Basile Stavracas Neto2023-02-281-1/+0
| | | | Remove an empty newline
* filethumbnail: Add 'icon-size' propertyGeorges Basile Stavracas Neto2022-12-131-1/+48
| | | | | This will be used by future commits so that we can reuse this widget in the file chooser grid view.
* filesystemmodel: Retire GtkFileSystemItemGeorges Basile Stavracas Neto2022-10-201-33/+27
| | | | | | | | | | This has to be the shortest-living object in GTK history! It helped us greatly during the transition to GtkColumnView, but now we can remove it in favour of GFileInfo directly. Perhaps I could have never introduced GtkFileSystemItem in the first place, but we're 30 commits deep and it's too late to just redo the whole thing that will get us exactly here anyway.
* filechooserwidget: Move file icon to column viewGeorges Basile Stavracas Neto2022-10-201-0/+261
This commit moves the icon loading code into a new private widget called GtkFileThumbnail, which is bound to the GFileInfo of the model, and asynchronously loads the file icon from that.