diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-11-09 16:13:43 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-11-09 16:13:43 +0000 |
commit | c8d3d628f583cfff6ae70571bf8e184e70bf8578 (patch) | |
tree | c4f33337a68abb9dc8229b1da9254bc33024a975 /perl-install | |
parent | 6c4f139fc9f80fc7f2da9d21718a7e6b617c541c (diff) | |
download | drakx-backup-do-not-use-c8d3d628f583cfff6ae70571bf8e184e70bf8578.tar drakx-backup-do-not-use-c8d3d628f583cfff6ae70571bf8e184e70bf8578.tar.gz drakx-backup-do-not-use-c8d3d628f583cfff6ae70571bf8e184e70bf8578.tar.bz2 drakx-backup-do-not-use-c8d3d628f583cfff6ae70571bf8e184e70bf8578.tar.xz drakx-backup-do-not-use-c8d3d628f583cfff6ae70571bf8e184e70bf8578.zip |
basic port from Gtk-1.2.x to Gtk+-2.x
Diffstat (limited to 'perl-install')
-rwxr-xr-x | perl-install/share/theme-editor.pl | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/perl-install/share/theme-editor.pl b/perl-install/share/theme-editor.pl index fb505bca9..74bd760be 100755 --- a/perl-install/share/theme-editor.pl +++ b/perl-install/share/theme-editor.pl @@ -18,16 +18,16 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -use Gtk; + use lib qw(/usr/lib/libDrakX); -use my_gtk qw(:helpers :wrappers); + use common; +use ugtk2 qw(:all); #- languages that can't be displayed with gtk1, so we unset translations #- for them until this tool is ported to gtk2 if ($ENV{LANGUAGE} =~ /\b(ar|he|hi|ta)/) { $ENV{LANGUAGE} = "C" }; -init Gtk; if ("@ARGV" =~ /-h/) { print q(DrakX theme editor by dam's. @@ -42,12 +42,11 @@ my ($file) = "@ARGV" =~ /-f (.+)/; my ($file2) = "@ARGV" =~ /-o (.+)/; $file ||= "themes-mdk.rc"; $file2 ||= $file; -my $window1 = new Gtk::Window -toplevel; -$window1->signal_connect ( delete_event => sub { Gtk->exit(0); }); +my $window1 = new Gtk2::Window -toplevel; +$window1->signal_connect ( delete_event => sub { Gtk2->exit(0); }); $window1->set_title(N("Theme editor")); -$window1->set_policy(0, 1, 0); $window1->set_border_width(5); -gtkadd($window1, my $vb = new Gtk::VBox(0,5)); +gtkadd($window1, my $vb = new Gtk2::VBox(0,5)); $window1->show_all; $window1->realize; my $f; @@ -69,47 +68,47 @@ foreach (cat_($file)) { my ($a1, $a2) = ($1, $2); my $style2 = $style; if ($do_style) { - $cpt == 0 and gtkpack__($vb, $hb = new Gtk::HBox(0,5)); + $cpt == 0 and gtkpack__($vb, $hb = new Gtk2::HBox(0,5)); $cpt++; $cpt == 4 and $cpt = 0; gtkpack__($hb, - gtkadd(gtkset_shadow_type($f = new Gtk::Frame(" $style "), 'etched_out'), - $vb2 = gtkset_border_width(new Gtk::VBox(0,5),5) + gtkadd(gtkset_shadow_type($f = new Gtk2::Frame(" $style "), 'etched_out'), + $vb2 = gtkset_border_width(new Gtk2::VBox(0,5),5) ) ); $do_style = 0; } - my $c =my_gtk::gtkcolor($3*65535, $4*65535, $5*65535); + my $c =ugtk2::gtkcolor($3*65535, $4*65535, $5*65535); $color{$style}{$1}{$2} = $c; - my $gc = new Gtk::Gdk::GC($window1->window); + my $gc = new Gtk2::Gdk::GC($window1->window); $gc->set_foreground($c); gtkpack__($vb2, - gtkpack_(new Gtk::HBox(0,0), - 1, gtkpack__(new Gtk::HBox(0,0),"$1 [$2] : "), - 0, gtksignal_connect(gtkset_relief(my $b = new Gtk::Button(), 'none'), clicked => sub { + gtkpack_(new Gtk2::HBox(0,0), + 1, gtkpack__(new Gtk2::HBox(0,0),"$1 [$2] : "), + 0, gtksignal_connect(gtkset_relief(my $b = new Gtk2::Button(), 'none'), clicked => sub { $c = change_color($c); $gc->set_foreground($c); $color{$style2}{$a1}{$a2} = $c; - $_[0]->draw(undef); + $_[0]->queue_draw; }) ) ); - $b->add(gtksignal_connect(gtksize(gtkset_usize(new Gtk::DrawingArea(), 60, 20), 60, 20), expose_event => sub{ $_[0]->window->draw_rectangle ($gc, 1, 0, 0, 60, 20)} )); + $b->add(gtksignal_connect(gtksize(gtkset_size_request(new Gtk2::DrawingArea(), 60, 20), 60, 20), expose_event => sub{ $_[0]->window->draw_rectangle ($gc, 1, 0, 0, 60, 20)} )); } /\{/ and $ref++; if (/\}/) { $ref--; $ref == 0 and undef $style } } gtkpack__($vb, - gtkadd(gtkset_layout(new Gtk::HButtonBox, -end), - gtksignal_connect(new Gtk::Button(N("OK")), clicked => sub { doit(); Gtk->main_quit() }), - gtksignal_connect(new Gtk::Button(N("Cancel")), clicked => sub { Gtk->main_quit() }), + gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'end'), + gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { doit(); Gtk2->main_quit() }), + gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { Gtk2->main_quit() }), ) ); -$window1->set_position(1); +$window1->set_position('center'); $window1->show_all; -Gtk->main; -Gtk->exit(0); +Gtk2->main; +Gtk2->exit(0); sub doit { system("rm -f /tmp/plop"); @@ -140,26 +139,26 @@ sub doit { sub change_color { my ($color) = @_; - my $window = new Gtk::Window -toplevel; + my $window = new Gtk2::Window -toplevel; my $doit; - $window->signal_connect ( delete_event => sub { Gtk->main_quit() }); - $window->set_position(1); + $window->signal_connect ( delete_event => sub { Gtk2->main_quit() }); + $window->set_position('center'); $window->set_title(N("Color configuration")); $window->set_border_width(5); gtkadd(gtkset_modal($window,1), - gtkpack_(new Gtk::VBox(0,5), - 1, my $colorsel = new Gtk::ColorSelection, - 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -end), - gtksignal_connect(new Gtk::Button(N("OK")), clicked => sub { $doit=1; Gtk->main_quit() }), - gtksignal_connect(new Gtk::Button(N("Cancel")), clicked => sub { Gtk->main_quit() }), + gtkpack_(new Gtk2::VBox(0,5), + 1, my $colorsel = new Gtk2::ColorSelection, + 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'end'), + gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { $doit=1; Gtk2->main_quit() }), + gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { Gtk2->main_quit() }), ) ) ); - $colorsel->set_color($color->red()/65535, $color->green()/65535, $color->blue()/65535, $color->pixel()); + $colorsel->set_current_color($color); $window->show_all(); - Gtk->main; + Gtk2->main; $window->destroy(); $doit or return $color; - my (@color) = $colorsel->get_color(); - my_gtk::gtkcolor($color[0]*65535, $color[1]*65535, $color[2]*65535); + my (@color) = $colorsel->get_current_color(); + ugtk2::gtkcolor($color[0]*65535, $color[1]*65535, $color[2]*65535); } |