logo       

Re: question on glade/gtkperl application packaging: msg#00083

gnome.gtk+.perl

Subject: Re: question on glade/gtkperl application packaging

On Wed, 2002-05-15 at 12:12, Thomas Ledbetter wrote:
>
>
> I've been messin' around with gtk perl for awhile, and lately have
> been using Glade to design the interface. Its cool - but using Glade
> generates many files which make up the end application.
>
> I've seen how to write the interface in gtkperl directly, but its
> really nice to be able to use Glade to design the interface.
>
> Has any one had much success in _easily_ packing everything up into a
> single executable?
>
> There is a gtkperl application called 'frood' which I downloaded off
> of freshmeat, that was the best example of a distributed gtkperl
> application with a glade interface that I have seen - but it still
> required making a directory to store all the glade stuff in, determing
> where the directory was at runtime, etc..
>
> What is the best way to do package a gtkperl application that has had
> its interface created by glade?
>
>
> --
> ____________________________________________________________________
> Thomas Ledbetter GCS/MU
> tledbett@xxxxxxxxxxxxxx ULVS++++$
>
> L I N U X
>
> 'The apparent randomness with which the universe presents itself,
> is proof that it operates on an inherent higher order..'

I always love a challenge. The following is a single file Gtk version
of the classic Hello World program. I created the glade file with glade
and then slapped it on the end of a Perl file. The only downside to
this is that you have to merge the two files after any change.

<file name="hello_world.pl">
#!/usr/bin/perl

use strict;

use Gtk;
use Gtk::GladeXML;

our $glade = join '', <DATA>;

Gtk->init;

my $app = Gtk::GladeXML->new_from_memory($glade);
$app->signal_autoconnect_from_package('app');

Gtk->main;

package app;

sub on_main_window_destroy {
Gtk->main_quit;
}


package main;

__DATA__
<?xml version="1.0"?>
<GTK-Interface>

<project>
<name>Hello_world</name>
<program_name>hello_world</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>Perl</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
</project>

<widget>
<class>GtkWindow</class>
<name>main_window</name>
<signal>
<name>destroy</name>
<handler>on_main_window_destroy</handler>
<last_modification_time>Wed, 15 May 2002 16:21:50
GMT</last_modification_time>
</signal>
<title>Hello</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>

<widget>
<class>GtkLabel</class>
<name>label_hello</name>
<label>Hello World</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>

</GTK-Interface>
</file>

--
Today is Setting Orange the 62nd day of Discord in the YOLD 3168
Grudnuk demand sustenance!

Missile Address: 33:48:3.521N 84:23:34.786W


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise