Repository navigation
places-sidebar: Add user-defined bookmark groups - #3856
Closed
BerziOnline wants to merge 1 commit into
Closed
BerziOnline wants to merge 1 commit into
BerziOnline wants to merge 1 commit into
Conversation
Users can create, rename and delete groups in the Places sidebar and move bookmarks into them via a context submenu or drag and drop. Bookmarks stay in the GTK bookmarks file; Nemo stores only the group membership, order and collapsed state in ~/.config/nemo/bookmark-groups (GKeyFile). Without that file the sidebar is unchanged. Related: linuxmint#2489
Member
|
No thanks, we think the current sidebar behavior is sufficient - you can drag bookmarks between the Computer and Bookmarks section also. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds user-defined bookmark groups to the Places sidebar. Users can create their own sidebar sections (e.g. "LAN" for network mounts, "Work" for project folders) and move bookmarks into them via the context menu or by drag and drop. Without any groups the sidebar looks and behaves exactly as before.
Related: #2489 ("Customize Sidebar - allow adding Groups", closed as stale without a decision).
Motivation
With several network mounts (cifs/sshfs via fstab) and work folders, the single "Bookmarks" section becomes long and mixed. Grouping them keeps the sidebar readable, similar to how "My Computer", "Bookmarks", "Devices" and "Network" are already separated.
Behaviour
Deleting a group never deletes bookmarks or files; its bookmarks return to "Bookmarks".
Storage and compatibility
~/.config/gtk-3.0/bookmarks), so GTK file choosers and other applications keep seeing the normal flat list.~/.config/nemo/bookmark-groups(GKeyFile): group order, display names, member URIs in order, collapsed state.What changed where
src/nemo-bookmark-groups.{c,h}(new, GLib only)load/save(g_key_file_save_to_file, which writes atomically),get_ids,create,rename,delete,find(group of a URI),move(assign/reorder a URI, incl. "before" position; moving an item before itself is a no-op),prune(drop URIs that are no longer bookmarks). No GTK dependency, so it is unit-testable.src/nemo-places-sidebar.cPLACES_SIDEBAR_COLUMN_GROUP_IDand section typeSECTION_BOOKMARK_GROUP.update_places(): loads the groups file, leaves grouped bookmarks out of the normal "Bookmarks" section and renders one heading per group via the newadd_bookmark_groups()(between Bookmarks and Devices).Context menus:
append_group_menu()/group_menu_activate()add New/Rename/Delete and "Move to group"; group headings get their own menu inbookmarks_button_press_event_cb(); group items are removed again from the shared popup so they never leak into device/network menus.Drag and drop:
get_drag_type()andcompute_drop_position()accept group rows/headings as targets; the source row is resolved from the drag data (get_drag_source_iter()), not from the selection;reorder_group_bookmark()updates the groups file for moves into, within and out of groups.Expand/collapse:
update_expanded_state()/restore_expand_state_foreach()persist the per-group collapsed state.groups_changed_cb(): a directory monitor on~/.config/nemo/refreshes the sidebar when the file changes, including atomic renames (other_file).src/nemo-bookmark-list.cprune_bookmark_groups()is called after deleting bookmarks and after loading the list;load_files_thread()marks a load as authoritative only if the file was read and is valid UTF-8 with valid URIs.src/meson.buildnemoCommon_sourcesand tonemo-connect-server, which also compilesnemo-bookmark-list.c.test/test-bookmark-groups.c,test/meson.buildNew user-visible strings use
_(); nopo/changes are included (translations go through Launchpad).Testing
meson test "Bookmark groups": all tests pass. This branch is rebased onto currentmaster(e5b6cfc) and builds there without warnings; the two conflicts were inbookmarks_button_press_event_cb()(now usesGDK_BUTTON_SECONDARY/GDK_BUTTON_MIDDLE) andtest/meson.build.Notes
GTK_TARGET_SAME_WIDGET), as for the existing bookmark reordering. Reordering whole groups by drag and drop is not part of this PR.