From 474603498e0fe7e951b426abb245aa7d2fba0a20 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 18 Dec 2002 08:01:56 +0000 Subject: - gtk+-2 port is completed (switch from CList to TreeView) - gtk+-2 minor fixes (use new API rather than old one) - fix non wizard mode (add to frame not to window which is already full) - wizard mode is fixed by previous ugtk2 fix - simplify through MDK::Common --- perl-install/standalone/drakconnect | 47 ++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 4417a8d0e..739b2dc67 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -74,9 +74,9 @@ unless ($::isEmbedded) { $window1->{rwindow}->set_title(N("Network configuration (%d adapters)", @all_cards)); $window1->{rwindow}->set_size_request(500, 400); } -$window1->{rwindow}->border_width(10); +$window1->{rwindow}->set_border_width(10); my $vbox1 = new Gtk2::VBox(0,10); -$window1->{rwindow}->add($vbox1); +$window1->{window}->add($vbox1); my $hbox1 = new Gtk2::HBox(0,0); $vbox1->pack_start($hbox1,0,0,0); $hbox1->pack_start(new Gtk2::Label(N("Profile: ")),0,0,0); @@ -169,7 +169,7 @@ my $table1 = new Gtk2::Table(3,3, 0); $table1->set_border_width(5); $table1->set_row_spacings(5); $table1->set_col_spacings(5); -#$table1->border_width(10); +#$table1->set_border_width(10); $vbox_frame1->pack_start($table1,1,1,0); #attach(table, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding) #$table->attach($button[0], 0, 1, 0, 1, {expand=>1,fill=>1}, {expand=>1,fill=>1},0,0); @@ -224,16 +224,21 @@ $vbox1->pack_start($frame2,1,1,0); my $vbox2 = new Gtk2::VBox(0,0); $vbox2->set_border_width(5); $frame2->add($vbox2); -my $clist1 = Gtk2::CList->new_with_titles("", N("Interface"), N("IP address"), N("Protocol"), N("Driver"), N("State")); -$clist1->set_column_auto_resize($_,1) foreach (0..4); -$clist1->column_titles_passive(); -$clist1->set_shadow_type('etched_out'); -$vbox2->pack_start($clist1, 0, 0, 5); + +my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->OBJECT, map { Gtk2::GType->STRING } 2..6); +my $list = Gtk2::TreeView->new_with_model($tree_model); +$list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererPixbuf->new, 'pixbuf' => 0)); +each_index { $list->append_column(Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i + 1)) } (N("Interface"), N("IP address"), N("Protocol"), N("Driver"), N("State")); + +#TV $list->set_column_auto_resize($_,1) foreach (0..4); +#TV $list->column_titles_passive(); +#TV $list->set_shadow_type('etched_out'); +$vbox2->pack_start($list, 0, 0, 5); #$scrolled1->add_with_viewport($table2); my $ip_regexp = qr/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; -build_clist(); +build_list(); my $hbox3 = new Gtk2::HBox(0,0); my $button3 = new Gtk2::Button(N("Configure Local Area Network...")); @@ -327,7 +332,7 @@ dd: network::netconnect::intro('', $netcnx, $in); $in->exit(0); -sub build_clist { +sub build_list { foreach my $i (0..$#all_cards) { my ($ip, $state); if (-e "/sbin/ifconfig") { @@ -336,10 +341,8 @@ sub build_clist { $_ = `LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /sbin/ifconfig`; $state = /eth$i/ ? "up" : "down"; } else { $ip = $intf->{"eth$_"}{IPADDR}; $state = "n/a" } - $clist1->append("", "eth$i", $ip , $intf->{"eth$i"}{BOOTPROTO}, $all_cards[$i][1], $state); - $clist1->set_pixmap($i, 0, gtkcreate_img("eth_card_mini2.png")); - - $clist1->set_selectable($i, 0); + $tree_model->append_set(undef, [ map_index { $::i => $_ } (gtkcreate_pixbuf("eth_card_mini2.png"), "eth$i", $ip , $intf->{"eth$i"}{BOOTPROTO}, $all_cards[$i][1], $state) ])->free; +#TV $list->set_selectable($i, 0); } } @@ -370,10 +373,10 @@ sub update { $label4->set($netcnx->{type}); $label5->set($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:")); $label6->set($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE}); - $clist1->freeze(); - $clist1->clear(); - build_clist(); - $clist1->thaw(); +#TV $list->window->freeze(); +#TV $list->window->clear(); +#TV build_list(); +#TV $list->window->thaw(); $button_del->set_sensitive(network::netconnect::get_profiles() > 1); $isconnected != -1 or return 1; $label8->set($isconnected ? N("Connected") : N("Not connected")); @@ -441,7 +444,7 @@ Configure them first by clicking on 'Configure'")),1,1,0); $window->signal_connect(delete_event => sub { Gtk2->main_quit }); $window->set_position('center'); $window->set_title(N("LAN configuration")); - $window->border_width(10); + $window->set_border_width(10); my $vbox1 = new Gtk2::VBox(0,0); $window->add($vbox1); $vbox1->pack_start(new Gtk2::Label(N("LAN Configuration")),0,1,0); @@ -498,8 +501,8 @@ Configure them first by clicking on 'Configure'")),1,1,0); $vbox_local->pack_start(gtkpack__(new Gtk2::HBox(0,0), $widget_temp ),0,0,0); - # $clist1->append($_+1, "eth$_", $intf->{"eth$_"}{IPADDR}, $intf->{"eth$_"}{BOOTPROTO}, $all_cards[$_]->[1]); - # $clist1->set_selectable($_, 0); + # $list->append($_+1, "eth$_", $intf->{"eth$_"}{IPADDR}, $intf->{"eth$_"}{BOOTPROTO}, $all_cards[$_]->[1]); + # $list->set_selectable($_, 0); # require Data::Dumper; # print "------------\n" . Data::Dumper->Dump([$b],['b']) . "\n"; my $hbox_local = new Gtk2::HBox(0,0); @@ -573,7 +576,7 @@ Create one first by clicking on 'Configure'")),1,1,0); $window->signal_connect(delete_event => sub { Gtk2->main_quit }); $window->set_position('center'); $window->set_title(N("Internet connection configuration")); - $window->border_width(10); + $window->set_border_width(10); my $vbox1 = new Gtk2::VBox(0,0); $window->add($vbox1); $vbox1->pack_start(new Gtk2::Label(N("Internet Connection Configuration")),0,1,0); -- cgit v1.2.1