GDesktopAppInfo: avoid inotify on missing dirs
authorRyan Lortie <desrt@desrt.ca>
Tue, 9 Sep 2014 17:58:38 +0000 (13:58 -0400)
committerRyan Lortie <desrt@desrt.ca>
Tue, 9 Sep 2014 18:11:38 +0000 (14:11 -0400)
commit3b8bc8bacf1fe31cda44fb5293711e87989388ea
tree3a67a8250784d18b017dccd5be924393c133930c
parent2f55c66c64d77de9fa7d5524468d424071aecc44
GDesktopAppInfo: avoid inotify on missing dirs

Some desktop file directories, like /usr/local/share/applications may be
missing on some systems.

When we try to inotify on these directories, this will result in a
every-4-seconds poll being setup which is quite bad.

This is an issue that should be fixed in inotify itself but the problem
is much larger there.  For now, we can work around it in GDesktopAppInfo
by refusing to monitor missing directories.

We may get some spurious notifications of changes in the case that
/usr/local/share or /usr/local/share/applications is created without
actually adding desktop files, but spurious changes can already be
reported in other cases, so that's OK.  We won't get (user-visible)
notification for a simple case of a completely unrelated file being
created (however we cannot avoid the wakeup in this case due to how
inotify works).  That's probably pretty theoretical, though, since files
in /usr don't change much and for the home directory we're likely to
have at least ~/.config and ~/.local existing.

https://bugzilla.gnome.org/show_bug.cgi?id=736350
gio/gdesktopappinfo.c