From 8a7b44844b82c613bc8ca70d2cae3a9a98dd2bb6 Mon Sep 17 00:00:00 2001 From: Damien Chaumette Date: Sun, 17 Aug 2003 14:52:56 +0000 Subject: allow hostname change in mcc perl_checker --- perl-install/standalone/drakconnect | 49 +++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index b261bb876..599cf168c 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -18,7 +18,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - +use strict; +use diagnostics; use lib qw(/usr/lib/libDrakX); @@ -185,10 +186,14 @@ $window1->{window}->add( 0, $button_new, ), ), - 0, gtkpack_(Gtk2::HBox->new(0,0), - 0, new Gtk2::Label(N("Hostname: ")), - 0, $label_host = new Gtk2::Label($hostname), - ), + 0, gtkpack_(Gtk2::HBox->new(1,0), + 0, gtkpack_(Gtk2::HBox->new(0,0), + 0, new Gtk2::Label(N("Hostname: ")), + 0, $label_host = new Gtk2::Label($hostname), + ), + 0, gtksignal_connect(Gtk2::Button->new(N("Configure hostname...")), + clicked => \&configure_hostname), + ), 0, gtkadd(Gtk2::Frame->new(N("Internet access")), gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 5), 1, gtkset_border_width(create_packtable({ col_spacings => 5, row_spacings => 5 }, @@ -372,6 +377,40 @@ sub quit_global() { ugtk2->exit(0); } +sub configure_hostname() { + my $window = _create_dialog(N("Hostname configuration"), { small => 1 }); + + $window->set_border_width(10); + $window->vbox->pack_start(new Gtk2::Label(N("Hostname configuration")), 1, 1, 0); + $window->vbox->pack_start(my $hbox = new Gtk2::HBox(0,0), 1, 0, 0); + $hbox->set_border_width(10); + $hbox->pack_start(new Gtk2::Label(N("Hostname")), 0, 1, 0); + $hbox->pack_start(my $entry = Gtk2::Entry->new_with_text($netc->{HOSTNAME}), 0, 1, 0); + + $window->action_area->pack_start(gtkpack(Gtk2::HButtonBox->new, + gtksignal_connect(Gtk2::Button->new(N("Cancel")), + clicked => sub { $window->destroy; Gtk2->main_quit }), + ), + 1, 1, 0, + ); + + $window->action_area->pack_start(gtkpack(Gtk2::HButtonBox->new, + gtksignal_connect(Gtk2::Button->new(N("Ok")), + clicked => sub { + $netc->{HOSTNAME} = $entry->get_text || "localhost"; + network::sethostname($netc); + update(); + $window->destroy; Gtk2->main_quit + }), + ), + 1, 1, 0, + ); + + $window->show_all; + $window->run; + return; +} + sub configure_lan() { my $window = _create_dialog(N("LAN configuration"), { small => 1 }); my @card_tab; -- cgit v1.2.1