Re: g_app_info_launch_default_for_uri



Hello,

This should work:

  use Glib; # But Glib is not necessary here
  use Glib::IO;

  # Glib::Object::Introspection is not needed

  my $uri = Glib->filename_to_uri($file, undef); # undef => no hostname
  my $context = Glib::IO::AppLaunchContext->new;

  Glib::IO::AppInfo::launch_default_for_uri($uri, $context);

I wonder whether there is any advantage (?) of invoking it
by Glib::Object::Introspection when the Glib::IO::AppLaunchContext is
available.

If you have some special reason to call
Glib::IO::AppInfo::launch_default_for_uri() via the G::O::I, you can do
it as follows:

  use Glib::Object::Introspection;

  Glib::Object::Introspection->invoke(
    'Gio',     # basename
    'AppInfo', # namespace
    'launch_default_for_uri', # function
    $uri,    # $ARG[0]
    $context # $ARG[1]
  );

Note that the Glib::IO::AppLaunchContext may need to be called like
this, too.

-- 
Martin Mezl

Jeff via gtk-perl-list píše v Po 04. 05. 2020 v 22:54 +0200:
How can I call g_app_info_launch_default_for_uri() from Perl?

I've tried variations on:

Glib::Object::Introspection->invoke( 'GLib', 'AppInfo',
'launch_default_for_uri', 'x@y' );

Glib::Object::Introspection->invoke( 'GAppInfo', undef,
'launch_default_for_uri', 'x@y' );

to no avail.

Regards

Jeff

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]