summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/any.pm8
-rw-r--r--perl-install/install_gtk.pm16
-rw-r--r--perl-install/install_steps_gtk.pm14
-rw-r--r--perl-install/install_steps_interactive.pm6
-rw-r--r--perl-install/interactive_gtk.pm4
-rw-r--r--perl-install/my_gtk.pm16
6 files changed, 37 insertions, 27 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 2b2f2b4b8..2b65ca7c4 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -28,11 +28,15 @@ sub face2xpm {
my ($face, $prefix) = @_;
facesdir($prefix) . $face . ".xpm";
}
+sub face2png {
+ my ($face, $prefix) = @_;
+ facesdir($prefix) . $face . ".png";
+}
sub facesnames {
my ($prefix) = @_;
my $dir = facesdir($prefix);
my @l = grep { /^[A-Z]/ } all($dir);
- grep { -e "$dir/$_.png" } map { /(.*)\.xpm/ } @l ? @l : all($dir);
+ grep { -e "$dir/$_.png" } map { /(.*)\.xpm/ } (@l ? @l : all($dir));
}
sub addKdmIcon {
@@ -675,7 +679,7 @@ sub ask_users {
{ label => _("Password (again)"), val => \$u->{password2}, hidden => 1 },
{ label => _("Shell"), val => \$u->{shell}, list => [ shells($prefix) ], not_edit => !$::expert, advanced => 1 },
if_($security <= 3,
- { label => _("Icon"), val => \$u->{icon}, list => [ facesnames($prefix) ], icon2f => sub { face2xpm($_[0], $prefix) }, format => \&translate },
+ { label => _("Icon"), val => \$u->{icon}, list => [ facesnames($prefix) ], icon2f => sub { face2png($_[0], $prefix) }, format => \&translate },
),
],
) or return;
diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm
index 4e189c2d0..2a28ef1fd 100644
--- a/perl-install/install_gtk.pm
+++ b/perl-install/install_gtk.pm
@@ -102,7 +102,7 @@ sub create_help_window {
$w->{rwindow}->set_usize($::helpwidth, $::helpheight);
$w->sync;
}
- my $pixmap = gtkxpm($w->{window}, "$ENV{SHARE_PATH}/help.xpm");
+ my $pixmap = gtkpng("$ENV{SHARE_PATH}/help.png");
gtkadd($w->{window},
gtkpack_(new Gtk::HBox(0,-2),
0, gtkadd(gtksignal_connect(new Gtk::Button, clicked => sub { create_big_help($o) }), $pixmap),
@@ -137,11 +137,9 @@ sub create_steps_window {
my $darea = new Gtk::DrawingArea;
my $in_button;
my $draw_pix = sub {
- my $pixmap = Gtk::Gdk::Pixmap->create_from_xpm($darea->window,
- $darea->style->bg('normal'),
- $_[0]) or die;
+ my ($map, $mask) = gtkcreate_png($_[0]);
$darea->window->draw_pixmap ($darea->style->bg_gc('normal'),
- $pixmap, 0, 0,
+ $map, 0, 0,
($darea->allocation->[2]-$PIX_W)/2 + ($o->{meta_class} eq 'firewall' ? 3 : 0),
($darea->allocation->[3]-$PIX_H)/2,
$PIX_W , $PIX_H );
@@ -150,7 +148,7 @@ sub create_steps_window {
my $f = sub {
my ($type) = @_;
my $color = $step->{done} ? 'green' : $step->{entered} ? 'orange' : 'red';
- "$ENV{SHARE_PATH}/step-$color$type.xpm";
+ "$ENV{SHARE_PATH}/step-$color$type.png";
};
$darea->set_usize($PIX_W+($o->{meta_class} eq 'firewall' ? 3 : 0),$PIX_H);
$darea->set_events(['exposure_mask', 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]);
@@ -190,10 +188,10 @@ sub create_logo_window {
$w->{rwindow}->set_usize($::logowidth, $::logoheight);
$w->{rwindow}->set_name("logo");
$w->show;
- my $file = $o->{meta_class} eq 'desktop' ? "logo-mandrake-Desktop.xpm" : "logo-mandrake.xpm";
- $o->{meta_class} eq 'firewall' and $file = "logo-mandrake-Firewall.xpm";
+ my $file = $o->{meta_class} eq 'desktop' ? "logo-mandrake-Desktop.png" : "logo-mandrake.png";
+ $o->{meta_class} eq 'firewall' and $file = "logo-mandrake-Firewall.png";
-r $file or $file = "$ENV{SHARE_PATH}/$file";
- -r $file and gtkadd($w->{window}, gtkxpm($w->{window}, $file));
+ -r $file and gtkadd($w->{window}, gtkpng($file));
$o->{logo_window} = $w;
}
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index 145b56159..f77945e07 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -283,18 +283,18 @@ sub choosePackagesTree {
$go->grab_focus;
$w->{rwindow}->show_all;
- my $pix_base = [ gtkcreate_xpm($w->{window}, "$ENV{SHARE_PATH}/rpm-base.xpm") ];
- my $pix_selected = [ gtkcreate_xpm($w->{window}, "$ENV{SHARE_PATH}/rpm-selected.xpm") ];
- my $pix_unselect = [ gtkcreate_xpm($w->{window}, "$ENV{SHARE_PATH}/rpm-unselected.xpm") ];
- my $pix_semisele = [ gtkcreate_xpm($w->{window}, "$ENV{SHARE_PATH}/rpm-semiselected.xpm") ];
- my $pix_installed= [ gtkcreate_xpm($w->{window}, "$ENV{SHARE_PATH}/rpm-installed.xpm") ];
+ my $pix_base = [ gtkcreate_png("$ENV{SHARE_PATH}/rpm-base.png") ];
+ my $pix_selected = [ gtkcreate_png("$ENV{SHARE_PATH}/rpm-selected.png") ];
+ my $pix_unselect = [ gtkcreate_png("$ENV{SHARE_PATH}/rpm-unselected.png") ];
+ my $pix_semisele = [ gtkcreate_png("$ENV{SHARE_PATH}/rpm-semiselected.png") ];
+ my $pix_installed= [ gtkcreate_png("$ENV{SHARE_PATH}/rpm-installed.png") ];
my $add_parent; $add_parent = sub {
$_[0] or return undef;
if (my $w = $wtree{$_[0]}) { return $w }
my $s; foreach (split '/', $_[0]) {
my $s2 = $s ? "$s/$_" : $_;
- $wtree{$s2} ||= do {
+ $wtree{$s2} ||= do {
my $n = $tree->insert_node($s ? $add_parent->($s) : undef, undef, [$_, '', ''], 5, (undef) x 4, 0, 0);
$n;
};
@@ -343,7 +343,7 @@ sub choosePackagesTree {
);
$toolbar->set_button_relief("none");
foreach (grep_index { $::i % 2 == 0 } @toolbar) {
- gtksignal_connect($toolbar->append_item(undef, $toolbar{$_}[0], undef, gtkxpm($tree, "$ENV{SHARE_PATH}/$_.xpm")),
+ gtksignal_connect($toolbar->append_item(undef, $toolbar{$_}[0], undef, gtkpng("$ENV{SHARE_PATH}/$_.png")),
clicked => $toolbar{$_}[1]);
}
$toolbar->set_style("icons");
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index fad149732..260ee774a 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -526,9 +526,9 @@ sub chooseGroups {
val => sub { \$val{$_} },
icon2f => sub {
my $f = "/usr/share/icons/" . ($o->{compssUsersIcons}{$_} || 'default');
- -e "$f.xpm" or $f .= "_section";
- -e "$f.xpm" or $f = '/usr/share/icons/default_section';
- "$f.xpm";
+ -e "$f.png" or $f .= "_section";
+ -e "$f.png" or $f = '/usr/share/icons/default_section';
+ "$f.png";
},
label => sub { translate($_) . ($size{$_} ? sprintf " (%d%s)", $size{$_}, _("MB") : '') },
},
diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm
index 85d894041..69140aad9 100644
--- a/perl-install/interactive_gtk.pm
+++ b/perl-install/interactive_gtk.pm
@@ -314,7 +314,7 @@ sub ask_from_entries_refW {
gtkdestroy($e->{icon});
my $f = $e->{icon2f}->($_[0]);
$e->{icon} = -e $f ?
- gtkxpm($mainw->{window}, $f) :
+ gtkpng($f) :
new Gtk::Label(may_apply($e->{format}, $_[0]));
$w->add($e->{icon});
$e->{icon}->show;
@@ -388,7 +388,7 @@ sub ask_from_entries_refW {
{ e => $e, w => $w, real_w => $real_w || $w, expand => $expand,
get => $get || sub { ${$e->{val}} }, set => $set || sub {},
- icon_w => -e $e->{icon} ? gtkxpm($mainw->{window}, $e->{icon}) : '' };
+ icon_w => -e $e->{icon} ? gtkpng($e->{icon}) : '' };
};
@widgets_always = map_index { $create_widget->($_, $::i ) } @$l;
@widgets_advanced = map_index { $create_widget->($_, $::i + @$l) } @$l2;
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm
index 1f878e52d..69c0d1b95 100644
--- a/perl-install/my_gtk.pm
+++ b/perl-install/my_gtk.pm
@@ -10,13 +10,14 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border);
@ISA = qw(Exporter);
%EXPORT_TAGS = (
helpers => [ qw(create_okcancel createScrolledWindow create_menu create_notebook create_packtable create_hbox create_vbox create_adjustment create_box_with_title create_treeitem) ],
- wrappers => [ qw(gtksignal_connect gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtksetstyle gtkappend gtkadd gtkput gtktext_insert gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkcreate_xpm) ],
+ wrappers => [ qw(gtksignal_connect gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtksetstyle gtkappend gtkadd gtkput gtktext_insert gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkpng gtkcreate_xpm gtkcreate_png) ],
ask => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_file) ],
);
$EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ];
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
use Gtk;
+use Gtk::Gdk::ImlibImage;
use c;
use log;
use common qw(:common :functional :file);
@@ -33,6 +34,7 @@ sub new {
my ($type, $title, %opts) = @_;
Gtk->init;
+ init Gtk::Gdk::ImlibImage;
Gtk->set_locale;
my $o = bless { %opts }, $type;
$o->_create_window($title);
@@ -262,14 +264,20 @@ sub gtkctree_children {
@l;
}
-sub gtkcreate_xpm {
- my ($w, $f) = @_;
+sub gtkcreate_xpm {
+ my ($w, $f) = @_;
my @l = Gtk::Gdk::Pixmap->create_from_xpm($w->window, $w->style->bg('normal'), $f) or die "gtkcreate_xpm: missing pixmap file $f";
@l;
}
+sub gtkcreate_png {
+ my ($f) = @_;
+ my $im = load_image Gtk::Gdk::ImlibImage("$f");
+ $im->render($im->rgb_width, $im->rgb_height);
+ ($im->move_image(), $im->move_mask);
+}
sub xpm_d { my $w = shift; Gtk::Gdk::Pixmap->create_from_xpm_d($w->window, undef, @_) }
sub gtkxpm { new Gtk::Pixmap(gtkcreate_xpm(@_)) }
-
+sub gtkpng { new Gtk::Pixmap (gtkcreate_png(@_)) }
#-###############################################################################
#- createXXX functions