Re: Override of Gtk3::Application->new

The following doesn't also work with the override, no matter whether the
Gtk3::Application was created with "my $app =
Gtk3::Application->new('app.pp','flags-none');" or with
"Gtk3::Application::new(my $app,'app.pp','flags-none');"!

my $window = Gtk3::ApplicationWindow->new($app);

The error message is:
undef is not of type Gtk3::Application
at /usr/local/lib/x86_64-linux-gnu/perl/5.20.2/Glib/Object/ line 67.

This is very curious and I don't know why this is so??? I thought
Gtk3::ApplicationWindow->new is the short form of Gtk3::Window->new and

Am Sonntag, den 29.05.2016, 18:03 +0200 schrieb Maximilian Lika:
Dear Gtk3 Maintainers,

I suggest to add the following override to the Gtk3 Perl module:

sub Gtk3::Application::new {
      my ($class, $app_id, $flags) = @_;
      print "flags \n";
      Glib::Object::Introspection->invoke (
    $_GTK_BASENAME, 'Application', 'new', my $app, $app_id, $flags);
      return $app;

If you call "my $app = Gtk3::Application->new('','flags-none');",
I get an segmentation fault error (perhaps someone can confirm the
bug?). Creating a Gtk Application is important for a Application Window!
By contrats the command "Gtk3::Application::new($app, '',
'flags-none')" works like a charme. For a beginner this is a big source
of errors. With the override above also the more perlish command "my
$app = Gtk3::Application->new('','flags-none');" works well.

Here a little example (translated from the python beginners tutorial):

#! /usr/bin/perl

use strict;
use warnings;
use utf8;
use Gtk3 -init;
use Glib ('TRUE','FALSE');

# this works at the moment
Gtk3::Application::new(my $app,'app.pp','flags-none');

# this causes on my machine a segmentation fault error
# my $app = Gtk3::Application->new('app.pp','flags-none');
my $window = Gtk3::Window->new();
$window->set_title('Welcome to GNOME');
$window->signal_connect('delete-event'=>sub {Gtk3->main_quit()});


Please let me know, whether this patch submission was submitted in the
right way? I am very inexperiments with this!

Best regards,

gtk-perl-list mailing list
gtk-perl-list gnome org

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