Fw: Aw: Re: GIO in Perl



 
sorry for sending multiply. First wrong sender eMail, then sent only to Thorsten ;-)
Gesendet: Donnerstag, 17. März 2016 um 12:07 Uhr
Von: max augsburg gmx de
An: "Torsten Schönfeld" <kaffeetisch gmx de>
Betreff: Aw: Re: GIO in Perl
Dear Thorsten,
dear Emmanuelle,

Thank you very much for your help. Unfortunatelly I couldn't translate
the menu example with Glib::IO. I got it with "old-style" Gtk3::Menu,
Gtk3::Menubar and  Gtk3::MenuItem. And i saw that some perl programmers
works with Gtk3::UIManager in a similiar way as with Gio. But on GNOME
dev page is said that this way is deprecated.

I really searched hard for examples of GMenu in perl. Perhaps the import
of Glib::IO is not so far or my knowledge isn't enough? Perhaps, you
could take a quick look at my code although I don't want to waste your
worthwile time? Perhaps you have an idea, how to implement a GMenu with
Perl using Glib::IO?

Thank you very much for all your support and work,
Max

CODE BEGIN
#!/usr/bin/perl

use strict;
use Gtk3 -init;
use Glib ("TRUE","FALSE");
use Glib::IO;

# construct a window
my $app = Gtk3::Application->new("a.app","flags-none");
my $window = Gtk3::Window->new("toplevel","app");
$window->set_title ("Gtk3 Menu Example");
$window->set_default_size (200, 200);
$window->signal_connect("delete_event" => sub {Gtk3->main_quit()});

# create a menu
my $menu = Glib::IO::Menu->new();
$menu->append("New", "app.new");

# set the menu as menu of the application
$app->set_app_menu($menu);

# create an action for the option "new" of the menu
my $new_action = Glib::IO::SimpleAction->new("new", "None");
# connect it to the callback function new_cb
$new_action->signal_connect("activate" => \&new_cb);
# add action to the application
$app->add_action($new_action);

# callback function for "new"
sub new_cb {
        print "This does nothing. It is only a demonstration.\n";
        }

# show the window and run the Application
$window -> show_all();
$app->run;

CODE END
 
Gesendet: Donnerstag, 17. März 2016 um 10:54 Uhr
Von: "Torsten Schönfeld" <kaffeetisch gmx de>
An: gtk-perl-list gnome org
Betreff: Re: GIO in Perl
You can also use the tool perli11ndoc, which comes with Glib::Object::Introspection, to view API docs in the Perl conventions for all *.gir files available on your installation.
_______________________________________________
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]