Re: gtk2-perl / a script to help converting basic functions




On Fri, Oct 25, 2002 at 05:11:15PM +0200, Guillaume Cottenceau wrote:
With current gtk-perl, when perl destroys a Gtk::Window, it
automatically destroys the "actual" gtk window on the GUI. I like
this feature, it's logical and useful (because it's a toplevel
widget). If we do what you suggest, then we'd need to call
$window->destroy at the user level just before perl destroys the
Gtk::Window. This is another possibility, it's possible, but I
personally don't like it, I prefer it inside gtk2-perl, it's more
clean and more logical for the gtk2-perl users IMHO.

hmm,
if I do this:

sub x
{
  my $window = GTk2::Window->new;
  ...
  $window->show;
}


the $window variable is unreferenced and might get GCed at any 
time (won't it)? 
It may be bad style to code thtat way but I don't  think I like 
the supprise of the window disappearing when a perl variable get 
garbage collected.

I also think Daniel's suggestions about structs has it point
don't be afraid to refactor solutions that are not good.
Some struct may just as well implemented as hashes (if used
mostly from perl) and some would be better of in native format
(those created soley to be passed to libgtk+)

Also string where mentioned earlier,
Daniel is right in that using g_strdup as I
have done in a few palces is not too clever.
Better to copy it into a SvPV so perl can GC it.

It is late, and I probably missed something or 
misinterpreted some statement but that my 2 cents
for tonight.

/göran




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