Gtk3::Application and handles-command-line

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Gtk3::Application and handles-command-line

Jeff
Investing Gtk3::Application further, I find that if I try to run the
code below, it falls over calling
Glib::IO::ApplicationCommandLine::get_options_dict()

GType GVariantDict (46597648) is not registered with gperl
at /usr/lib/i386-linux-gnu/perl5/5.26/Glib/Object/Introspection.pm line
67.

What can I do to get this running?

Regards

Jeff


#!/usr/bin/perl

package MyApp;

BEGIN {
  use Glib::Object::Introspection;
  Glib::Object::Introspection->setup(
    basename => 'Gio',
    version => '2.0',
    package => 'Glib::IO');
}

use strict;
use warnings;

use Gtk3;
use Glib qw/TRUE FALSE/;

my $window;

use Glib::Object::Subclass qw/Gtk3::Application/;

sub STARTUP {
    my ($app) = @_;
    print "entering STARTUP with $app\n";
    $app->SUPER::STARTUP ();
    $app->add_main_option('test', ord('t'), [], 'none', 'Command line
test', undef); $window = Gtk3::ApplicationWindow->new ($app);
    print "after new\n";
    $window->set_title ('Welcome to GNOME');
    $window->set_default_size (200, 200);
    $window->signal_connect ('delete_event' => sub {$app->quit()});
    $window->show_all ();
    print "leaving STARTUP\n";
    return;
}

sub ACTIVATE {
    my ($app) = @_;
    print "entering ACTIVATE\n";
    $window->present;
    print "leaving ACTIVATE\n";
    return $app->SUPER::ACTIVATE ();
}

sub OPEN {
    my ($app, $files, $nfiles, $arg3) = @_;
    print "in open\n";
    use Data::Dumper;
    print Dumper($files, $nfiles, $arg3);
    for my $file (@$files) {
        print $file->get_path(), "\n";
    }

}

sub COMMAND_LINE {
    my ($app, $command_line) = @_;
    print "in command line $command_line\n";
    my $options = $command_line->get_options_dict();
    return $app->SUPER::COMMAND_LINE ($command_line);
}


sub SHUTDOWN {
    my ($app) = @_;
    print "entering SHUTDOWN\n";
    return $app->SUPER::SHUTDOWN ();
}

package main;

my $app = MyApp->new(
        application_id => 'app.test',
        flags => ['handles-open','handles-command-line']);
exit $app->run([$0, @ARGV]);
_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Gtk3::Application and handles-command-line

Torsten Schoenfeld
On 08.06.2018 15:16, Jeffrey Ratcliffe wrote:
> Investing Gtk3::Application further, I find that if I try to run the
> code below, it falls over calling
> Glib::IO::ApplicationCommandLine::get_options_dict()
>
> GType GVariantDict (46597648) is not registered with gperl
> at /usr/lib/i386-linux-gnu/perl5/5.26/Glib/Object/Introspection.pm line
> 67.
>
> What can I do to get this running?
Support for GVariantDict was missing from Glib.  I just added it:

https://gitlab.gnome.org/GNOME/perl-glib/commit/5dc4a9cdc37ac4987df43c9757c611107b6da1e9

-Torsten
_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list