diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2002-09-03 22:11:11 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2002-09-03 22:11:11 +0000 |
commit | 62c8c551bd9f258a3b97ad0d554b4b3b3e4456d2 (patch) | |
tree | 89dcdb5bee789c4620c4f068f22bf8d63863ca02 /perl-install | |
parent | 130e60f3508fbf370afe189866183d528e535e34 (diff) | |
download | drakx-62c8c551bd9f258a3b97ad0d554b4b3b3e4456d2.tar drakx-62c8c551bd9f258a3b97ad0d554b4b3b3e4456d2.tar.gz drakx-62c8c551bd9f258a3b97ad0d554b4b3b3e4456d2.tar.bz2 drakx-62c8c551bd9f258a3b97ad0d554b4b3b3e4456d2.tar.xz drakx-62c8c551bd9f258a3b97ad0d554b4b3b3e4456d2.zip |
try to get rid of BEGIN but still be able to start up the install :-)
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/my_gtk.pm | 1 | ||||
-rw-r--r-- | perl-install/ugtk.pm | 25 |
2 files changed, 9 insertions, 17 deletions
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index e8454543d..f8cef32fe 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -29,7 +29,6 @@ $border = 5; sub new { my ($type, $title, %opts) = @_; - Gtk->init; Gtk->set_locale; my $o = bless { %opts }, $type; diff --git a/perl-install/ugtk.pm b/perl-install/ugtk.pm index 63c781ff2..dfac6d8f3 100644 --- a/perl-install/ugtk.pm +++ b/perl-install/ugtk.pm @@ -2,7 +2,7 @@ package ugtk; use diagnostics; use strict; -use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border); +use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border $use_pixbuf $use_imlib); @ISA = qw(Exporter); %EXPORT_TAGS = ( @@ -13,23 +13,16 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border); $EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ]; @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; -my $use_pixbuf; -my $use_imlib; -my $use_gnome; +use Gtk; -BEGIN { - unless ($::isInstall) { - eval { require Gtk; Gtk->init }; - eval { require Gtk::Gdk::Pixbuf; Gtk::Gdk::Pixbuf->init }; - } +unless ($::isInstall) { + !$ENV{DISPLAY} || system('/usr/X11R6/bin/xtest') and die "Cannot be run in console mode.\n"; + Gtk->init; + eval { require Gtk::Gdk::Pixbuf; Gtk::Gdk::Pixbuf->init }; $use_pixbuf = $@ ? 0 : 1; - eval { require Gtk::Gdk::ImlibImage; Gtk::Gdk::ImlibImage->init }; - $use_imlib = $@ ? 0 : 1; - eval { require Gnome }; - $use_gnome = $@ ? 0 : 1; } - -use Gtk; +eval { require Gtk::Gdk::ImlibImage; Gtk::Gdk::ImlibImage->init }; +$use_imlib = $@ ? 0 : 1; use c; use log; @@ -758,7 +751,7 @@ sub gtkcreate_xpm { sub gtkcreate_png_pixbuf { my ($f) = shift; - die 'gdk-pixbuf loibrary is unavaillable' unless ($use_pixbuf); + die 'gdk-pixbuf library is not available' unless ($use_pixbuf); $f =~ /\.png$/ or $f .= '.png'; if ($f !~ /^\//) { -e "$_/$f" and $f = "$_/$f", last foreach icon_paths() } Gtk::Gdk::Pixbuf->new_from_file($f) or die "gtkcreate_png: missing png file $f"; |