[749] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: Gtk & Perl

daemon@ATHENA.MIT.EDU (Kenneth Albanowski)
Sun Aug 17 14:27:45 1997

Date: Sun, 17 Aug 1997 13:59:43 -0400 (EDT)
From: Kenneth Albanowski <kjahds@kjahds.com>
To: "Shawn T. Amundson" <amundson@CompleteIS.com>
cc: gtk-list@redhat.com
In-Reply-To: <Pine.GSO.3.95.970817112312.19168A-100000@riker>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

On Sun, 17 Aug 1997, Shawn T. Amundson wrote:

> Something like the below is *much* better for Perl:

You misunderstand. I _want_ something like you show, but the way arguments
are supported by Gtk, the code can only be writted as I showed (at least
without severely more work then should be expected.)

> use Glib; # Exports g_print, etc.

I've avoided Glib entirely (figuring that everything should be translated
directly into Perl) and Gdk is in the Gtk::Gdk namespace, to avoid
cluttering the root.

> use Gtk;  # Only exports GtkMainLoop()

I'm not exporting anything. :-)

> my $app = new Gtk::Application;

I've not added any convenience functions, so if Gtk doesn't have a
gtk_application_new, then I don't either. At the moment, anyhow.

> my $window = $app->Window(
>                           -user_data    => undef,
>                           -type         => 0,
>                           -title        => 'hello world',
>                           -allow_grow   => 0,
>                           -allow_shrink => 0,
>                           -border_width => 10
>                          );
> 
> my $button = $app->Button( # Should allow $window->Button to rid -parent arg
>                           -label       => 'hello world',
>                           -sig_clicked => sub { g_print "hello world\n"; },
>                           -parent      => $window,
>                           -visible     => 1
>                          );

I probably could support this sort of sub-allocation
($app->Window()->Button) with some AUTOLOAD trickery. 


> $window->show;
>
> GtkMainLoop $app;
> 
> > 
> > I'll mail you a copy -- it's not too large.
> > 
> 
> Please me too.  I'd recommend letting the whole list at it for a week or
> so before you put it up on CPAN.  ;-)

Done. I don't have anywhere to upload it (save CPAN), so I'll mail it at
request.

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)


--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post