GDesktopAppInfo: rewrite content type code
authorRyan Lortie <desrt@desrt.ca>
Wed, 9 Apr 2014 12:44:18 +0000 (08:44 -0400)
committerRyan Lortie <desrt@desrt.ca>
Tue, 15 Apr 2014 15:36:39 +0000 (11:36 -0400)
commit6fd5a8cdaa0dee2217ebe7411adf3ddb37f1827e
tree18b99235b4287ecec4a80c48c6b7cf290a0486ab
parentcaf0f1df1c59b0b7e5f68327e3852817d74609a5
GDesktopAppInfo: rewrite content type code

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
gio/gdesktopappinfo.c
gio/tests/mimeapps.c