Re: Gtk3::Application->new with Perl



Sorry, guys,

I think my override doesn't work. Also
Gtk3::Application::new('app.id','flags-none'); seems to be unrewarding!
Both create a variable with the content undef. Therefore
$window->set_application works and Gtk3::ApplicationWindow->new($app);
doesnt work!

For that please forget my mails!
Has someone an idea how to implement a Gtk3 Application or
ApplicationWindow (I want to use GActions!) as in
https://developer.gnome.org/gnome-devel-demos/stable/GtkApplicationWindow.py.html.en or as in 
https://developer.gnome.org/gnome-devel-demos/stable/menubar.py.html.en

I know, one can reach the similar result with GtkUIManager and GtkAction
and GtkActionGroups (see
https://github.com/dave-theunsub/gtk3-perl-demos/blob/master/builder.pl)
but I saw that this is deprecated...

Best wishes,
Max

Am Sonntag, den 29.05.2016, 18:25 +0200 schrieb max augsburg gmx de:
PS.:
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/Introspection.pm 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
$window->set_application?

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;
}


Explantation:
If you call "my $app = Gtk3::Application->new('app.id','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, 'app.id',
'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('app.id','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_application($app);
$window->set_title('Welcome to GNOME');
$window->signal_connect('delete-event'=>sub {Gtk3->main_quit()});

$window->show_all();
Gtk3->main;

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

Best regards,
Max

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


_______________________________________________
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]