Skip to content

Conversation

friday
Copy link
Member

@friday friday commented Oct 28, 2021

Work in progress implementation for #833

This removes the inotify dependency and file watching completely, as well as several other classes we don't really need (AppDb, AppIconCache). It's both due to using Gio.DesktopAppInfo.get_all() now to load the apps, but also for just a lot of refactoring in general

  • There's no caching at all now in our logic, but the C-code for the Gio.DesktopAppInfo.get_all() API does cache.
  • Most of the logic is now in AppResultItem.py, which I consider to be as close as it gets to the "app object". I want to move the LaunchAppAction there as well, but I'm not sure if this class is used by any extensions.
  • The code to fetch the apps and filter them is now run for every keystroke, which might be something we want to avoid, but it was easier to implement it like this as there is no event for when the window is shown in the right place. And the performance is snappy as ever.
  • There's an incompatibility with the app stat db, so I changed the name of the file to app_stat_v3. Previously it used the desktop file path as the identifier, but now it uses the desktop app id (which is what it should have used before, to avoid duplicating apps)
  • This will fix Custom desktop entries in home dir should persist if the global variant updates #320 as we're no longer handling files directly, and should also fix App scanner doesn't follow symlinks #310, assuming Gio.DesktopAppInfo.get_all() supports symlinks (if it doesn't we should ask users to submit an issue to the maintainers of Gnome/Glib).
  • SortedList and SortedCollection were used for the file browse mode as well, but I removed this dependency in a separate commit before this, so they can be removed completely. We really don't need them. It's easier to sort normal python lists in just a few lines of code, and performance isn't an issue here.

@friday friday added this to the 6.0.0 milestone Oct 28, 2021
@friday friday changed the title Simplify apps logic (use Gio.DesktopAppInfo.get_all() to fetch apps and remove file watching, caching objects etc) Rewrite apps logic using Gio.DesktopAppInfo.get_all() Oct 28, 2021
@friday friday force-pushed the v6-simplify-app-logic branch 3 times, most recently from da4d85c to 2a968ba Compare October 30, 2021 22:43
@friday friday force-pushed the v6-simplify-app-logic branch 2 times, most recently from 50c54cf to 6ad73c5 Compare November 1, 2021 15:02
@friday friday marked this pull request as ready for review November 1, 2021 15:04
@friday
Copy link
Member Author

friday commented Nov 1, 2021

I added back the test for AppResultItem and fixed them, and added a couple more tests for basic search.
The AppSearchMode tests is still just removed since it does barely anything now (just wraps AppResultItem), and I haven't added tests for should_show, because I don't fully understand how to mock settings, and I was planning to remove blacklisted_dirs anyway after merging this.

should_show() is probably the weirdest method in AppResultItem due to loading user settings and ignoring NoDisplay for gnome-control-center

@friday friday force-pushed the v6-simplify-app-logic branch from 6ad73c5 to 3676078 Compare November 8, 2021 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants