GDesktopAppInfo: rewrite content type code

Desktop / GNOME / GLib - Ryan Lortie [desrt.ca] - 15 April 2014 10:36 UTC

Redo the code for type-based selection of applications (all, recommended, default, fallback) based on the new DesktopFileDir structures that we introduced last cycle.

At the same time, we expand the functionality to add support for the new features of the specification:

- moving ~/.local/share/applications/mimeapps.list to ~/.config/

- per-desktop default applications (via XDG_CURRENT_DESKTOP)

- sysadmin customisation of defaults (via /etc/xdg/mimeapps.list)

- deprecation of the old defaults.list, favouring the use of /usr/share/applications/mimeapps.list (or gnome-mimeapps.list) to accomplish the same

We modify the mimeapps testcase to check for mimeapps.list having been created in XDG_CONFIG_HOME instead of XDG_DATA_HOME.

The modification is a net reduction of code (due to less duplication in bookkeeping). It is also an increase in performance and reduction in memory consumption (due to simplified data structures). Finally, it removes the stat-based timestamp checking in favour of the GFileMonitor-based approach that was already being used in the implementation of DesktopFileDir (in order to know if we had to rescan the desktop files themselves).

https://bugzilla.gnome.org/show_bug.cgi?id=728040

6fd5a8c GDesktopAppInfo: rewrite content type code
gio/gdesktopappinfo.c | 1479 +++++++++++++++++++++----------------------------
gio/tests/mimeapps.c | 7 +-
2 files changed, 632 insertions(+), 854 deletions(-)

Upstream: git.gnome.org


  • Share