From d0bc1a61790e16d4499b80539cf1561a45c75daf Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 21 Nov 2002 10:57:28 +0000 Subject: switch latest tools that still manually handle embedding to use my_gtk --- perl-install/standalone/drakTermServ | 34 ++++++++++++++++------------------ perl-install/standalone/drakbackup | 2 +- perl-install/standalone/drakconnect | 26 +++++++++++++------------- perl-install/standalone/drakfont | 32 ++++++++++++++------------------ perl-install/standalone/drakgw | 26 +++++++++++++------------- perl-install/standalone/net_monitor | 5 ++--- 6 files changed, 59 insertions(+), 66 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ index 55059bda1..ceb377387 100755 --- a/perl-install/standalone/drakTermServ +++ b/perl-install/standalone/drakTermServ @@ -37,7 +37,6 @@ # Michael Brown # -use Gtk; use lib qw(/usr/lib/libDrakX); use standalone; #- warning, standalone must be loaded very first, for 'explanations' @@ -201,13 +200,13 @@ x:5:respawn:/usr/X11R6/bin/X -ac -query $server_ip\n"; sub cursor_wait { # turn the cursor to a watch - $window1->window->set_cursor(new Gtk::Gdk::Cursor(150)); + $window1->{rwindow}->window->set_cursor(new Gtk::Gdk::Cursor(150)); Gtk->main_iteration while Gtk->events_pending; } sub cursor_norm { # restore normal cursor - $window1->window->set_cursor(new Gtk::Gdk::Cursor(68)); + $window1->{rwindow}->window->set_cursor(new Gtk::Gdk::Cursor(68)); Gtk->main_iteration while Gtk->events_pending; } @@ -231,16 +230,17 @@ sub display_error { sub interactive_mode { my $font_sel; # $interactive = 1; - init Gtk; - $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel; - $window1->signal_connect (delete_event => sub { Gtk->exit(0) }); - $window1->set_position(1); - $window1->set_title(N("Mandrake Terminal Server Configuration")); - $window1->set_border_width(5); + $window1 = my_gtk->new('drakTermServ'); + $window1->{rwindow}->signal_connect (delete_event => sub { my_gtk->exit(0) }); + unless ($::isEmbedded) { + $window1->{rwindow}->set_position(1); + $window1->{rwindow}->set_title(N("Mandrake Terminal Server Configuration")); + } + $window1->{rwindow}->set_border_width(5); my ($pix_user_map, $pix_user_mask) = gtkcreate_png("ic82-network-40"); my ($pix_u_map, $pix_u_mask) = gtkcreate_png("drakTS.620x57"); - gtkadd($window1, + gtkadd($window1->{window}, gtkpack_(new Gtk::VBox(0,2), if_(!$::isEmbedded, 0, new Gtk::Pixmap($pix_u_map, $pix_u_mask)), 1, gtkpack_(new Gtk::HBox(0,2), @@ -308,14 +308,12 @@ sub interactive_mode { ), ); $central_widget = \$main_box; - $window1->show_all; - $window1->realize; - $window1->show_all(); - - Gtk->main_iteration while Gtk->events_pending; - $::isEmbedded and kill 'USR2', $::CCPID; - Gtk->main; - Gtk->exit(0); + $window1->{rwindow}->show_all; + $window1->{rwindow}->realize; + $window1->{rwindow}->show_all(); + + $window1->main; + my_gtk->exit(0); } sub about { diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup index 1dc69b6c0..321a34418 100755 --- a/perl-install/standalone/drakbackup +++ b/perl-install/standalone/drakbackup @@ -4613,7 +4613,7 @@ sub interactive_mode { $my_win->{rwindow}->set_position(1); $my_win->{rwindow}->set_title(N("Drakbackup")); } - $my_win->{rwindow}->signal_connect (delete_event => sub { Gtk->exit(0) }); + $my_win->{rwindow}->signal_connect (delete_event => sub { my_gtk->exit(0) }); my ($pix_u_map, $pix_u_mask) = gtkcreate_png("drakbackup.540x57"); read_conf_file(); diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 7d5f5ac36..b8f880371 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -60,8 +60,6 @@ MDK::Common::Globals::init( ); $::isEmbedded && ref($in) =~ /gtk/ or goto dd; -require Gtk; -init Gtk; require my_gtk; import my_gtk qw(:helpers :wrappers); my $expert_mode = 0; @@ -70,14 +68,16 @@ any::load_category_no_message('net', undef); my @all_cards = network::ethernet::conf_network_card_backend ($netc, $intf, undef, undef, undef, undef); network::netconnect::load_conf($netcnx, $netc, $intf); -my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel; -$window1->signal_connect (delete_event => sub { Gtk->exit(0) }); -$window1->set_position(1); -$window1->set_title(N("Network configuration (%d adapters)", @all_cards)); -$window1->border_width(10); -$::isEmbedded or $window1->set_usize(500, 400); +my $window1 = my_gtk->new('drakconnect'); +$window1->{rwindow}->signal_connect (delete_event => sub { my_gtk->exit(0) }); +unless ($::isEmbedded) { + $window1->{rwindow}->set_position(1); + $window1->{rwindow}->set_title(N("Network configuration (%d adapters)", @all_cards)); + $window1->{rwindow}->set_usize(500, 400); +} +$window1->{rwindow}->border_width(10); my $vbox1 = new Gtk::VBox(0,10); -$window1->add($vbox1); +$window1->{rwindow}->add($vbox1); my $hbox1 = new Gtk::HBox(0,0); $vbox1->pack_start($hbox1,0,0,0); $hbox1->pack_start(new Gtk::Label(N("Profile: ")),0,0,0); @@ -316,13 +316,13 @@ $combo1->entry->signal_connect('changed', sub { $button_apply->set_sensitive(1); }); -$window1->show_all(); +$window1->{rwindow}->show_all(); $_->hide foreach ($button1, $button3); Gtk->main_iteration while Gtk->events_pending; $::isEmbedded and kill 'USR2', $::CCPID; my $tag = Gtk->timeout_add(4000, \&update2); -Gtk->main; -Gtk->exit(0); +$window1->main; +my_gtk->exit(0); dd: network::netconnect::intro('', $netcnx, $in); @@ -410,7 +410,7 @@ sub update2 { } sub quit_global { - $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0); + my_gtk->exit(0); } sub configure_lan { diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index f9b5e2ad6..998f8c706 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -78,11 +78,9 @@ # directory to install fonts /usr/X11R6/lib/X11/fonts/ # -->> /usr/X11R6/lib/X11/fonts/drakfont -use Gtk; use lib qw(/usr/lib/libDrakX ); -use standalone - ; #- warning, standalone must be loaded very first, for 'explanations' +use standalone; #- warning, standalone must be loaded very first, for 'explanations' use interactive; use my_gtk qw(:helpers :wrappers); @@ -618,18 +616,18 @@ sub display_error { sub interactive_mode { my $font_sel; $interactive = 1; - init Gtk; - my $window1 = - $::isEmbedded ? new Gtk::Plug($::XID) : new Gtk::Window -toplevel; - $window1->signal_connect( delete_event => sub { Gtk->exit(0) } ); - $window1->set_position(1); - $window1->set_title( N("Fonts Importation") ); - $window1->set_border_width(5); + my $window1 = my_gtk->new('drakfont'); + $window1->{rwindow}->signal_connect( delete_event => sub { my_gtk->exit(0) } ); + unless ($::isEmbedded) { + $window1->{rwindow}->set_position(1); + $window1->{rwindow}->set_title( N("Fonts Importation") ); + } + $window1->{rwindow}->set_border_width(5); my ( $pix_user_map, $pix_user_mask ) = gtkcreate_png("ic-drakfont-48"); my ( $pix_u_map, $pix_u_mask ) = gtkcreate_png("drakfont.620x57"); gtkadd( - $window1, + $window1->{window}, gtkpack_( new Gtk::VBox( 0, 2 ), if_( @@ -726,19 +724,17 @@ sub interactive_mode { ), ); $central_widget = \$font_sel; - $window1->show_all; + $window1->{rwindow}->show_all; $font_sel->set_page(1); $font_sel->cur_page->child->hide(); $font_sel->set_page(2); $font_sel->cur_page->child->hide(); $font_sel->set_page(0); - $window1->realize; + $window1->{rwindow}->realize; - # $window1->show_all(); - Gtk->main_iteration while Gtk->events_pending; - $::isEmbedded and kill 'USR2', $::CCPID; - Gtk->main; - Gtk->exit(0); + # $window1->{rwindow}->show_all(); + $window1->main; + my_gtk->exit(0); } sub about { diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw index 82dc9d310..053faac95 100755 --- a/perl-install/standalone/drakgw +++ b/perl-install/standalone/drakgw @@ -516,21 +516,23 @@ sub quit_global { } sub pur_gtk_mode { - require Gtk; - init Gtk; + require my_gtk; + import my_gtk qw(:helpers :wrappers); my $setup_state = $shorewall && $shorewall->{masquerade} ? ($shorewall->{disabled} ? N("The setup has already been done, but it's currently disabled.") : N("The setup has already been done, and it's currently enabled.")) : N("No Internet Connection Sharing has ever been configured."); - my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel; - $window1->signal_connect(delete_event => sub { Gtk->exit(0) }); - $window1->set_position(1); - $window1->set_title(N("Internet connection sharing configuration")); - $window1->border_width(10); + my $window1 = my_gtk->new('drakgw'); + $window1->{rwindow}->signal_connect(delete_event => sub { my_gtk->exit(0) }); + unless ($::isEmbedded) { + $window1->{rwindow}->set_position(1); + $window1->{rwindow}->set_title(N("Internet connection sharing configuration")); + } + $window1->{rwindow}->border_width(10); my $vbox1 = new Gtk::VBox(0,0); - $window1->add($vbox1); + $window1->{rwindow}->add($vbox1); my $hbox1 = new Gtk::HBox(0,0); $vbox1->pack_start($hbox1,1,1,0); my $label1 = new Gtk::Label( @@ -557,10 +559,8 @@ Click on Configure to launch the setup wizard.", $setup_state)); kill('USR1', $::CCPID); }); $bbox1->add($button_cancel); - $window1->show_all(); - Gtk->main_iteration while Gtk->events_pending; - $::isEmbedded and kill 'USR2', $::CCPID; - Gtk->main; - Gtk->exit(0); + $window1->{rwindow}->show_all(); + $window1->main; + my_gtk->exit(0); } diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor index d25d83fcc..2baf9114a 100755 --- a/perl-install/standalone/net_monitor +++ b/perl-install/standalone/net_monitor @@ -18,7 +18,6 @@ # 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 strict; @@ -49,7 +48,7 @@ my $in = 'interactive'->vnew('su', 'default'); my $window1 = my_gtk->new('net_monitor'); -$window1->{rwindow}->signal_connect(delete_event => sub { Gtk->exit(0) }); +$window1->{rwindow}->signal_connect(delete_event => sub { my_gtk->exit(0) }); $window1->{rwindow}->set_position(1); $window1->{rwindow}->set_title(N("Network Monitoring")); $window1->{rwindow}->set_policy(1, 1, 1); @@ -116,7 +115,7 @@ gtkadd($window1->{rwindow}, ? system('/usr/sbin/logdrake --file=/var/log/messages &') : system('/usr/X11R6/bin/xvt -e "tail -f /var/log/messages " &') }), - gtksignal_connect(my $button_close = new Gtk::Button(N("Close")), clicked => sub { Gtk->exit(0) }), + gtksignal_connect(my $button_close = new Gtk::Button(N("Close")), clicked => sub { my_gtk->exit(0) }), ) ) ) -- cgit v1.2.1