Finding .desktop file and application info
- From: Osmo Antero <osmoma gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Finding .desktop file and application info
- Date: Sun, 3 Mar 2019 17:36:05 +0000
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")
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
--
Sent from my PC, laptop or phone with Ubuntu-Linux.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]