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:
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

$ sudo updatedb
$ locate 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

Just for info:
My application gets the "org.kde.amarok.desktop" name from Amarok via the
MPRIS2 DBus-interface.  Please see "DesktopEntry" of

Please educate me.

  Osmo Moma Antero

Sent from my PC, laptop or phone with Ubuntu-Linux.
gtk-app-devel-list mailing list

Reply via email to