Bugzilla is down or I'd write this there, and it's a bit lengthy to fit in the SoC wiki page, so I'll just post here and link from the wiki.
== Desktop File Cache == Because GNOME doesn't have an application installation story, a lot of OS creators simply ship with a lot of apps. An app here is a .desktop file, normally in /usr/share/applications. It turns out that reading all these files can be slow, for a variety of reasons. Here is a link to the full specification: http://standards.freedesktop.org/menu-spec/latest/index.html#introduction == Kill gnome-menus == gnome-menus is the library which reads all this stuff presently, and it has one serious drawback: * It is entirely synchronous This especially hurts since we have to read applications from gnome-shell, which is the compositor - a blocked compositor means no redrawing. There are other, more minor flaws: * It is quite inefficient; there is a ton of string allocation going on. * It's not threadsafe (see e.g. the static GSList *pending_events in menu-monitor.c) * It wasn't designed for introspection ( https://live.gnome.org/GObjectIntrospection ) == Implementing a saner tool == There are multiple ways to approach this, but I think by far the simplest is just an mmap'able file containing all .desktop files found in the desktop paths. Don't try to implement all the merge logic, etc. How do you implement a mmap'd file? Take a look at how dconf does it: http://git.gnome.org/browse/dconf/tree/gvdb The next question is how does the cache get rebuilt? I think we basically need a system service with an inotify (GFileMonitor) watch on all those directories, and it takes care of rebuilding it. The library api could simply be: void on_desktop_cache_changed () { DesktopCacheEntryIter iter; desktop_cache_iter_init (cache, &iter); while (desktop_cache_iter_next (cache, &iter)) { g_print ("desktop file path: %s\n", desktop_cache_iter_get_desktop_file_path (&iter)); g_print ("desktop name: %s\n", desktop_cache_iter_get_desktop_name (&iter)); } } DesktopCache *cache = desktop_cache_get(); g_signal_connect (cache, "changed", on_desktop_cache_changed, self); desktop_cache_read_async (cache, on_desktop_cache_read_complete, self); The library would simply have an inotify watch on the cache file. Which should probably simply be defined to live in /usr/share/applications/applications.cache, say. Filtering the menus by category would live in a higher layer, in my case, gnome-shell probably. _______________________________________________ desktop-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/desktop-devel-list
