-
Notifications
You must be signed in to change notification settings - Fork 28
Implemented bookmarking feature to add directories to places #352
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
base: master
Are you sure you want to change the base?
Conversation
tchx84
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @beef331 , thanks for working on this :) It would be a nice addition indeed.
I left some comments on how we could better integrate this, please check these comments and let me know if you have any questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there's a way to reuse the already existent user-bookmarks-symbolic and handle the "filled" case with CSS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be wrong, but I don't think it's possible to fill the svg's shape using CSS alone.
|
Given the mess made more sense to rebase, sorry if it causes any issues. Still uncertain how to pipe signals around this I for one don't like the indirection it hurts my head. |
No worries, I can still review it, but eventually we should fix this rebase, these older commits shouldn't show up. |
tchx84
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking much better :) But see my comments on how this model should be designed and used.
src/places.py
Outdated
| self._devices_listbox = utils.find_child_by_id(self._devices_group, "listbox") | ||
| self._bookmarks_listbox = utils.find_child_by_id(self._bookmarks_group, "listbox") | ||
|
|
||
| self._add_unadded_accessible_bookmarks() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about _populate_initial_bookmarks ?
| for path in self._bookmarks.bookmarked: | ||
| notAdded = self._find_place_by_path(self._bookmarks_listbox, path) is None | ||
| if notAdded and os.path.isdir(path): # Might be a bookmarked path on a unmounted device | ||
| self._add_bookmark_place(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to check if it's in widget? If you're worried about duplicates, that's something you can deal with in the mode (e.g., using a set instead of a list). Same thing for available or unavailable bookmarks.
So this ideally look like:
for path in self._bookmarks.bookmarked:
self._add_bookmark_place(path)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One may connect a device which has paths stored in their bookmarks, the check was to not repeat add to the collection. As on start up it can be come disjointed from the stored list as there may not be bookmarks accessible at the time of opening.
tchx84
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking much better :)
Can you try adding a custom PortfolioBookmarkButton class and move that "icon update" logic inside it?
So, the window widget will:
- Create the model (as it already does).
- Create the button widget, and passes the model (missing).
- Create the places widget, and passes the model (as it already does).
- Update the button widget "path" property when the path changes (missing).
And, the button class will:
- Handle the "clicked" event internally.
- Handle the updating of the icon internally, in one place.
If done as described, the Window widget can simply do something like self._bookmark_button.path = path, and the button can internally handle all bookmark-related logic like talking to the model and update the icon, in one place.
|
Yea my uncertainty in how to do that is why it was not done 😄 I cannot find any reference in this codebase nor online how to properly do that. Then inside the .ui change it to be |
No problem, for now just add an empty GtkBox to the window.ui file and call it something like EDIT: there are existing examples of this, look for "placeholder" in window.ui. |
|
Are there any more changes you want to see? |
Adds button to the header bar to add or remove a bookmark.
Bookmarks are stored inside a file at
$XDG_CONFIG_HOME/Portfolio/bookmarks.