Giter Club home page Giter Club logo

gnome-gtk3's Introduction

gtk logo

Gnome Gtk3 - Widget toolkit for graphical interfaces

artistic-2.0

Documentation at this site has the GNU Free Documentation License.

Description

The purpose of this project is to create an interface to the GTK+ version 3 library.

History

There is already a bit of history for this package. It started off building the GTK::Glade package which soon became too big. So a part was separated into GTK::V3. After some working with the library I felt that the class names were a bit too long and that the words gtk and gdk were repeated too many times in the class path. E.g. there was GTK::V3::Gtk::GtkButton and GTK::V3::Gdk::GdkScreen to name a few. So, finally it was split into several other packages named, Gnome::N for the native linkup on behalf of any other Gnome modules, Gnome::Glib, Gnome::GObject, Gnome::Gdk3 and Gnome::Gtk3 according to what is shown on the developers page here. The classes in these packages are now renamed into e.g. Gnome::Gtk3::Button, Gnome::Gdk3::Screen, Gnome::GObject::Object and Gnome::Glib::List.

Note that all modules are now in :api<1> (as of 2024/4/5). This is done to prevent clashes with future distributions having the same class names only differing in this api string. So, add this string to your import statements and dependency modules of these classes in META6.json. Furthermore add this api string also when installing with zef.

Example

This example does the same as the example from GTK::Simple to show you the differences between the implementations. What immediately is clear is that this example is somewhat longer. To sum up;

Pros

  • The defaults of GTK+ are kept.
  • No fancy stuff like tapping into channels to run signal handlers.
  • Separation of callbacks from other code. Callbacks are always given to the routines as an object and a name. The name is the callback method which is defined in that object. Extra user data can be provided using named arguments to the callback setup.
  • The most common use of callback routines is for responding to events resulting from signals like button clicks, keyboard input and mouse events. To set a callback to handle events is by calling the register-signal() method.

Cons

  • The code is larger because it is more low level, that is, closer to the GTK+ api.
  • Code is somewhat slower. The setup of the example shown next is about 0.05 sec slower. That isn't much seen in the light that a user interface is mostly set up and drawn once.
  • More worrying is the compile time of a sufficient large application.
A screenshot of the example A screenshot of Gtk Simple

The code can be found down on the Getting Started page.

use v6.d;

use Gnome::Gtk3::Main:api<1>;
use Gnome::Gtk3::Window:api<1>;
use Gnome::Gtk3::Grid:api<1>;
use Gnome::Gtk3::Button:api<1>;

# Instantiate main module for UI control
my Gnome::Gtk3::Main $m .= new;


# Class to handle signals
class AppSignalHandlers {

  # Handle 'Hello World' button click
  method first-button-click ( :_widget($b1), :other-button($b2) ) {
    $b1.set-sensitive(False);
    $b2.set-sensitive(True);
  }

  # Handle 'Goodbye' button click
  method second-button-click ( ) {
    $m.gtk-main-quit;
 }

  # Handle window managers 'close app' button
  method exit-program ( ) {
    $m.gtk-main-quit;
  }
}

# Instantiate the event handler class and register signals
my AppSignalHandlers $ash .= new;


# Create buttons and disable the second one
with my Gnome::Gtk3::Button $second .= new(:label('Goodbye')) {
  .set-sensitive(False);
  .register-signal( $ash, 'second-button-click', 'clicked');
}

with my Gnome::Gtk3::Button $button .= new(:label('Hello World')) {
  .register-signal(
    $ash, 'first-button-click', 'clicked',  :other-button($second)
  );
}

# Create grid and add buttons to the grid
with my Gnome::Gtk3::Grid $grid .= new {
  .attach( $button, 0, 0, 1, 1);
  .attach( $second, 0, 1, 1, 1);
}

# Create a top level window and set a title among other things
with my Gnome::Gtk3::Window $top-window .= new {
  .set-title('Hello GTK!');
  .set-border-width(20);

  # Create a grid and add it to the window
  .add($grid);

  .register-signal( $ash, 'exit-program', 'destroy');

  # Show everything and activate all
  .show-all;
}

# Start the event loop
$m.gtk-main;

Documentation

TODO

Versions of involved software

  • Program is tested against the latest version of Raku on rakudo en moarvm. It is also necessary to have the (almost) newest compiler, because there are some code changes which made e.g. variable argument lists to the native subs possible. Older compilers cannot handle that (before summer 2019 I believe). Bugs come and go again. There was one the software had a problem with, which was ironed away just before Raku version 2020.10.

    Some steps to follow if you want to be at the top of things (but try the easy way first!). You need git to get software from the github site.

    1. Make a directory to work in e.g. Raku
    2. Go in that directory and run git clone https://github.com/rakudo/rakudo.git
    3. Then go into the created rakudo directory and read README.md and INSTALL.md
    4. Run perl Configure.pl --gen-moar --gen-nqp --backends=moar
    5. Run make test
    6. And run make install

    Subsequent updates of the Raku compiler and moarvm can be installed with

    1. Go into the rakudo directory
    2. Run git pull then repeat steps 4 to 6 from above

    Your path must then be set to the program directories where $Rakudo is your rakudo directory; ${PATH}:$Rakudo/install/bin:$Rakudo/install/share/perl6/site/bin

    After this, you will notice that the raku command is available next to perl6 so it is also a move forward in the renaming of perl6.

    The rakudo star installation must be removed, because otherwise there will be two raku compilers wanting to be the captain on your ship. Also all modules must be reinstalled of course and are installed at $Rakudo/install/share/perl6/site.

  • Gtk library used Gtk 3.24. The versioning of GTK+ is a bit different in that there is also a 3.90 and up. This is only meant as a prelude to version 4. So do not use those versions for the Raku packages.

Installation

The version of Raku must be at least 2020.10, otherwise a few tests will not run!

There are several dependencies from one package to the other because it was one package in the past. To get all packages, just install the Gnome::Gtk3 package and the rest will be installed with it.

zef install 'Gnome::Gtk3:api<1>'

Issues

There are always some problems! If you find one, please help by filing an issue at my github project.

Attribution

  • The inventors of Raku, formerly known as Perl 6, of course and the writers of the documentation which helped me out every time again and again.
  • The builders of the GTK+ library and the documentation.
  • I would like to thank the developers of the GTK::Simple project because of the information I got while reading the code. Also because one of the files is copied unaltered for which I did not had to think about to get that right. The examples in that project are also useful to compare code with each other and to see what is or is not possible.
  • Other helpful modules for their insight and use. E.g. the Cairo package of Timo.
  • Documentation from Wikibooks and Zetcode
  • Helpful hands are there when issues are raised, after requesting for help or developers returning ideas tips, etcetera for documentation; Pixlmixr, Hkdtam, JackKuhan, Alain Barbason, Clifton Wood, Rob Ransbottom, HΓ₯kon HΓ¦gland (some names are Github names).
  • Icons used from www.iconfinder.com, humility icons, Andy Fitzsimon, licensed GPL.
  • Prof Stewart Weiss, web address. On his site are numerous documents under which many about GTK+. I have used parts from these to explain many aspects of the user interface system.

Licenses

  • Raku code and pod documentation: Artistic License 2.0
  • Use of Gnome reference documentation: GNU Free Documentation License Version 1.3
  • Documentation from other external sources used in tutorials: Creative Commons Attribution-ShareAlike 4.0 International Public License

Author

Name: Marcel Timmerman Github account name: MARTIMM

Copyright

Β© 2019 - ∞ πŸ˜‰. Marcel Timmerman

gnome-gtk3's People

Contributors

martimm avatar ugexe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gnome-gtk3's Issues

Problem installing on older MacOS (10.11 El Capitan)

I haven't tried --force-build yet, but here's what I see so far:

$ ~/rakudo/rakudo-2021.06/zef/bin/zef install Gnome::Gtk3
===> Searching for: Gnome::Gtk3
===> Searching for missing dependencies: Gnome::N, Gnome::Glib, Gnome::GObject, Gnome::Gio, Gnome::Gdk3, Gnome::Cairo
===> Building: Gnome::N:ver<0.19.8>
[Gnome::N] Use of uninitialized value $!path of type Str in string context.
[Gnome::N] Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
[Gnome::N]   in block  at /Users/admin/.zef/tmp/gnome-native-0.19.8.tar.gz/gnome-native-0.19.8/Build.pm6 line 69
[Gnome::N] Use of uninitialized value element of type Str in string context.
[Gnome::N] Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
[Gnome::N]   in block  at /Users/admin/.zef/tmp/gnome-native-0.19.8.tar.gz/gnome-native-0.19.8/Build.pm6 line 69
[Gnome::N] The spawned command '' exited unsuccessfully (exit code: 1, signal: 0)
[Gnome::N]   in method map-installed-libraries at /Users/admin/.zef/tmp/gnome-native-0.19.8.tar.gz/gnome-native-0.19.8/Build.pm6 line 118
[Gnome::N]   in method build at /Users/admin/.zef/tmp/gnome-native-0.19.8.tar.gz/gnome-native-0.19.8/Build.pm6 line 11
[Gnome::N]   in block <unit> at -e line 1
===> Building [FAIL]: Gnome::N:ver<0.19.8>
Aborting due to build failure: Gnome::N:ver<0.19.8> (use --force-build to override)
admin@mbook:~/zef/bin(master)$ /Users/admin/.zef/tmp/gnome-native-0.19.8.tar.gz/gnome-native-0.19.8/Build.pm6
-bash: /Users/admin/.zef/tmp/gnome-native-0.19.8.tar.gz/gnome-native-0.19.8/Build.pm6: Permission denied

Note, I navigated to line 69 in /Users/admin/.zef/tmp/gnome-native-0.19.8.tar.gz/gnome-native-0.19.8/Build.pm6; there I found the line:

my Proc $p = run $ldconfig-path, '-vN', :out, :err;

I tried single-quoting $ldconfig-path to get around the error above, but still I couldn't get gnome-gtk3 to install.

crash when using threads on X11

Crashes may take place when starting a thread using .start-thread(). Errors vary like

[xcb] Unknown sequence number while processing reply
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.

or

[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.

Raku reacts with

raku: xcb_io.c:263: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.

Test case failures on debian 11 (bullseye)

Hello,

I managed to install Gnome::Gtk3 on my system, albeit with the --force-test option.

I got the following two errors:

===> Testing: Gnome::Glib:ver<0.20.6>
[Gnome::Glib] Cannot locate symbol 'g_prefix_error_literal' in native library 'libglib-2.0.so.0'
[Gnome::Glib]   in method setup at /home/chromisx/.rakubrew/versions/moar-2022.07/install/share/perl6/core/sources/A37F26876B58371B70EDD889AD69F064C90AC2C6 (NativeCall) line 319
[Gnome::Glib]   in method setup at /home/chromisx/.rakubrew/versions/moar-2022.07/install/share/perl6/core/sources/A37F26876B58371B70EDD889AD69F064C90AC2C6 (NativeCall) line 366
[Gnome::Glib]   in sub raku-nativecall at /home/chromisx/.rakubrew/versions/moar-2022.07/install/share/perl6/core/sources/A153F63283BF744FD66BF7212910E5F389384F6E (NativeCall::Dispatcher) line 46
[Gnome::Glib]   in method prefix-error-literal at /home/chromisx/.zef/tmp/Gnome%3A%3AGlib%3Aver%3C0.20.6%3E%3Aauth%3Ccpan%3AMARTIMM%3E.tar.gz/gnome-glib-0.20.6/lib/Gnome/Glib/Error.pm6 (Gnome::Glib::Error) line 482
[Gnome::Glib]   in block <unit> at t/Error.t line 71
[Gnome::Glib]     # dict entries: {'height': <200>, 'vd01': <-40>}
===> Testing [FAIL]: Gnome::Glib:ver<0.20.6>
[Gnome::Glib] Failed to get passing tests, but continuing with --force-test

Command pkg-config --modversion glib-2.0 emits 2.66.8 on my system.

The second error:

===> Testing: Gnome::Gtk3:ver<0.48.8>:auth<github:MARTIMM>
[Gnome::Gtk3] (AppChooser.t:601293): GLib-GIO-CRITICAL **: 07:17:17.274: g_app_info_get_commandline: assertion 'G_IS_APP_INFO (appinfo)' failed
[Gnome::Gtk3] Use of uninitialized value of type Str in string context.
[Gnome::Gtk3] Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
[Gnome::Gtk3]   in block  at t/AppChooser.t line 24
[Gnome::Gtk3] Use of uninitialized value element of type Str in string context.
[Gnome::Gtk3] Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
[Gnome::Gtk3]   in block  at t/AppChooser.t line 24
[Gnome::Gtk3]     # Failed test 'commandline for type 'text/plain' = '
[Gnome::Gtk3]     # at t/AppChooser.t line 24
[Gnome::Gtk3]     # You failed 1 test of 3
[Gnome::Gtk3] # Failed test 'Interface ...'
[Gnome::Gtk3] # at t/AppChooser.t line 21
[Gnome::Gtk3] # You failed 1 test of 2
===> Testing [FAIL]: Gnome::Gtk3:ver<0.48.8>:auth<github:MARTIMM>
[Gnome::Gtk3] Failed to get passing tests, but continuing with --force-test

Command pkg-config --modversion gtk+-3.0 emits 3.24.24 on my system.

This is on Rakudo v2022.07, running on debian 11.

Thanks for your time and effort that makes this module possible!

Regards,

Raymond.

Error installing Gnome::Gtk3 - Could not find Gnome::Gdk3::EventTypes

jkuan@local:x86_64-linux-gnu|11:47:18|[0 0]()$ zef install Gnome::Gtk3
===> Searching for: Gnome::Gtk3
===> Searching for missing dependencies: Gnome::N, Gnome::Glib, Gnome::GObject, Gnome::Gdk3
===> Building: Gnome::N:ver<0.13.5>
===> Building [OK] for Gnome::N:ver<0.13.5>
===> Testing: Gnome::N:ver<0.13.5>
===> Testing [OK] for Gnome::N:ver<0.13.5>
===> Testing: Gnome::Glib:ver<0.13.3>
===> Testing [OK] for Gnome::Glib:ver<0.13.3>
===> Testing: Gnome::GObject:ver<0.13.10>
===> Testing [OK] for Gnome::GObject:ver<0.13.10>
===> Testing: Gnome::Gdk3:ver<0.14.5>
===> Testing [OK] for Gnome::Gdk3:ver<0.14.5>
===> Testing: Gnome::Gtk3:ver<0.17.1>
===SORRY!===
Could not find Gnome::Gdk3::EventTypes at line 72 in:
    file#/home/jkuan/.zef/store/perl6-gnome-gtk3-0.17.1.tar.gz/perl6-gnome-gtk3-0.17.1
    file#/home/jkuan/.zef/store/perl6-gnome-gtk3-0.17.1.tar.gz/perl6-gnome-gtk3-0.17.1/lib
    file#/home/jkuan/.zef/store/perl6-gnome-native-0.13.5.tar.gz/perl6-gnome-native-0.13.5/lib
    file#/home/jkuan/.zef/store/perl6-gnome-glib-0.13.4.tar.gz/perl6-gnome-glib-0.13.4/lib
    file#/home/jkuan/.zef/store/perl6-gnome-gobject-0.13.10.tar.gz/perl6-gnome-gobject-0.13.10/lib
    file#/home/jkuan/.zef/store/perl6-gnome-gdk3-0.14.5.tar.gz/perl6-gnome-gdk3-0.14.5/lib
    inst#/home/jkuan/.perl6
    inst#/opt/rakudo-pkg/share/perl6/site
    inst#/opt/rakudo-pkg/share/perl6/vendor
    inst#/opt/rakudo-pkg/share/perl6
    ap#
    nqp#
    perl5#

It appears the correct type name is actually Gnome::Gdk3::EventType instead of Gnome::Gdk3::EventTypes ?

Could not find Gnome::Gtk3::Main

I'm working with raku as provided by the rakudo-moar-2020.12-01-linux-x86_64-gcc.tar.gz binary installation provided by radudo. Zef (e.g. "zef install Gnome::Gtk3") proceeds up to the point where these diagnostics are issued:

===> Testing [OK] for Gnome::GObject:ver<0.16.16.2>
===> Testing: Gnome::Gio:ver<0.5.3>
[Gnome::Gio] ===SORRY!=== Error while compiling /home/jim/.zef/store/gnome-gio-0.5.3.tar.gz/gnome-gio-0.5.3/t/SimpleAction.t
[Gnome::Gio] Could not find Gnome::Gtk3::Main in:
[Gnome::Gio] file#/home/jim/.zef/store/gnome-gio-0.5.3.tar.gz/gnome-gio-0.5.3
[Gnome::Gio] file#/home/jim/.zef/store/gnome-native-0.18.7.1.tar.gz/gnome-native-0.18.7.1
[Gnome::Gio] file#/home/jim/.zef/store/gnome-glib-0.18.2.tar.gz/gnome-glib-0.18.2
[Gnome::Gio] file#/home/jim/.zef/store/gnome-gobject-0.16.16.2.tar.gz/gnome-gobject-0.16.16.2
[Gnome::Gio] inst#/home/jim/.raku
[Gnome::Gio] inst#/home/jim/rakudo-moar-2020.12-01-linux-x86_64-gcc/share/perl6/site
[Gnome::Gio] inst#/home/jim/rakudo-moar-2020.12-01-linux-x86_64-gcc/share/perl6/vendor
[Gnome::Gio] inst#/home/jim/rakudo-moar-2020.12-01-linux-x86_64-gcc/share/perl6/core
[Gnome::Gio] ap#
[Gnome::Gio] nqp#
[Gnome::Gio] perl5#
[Gnome::Gio] Please note that a 'META6.json' file was found in '.', of which the 'provides' section was used to determine if a dependency is available or not. Perhaps you need to add 'Gnome::Gtk3::Main' in the section of that file? Or need to specify a directory that does not have a 'META6.json' file?
[Gnome::Gio] at /home/jim/.zef/store/gnome-gio-0.5.3.tar.gz/gnome-gio-0.5.3/t/SimpleAction.t:157
===> Testing [FAIL]: Gnome::Gio:ver<0.5.3>
Aborting due to test failure: Gnome::Gio:ver<0.5.3> (use --force-test to override)

Have you any suggestions? Raku reports its version as Rakudo v2020.12. Am I missing other prerequisites?

Ubuntu 20.04, failed test 'class is a 'text-button' at t/WidgetPath.t line 77

I am trying to install Gnome::Gtk3 on Ubuntu 20.04:

$ perl6 --version
Welcome to Rakudo(tm) v2020.11.
Implementing the Raku(tm) programming language v6.d.
Built on MoarVM version 2020.11.
$ zef install Gnome::Gtk3
===> Searching for: Gnome::Gtk3
===> Searching for missing dependencies: Gnome::N, Gnome::Glib, Gnome::Gio, Gnome::GObject, Gnome::Gdk3, Gnome::Cairo
===> Building: Gnome::N:ver<0.18.1.2>
===> Building [OK] for Gnome::N:ver<0.18.1.2>
===> Testing: Gnome::N:ver<0.18.1.2>
===> Testing [OK] for Gnome::N:ver<0.18.1.2>
===> Testing: Gnome::Glib:ver<0.17.2>
===> Testing [OK] for Gnome::Glib:ver<0.17.2>
===> Testing: Gnome::GObject:ver<0.16.15.1>
===> Testing [OK] for Gnome::GObject:ver<0.16.15.1>
===> Testing: Gnome::Gio:ver<0.5.1.1>
===> Testing [OK] for Gnome::Gio:ver<0.5.1.1>
===> Testing: Gnome::Cairo:ver<0.2.0>
===> Testing [OK] for Gnome::Cairo:ver<0.2.0>
===> Testing: Gnome::Gdk3:ver<0.17.1>
===> Testing [OK] for Gnome::Gdk3:ver<0.17.1>
===> Testing: Gnome::Gtk3:ver<0.34.2>
[Gnome::Gtk3]     # 
[Gnome::Gtk3]     #  Row  |  String
[Gnome::Gtk3]     # ------+-------------------
[Gnome::Gtk3]     #     0 | folder_pictures
[Gnome::Gtk3]     #     1 | network-workgroup
[Gnome::Gtk3]     #     2 | gnome-fs-directory-accept
[Gnome::Gtk3]     #     3 | desktop
[Gnome::Gtk3]     #     4 | start-here
[Gnome::Gtk3]     #     5 | stock_playlist
[Gnome::Gtk3]     #     6 | gnome-mime-x-directory-smb-workgroup
[Gnome::Gtk3]     #     7 | user-images
[Gnome::Gtk3]     #     8 | folder-saved-search
[Gnome::Gtk3]     #     9 | user-trash
[Gnome::Gtk3]     #    10 | user-bookmarks
[Gnome::Gtk3]     # 
[Gnome::Gtk3]     #  Row  | Number | String
[Gnome::Gtk3]     # ------+--------+-------------------
[Gnome::Gtk3]     #     0 |   4004 | dus
[Gnome::Gtk3]     #     1 |   1001 | duizend en een nacht
[Gnome::Gtk3]     #     2 |    555 | en een nieuwe entry
[Gnome::Gtk3]     #     3 |    123 | I am lost of words
[Gnome::Gtk3]     #     4 |   2002 | een beetje later
[Gnome::Gtk3]     #     5 |   1098 | #me too
[Gnome::Gtk3]     # 
[Gnome::Gtk3]     #  Row  | Number | String
[Gnome::Gtk3]     # ------+--------+-------------------
[Gnome::Gtk3] (TextTagTable.t:362717): Gtk-WARNING **: 20:34:06.863: A tag named 'my-tt' is already in the tag table.
[Gnome::Gtk3]     # 
[Gnome::Gtk3]     #  Row  | Number | String
[Gnome::Gtk3]     # ------+--------+-------------------
[Gnome::Gtk3]     #     0 |   9092 | the rain in spain...
[Gnome::Gtk3]     #     1 |   5005 | dus
[Gnome::Gtk3]     #   1:0 |      6 | en nog wat
[Gnome::Gtk3]     # 1:0:0 |    123 | uno dos tres
[Gnome::Gtk3]     # 1:0:1 |      7 | je kan me wat
[Gnome::Gtk3]     #   1:1 |      2 | the rain in spain... deel 3
[Gnome::Gtk3]     #   1:2 |      1 | the rain in spain... deel 2
[Gnome::Gtk3]     #     2 |   1001 | duizend en een nacht
[Gnome::Gtk3]     #   2:0 |      1 | wat zal ik nou weer eens tikken... deel 2
[Gnome::Gtk3]     #   2:1 |      2 | wat zal ik nou weer eens tikken... deel 3
[Gnome::Gtk3]     #   2:2 |    101 | one o one
[Gnome::Gtk3]     #   2:3 |      3 | en nog een zinnetje
[Gnome::Gtk3]     #     3 |   9091 | wat zal ik nou weer eens tikken...
[Gnome::Gtk3]     # 
[Gnome::Gtk3]     #  Row  | Number | String
[Gnome::Gtk3]     # ------+--------+-------------------
[Gnome::Gtk3]     # Failed test 'class is a 'text-button''
[Gnome::Gtk3]     # at t/WidgetPath.t line 77
[Gnome::Gtk3]     # expected: 'text-button'
[Gnome::Gtk3]     #      got: 'NativeCall::Types::Pointer<93956986005168>'
[Gnome::Gtk3]     # You failed 1 test of 23
[Gnome::Gtk3] # Failed test 'Manipulations'
[Gnome::Gtk3] # at t/WidgetPath.t line 30
[Gnome::Gtk3] # You failed 1 test of 2
===> Testing [FAIL]: Gnome::Gtk3:ver<0.34.2>
Aborting due to test failure: Gnome::Gtk3:ver<0.34.2> (use --force-test to override)

event signals have wrong signature

in Gnome::GObject::Signal to catch an Event signal, one of the handler arguments have a wrong type. This was changed to remove a dependency on Gnome::Gdk3. This does not work.

Programs crash with core dumps

Crashes take place with some tryout programs of mine. It has several widgets from buttons to treeviews, so rather complex already.

The error is sometimes like

***MEMORY-ERROR***: qa-manager.pl6[10858]: GSlice: assertion failed: sinfo->n_allocated > 0
Abort (core dumped)

This is a nasty error for which I do not yet have an answer, let alone a solution :-(

Cannot use classes as a parent class

Due to the way the classes are initialized, the classes cannot be inherited. Need to review the BUILD() routines. This will take some time though!

Zef can't find Gnome::Glib

also can't install GTK::Simple on x86_64 GNU/Linux with Rakudo 2020.01.1.

Zef seems to work fine otherwise.

Thanks for all your great work so far!

Can't connect to "scroll-event" signal

I can't figure out what I'm doing wrong here

use Gnome::Gtk3::Window;
use Gnome::Gtk3::Main;
use Gnome::Gtk3::Grid;
use Gnome::Gtk3::EventBox;
use Gnome::Gtk3::DrawingArea;
use Gnome::Gdk3::Events;
use Gnome::N::GlibToRakuTypes;

class Events {
	method on-scroll-event(N-GdkEventScroll $event --> gboolean) {
		say 'scrolled the mouse wheel at ', $event.x, ' ', $event.y;
	}
	method on-any-button-clicked(N-GdkEventButton $event) {
		say 'button clicked at ', $event.x, ' ', $event.y;
	}
}

my Gnome::Gtk3::Window $w .= new;
my Gnome::Gtk3::Grid $g .= new;
my Gnome::Gtk3::EventBox $eb .= new;
my Gnome::Gtk3::DrawingArea $da .= new;
$da.set-hexpand(True);
$da.set-vexpand(True);
my Events $e .= new;

$eb.register-signal($e, 'on-scroll-event', 'scroll-event');
$eb.register-signal($e, 'on-any-button-clicked', 'button-press-event');
$eb.add($da);
$g.attach($eb, 0, 0 , 1, 1);
$w.add($g);
$w.show-all;
Gnome::Gtk3::Main.new.main;

The regular button-press-event works just fine, but the scroll-event isnt getting recognized... What can I do to make it work?

Can't create signal for DrawingArea

use Gnome::Gtk3::DrawingArea;
use Gnome::Gtk3::Main;
use Gnome::Gtk3::Window;
use Gnome::Gtk3::Fixed;

my Gnome::Gtk3::Main $m .= new;
my Gnome::Gtk3::Window $top-window .= new;
my Gnome::Gtk3::Fixed $fixed .= new;
my Gnome::Gtk3::DrawingArea $draw .= new;


class AppSignalHandlers {
	method exit() { $m.main-quit; }

	method draw() {
             say 'drew';
        }
}
my AppSignalHandlers $ash .= new;

$top-window.register-signal($ash, 'exit', 'destroy');
$draw.register-signal($ash, 'draw', 'draw');

$top-window.add($fixed);
$fixed.put($draw, 0,0);

$top-window.show-all;
$m.main;

This code (which i put in a file test.raku) crashes right away and quits with the following error:

Unhandled exception: Too few positionals passed; expected 3 arguments but got 2
   at home#sources/F6AA9E9400E2588222D42E8EBDAC014B28828C6A (Gnome::GObject::Object):650  (/home/user/.raku/precomp/CC223920E11FB7316B7A8382326F9624B92C2B9E/F6/F6AA9E9400E2588222D42E8EBDAC014B28828C6A:w1)
 from core#sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall):595  (/usr/share/perl6/core/precomp/CC223920E11FB7316B7A8382326F9624B92C2B9E/94/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B:)
 from home#sources/B402161F1A1700B2A55800B42CCB62970438CA23 (Gnome::Gtk3::Main):825  (/home/user/.raku/precomp/CC223920E11FB7316B7A8382326F9624B92C2B9E/B4/B402161F1A1700B2A55800B42CCB62970438CA23:main)
 from test.raku:26  (<ephemeral file>:<unit>)
 from test.raku:1  (<ephemeral file>:<unit-outer>)
 from gen/moar/stage2/NQPHLL.nqp:1946  (/usr/share/nqp/lib/NQPHLL.moarvm:eval)
 from gen/moar/stage2/NQPHLL.nqp:2151  (/usr/share/nqp/lib/NQPHLL.moarvm:evalfiles)
 from gen/moar/stage2/NQPHLL.nqp:2081  (/usr/share/nqp/lib/NQPHLL.moarvm:command_eval)
 from gen/moar/Compiler.nqp:109  (/usr/share/perl6/lib/Perl6/Compiler.moarvm:command_eval)
 from gen/moar/stage2/NQPHLL.nqp:2036  (/usr/share/nqp/lib/NQPHLL.moarvm:command_line)
 from gen/moar/rakudo.nqp:127  (/usr/share/perl6/runtime/perl6.moarvm:MAIN)
 from gen/moar/rakudo.nqp:1  (/usr/share/perl6/runtime/perl6.moarvm:<mainline>)
 from <unknown>:1  (/usr/share/perl6/runtime/perl6.moarvm:<main>)
 from <unknown>:1  (/usr/share/perl6/runtime/perl6.moarvm:<entry>)

Any help on how to do this properly would be really appreciated

Failed during Testing: Gnome::Glib:ver<0.14.4>

Hi,

Thanks for your nice module.

I got the following errors during installation, not sure if it is because of my little aged environment .

===> Testing [OK] for Gnome::N:ver<0.13.8>
===> Testing: Gnome::Glib:ver<0.14.4>
[Gnome::Glib]     # .clear-error()
[Gnome::Glib]     # Failed test 'domain is 3; 3rd domain registration in this test'
[Gnome::Glib]     # at t/Error.t line 119
[Gnome::Glib]     # expected: '3'
[Gnome::Glib]     #      got: '4'
[Gnome::Glib]     # Failed test 'Failed to open file 'unknown-file.txt': No such file or directory'
[Gnome::Glib]     # at t/Error.t line 126
[Gnome::Glib]     # expected: 'Failed to open file \u201cunknown-file.txt\u201d: No such file or directory'
[Gnome::Glib]     #      got: 'Failed to open file 'unknown-file.txt': No such file or directory'
[Gnome::Glib]     # You failed 2 tests of 8
[Gnome::Glib] # Failed test 'A real error'
[Gnome::Glib] # at t/Error.t line 101
[Gnome::Glib] # You failed 1 test of 3
===> Testing [FAIL]: Gnome::Glib:ver<0.14.4>
Aborting due to test failure: Gnome::Glib:ver<0.14.4> (use --force-test to override)
name -a
Linux myhost 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
dpkg -l | fgrep gtk-3-dev
ii  libgtk-3-dev                                          3.10.8-0ubuntu1.6                                    amd64        development files for the GTK+ library

Thanks in advance for your help.

Can't connect to "draw" signal on inherited DrawingArea

use Gnome::Gtk3::Window;
use Gnome::Gtk3::Main;
use Gnome::Gtk3::Grid;
use Gnome::Gtk3::EventBox;
use Gnome::Gtk3::DrawingArea;
use Gnome::Gdk3::Events;
use Gnome::Cairo;
use Gnome::Cairo::Types;
use Gnome::Cairo::Enums;
use Gnome::N::GlibToRakuTypes;

class Events {
	method exit {
		Gnome::Gtk3::Main.new.quit;
	}
}

class DA is Gnome::Gtk3::DrawingArea {
	submethod new (|c) {
		self.bless(:GtkDrawingArea, |c);
	}
	submethod TWEAK {
		self.register-signal(self, 'on-draw', 'draw');
		self.set-hexpand(True);
		self.set-vexpand(True);
	}

	my gdouble $zero = 0e0;
	method on-draw(cairo_t $cr) {
		my Gnome::Cairo $surface .= new(:native-object($cr));

		given $surface {
			.set-source-rgb($zero, $zero, $zero);
			.set-line-width(2);
			.move-to(10,10);
			.line-to(30, 23);
			.stroke;
		}
	}
}

my Gnome::Gtk3::Window $w .= new;
my Gnome::Gtk3::Grid $g .= new;
my DA $da .= new;
my Events $e .= new;

$g.attach($da, 0, 0 , 1, 1);
$w.add($g);
$w.register-signal($e, 'exit', 'destroy');
$w.show-all;
Gnome::Gtk3::Main.new.main;

I have an example project here where I inherit from a DrawingArea, but when I try to register a signal to 'draw', I get an error:

Type check failed in binding to parameter '$instance'; expected N-GObject but got Any (Any)
  in method _convert_g_signal_connect_object at /home/me/.raku/sources/EFAA11A228A80867C7D458CBFF6093C5E29C743C (Gnome::GObject::Signal) line 159
  in block  at /home/me/.raku/sources/DE851E534AAABC702583A6B973705192647318EA (Gnome::GObject::Object) line 815
  in method register-signal at /home/me/.raku/sources/DE851E534AAABC702583A6B973705192647318EA (Gnome::GObject::Object) line 805
  in submethod TWEAK at testmain.raku line 23
  in submethod new at testmain.raku line 20
  in block <unit> at testmain.raku line 44

Any ideas on what I'm doing wrong?

How to go through each page in a GtkNotebook

my Gnome::Gtk3::Notebook $nb .= new;
... add pages ...
for ^$nb.get-n-pages -> $i {
	# replace grid with whatever you have
	my Gnome::Gtk3::Grid $contents .= new(:native-object($nb.get-nth-page($i)));
}

I can do this ↑ and it will technically work, but the problem is that it creates a new object - which doesn't know about any of the properties that are set (thus defeating the purpose of what I need).

So I guess what I'm really asking is: is there a way to get a gtk object without having to do .new. (maybe you can a -rk method to get-nth-page or something like that)

Returning True from delete-event signal doesn't leave window open

use Gnome::Gtk3::Main;
use Gnome::Gtk3::Window;

class Handlers {
	method on-close {
		say 'staying open';
		return True;
	}
}

my Gnome::Gtk3::Main $m .= new;
my Handlers $handler .= new;

given Gnome::Gtk3::Window.new {
  .set-size-request( 600, 300);
  .show-all;
  .register-signal($handler, 'on-close', 'delete-event');
}

$m.gtk-main;

The window here should stay open when the X button is pressed, but it doesn't...

It doesn't work when I return 1 either.

According to ↓ you should be able to cancel the delete event by returning True

Also, delete-event takes a GdkEvent argument that isn't accepted.

I'm not sure where you implemented this signal so idk where to go and make the necessary edits myself.

packages getting larger and slower

Packages are growing and with that, they get slower to load. Mainly the Gnome::Gtk3 package is large. Also, tests are taking a long time to finish.

Installing Gnome::Gtk3 on Windows 10, MSYS2 : Cannot locate native library '(null)': error 0x7e

I have installed Gtk3 for windows MSYS2 as described here. In the MSYS2 terminal window:

$ perl6 --version
This is Rakudo version 2020.01 built on MoarVM version 2020.01.1
implementing Perl 6.d.

$  pkg-config --libs gtk+-3.0
-L/mingw64/lib -L/mingw64/lib/../lib -L/mingw64/lib -lgtk-3 -lgdk-3 -lz -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lepoxy -lopengl32 -lgdi32 -lpangocairo-1.0 -lm -lgdi32 -lpangoft2-1.0 -lm -lpangowin32-1.0 -lm -lusp10 -lgdi32 -lpango-1.0 -lm -lfribidi -lthai -ldatrie -latk-1.0 -lcairo-gobject -lcairo -lz -lpixman-1 -lm -pthread -lfontconfig -liconv -lexpat -lfreetype -lbz2 -lharfbuzz -lm -lusp10 -lgdi32 -lrpcrt4 -ldwrite -lgraphite2 -lbrotlidec -lbrotlicommon -lpng16 -lz -lgdk_pixbuf-2.0 -lm -lgio-2.0 -pthread -lintl -lshlwapi -ldnsapi -liphlpapi -lws2_32 -lgmodule-2.0 -pthread -lintl -lz -lgobject-2.0 -pthread -lintl -lffi -lglib-2.0 -lintl -lws2_32 -lole32 -lwinmm -lshlwapi -pthread -lm -lpcre

$ ls  /mingw64/lib/libglib*
/mingw64/lib/libglib-2.0.a  /mingw64/lib/libglib-2.0.dll.a

$ ls  /mingw64/include/glib-2.0/glib.h
/mingw64/include/glib-2.0/glib.h

$ zef install Gnome::Gtk3
===> Searching for: Gnome::Gtk3
===> Updating cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan1.json
===> Searching for missing dependencies: Gnome::N, Gnome::Glib, Gnome::Gio, Gnome::GObject, Gnome::Gdk3, Gnome::Cairo
===> Building: Gnome::N:ver<0.18.1.2>
===> Building [OK] for Gnome::N:ver<0.18.1.2>
===> Testing: Gnome::N:ver<0.18.1.2>
===> Testing [OK] for Gnome::N:ver<0.18.1.2>
===> Testing: Gnome::Glib:ver<0.17.2>
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in sub test-call-without-natobj at C:\msys64\home\hakon\.zef\store\gnome-native-0.18.1.2.tar.gz\gnome-native-0.18.1.2\lib\Gnome\N\X.pm6 (Gnome::N::X) line 140
[Gnome::Glib]   in method FALLBACK at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\Quark.pm6 (Gnome::Glib::Quark) line 113
[Gnome::Glib]   in block <unit> at t\Error.t line 25
[Gnome::Glib] Died
[Gnome::Glib]   in method FALLBACK at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\Quark.pm6 (Gnome::Glib::Quark) line 104
[Gnome::Glib]   in block <unit> at t\Error.t line 25
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in method set-class-info at C:\msys64\home\hakon\.zef\store\gnome-native-0.18.1.2.tar.gz\gnome-native-0.18.1.2\lib\Gnome\N\TopLevelClassSupport.pm6 (Gnome::N::TopLevelClassSupport) line 273
[Gnome::Glib]   in submethod BUILD at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\List.pm6 (Gnome::Glib::List) line 146
[Gnome::Glib]   in block <unit> at t\List.t line 15
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in sub test-call-without-natobj at C:\msys64\home\hakon\.zef\store\gnome-native-0.18.1.2.tar.gz\gnome-native-0.18.1.2\lib\Gnome\N\X.pm6 (Gnome::N::X) line 140
[Gnome::Glib]   in method FALLBACK at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\Quark.pm6 (Gnome::Glib::Quark) line 113
[Gnome::Glib]   in block <unit> at t\Quark.t line 20
[Gnome::Glib] Died
[Gnome::Glib]   in method FALLBACK at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\Quark.pm6 (Gnome::Glib::Quark) line 104
[Gnome::Glib]   in block <unit> at t\Quark.t line 20
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in method set-class-info at C:\msys64\home\hakon\.zef\store\gnome-native-0.18.1.2.tar.gz\gnome-native-0.18.1.2\lib\Gnome\N\TopLevelClassSupport.pm6 (Gnome::N::TopLevelClassSupport) line 273
[Gnome::Glib]   in submethod BUILD at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\SList.pm6 (Gnome::Glib::SList) line 145
[Gnome::Glib]   in block <unit> at t\Slist.t line 12
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in method set-class-info at C:\msys64\home\hakon\.zef\store\gnome-native-0.18.1.2.tar.gz\gnome-native-0.18.1.2\lib\Gnome\N\TopLevelClassSupport.pm6 (Gnome::N::TopLevelClassSupport) line 273
[Gnome::Glib]   in submethod BUILD at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\Variant.pm6 (Gnome::Glib::Variant) line 502
[Gnome::Glib]   in block <unit> at t\Variant.t line 20
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in method set-class-info at C:\msys64\home\hakon\.zef\store\gnome-native-0.18.1.2.tar.gz\gnome-native-0.18.1.2\lib\Gnome\N\TopLevelClassSupport.pm6 (Gnome::N::TopLevelClassSupport) line 273
[Gnome::Glib]   in submethod BUILD at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\VariantBuilder.pm6 (Gnome::Glib::VariantBuilder) line 94
[Gnome::Glib]   in block <unit> at t\VariantBuilder.t line 22
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in submethod BUILD at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\VariantType.pm6 (Gnome::Glib::VariantType) line 147
[Gnome::Glib]   in sub g_variant_parse at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\Variant.pm6 (Gnome::Glib::Variant) line 3501
[Gnome::Glib]   in submethod BUILD at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\Variant.pm6 (Gnome::Glib::Variant) line 492
[Gnome::Glib]   in block <unit> at t\VariantIter.t line 33
[Gnome::Glib] Cannot locate native library '(null)': error 0x7e
[Gnome::Glib]   in method setup at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 298
[Gnome::Glib]   in sub  at C:\rakudo\share\perl6\core\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 594
[Gnome::Glib]   in submethod BUILD at C:\msys64\home\hakon\.zef\store\gnome-glib-0.17.2.tar.gz\gnome-glib-0.17.2\lib\Gnome\Glib\VariantType.pm6 (Gnome::Glib::VariantType) line 147
[Gnome::Glib]   in block <unit> at t\VariantType.t line 15
===> Testing [FAIL]: Gnome::Glib:ver<0.17.2>
===> Updated cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan1.json
===> Updating p6c mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/p6c1.json
===> Updated p6c mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/p6c1.json
Aborting due to test failure: Gnome::Glib:ver<0.17.2> (use --force-test to override)

native types are not always used properly

There was some misunderstanding about which type to use when it comes to e.g. int, GType, long, etc. These can be 2 or 4 bytes depending on the used processor in 32/64 bit architectures. I have sometimes fixed it by using int32 instead of just int. It turns out that most of the time the software runs alright but may fail on other systems because of this.

Container.get-children causes application to freeze

whenever I call get-children on a container node (grid, list, etc) my entire program freezes...

heres a small sample project (from the demo projects) with a get-children attached.
Once the window opens click on the top button and the program will freeze.

use Gnome::Gtk3::Main;
use Gnome::Gtk3::Window;
use Gnome::Gtk3::Button;
use Gnome::Gtk3::Grid;

#instantiate main module for UI control 
my Gnome::Gtk3::Main $m .= new;
#create grid
my Gnome::Gtk3::Grid $grid .= new;

# A callback handler class to respond to signals
class AppSignalHandlers {
	method exit-program() { $m.gtk-main-quit; }

	method first-button-click ( :widget($b1), :other-button($b2) ) {
		$b1.set-sensitive(False);
		$b2.set-sensitive(True);
		say $grid.get-children;
	}
	method second-button-clicked() { $m.gtk-main-quit; }
}

#create a top level window and set a title
my Gnome::Gtk3::Window $top-window .= new;
$top-window.set-border-width(20);
$top-window.set-title("Example");

$top-window.add($grid);
# create button
#my Gnome::Gtk3::Button $button1 .= new(:label('Exit program'));
#my Gnome::Gtk3::Button $button2 .= new(:label('also Exit program'));
my Gnome::Gtk3::Button $button1 .= new(:label('hello world'));
my Gnome::Gtk3::Button $button2 .= new(:label('goodbye'));
#disable second button
$button2.set-sensitive(False);

# add buttons to the grid
$grid.attach($button1, 0,0,2,1);
$grid.attach($button2, 0, 1, 1, 1);


# set up signal event handler
my AppSignalHandlers $ash .= new;
$top-window.register-signal($ash, 'exit-program', 'destroy');
$button1.register-signal($ash, 'first-button-click', 'clicked', :other-button($button2));
$button2.register-signal($ash, 'second-button-clicked', 'clicked');

# show everything and activate
$top-window.gtk-widget-show-all;

$m.gtk-main;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.