GNOME Bugzilla – Bug 567721
get more key/values from GDesktopAppInfo
Last modified: 2013-02-03 05:05:23 UTC
It would be nice to be able to access all fields of the desktop files from GDesktopAppInfo. This might be beyond the GAppInfoIface. One idea would be having const gchar *g_desktop_app_info_get_detail(GDesktopAppInfo *info,const gchar *detail); categories=g_desktop_app_info_get_detail(da_info,"Categories"); or categories=g_desktop_app_info_get_detail(da_info,G_KEY_FILE_DESKTOP_KEY_CATEGORIES); Also in g_desktop_app_info_new(const char *desktop_id) desktop_id is not clear. Are applications supposed to do: g_desktop_app_info_new(g_get_prgname())? The use case I am looking into is a library which wants to know more about the application that is using it.
I don't think g_desktop_app_info is the place to do that. Just use GKeyFile directly. Of course, you have to figure out what desktop file to load, but GDesktopAppInfo doesn't solve that for you anyway...
Yes, I noticed that shortcomming of the api too. How to get from the $argv[0] / g_get_prgname() to the desktop file. The program name should be there in Exec/TryExec, but I don't think we have API in glb that makes that connection. Would you think such a API is the way to go?
It is not a shortcoming of the api, really, but rather one of the many shortcoming of the whole 'stuff it all into desktop files' approach to an application database. There _is_ no clear connection.
What about introducing a g_set_application_desktop_file() resp. g_get_application_desktop_file() or suchlike? That would simply take the .desktop file name without prefix and without suffix. If not initialized defaults to the prgname. And both gtk_window_set_default_icon_name() and g_set_application_name() could be initialized from that.
eggdesktopfile (bug 415070) has something like that, but i think that isn't what this bug is actually about; this is about finding other peoples' desktop files. (there is a recurring idea of making a .desktop file database a la the icon database, but no one has ever gotten around to it
Also the launchers could export an env-var so that somthing in glib looks for if the dektop file is queried. I am more and more convinced that this is useful, especialy after looking how bug-buddy gets to the desktop file (src/bugzilla.c::get_all_applications()).
As far as I realize g_app_info_get_id returns the desktop file on Freedesktop.org platforms like GNOME and Xfce. Or is there something still missing?
(In reply to comment #7) > As far as I realize g_app_info_get_id returns the desktop file on > Freedesktop.org platforms like GNOME and Xfce. Or is there something still > missing? Apps would still need ti lookup the file and parse it. Would be nice to not expose the implementation (GKeyfile) on this api.
We now have g_desktop_app_info_get_categories g_desktop_app_info_get_string