Osmo Antero 20:53 (há 11 minutos) para tito-wolit Hello Tito, Muito obrigado. Thank you, the call with "kde4-" worked fine.
However, the "DesktopEntry" value from Amarok/DBus does not contain the "kde4" part. Please see the MRIS2-spec: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry My application cannot guess that it must include the "kde4" to get a valid .desktop file. I think g_desktop_app_info_new() should also browse all sub-directories, but is does not. One possible solutions is this: The application should find the real location and path of "org.kde.amarok.desktop". The "locate" command does the same thing. My app cannot call "locate" directly because it depends on "sudo updatedb". I will write my own routine that dives to usr/share/applications/ and its sub folders. This is my best shot ! Then the app can call: GDesktopAppInfo *g_desktop_app_info_new_from_filename(const char *filename); My very old app is this: (the latest is v3.0.2) https://launchpad.net/~audio-recorder Thanks, Obrigado e boa noite. // Moma Portugal tito-wolit via gtk-app-devel-list <email@example.com> escreveu no dia domingo, 3/03/2019 à(s) 19:42: > > > 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 > firstname.lastname@example.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > -- Sent from my PC, laptop or phone with Ubuntu-Linux. _______________________________________________ gtk-app-devel-list mailing list email@example.com https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list