"Starred" User Bookmarks - #1982
Conversation
|
Perhaps table header doesn't require the bookmark icon? |
I wasn't too sure about that myself, but the column is sortable and I didn't like the UX behind an empty header and "Bookmarks" made the column unnecessarily wide. "Star" could work, but then I'd need to rename everything from "Bookmarks" to "Starred". I'll post screenshots of a few variations of the header to compare the options. |
This comment was marked as resolved.
This comment was marked as resolved.
|
Thanks for pointing that out - I just noticed it myself when testing with Dolphin and Nautilus installed. It looks to be an issue with the underlying EDIT: The issue appears to be with mapping certain structures and missing attributes within the xbel file to the internal structs when reading (done on writing to 'update' instead of append). The indentation and KDE-specific blocks are ignored. The current code is optimistic on what it'll find, so I'm looking to have it just ignore bad structures, not just unknown ones. There is no issue in the COSMIC Files code for this unless we want to double-handle errors, or auto-disable the feature on such an error. If you rename the existing file it should auto-create an empty one to test the feature with, and then you can roll back when finished. |
d7f9657 to
1e505a6
Compare
|
That issue has been fixed now - the In testing this I realised that I had left a cap of 50 items in the Starred page with unnecessary filtering via date, so I've pushed a fix for that. I've also rebased onto the updated I'd love for you to check again with both a reset |
|
The issue has been fixed now! |
|
There are now some branch conflicts needing resolving and I've decided that I should have supported both Grid View and the compact list before marking as 'ready'. I'm working on those changes now. |
Trigger rescanning the Recents tab when deleting a file, forcing it to no longer display the deleted file
Trigger rescanning the Recents tab when deleting a file.
Trigger rescanning the Recents tab after processing each completed operation, and when watching the Trash. This allows it to cover: - Moving a file to Trash from anywhere - Restoring a file from Trash - Renaming a file from anywhere
This requries a new dependency: "user-places-xbel" forked from "recently-used-xbel" Add a new Sidebar item for the Bookmarks tab, and a setting to show/hide it, similar to the Recents tab. Bookmarks icon is different when no bookmarks made. File context menus now have "Add to Bookmarks" next to "Add to Sidebar" unless within the Bookmarks location, which has "Remove from Bookmarks"
Added new column to indicate whether an item is bookmarked or not. This icon is a clickable button to toggle the bookmarked state. The right-click context menu is now smarter for Add to Bookmarks or Remove from Bookmarks. STILL TO DO: - Refresh bookmarked icon state immediately - Spacing to align bookmarked column icons - Add to Sidebar to be restricted to Directories only - Reduced file calls to user_places.xbel - Hide column if bookmarks are hidden
+ Added show_bookmarks to TabConfig to pass down for views + Don't toggle Bookmarks icon in sidebar + Add to Sidebar restricted to Directories only + Hide Bookmark column if bookmarks are hidden + Changed wording of setting as it now hides the column too + Fixed Open With for Bookmarks location + Updated keyboard shortcuts: [Ctrl] + [D] is Add to bookmarks and [Ctrl] + [Shift] + [D] is Add to sidebar + Build the list view columns more dynamically + Padding to align bookmarked column icons STILL TO DO: - Reduced file calls to user_places.xbel - Atomic updates in user-places-xbel to prevent: WARN Error reading bookmarks files: Deserialization(UnexpectedEof)
+ Call user_places_xbel::read_user_places() instead of user_places_xbel::parse_file() to create file if missing + Fixed alignment of bookmarks column STILL TO DO: - Reduced file calls to user_places.xbel
+ Renamed all variables from "bookmarks" to "starred", except for those in the user_places_xbel crate + Fixed glitch where List View headers would disappear early when shrinking the window into condensed view + Shrunk column widths to allow for more compact view before switching to condensed
+ Removed overlooked filtering, sorting and limiting of Starred items to max of 50. It now lists all starred items it can parse.
1e505a6 to
5b0d76d
Compare
+ Added Sort menu options for toggling the "Starred" sorting. + Refactored menu_bar() to make it easier to edit contents based on config, such as possible sort by Type in the future
This implements Starred for Grid View by sacrificing the third line of text to show the Star button, keeping the same item density as before. I would have preferred to have the star overlayed on top of the icon, but that does not seem possible yet..






Added User Bookmarks via a special "Starred" tab with a pinned sidebar item (like Recents) and a sortable "Starred" column in List View. The list view icons are clickable buttons to toggle the bookmark state immediately. The Starred tab is searchable, to be consistent with Recents and Trash.
Starred Location
There is a new "Starred" location that only appears when the "Show starred" config is enabled. This page lists all the items that the user has starred (a.k.a. bookmarked) in one easy location.

New Config, off by default
There is a new "Show starred" setting option that is off by default ( unless pre-added to the COSMIC Files settings file ) that reveals the new features when enabled. Disabling the setting does not forget the starred bookmarks.

List View
The List View shows the "Star" column at the far right when the feature is enabled

List View (Condensed)
The condensed List View still shows the "Star" column at the far right.

Grid View
For Grid View the icon displays below the names, which are now to 2 lines while Starred are shown, and the original 3 lines while disabled. This keeps the item density (and positioning) the same between both options.

Sort Menu
There are now two new options for the Sort Menu that only appear while the "Show starred" feature is enabled, allowing sorting by "Starred first" or "Starred last" and honouring the "List directories first" setting.

Add to sidebar
The existing Add to sidebar functionality covered both pinned locations and user bookmarks, resulting in a bad UX when a lot of files and directories were added. This update changes this, only allowing users to pin directories to the sidebar but not files, creating a clear separation between the two concepts.
NOTE: Several options were explored and there are two best choices for the header: star or empty - see the comments below - the current code has the star icon
Context menus
The context menu for both files and directories now shows "Add to starred" instead of "Add to sidebar", however directories will list both items. Neither option appears when inside the Trash location.

When inside the Starred location, or when a file is already starred the context menu will have the "Remove from starred" action.
Keyboard Shortcuts
The
Ctrl + Dshortcut has been taken over by the "Add to starred" functionality, which is expected to be used more frequently than the adjusted "Add to sidebar" capability. The latter has been moved toCtrl + Shift + Das a keyboard shortcut. Both keyboard key binds are additive and there is no shortcut for "Remove from starred".Selections
The keyboard shortcuts and context menus support selections too, only showing the options relevant to the current selection. "Add to sidebar" only shows if all selected items are directories,; "Add to starred" and
"Remove from starred" can both be shown if there's a mix in the selection.
Trash
The "Trash" tab does not show starred and does not have the context menu items. Restoring a starred item from trash will cause it to reappear in the "Starred" area, as the location is still preserved in the user-places.xbel
Freedesktop Standard
Bookmarks are stored in the ~/.local/share/user-places.xbel file, to be shared with other compliant programs.
NOTE: This file is used by KDE's Dolphin file browser to manage the pinned "Places" in the sidebar, not favourites like I had assumed. Gnome Files (Nautilus) uses an internal DB for this.
Dependencies
This requires a new library to edit the
user-places.xbelfile storing the bookmarks. I have created user_places_xbel forked from recent_places_xbel to point to the new file and to bring in atomic writes and other bug fixes.Other impacts
The building of the List View headers was tweaked to fix positional issue and to support icons as headers. This will impact other PRs adjusting this list, such as including a Types column. The changes made here are easy to adjust to, and should pave the way to having user-specified optional columns.
The
user-places-xbellibrary should really be merged with therecent-places-xbellibrary into a generic XBEL handler, but as I don't know the wider impact I placed it safe via a fork.Related to: #353