Gtk3::Application and handles-command-line
- From: Jeffrey Ratcliffe <jffry posteo net>
- To: gtk-perl-list gnome org
- Subject: Gtk3::Application and handles-command-line
- Date: Fri, 8 Jun 2018 15:16:57 +0200
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]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]