-
-
Notifications
You must be signed in to change notification settings - Fork 8
MainWindow: add and remove search results instead of clearing the list #153
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b45e697
MainWindow: add and remove search results instead of clearing the list
danirabbit c9adaf2
Merge branch 'main' into danirabbit/mainwindow-searchres-addremove
danirabbit 593d643
Merge branch 'main' into danirabbit/mainwindow-searchres-addremove
danirabbit 5ffc3a2
Only increase index when we don't remove
danirabbit c29dbd1
Merge branch 'main' into danirabbit/mainwindow-searchres-addremove
danirabbit 3cc8a71
Merge branch 'main' into danirabbit/mainwindow-searchres-addremove
ryonakano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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 guess
GLib.List.find()is pointer comparison? So I'm not sure if this works as you expect.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.
Yeah I wasn't sure about it, but from testing it seems to work. I had it print number added and number removed and most of the time they were not equal amounts and there was matches to be removed 🤷♀️
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 find with equal func would be better?
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.
As far as I understand and test correctly, all of old results are removed even if the data in the list is completely equal because they have different (memory) address.
I try calling
compute_location()again immediately after calling it first time, which meansGeocode.Forward.search_async()should return the same result in its content data:The above code results that all results are removed:
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.
@danirabbit Yes, you should use
GLib.List.find_custom()instead if you really want to do this, but honestly I'm not sure if removing/adding results is better than clearing the liststore……I know this is an application code but we callfind()in the list, which I don't think light call, twice in this code.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.
Okay gonna just close. This might be trying to over-optimize. We can always revisit it later if there's a real performance issue to look at