diff options
-rwxr-xr-x | gecko.pm | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/gecko.pm b/gecko.pm new file mode 100755 index 00000000..9a31756d --- /dev/null +++ b/gecko.pm @@ -0,0 +1,70 @@ +#!/usr/bin/perl -w + +# TITLE: Mozilla embedding +# REQUIRES: Gtk Mozilla +use POSIX qw(getenv); +use Gtk::MozEmbed; +use Locale::GetText; +use lib qw(/usr/lib/libDrakX); +use interactive; +use standalone; +use common qw(:common :file :functional :system); + +# unless you use a threaded perl, you need to run this app with: +# LD_PRELOAD=libpthread-0.9.so or something like that to make use of networking + +Gtk->set_locale; +init Gtk; + +system("LD_PRELOAD=libpthread.so ; export LD_PRELOAD"); + +$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/; +#my $in = vnew interactive('su'); +my $window = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel; +$window->set_default_size(600, 400); +$window->signal_connect('destroy', sub {Gtk->main_quit}); + +my $box1= new Gtk::VBox($false,0); + +my $event_box = new Gtk::EventBox(); +$box1->add($event_box); +$event_box->show(); + +my $embed_moz= new Gtk::MozEmbed; +#$embed_moz->load_url(shift || "https://www.mandrake.com"); +$embed_moz->render_data("hello world","/","text/html"); +$embed_moz->open_stream("/","text/html"); +$embed_moz->append_data("</html>\n</body>\nhello world\n</body>\n</html>\n"); +$embed_moz->close_stream(); +$event_box->add($embed_moz); +$embed_moz->show(); + +my $separator= new Gtk::HSeparator(); +$box1->pack_start($separator,$false,$false,0); +$separator->show(); + +my $box2=new Gtk::HBox($false,0); +$box1->pack_start($box2,$false,$false,0); +$box2->show(); + +my $button_next= new Gtk::Button("Next"); +$box2->pack_end($button_next,$false,$false,0); +$button_next->show(); + +my $button_prev= new Gtk::Button("Previous"); +$box2->pack_end($button_prev,$false,$false,0); +$button_prev->show(); + +my $button_skipwiz= new Gtk::Button("Skip Wizard"); +$button_skipwiz->signal_connect ( clicked => sub { Gtk->main_quit();}); +$box2->pack_start($button_skipwiz,$false,$false,0); +$button_skipwiz->show(); + + +$window->add($box1); + +$box1->show; +$window->show; + +main Gtk; +exit (0); |