After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755948 - g_app_info_launch_uris does not seem to be launching apps when uri is an URL
g_app_info_launch_uris does not seem to be launching apps when uri is an URL
Status: RESOLVED NOTABUG
Product: glib
Classification: Platform
Component: gio
2.46.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-10-01 15:32 UTC by Felipe Borges
Modified: 2015-10-02 08:03 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Felipe Borges 2015-10-01 15:32:20 UTC
Evince uses g_app_info_launch_uris in order to spawn new instances for multiple arguments. g_app_info_launch_uris does not seem to be passing the right URIs to the application.

How reproducible:

#include <gio/gdesktopappinfo.h>

int main(int argc, char *argv[])
{
  GAppInfo *app;
  GList uri_list;
  GFile *file;
  gboolean res;
  GError *error = NULL;

  app = g_app_info_create_from_commandline ("/usr/bin/evince",
                                            NULL, 0, &error);


  uri_list.data = (gchar*) argv[1];
  uri_list.prev = uri_list.next = NULL;

  res = g_app_info_launch_uris (app, &uri_list, NULL, &error);

  g_object_unref (app);

  return res;
}

g_app_info_launch_uris is returning TRUE for arguments such as http://www.farnell.com/datasheets/664229.pdf, although it does not really launch anything.

It works fine for local uris such as file:///home/fborges/664229.pdf
Comment 1 Matthias Clasen 2015-10-01 15:45:22 UTC
That seems pretty a backwards way to go about launching more instances of yourself, but if you want to go that route and make it work for uris, you need to pass G_APP_INFO_CREATE_SUPPORTS_URIS
Comment 2 Felipe Borges 2015-10-02 08:03:00 UTC
Thank you for the heads up.