On 3/3/19 6:36 PM, Osmo Antero via gtk-app-devel-list wrote:
Hello, I have an application that uses g_desktop_app_info_new() function to find GDesktopAppInfo. I just wonder why the g_desktop_app_info_new() FAILS to find the GDesktopAppInfo if the .desktop file is in a sub directory under usr/share/applications/. So this fails: GDesktopAppInfo *app_info = g_desktop_app_info_new("org.kde.amarok.desktop")
hi, try: GDesktopAppInfo *app_info = g_desktop_app_info_new("kde4-org.kde.amarok.desktop") ciao, Tito
If the "org.kde.amarok.desktop" file is located in: /usr/share/applications/kde4/org.kde.amarok.desktop This is the default location of Amarok player. --- Then I move the file "org.kde.amarok.desktop" to /usr/share/applications/. $ sudo mv /usr/share/applications/kde4/org.kde.amarok.desktop /usr/share/applications/org.kde.amarok.desktop $ sudo updatedb $ locate org.kde.amarok.desktop /usr/share/applications/org.kde.amarok.desktop Now the call succeeds. It returns GDesktopAppInfo structure. GDesktopAppInfo *app_info = g_desktop_app_info_new("org.kde.amarok.desktop") Something is wrong, because the manual says that the desktop file can stay in a sub directory: """" g_desktop_app_info_new () GDesktopAppInfo * g_desktop_app_info_new (const char *desktop_id); Creates a new GDesktopAppInfo based on a desktop file id. A desktop file id is the basename of the desktop file, including the .desktop extension. GIO is looking for a desktop file with this name in the applications subdirectories of the XDG data directories (i.e. the directories specified in the XDG_DATA_HOME and XDG_DATA_DIRS environment variables). GIO also supports the prefix-to-subdirectory mapping that is described in the Menu Spec (i.e. a desktop id of kde-foo.desktop will match/usr/share/applications/kde/foo.desktop). """" Just for info: My application gets the "org.kde.amarok.desktop" name from Amarok via the MPRIS2 DBus-interface. Please see "DesktopEntry" of https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry Please educate me. Kindly Osmo Moma Antero Portugal
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list