#!/usr/bin/perl -w

=head1 #temp comment this out, this is on the metal, no glade file, much code for not much GUI
#but still less than in C for the same thing...
		use Gtk2 -init;
         # Gtk2->init; works if you didn't use -init on use
         my $window = Gtk2::Window->new ('toplevel');
         my $button = Gtk2::Button->new ('Quit');
         $button->signal_connect (clicked => sub { Gtk2->main_quit });
         $window->add ($button);
         $window->show_all;
         Gtk2->main;
=cut

# note -- for this to work in perl, you have to use the libglade save format in glade 3.x
#further, unlike most tutorials, you have to set the main window visible in glade, or write code to
#show it (I did the former here).  Also, one has to define the sub gtk_main_quit as it's not free like in 
# the C interface.  Other than those, the same glade layout works in either perl or C, pretty cool, could
# be better, but not so bad either.

#test with gui file from glade

 use Gtk2 -init;
  use Gtk2::GladeXML;
  
    sub gtk_main_quit
  {
        Gtk2->main_quit;
  }
  
  $gladexml = Gtk2::GladeXML->new('gtktut1.glade') or die "Couldn't load  glade file: $!\n";
  $gladexml->signal_autoconnect_from_package('main'); # hook to signals named right
#  $quitbtn = $gladexml->get_widget('Quit'); # from web, but not needed in this case for the regular X on mainwindow
  Gtk2->main;
  
  

