diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-11-07 16:57:13 +0100 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-11-24 11:00:40 +0100 |
commit | 4a4453328a1a2051307f44e6c1c200625666ba16 (patch) | |
tree | 9fb9eb5089abd561cf1c857e448e3c63fcc4465e /bin | |
parent | 7bf101337af175668274aaae14b6320a5224f480 (diff) | |
download | drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar.gz drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar.bz2 drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar.xz drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.zip |
switch from gtk2 to gtk3
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/drakconnect | 2 | ||||
-rwxr-xr-x | bin/drakconnect-old | 88 | ||||
-rwxr-xr-x | bin/drakfirewall | 2 | ||||
-rwxr-xr-x | bin/drakhosts | 44 | ||||
-rwxr-xr-x | bin/drakids | 38 | ||||
-rwxr-xr-x | bin/drakinvictus | 10 | ||||
-rwxr-xr-x | bin/draknetprofile | 42 | ||||
-rwxr-xr-x | bin/draknfs | 58 | ||||
-rwxr-xr-x | bin/drakproxy | 2 | ||||
-rwxr-xr-x | bin/draksambashare | 218 | ||||
-rwxr-xr-x | bin/net_applet | 46 | ||||
-rwxr-xr-x | bin/net_monitor | 30 |
12 files changed, 290 insertions, 290 deletions
diff --git a/bin/drakconnect b/bin/drakconnect index 4f58840..72d24aa 100755 --- a/bin/drakconnect +++ b/bin/drakconnect @@ -33,7 +33,7 @@ use modules; require_root_capability(); -$ugtk2::wm_icon = "drakconnect"; +$ugtk3::wm_icon = "drakconnect"; my $in = 'interactive'->vnew; my $net = {}; diff --git a/bin/drakconnect-old b/bin/drakconnect-old index e53ffe8..10d5a0b 100755 --- a/bin/drakconnect-old +++ b/bin/drakconnect-old @@ -28,14 +28,14 @@ BEGIN { unshift @::textdomains, 'drakx-net' } use standalone; #- warning, standalone must be loaded very first, for 'explanations' use common; use interactive; -use ugtk2 qw(:create :dialogs :helpers :wrappers); -use mygtk2 qw(gtknew); +use ugtk3 qw(:create :dialogs :helpers :wrappers); +use mygtk3 qw(gtknew); use network::netconnect; use network::connection::ethernet; require_root_capability(); -$ugtk2::wm_icon = "drakconnect"; +$ugtk3::wm_icon = "drakconnect"; my $in = 'interactive'->vnew; my $net = {}; @@ -44,8 +44,8 @@ my $modules_conf = modules::any_conf->read; my @all_cards; -my $window1 = ugtk2->new(N("Network configuration (%d adapters)", scalar @all_cards)); -$window1->{rwindow}->signal_connect(delete_event => sub { ugtk2->exit(0) }); +my $window1 = ugtk3->new(N("Network configuration (%d adapters)", scalar @all_cards)); +$window1->{rwindow}->signal_connect(delete_event => sub { ugtk3->exit(0) }); unless ($::isEmbedded) { $window1->{rwindow}->set_position('center'); $window1->{rwindow}->set_size_request(-1, -1); @@ -57,11 +57,11 @@ my $button_apply; my $hostname = chomp_(`hostname`); -my $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", map { "Glib::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)); +my $tree_model = Gtk3::TreeStore->new("Gtk3::Gdk::Pixbuf", map { "Glib::String" } 2..6); +my $list = Gtk3::TreeView->new_with_model($tree_model); +$list->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererPixbuf->new, 'pixbuf' => 0)); each_index { - $list->append_column(my $col = Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i + 1)); + $list->append_column(my $col = Gtk3::TreeViewColumn->new_with_attributes($_, Gtk3::CellRendererText->new, 'text' => $::i + 1)); $col->set_sort_column_id($::i); } (N("Interface"), N("IP address"), N("Protocol"), N("Driver"), N("State")); @@ -76,11 +76,11 @@ update_list($modules_conf); my $label_host; $window1->{window}->add( - gtkpack__(Gtk2::VBox->new(0,10), - gtkpack(Gtk2::HBox->new, - Gtk2::Label->new(N("Hostname: ")), - $label_host = Gtk2::Label->new($hostname), - gtksignal_connect(Gtk2::Button->new(N("Configure hostname...")), + gtkpack__(Gtk3::VBox->new(0,10), + gtkpack(Gtk3::HBox->new, + Gtk3::Label->new(N("Hostname: ")), + $label_host = Gtk3::Label->new($hostname), + gtksignal_connect(Gtk3::Button->new(N("Configure hostname...")), clicked => sub { local ($::isWizard, $::Wizard_finished) = (1, 1); eval { # For wizcancel @@ -95,26 +95,26 @@ $window1->{window}->add( ), ), gtkadd(gtkcreate_frame(N("LAN configuration")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 5), + gtkpack_(gtkset_border_width(Gtk3::VBox->new(0,0), 5), 0, $list, - 0, Gtk2::HBox->new(0,0), - 0, gtkpack_(Gtk2::HBox->new(0, 0), - 0, gtksignal_connect(Gtk2::Button->new(N("Configure Local Area Network...")), + 0, Gtk3::HBox->new(0,0), + 0, gtkpack_(Gtk3::HBox->new(0, 0), + 0, gtksignal_connect(Gtk3::Button->new(N("Configure Local Area Network...")), clicked => \&configure_lan), ), ) ), - gtkpack(Gtk2::HButtonBox->new, - gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { + gtkpack(Gtk3::HButtonBox->new, + gtksignal_connect(Gtk3::Button->new(N("Help")), clicked => sub { run_program::raw({ detach => 1 }, 'drakhelp', '--id', 'internet-connection') }), - $button_apply = gtksignal_connect(gtkset_sensitive(Gtk2::Button->new(N("Apply")), 0), + $button_apply = gtksignal_connect(gtkset_sensitive(Gtk3::Button->new(N("Apply")), 0), clicked => \&apply), - gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => \&quit_global), - gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { + gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => \&quit_global), + gtksignal_connect(Gtk3::Button->new(N("Ok")), clicked => sub { if ($button_apply->get('sensitive')) { my $dialog = _create_dialog(N("Please wait")); gtkpack($dialog->vbox, - Gtk2::Label->new(N("Please Wait... Applying the configuration"))); + Gtk3::Label->new(N("Please Wait... Applying the configuration"))); $dialog->show_all; gtkflush(); apply(); @@ -132,10 +132,10 @@ $window1->{window}->add( $window1->{rwindow}->show_all; gtkflush(); $window1->main; -ugtk2->exit(0); +ugtk3->exit(0); sub quit_global() { - ugtk2->exit(0); + ugtk3->exit(0); } sub get_intf_status { @@ -174,11 +174,11 @@ sub configure_lan() { my @card_tab; if (@all_cards < 1) { - $window->vbox->add(Gtk2::Label->new(N("You do not have any configured interface. + $window->vbox->add(Gtk3::Label->new(N("You do not have any configured interface. Configure them first by clicking on 'Configure'"))); gtkpack(gtkset_layout($window->action_area, 'end'), - gtksignal_connect(Gtk2::Button->new(N("Ok")), - clicked => sub { Gtk2->main_quit }) + gtksignal_connect(Gtk3::Button->new(N("Ok")), + clicked => sub { Gtk3->main_quit }) ); $window->show_all; $window->run; @@ -188,8 +188,8 @@ Configure them first by clicking on 'Configure'"))); $window->set_border_width(10); gtkpack($window->vbox, - Gtk2::Label->new(N("LAN Configuration")), - my $notebook = Gtk2::Notebook->new, + Gtk3::Label->new(N("LAN Configuration")), + my $notebook = Gtk3::Notebook->new, ); foreach (0..$#all_cards) { @@ -198,9 +198,9 @@ Configure them first by clicking on 'Configure'"))); $card_tab[2*$_] = \@infos; $card_tab[2*$_+1] = \@conf_data; - my $vbox_local = Gtk2::VBox->new(0,0); + my $vbox_local = Gtk3::VBox->new(0,0); $vbox_local->set_border_width(10); - $vbox_local->pack_start(Gtk2::Label->new(N("Adapter %s: %s", $_+1 , $all_cards[$_][0])),1,1,0); + $vbox_local->pack_start(Gtk3::Label->new(N("Adapter %s: %s", $_+1 , $all_cards[$_][0])),1,1,0); # Eth${_}Hostname = $netc->{HOSTNAME} # Eth${_}HostAlias = " . do { $netc->{HOSTNAME} =~ /([^\.]*)\./; $1 } . " # Eth${_}Driver = $all_cards[$_]->[1] @@ -214,22 +214,22 @@ Configure them first by clicking on 'Configure'"))); [ N("DHCP client"), \$net->{ifcfg}{$interface}{DHCP_CLIENT} ] ); my $i = 0; - my $size_group = Gtk2::SizeGroup->new('horizontal'); + my $size_group = Gtk3::SizeGroup->new('horizontal'); foreach my $j (@conf_data) { - my $l = Gtk2::Label->new($j->[0]); + my $l = Gtk3::Label->new($j->[0]); $l->set_justify('left'); - $infos[2*$i] = gtkpack_(Gtk2::HBox->new, + $infos[2*$i] = gtkpack_(Gtk3::HBox->new, 1, $l); $vbox_local->pack_start($infos[2*$i], 1, 1, 0); my $c; if (defined $j->[2]) { - $c = Gtk2::ComboBox->new_text; + $c = Gtk3::ComboBox->new_text; $c->set_popdown_strings(@{$j->[2]}); $infos[2*$i+1] = $c->entry; $infos[2*$i]->pack_start($c,0,0,0); } else { - $infos[2*$i+1] = ($c = Gtk2::Entry->new); + $infos[2*$i+1] = ($c = Gtk3::Entry->new); $infos[2*$i]->pack_start($infos[2*$i+1],0,0,0); } $size_group->add_widget($c); @@ -239,7 +239,7 @@ Configure them first by clicking on 'Configure'"))); my $widget_temp; if (-e "/etc/sysconfig/network-scripts/ifcfg-$interface") { - $widget_temp = gtksignal_connect(Gtk2::Button->new(get_intf_status($interface)), + $widget_temp = gtksignal_connect(Gtk3::Button->new(get_intf_status($interface)), clicked => sub { system("/sbin/if" . (ethisup($interface) ? "down" : "up") . " $interface"); $_[0]->set_label(get_intf_status($interface)); @@ -248,23 +248,23 @@ Configure them first by clicking on 'Configure'"))); } else { $widget_temp = N("This interface has not been configured yet.\nRun the \"%s\" assistant from the Mageia Linux Control Center", N("Set up a new network interface (LAN, ISDN, ADSL, ...)")); } - $vbox_local->pack_start(gtkpack__(Gtk2::HBox->new(0,0), + $vbox_local->pack_start(gtkpack__(Gtk3::HBox->new(0,0), $widget_temp ),0,0,0); # $list->append($_+1, $interface, $intf->{$interface}{IPADDR}, $intf->{$interface}{BOOTPROTO}, $all_cards[$_]->[1]); # $list->set_selectable($_, 0); - $notebook->append_page($vbox_local, Gtk2::Label->new($interface)); + $notebook->append_page($vbox_local, Gtk3::Label->new($interface)); } my $exit_dialogsub = sub { $window->destroy; - Gtk2->main_quit; + Gtk3->main_quit; }; gtkpack($window->action_area, - gtksignal_connect(Gtk2::Button->new(N("Cancel")), + gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => $exit_dialogsub), - gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { + gtksignal_connect(Gtk3::Button->new(N("Ok")), clicked => sub { foreach (0..$#all_cards) { my @infos = @{$card_tab[2*$_]}; each_index { ${$_->[1]} = $infos[2*$::i+1]->get_text } @{$card_tab[2*$_+1]}; diff --git a/bin/drakfirewall b/bin/drakfirewall index 9679cf9..358b9f6 100755 --- a/bin/drakfirewall +++ b/bin/drakfirewall @@ -24,7 +24,7 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla use interactive; use network::drakfirewall; -$ugtk2::wm_icon = "/usr/share/mcc/themes/default/firewall-mdk.png"; +$ugtk3::wm_icon = "/usr/share/mcc/themes/default/firewall-mdk.png"; common::require_root_capability(); diff --git a/bin/drakhosts b/bin/drakhosts index 627533b..1b53b68 100755 --- a/bin/drakhosts +++ b/bin/drakhosts @@ -26,9 +26,9 @@ use strict; use common; use network::network; -$ugtk2::wm_icon = 'IC-Dhost-48'; -use mygtk2 qw(gtknew); -use ugtk2 qw(:ask :wrappers :create :dialogs); +$ugtk3::wm_icon = 'IC-Dhost-48'; +use mygtk3 qw(gtknew); +use ugtk3 qw(:ask :wrappers :create :dialogs); use constant FALSE => 0; @@ -43,10 +43,10 @@ use constant NUM_COLUMNS => 3; require_root_capability(); -my %size_groups = map { $_ => Gtk2::SizeGroup->new('horizontal') } qw(label widget); +my %size_groups = map { $_ => Gtk3::SizeGroup->new('horizontal') } qw(label widget); my $label_and_widgets = sub { my ($label, $widget) = @_; - gtkpack_(Gtk2::HBox->new(0,5), + gtkpack_(Gtk3::HBox->new(0,5), 0, gtkadd_widget($size_groups{label}, gtknew('Label_Left', text => $label)), 1, gtkadd_widget($size_groups{widget}, $widget), ); @@ -82,7 +82,7 @@ sub add_modify_entry { undef $i; undef $iter; - $_ = Gtk2::Entry->new foreach $ip, $hostname, $alias; + $_ = Gtk3::Entry->new foreach $ip, $hostname, $alias; # test if modify or add a host @@ -160,7 +160,7 @@ sub remove_entry { sub create_model() { get_host_data(); - my $model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String"); + my $model = Gtk3::ListStore->new("Glib::String", "Glib::String", "Glib::String"); foreach my $a (@listhosts) { my $iter = $model->append; $model->set($iter, @@ -176,7 +176,7 @@ sub create_model() { sub add_columns { my $treeview = shift; each_index { - my $renderer = Gtk2::CellRendererText->new; + my $renderer = Gtk3::CellRendererText->new; $renderer->set(editable => 0); $renderer->set_data(column => $::i); $treeview->insert_column_with_attributes(-1, $_, $renderer, 'text' => $::i); @@ -190,13 +190,13 @@ sub add_columns { # create model my $model = create_model(); -my $window = ugtk2->new(N("Manage hosts definitions")); +my $window = ugtk3->new(N("Manage hosts definitions")); $::main_window = $window->{real_window}; $window->{rwindow}->set_size_request(500, 400) unless $::isEmbedded; my $W = $window->{window}; -$W->signal_connect(delete_event => sub { ugtk2->exit }); +$W->signal_connect(delete_event => sub { ugtk3->exit }); -my $treeview = Gtk2::TreeView->new_with_model($model); +my $treeview = Gtk3::TreeView->new_with_model($model); $treeview->set_rules_hint(1); $treeview->get_selection->set_mode('single'); add_columns($treeview); @@ -211,42 +211,42 @@ $treeview->signal_connect(button_press_event => sub { }); my $okcancel = create_okcancel({ - cancel_clicked => sub { ugtk2->exit }, - ok_clicked => sub { write_conf_hosts(); ugtk2->exit }, + cancel_clicked => sub { ugtk3->exit }, + ok_clicked => sub { write_conf_hosts(); ugtk3->exit }, }, ); # main interface -$W->add(gtkpack_(Gtk2::VBox->new(0,0), - if_(!$::isEmbedded, 0, Gtk2::Banner->new('IC-Dhost-48', N("Manage hosts definitions"))), - #if_($::isEmbedded, 0, Gtk2::Label->new("Here you can add, remove and alter hosts definition.")), - 1, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), +$W->add(gtkpack_(Gtk3::VBox->new(0,0), + if_(!$::isEmbedded, 0, Gtk3::Banner->new('IC-Dhost-48', N("Manage hosts definitions"))), + #if_($::isEmbedded, 0, Gtk3::Label->new("Here you can add, remove and alter hosts definition.")), + 1, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 0), 1, create_scrolled_window($treeview), 0, gtkpack_(gtkset_border_width(create_vbox('start', 3)), - 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => sub { eval { add_modify_entry($treeview, 'add', N("Add entry")) }; my $err = $@; if ($err) { err_dialog(N("Error"), N("Failed to add host.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Modify")), clicked => sub { eval { add_modify_entry($treeview, 'modify', N("Modify entry")) }; my $err = $@; if ($err) { err_dialog(N("Error"), N("Failed to Modify host.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { eval { remove_entry($treeview) }; my $err = $@; if ($err) { err_dialog(N("Error"), N("Failed to remove host.") . "\n\n" . $err); } }), - if_($::isEmbedded, 0, gtksignal_connect(Gtk2::Button->new(N("Quit")), clicked => sub { ugtk2->exit })), + if_($::isEmbedded, 0, gtksignal_connect(Gtk3::Button->new(N("Quit")), clicked => sub { ugtk3->exit })), ), ), 0, $okcancel, @@ -254,4 +254,4 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0), ); $W->show_all; -Gtk2->main; +Gtk3->main; diff --git a/bin/drakids b/bin/drakids index 50cc786..a51f047 100755 --- a/bin/drakids +++ b/bin/drakids @@ -8,15 +8,15 @@ use common; use standalone; use Socket; -use mygtk2 qw(gtknew); -use ugtk2 qw(:dialogs); +use mygtk3 qw(gtknew); +use ugtk3 qw(:dialogs); use POSIX qw(strftime); use dbus_object; use network::ifw; -use Gtk2::SimpleList; +use Gtk3::SimpleList; -use ugtk2 qw(:create :helpers :wrappers); +use ugtk3 qw(:create :helpers :wrappers); my $loglist = create_attack_list(); $loglist->get_selection->set_mode('single'); @@ -24,7 +24,7 @@ $loglist->get_selection->set_mode('single'); my $blacklist = create_attack_list(); $blacklist->get_selection->set_mode('multiple'); -my $whitelist = Gtk2::SimpleList->new(addr => 'hidden', +my $whitelist = Gtk3::SimpleList->new(addr => 'hidden', N("Allowed addresses") => 'text', ); $whitelist->get_selection->set_mode('multiple'); @@ -40,13 +40,13 @@ my $blocked_services = create_service_list(); my $title = N("Interactive Firewall"); my $icon = "drakfirewall"; -$ugtk2::wm_icon = $icon; -my $w = ugtk2->new($title); +$ugtk3::wm_icon = $icon; +my $w = ugtk3->new($title); my $ifw; eval { my $bus = dbus_object::system_bus(); - dbus_object::set_gtk2_watch_helper($bus); + dbus_object::set_gtk3_watch_helper($bus); network::ifw::init($bus, sub { my ($_con, $msg) = @_; my $member = $msg->get_member; @@ -76,7 +76,7 @@ init_lists(); gtkadd($w->{window}, gtknew('VBox', spacing => 5, children => [ - $::isEmbedded ? () : (0, Gtk2::Banner->new($icon, $title)), + $::isEmbedded ? () : (0, Gtk3::Banner->new($icon, $title)), 1, gtknew('Notebook', children => [ if_($i_m_ifw2, gtknew('Label', text => N("Log")), @@ -85,7 +85,7 @@ gtkadd($w->{window}, 0, gtknew('HButtonBox', layout => 'edge', children_loose => [ gtknew('Button', text => N("Allow"), clicked => sub {}), gtknew('Button', text => N("Block"), clicked => sub {}), - gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit }) + gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit }) ]), ]), gtknew('Label', text => N("Allowed services")), @@ -94,7 +94,7 @@ gtkadd($w->{window}, 0, gtknew('HButtonBox', layout => 'edge', children_loose => [ gtknew('Button', text => N("Remove"), clicked => sub {}), gtknew('Button', text => N("Block"), clicked => sub {}), - gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit }) + gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit }) ]), ]), gtknew('Label', text => N("Blocked services")), @@ -103,7 +103,7 @@ gtkadd($w->{window}, 0, gtknew('HButtonBox', layout => 'edge', children_loose => [ gtknew('Button', text => N("Remove"), clicked => sub {}), gtknew('Button', text => N("Allow"), clicked => sub {}), - gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit }) + gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit }) ]), ]), ), @@ -114,7 +114,7 @@ gtkadd($w->{window}, gtknew('Button', text => N("Clear logs"), clicked => \&clear_log), gtknew('Button', text => N("Blacklist"), clicked => sub { blacklist(get_selected_log_seq()) }), gtknew('Button', text => N("Whitelist"), clicked => sub { whitelist(get_selected_log()) }), - gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit }) + gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit }) ]), ]), gtknew('Label', text => N("Blacklist")), @@ -127,7 +127,7 @@ gtkadd($w->{window}, unblacklist(@addr); whitelist(@addr); }), - gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit }) + gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit }) ]), ]), gtknew('Label', text => N("Whitelist")), @@ -135,14 +135,14 @@ gtkadd($w->{window}, 1, gtknew('ScrolledWindow', width => 600, height => 260, child => $whitelist), 0, gtknew('HButtonBox', layout => 'edge', children_loose => [ gtknew('Button', text => N("Remove from whitelist"), clicked => sub { unwhitelist(get_selected_whitelist()) }), - gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit }) + gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit }) ]), ]), ]), ]), ); $w->show; -Gtk2->main; +Gtk3->main; $w->exit(0); @@ -160,7 +160,7 @@ sub handle_init() { sub list_remove_addr { my ($list, @addr) = @_; - #- workaround buggy Gtk2::SimpleList array abstraction, it destroys references + #- workaround buggy Gtk3::SimpleList array abstraction, it destroys references @$list = map { member($_->[0], @addr) ? () : [ @$_ ] } @$list; } @@ -250,7 +250,7 @@ sub clear_lists() { } sub create_attack_list() { - my $attacklist = Gtk2::SimpleList->new(addr => 'hidden', + my $attacklist = Gtk3::SimpleList->new(addr => 'hidden', seq => 'hidden', timestamp => 'hidden', N("Date") => 'text', @@ -287,7 +287,7 @@ sub attack_list_add { sub create_service_list { my ($o_status) = @_; - my $service_list = Gtk2::SimpleList->new( + my $service_list = Gtk3::SimpleList->new( N("Application") => 'text', N("Service") => 'text', if_($o_status, N("Status") => 'text'), diff --git a/bin/drakinvictus b/bin/drakinvictus index c903bc6..eaf6fe1 100755 --- a/bin/drakinvictus +++ b/bin/drakinvictus @@ -29,14 +29,14 @@ use common; use network::invictus; use network::network; use detect_devices; -use mygtk2 qw(gtknew); -use ugtk2 qw(:create :helpers :wrappers :dialogs); +use mygtk3 qw(gtknew); +use ugtk3 qw(:create :helpers :wrappers :dialogs); require_root_capability(); -$ugtk2::wm_icon = 'invictus-16'; +$ugtk3::wm_icon = 'invictus-16'; my $title = N("Invictus Firewall"); -my $w = ugtk2->new($title); +my $w = ugtk3->new($title); $::main_window = $w->{real_window}; #- so that transient_for is defined for wait messages and dialogs my $net = {}; @@ -98,7 +98,7 @@ sub update_ct_sync_state() { gtkadd($w->{window}, gtknew('VBox', spacing => 5, children_tight => [ - $::isEmbedded ? () : Gtk2::Banner->new('invictus-32', $title), + $::isEmbedded ? () : Gtk3::Banner->new('invictus-32', $title), gtknew('WrappedLabel', text => N("This tool allows to set up network interfaces failover and firewall replication.")), gtknew('Frame', border_width => 5, text => N("Network redundancy (leave empty if interface is not used)"), diff --git a/bin/draknetprofile b/bin/draknetprofile index e836c06..d2e5cce 100755 --- a/bin/draknetprofile +++ b/bin/draknetprofile @@ -28,16 +28,16 @@ use standalone; use common; use network::network; -use mygtk2; -use Gtk2::SimpleList; -use ugtk2 qw(:create :helpers :wrappers :dialogs :ask); +use mygtk3; +use Gtk3::SimpleList; +use ugtk3 qw(:create :helpers :wrappers :dialogs :ask); use POSIX (); require_root_capability(); -$ugtk2::wm_icon = 'draknetprofile-16'; +$ugtk3::wm_icon = 'draknetprofile-16'; my $title = N("Network profiles"); -my $w = ugtk2->new($title); +my $w = ugtk3->new($title); $::main_window = $w->{real_window}; #- so that transient_for is defined for wait messages and dialogs my $net = {}; @@ -45,10 +45,10 @@ my @profiles; my $default_profile = "default"; my %buttons; -package Gtk2::CellRendererRadio; +package Gtk3::CellRendererRadio; sub new { - my $renderer = Gtk2::CellRendererToggle->new; + my $renderer = Gtk3::CellRendererToggle->new; $renderer->set_radio(1); $renderer; } @@ -57,14 +57,14 @@ sub new { package main; -Gtk2::SimpleList->add_column_type( +Gtk3::SimpleList->add_column_type( 'radio', type => 'Glib::Boolean', - renderer => 'Gtk2::CellRendererRadio', + renderer => 'Gtk3::CellRendererRadio', attr => 'active', ); -my $modules_list = Gtk2::SimpleList->new( +my $modules_list = Gtk3::SimpleList->new( N("Module") => 'hidden', N("Enabled") => 'bool', N("Description") => 'text', @@ -81,7 +81,7 @@ $r[0]->signal_connect('toggled' => sub { }); -my $profiles_list = Gtk2::SimpleList->new( +my $profiles_list = Gtk3::SimpleList->new( "" => 'hidden', N("Profile") => 'text', ); @@ -157,15 +157,15 @@ sub set_profile { sub clone_profile() { #my $source_profile = get_selected_profile(); my $dialog = _create_dialog(N("New profile...")); - my $entry_dialog = Gtk2::Entry->new; + my $entry_dialog = Gtk3::Entry->new; gtkpack($dialog->vbox, - Gtk2::WrappedLabel->new(N("Please specify the name of the new network profile to be created (e.g., work, home, roaming, ..). This new profile will be created based on current settings, and you'll be able to configure your system configuration as usual afterwards.")), + Gtk3::WrappedLabel->new(N("Please specify the name of the new network profile to be created (e.g., work, home, roaming, ..). This new profile will be created based on current settings, and you'll be able to configure your system configuration as usual afterwards.")), $entry_dialog, ); gtkpack($dialog->action_area, - gtksignal_connect(Gtk2::Button->new(N("Cancel")), + gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => sub { $dialog->destroy }), - gtksignal_connect(my $bok = Gtk2::Button->new(N("Ok")), clicked => sub { + gtksignal_connect(my $bok = Gtk3::Button->new(N("Ok")), clicked => sub { my $dest_profile = $entry_dialog->get_text; # netprofile does not like spaces in profile names... $dest_profile =~ s/ /_/g; @@ -198,10 +198,10 @@ sub delete_selected_profile() { } # create advanced view to configure modules -my $expander = Gtk2::Expander->new(N("Advanced")); -$expander->add(gtkpack_(Gtk2::VBox->new, - 0, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 1), - 1, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), +my $expander = Gtk3::Expander->new(N("Advanced")); +$expander->add(gtkpack_(Gtk3::VBox->new, + 0, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 1), + 1, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, gtknew('WrappedLabel', text => N("Select the netprofile modules:")), 0, gtknew('ScrolledWindow', width => 300, height => 150, child => $modules_list), ), @@ -214,7 +214,7 @@ $expander->show_all; gtkadd($w->{window}, gtknew('VBox', spacing => 5, children => [ - $::isEmbedded ? () : (0, Gtk2::Banner->new('draknetprofile', $title)), + $::isEmbedded ? () : (0, Gtk3::Banner->new('draknetprofile', $title)), 0, gtknew('WrappedLabel', text => N("This tool allows you to control network profiles.")), 0, gtknew('WrappedLabel', text => N("Select a network profile:")), 1, gtknew('ScrolledWindow', width => 300, height => 150, child => $profiles_list), @@ -223,7 +223,7 @@ gtkadd($w->{window}, $buttons{activate} = gtknew('Button', text => N("Activate"), clicked => \&set_selected_profile, sensitive => 0), $buttons{clone} = gtknew('Button', text => N("New"), clicked => \&clone_profile, sensitive => 0), $buttons{delete} = gtknew('Button', text => N("Delete"), clicked => \&delete_selected_profile, sensitive => 0), - gtknew('Button', text => N("Quit"), clicked => sub { Gtk2->main_quit }), + gtknew('Button', text => N("Quit"), clicked => sub { Gtk3->main_quit }), ]), ]), ); diff --git a/bin/draknfs b/bin/draknfs index 98aae11..2a60db1 100755 --- a/bin/draknfs +++ b/bin/draknfs @@ -31,9 +31,9 @@ use services; require_root_capability(); my $nfsicon = "/usr/share/mcc/themes/default/draknfs.png"; -$ugtk2::wm_icon = $nfsicon; -use mygtk2 qw(gtknew gtkset); -use ugtk2 qw(:ask :wrappers :create :dialogs); +$ugtk3::wm_icon = $nfsicon; +use mygtk3 qw(gtknew gtkset); +use ugtk3 qw(:ask :wrappers :create :dialogs); my $in = 'interactive'->vnew; $in->do_pkgs->ensure_is_installed('nfs-utils', '/usr/sbin/rpc.nfsd') or exit(1); @@ -79,7 +79,7 @@ sub get_items() { } sub quit_all() { - ugtk2->exit; + ugtk3->exit; } sub restart_dialog() { @@ -97,7 +97,7 @@ sub wait_action { undef $w; } -my %size_groups = map { $_ => Gtk2::SizeGroup->new('horizontal') } qw(label widget button); +my %size_groups = map { $_ => Gtk3::SizeGroup->new('horizontal') } qw(label widget button); my $label_and_widgets = sub { my ($label, $widget, $button) = @_; gtknew('HBox', children => [ @@ -196,7 +196,7 @@ sub help_b { my $dialog = _create_dialog(N("Help"), { transient_for => $::main_window, modal => 1 }); gtkpack_($dialog->vbox, 1, gtknew('ScrolledWindow', width => 390, height => 300, - child => gtknew('TextView', text => ugtk2::markup_to_TextView_format(formatAlaTeX($help_data))) + child => gtknew('TextView', text => ugtk3::markup_to_TextView_format(formatAlaTeX($help_data))) ), 0, gtknew('Button', text => N("Close"), clicked => sub { $dialog->destroy; @@ -256,9 +256,9 @@ sub add_modify_entry { undef $i; undef $iter; $_ = gtknew('Entry') foreach $dir, $options; - $_ = Gtk2::OptionMenu->new foreach $lr, $luserid, $lsecure, $lsync, $lsubtree_check; + $_ = Gtk3::OptionMenu->new foreach $lr, $luserid, $lsecure, $lsync, $lsubtree_check; - $access = Gtk2::Combo->new; + $access = Gtk3::Combo->new; # $access = gtknew('ComboBox'); my @access_list = get_access_list(); # foreach (@access_list) { @@ -357,10 +357,10 @@ sub add_modify_entry { $_->set_sensitive(0) foreach $anongid, $anonuid; } - my $expender = Gtk2::Expander->new(N("Advanced")); - $expender->add(gtkpack_(Gtk2::HBox->new, - 0, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 1), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + my $expender = Gtk3::Expander->new(N("Advanced")); + $expender->add(gtkpack_(Gtk3::HBox->new, + 0, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->($adv_options{sync}, $lsync, help_b($help_global)), 0, $label_and_widgets->($adv_options{secured}, $lsecure, ""), 0, $label_and_widgets->($adv_options{ro}, $lr, ""), @@ -370,7 +370,7 @@ sub add_modify_entry { ), ); - my $w = ugtk2->new(N("Modify entry")); + my $w = ugtk3->new(N("Modify entry")); $w->{window}->set_modal(1); $w->{window}->set_position('center'); @@ -378,8 +378,8 @@ sub add_modify_entry { gtkadd($w->{window}, gtknew('VBox', spacing => 0, children_loose => [ -# gtkadd(Gtk2::Frame->new(("")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), +# gtkadd(Gtk3::Frame->new(("")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, gtknew('Title2', label => N("NFS directory")), 0, $label_and_widgets->(N("Directory:"), $dir, $button), 0, gtknew('Title2', label => N("Host access")), @@ -390,8 +390,8 @@ sub add_modify_entry { 0, $label_and_widgets->(N("Anonymous Group ID:"), $anongid, ""), ), # ), -# gtkadd(Gtk2::Frame->new(""), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), +# gtkadd(Gtk3::Frame->new(""), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $expender, ), # ), @@ -484,7 +484,7 @@ sub remove_entry { sub create_model() { get_nfs_data(); - my $model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String"); + my $model = Gtk3::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String"); foreach my $a (@listshare) { my $iter = $model->append; $model->set($iter, @@ -503,14 +503,14 @@ sub add_columns { my $model = $treeview->get_model; # my @colsize = (120, 160, 120); # each_index { -# my $renderer = Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i); +# my $renderer = Gtk3::TreeViewColumn->new_with_attributes($_, Gtk3::CellRendererText->new, 'text' => $::i); # $renderer->set_sort_column_id($::i); # $renderer->set_min_width($colsize[$::i]); # $treeview->append_column($renderer); # } N("Share Directory"), N("Hosts Wildcard"), N("General Options"), N("Custom Options"); each_index { - my $renderer = Gtk2::CellRendererText->new; + my $renderer = Gtk3::CellRendererText->new; $renderer->set(editable => 0); $renderer->signal_connect(edited => \&cell_edited, $model); $renderer->set_data(column => $::i); @@ -520,7 +520,7 @@ sub add_columns { sub cell_edited { my ($cell, $path_string, $new_text, $model) = @_; - my $path = Gtk2::TreePath->new_from_string($path_string); + my $path = Gtk3::TreePath->new_from_string($path_string); my $column = $cell->get_data("column"); my $iter = $model->get_iter($path); @@ -549,14 +549,14 @@ sub cell_edited { # create model my $model = create_model(); -my $window = ugtk2->new(N("Manage NFS shares")); +my $window = ugtk3->new(N("Manage NFS shares")); $::main_window = $window->{real_window}; $window->{rwindow}->set_size_request(550, 400) unless $::isEmbedded; $window->{rwindow}->set_position('center') if !$::isEmbedded; my $W = $window->{window}; -$W->signal_connect(delete_event => sub { ugtk2->exit }); +$W->signal_connect(delete_event => sub { ugtk3->exit }); -my $treeview = Gtk2::TreeView->new_with_model($model); +my $treeview = Gtk3::TreeView->new_with_model($model); $treeview->set_rules_hint(1); $treeview->get_selection->set_mode('single'); add_columns($treeview); @@ -573,15 +573,15 @@ $treeview->signal_connect(button_press_event => sub { # create menu my @items = get_items(); -my $factory = Gtk2::ItemFactory->new('Gtk2::MenuBar', '<main>', undef); +my $factory = Gtk3::ItemFactory->new('Gtk3::MenuBar', '<main>', undef); $factory->create_items('menu', @items); my $menu = $factory->get_widget('<main>'); my $okcancel = create_okcancel({ - cancel_clicked => sub { ugtk2->exit }, + cancel_clicked => sub { ugtk3->exit }, ok_clicked => sub { &write_conf; run_program::raw({ detach => 1 }, "exportfs -ra"); - ugtk2->exit }, + ugtk3->exit }, }, ); @@ -597,7 +597,7 @@ undef $wait; # main interface $W->add(gtknew('VBox', children => [ 0, $menu, - 0, Gtk2::Banner->new($nfsicon, N("DrakNFS manage NFS shares")), + 0, Gtk3::Banner->new($nfsicon, N("DrakNFS manage NFS shares")), #if_($::isEmbedded, 0, gtknew('Label', text => "Here you can add, remove and alter NFS shares.")), 1, gtknew('HBox', border_width => 0, children => [ 1, gtknew('ScrolledWindow', child => $treeview), @@ -630,4 +630,4 @@ $W->add(gtknew('VBox', children => [ ); $W->show_all; -Gtk2->main; +Gtk3->main; diff --git a/bin/drakproxy b/bin/drakproxy index 2c6b1fe..338dc9a 100755 --- a/bin/drakproxy +++ b/bin/drakproxy @@ -30,7 +30,7 @@ use common; require_root_capability(); -$ugtk2::wm_icon = "/usr/share/mcc/themes/default/drakproxy-mdk.png"; +$ugtk3::wm_icon = "/usr/share/mcc/themes/default/drakproxy-mdk.png"; my $u = { getVarsFromSh('/etc/profile.d/proxy.sh') }; my $in = 'interactive'->vnew; if (network::network::miscellaneous_choose($in, $u)) { diff --git a/bin/draksambashare b/bin/draksambashare index 0c5f97d..92209f0 100755 --- a/bin/draksambashare +++ b/bin/draksambashare @@ -27,10 +27,10 @@ use standalone; use common; use network::network; use interactive; -use mygtk2 qw(gtknew); -use ugtk2 qw(:ask :wrappers :create :dialogs); -use Gtk2::SimpleList; -use Gtk2::Gdk::Keysyms; +use mygtk3 qw(gtknew); +use ugtk3 qw(:ask :wrappers :create :dialogs); +use Gtk3::SimpleList; +use Gtk3::Gdk::Keysyms; use run_program; # use libconf @@ -53,9 +53,9 @@ my $sambaicon = "/usr/share/mcc/themes/default/diskdrake_samba.png"; my $fileshare_icon = "$icon_path/IC-winacces2-16.png"; my $printershare_icon = "$icon_path/IC-sambaprt-16.png"; my $sambauser_icon = "$icon_path/ic82-users-16.png"; -my $pixbuf_file = Gtk2::Gdk::Pixbuf->new_from_file($fileshare_icon); -my $pixbuf_printer = Gtk2::Gdk::Pixbuf->new_from_file($printershare_icon); -my $pixbuf_user = Gtk2::Gdk::Pixbuf->new_from_file($sambauser_icon); +my $pixbuf_file = Gtk3::Gdk::Pixbuf->new_from_file($fileshare_icon); +my $pixbuf_printer = Gtk3::Gdk::Pixbuf->new_from_file($printershare_icon); +my $pixbuf_user = Gtk3::Gdk::Pixbuf->new_from_file($sambauser_icon); my $printer_list = create_printer_list(); my $share_list = create_share_list(); @@ -63,14 +63,14 @@ my $user_list = create_user_list(); my $display_share = create_display_share(); sub create_user_list() { - my $user_list = Gtk2::SimpleList->new('' => 'pixbuf', + my $user_list = Gtk3::SimpleList->new('' => 'pixbuf', N("User name") => 'text', ); $user_list; } sub create_share_list() { - my $share_list = Gtk2::SimpleList->new('' => 'pixbuf', + my $share_list = Gtk3::SimpleList->new('' => 'pixbuf', N("Share name") => 'text', N("Share directory") => 'text', N("Comment") => 'text', @@ -98,7 +98,7 @@ sub create_share_list() { } sub create_display_share() { - my $display_share = Gtk2::SimpleList->new('' => 'pixbuf', + my $display_share = Gtk3::SimpleList->new('' => 'pixbuf', N("Share name") => 'text', N("Share directory") => 'text', N("Comment") => 'text', @@ -115,7 +115,7 @@ sub create_display_share() { } sub create_printer_list() { - my $printer_list = Gtk2::SimpleList->new('' => 'pixbuf', + my $printer_list = Gtk3::SimpleList->new('' => 'pixbuf', N("Printer name") => 'text', N("Path") => 'text', N("Comment") => 'text', @@ -215,7 +215,7 @@ sub get_items() { } sub quit_all() { - ugtk2->exit; + ugtk3->exit; } sub restart_dialog() { @@ -233,10 +233,10 @@ sub wait_action { undef $w; } -my %size_groups = map { $_ => Gtk2::SizeGroup->new('horizontal') } qw(label widget button); +my %size_groups = map { $_ => Gtk3::SizeGroup->new('horizontal') } qw(label widget button); my $label_and_widgets = sub { my ($label, $widget, $button) = @_; - gtkpack_(Gtk2::HBox->new(0,1), + gtkpack_(Gtk3::HBox->new(0,1), 0, gtkadd_widget($size_groups{label}, $label), 0, gtkadd_widget($size_groups{widget}, $widget), if_($button, 0, gtkadd_widget($size_groups{button}, $button)), @@ -369,22 +369,22 @@ sub printers_section() { sub add_entry() { my ($addshare_name, $addshare_comment, $addshare_dir); - $_ = Gtk2::Entry->new foreach $addshare_name, $addshare_comment, $addshare_dir; - my $button = Gtk2::Button->new(N("Open")); + $_ = Gtk3::Entry->new foreach $addshare_name, $addshare_comment, $addshare_dir; + my $button = Gtk3::Button->new(N("Open")); $button->signal_connect(clicked => sub { show_file_dialog($addshare_dir) }); my $dialog = _create_dialog(N("DrakSamba add entry"), { transient_for => $::main_window, modal => 1 }); local $::main_window = $dialog; gtkpack_($dialog->vbox, - 0, gtkadd(Gtk2::Frame->new(N("Add a share")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Add a share")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 3), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Name of the share:"), $addshare_name, ""), 0, $label_and_widgets->(N("Comment:"), $addshare_comment, ""), 0, $label_and_widgets->(N("Directory:"), $addshare_dir, $button), ), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, create_okcancel({ cancel_clicked => sub { $dialog->destroy }, ok_clicked => sub { @@ -545,9 +545,9 @@ sub modify_printers_entry { my ($selected) = @_; my ($dir, $comment, $print_command, $guest_ok, $share_name, $browseable, $printable, $write_list, $printing, $lpq_command, $create_mode, $writable, $use_client_driver, $inherit_permissions); - $share_name = Gtk2::Label->new; - $_ = Gtk2::Entry->new foreach $dir, $comment, $print_command, $write_list, $printing, $lpq_command, $create_mode; - $_ = Gtk2::OptionMenu->new foreach $browseable, $printable, $guest_ok, $writable, $use_client_driver, $inherit_permissions; + $share_name = Gtk3::Label->new; + $_ = Gtk3::Entry->new foreach $dir, $comment, $print_command, $write_list, $printing, $lpq_command, $create_mode; + $_ = Gtk3::OptionMenu->new foreach $browseable, $printable, $guest_ok, $writable, $use_client_driver, $inherit_permissions; $_->set_popdown_strings(@yesno) foreach $browseable, $printable, $guest_ok, $writable, $use_client_driver, $inherit_permissions; @@ -567,7 +567,7 @@ sub modify_printers_entry { $create_mode->set_text($printer_list->{data}[$selected][13]); $use_client_driver->set_text($printer_list->{data}[$selected][14]); - my $button = Gtk2::Button->new(N("Open")); + my $button = Gtk3::Button->new(N("Open")); $button->signal_connect(clicked => sub { show_file_dialog($dir) }); my $dialog = _create_dialog(N("DrakSamba Printers entry"), { transient_for => $::main_window, modal => 1 }); @@ -583,34 +583,34 @@ sub modify_printers_entry { } gtkpack_($dialog->vbox, - 0, gtkadd(Gtk2::Frame->new(N("Printer share")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 3), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Printer share")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 3), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Printer name:"), $share_name, ""), 0, $label_and_widgets->(N("Comment:"), $comment, ""), 0, $label_and_widgets->(N("Directory:"), $dir, $button), ), - 0, Gtk2::VSeparator->new, - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, Gtk3::VSeparator->new, + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Writable:"), $writable, ""), 0, $label_and_widgets->(N("Browseable:"), $browseable, ""), 0, $label_and_widgets->(N("Printable"), $printable, ""), ), ), ), - 0, gtkadd(Gtk2::Frame->new(N("Advanced options")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 3), - 0, gtkadd(Gtk2::Frame->new(N("Printer access")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Advanced options")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 3), + 0, gtkadd(Gtk3::Frame->new(N("Printer access")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Write list"), $write_list, ""), 0, $label_and_widgets->(N("Inherit permissions"), $inherit_permissions, ""), 0, $label_and_widgets->(N("Guest ok:"), $guest_ok, ""), 0, $label_and_widgets->(N("Create mode:"), $create_mode, ""), ), ), - 0, Gtk2::VSeparator->new, - 0, gtkadd(Gtk2::Frame->new(N("Printer command")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, Gtk3::VSeparator->new, + 0, gtkadd(Gtk3::Frame->new(N("Printer command")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Print command:"), $print_command, ""), 0, $label_and_widgets->(N("LPQ command:"), $lpq_command, ""), 0, $label_and_widgets->(N("Printing:"), $printing, ""), @@ -679,18 +679,18 @@ sub modify_entry { my ($selected) = @_; my ($dir, $comment, $create_mask, $directory_mask, $read_list, $write_list, $admin_users, $valid_users, $force_group, $browseable, $public, $writable, $hide_files, $hide_dot_files, $force_create_mode, $preserve_case, $default_case, $inherit_permissions, $share_name); - $share_name = Gtk2::Label->new; - $_ = Gtk2::Entry->new foreach $dir, $comment, $create_mask, $directory_mask, $hide_files; - $_ = Gtk2::Entry->new foreach $read_list, $write_list, $admin_users, $valid_users, $force_group, $force_create_mode; - $_ = Gtk2::OptionMenu->new foreach $browseable, $public, $writable, $default_case, $preserve_case, $hide_dot_files, $inherit_permissions; + $share_name = Gtk3::Label->new; + $_ = Gtk3::Entry->new foreach $dir, $comment, $create_mask, $directory_mask, $hide_files; + $_ = Gtk3::Entry->new foreach $read_list, $write_list, $admin_users, $valid_users, $force_group, $force_create_mode; + $_ = Gtk3::OptionMenu->new foreach $browseable, $public, $writable, $default_case, $preserve_case, $hide_dot_files, $inherit_permissions; $default_case->set_popdown_strings(@default_case); $_->set_popdown_strings(@yesno) foreach $browseable, $public, $writable, $hide_dot_files, $preserve_case, $inherit_permissions; - my $button = Gtk2::Button->new(N("Open")); + my $button = Gtk3::Button->new(N("Open")); $button->signal_connect(clicked => sub { show_file_dialog($dir) }); - my $w = ugtk2->new(N("DrakSamba entry")); + my $w = ugtk3->new(N("DrakSamba entry")); $w->{window}->set_modal(1); $w->{window}->set_position('center'); @@ -716,18 +716,18 @@ sub modify_entry { $force_group->set_text($share_list->{data}[$selected][18]); $default_case->set_text($share_list->{data}[$selected][19]); - my $expander_user = Gtk2::Expander->new(N("User options (user access, mask option, force mode)")); - $expander_user->add(gtkpack_(Gtk2::HBox->new, - 0, gtkadd(Gtk2::Frame->new(N("Samba user access")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + my $expander_user = Gtk3::Expander->new(N("User options (user access, mask option, force mode)")); + $expander_user->add(gtkpack_(Gtk3::HBox->new, + 0, gtkadd(Gtk3::Frame->new(N("Samba user access")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->($adv_options{read_list}, $read_list, ""), 0, $label_and_widgets->($adv_options{write_list}, $write_list, ""), 0, $label_and_widgets->($adv_options{admin_users}, $admin_users, ""), 0, $label_and_widgets->($adv_options{valid_users}, $valid_users, ""), ), ), - 0, gtkadd(Gtk2::Frame->new(N("Mask options")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Mask options")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->($adv_options{create_mask}, $create_mask, ""), 0, $label_and_widgets->($adv_options{directory_mask}, $directory_mask, ""), 0, $label_and_widgets->($adv_options{force_group}, $force_group, ""), @@ -738,16 +738,16 @@ sub modify_entry { ), ); - my $expander_file = Gtk2::Expander->new(N("File options (hide files, case)")); - $expander_file->add(gtkpack_(Gtk2::VBox->new, - 0, gtkadd(Gtk2::Frame->new(N("Display options")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 1), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + my $expander_file = Gtk3::Expander->new(N("File options (hide files, case)")); + $expander_file->add(gtkpack_(Gtk3::VBox->new, + 0, gtkadd(Gtk3::Frame->new(N("Display options")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->($adv_options{hide_dot_files}, $hide_dot_files, ""), 0, $label_and_widgets->($adv_options{hide_files}, $hide_files, ""), ), - 0, Gtk2::VSeparator->new, - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + 0, Gtk3::VSeparator->new, + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->($adv_options{default_case}, $default_case, ""), 0, $label_and_widgets->($adv_options{preserve_case}, $preserve_case, ""), ), @@ -762,25 +762,25 @@ sub modify_entry { gtkadd($w->{window}, gtknew('VBox', spacing => 0, children_loose => [ - gtkadd(Gtk2::Frame->new(N("Samba share directory")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 1), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + gtkadd(Gtk3::Frame->new(N("Samba share directory")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->(N("Share name:"), $share_name), 0, $label_and_widgets->(N("Directory:"), $dir, $button), 0, $label_and_widgets->(N("Comment:"), $comment, ""), ), - 0, Gtk2::VSeparator->new, - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + 0, Gtk3::VSeparator->new, + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->(N("Public:"), $public, ""), 0, $label_and_widgets->(N("Writable:"), $writable, ""), 0, $label_and_widgets->(N("Browseable:"), $browseable, ""), ), ), ), - gtkadd(Gtk2::Frame->new(N("Advanced options")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + gtkadd(Gtk3::Frame->new(N("Advanced options")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $expander_user, - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, 0, $expander_file, ), ), @@ -914,24 +914,24 @@ sub get_user() { sub modify_user_info { my ($user, $_passwd, $todo) = @_; my ($buser, $bpasswd); - my $dialog = new Gtk2::Dialog(); + my $dialog = new Gtk3::Dialog(); $dialog->set_title(N("Add Samba user")); $dialog->set_modal(1); $dialog->set_position('center'); $dialog->set_resizable(0); if ($todo eq "add") { - $buser = Gtk2::ComboBox->new_with_strings([ get_user() ]); + $buser = Gtk3::ComboBox->new_with_strings([ get_user() ]); $buser->set_wrap_width(3); } else { - $buser = Gtk2::Label->new; + $buser = Gtk3::Label->new; $buser->set_text($user); } - $bpasswd = Gtk2::Entry->new; + $bpasswd = Gtk3::Entry->new; $bpasswd->set_visibility(0); gtkpack_($dialog->vbox, - 0, gtkadd(Gtk2::Frame->new(N("User information")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5), + 0, gtkadd(Gtk3::Frame->new(N("User information")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 5), 0, $label_and_widgets->(N("User name:"), $buser, ""), 0, $label_and_widgets->(N("Password:"), $bpasswd, ""), ), @@ -1288,13 +1288,13 @@ add_data_printer_list($printer_list); add_data_user_list($user_list); $_->set_rules_hint(1) foreach $display_share, $printer_list, $user_list; -$ugtk2::wm_icon = $fileshare_icon; -$window = ugtk2->new(N("Manage Samba configuration")); +$ugtk3::wm_icon = $fileshare_icon; +$window = ugtk3->new(N("Manage Samba configuration")); $::main_window = $window->{real_window}; $window->{rwindow}->set_size_request(600, 410) unless $::isEmbedded; $window->{rwindow}->set_position('center') if !$::isEmbedded; my $W = $window->{window}; -$W->signal_connect(delete_event => sub { ugtk2->exit }); +$W->signal_connect(delete_event => sub { ugtk3->exit }); # double clic and popup modify window $display_share->signal_connect(button_press_event => sub { @@ -1326,9 +1326,9 @@ $user_list->signal_connect(button_press_event => sub { #} [ $share_list, $printer_list, $user_list ], [ modify_entry, modify_printers_entry, modify_user_info ]; # create popup menu -my $menupopup = Gtk2::Menu->new; -my $menuitem1 = Gtk2::MenuItem->new(N("Modify")); -my $menuitem2 = Gtk2::MenuItem->new(N("Remove")); +my $menupopup = Gtk3::Menu->new; +my $menuitem1 = Gtk3::MenuItem->new(N("Modify")); +my $menuitem2 = Gtk3::MenuItem->new(N("Remove")); $menuitem1->signal_connect(activate => sub { my ($selected) = $display_share->get_selected_indices; modify_entry($selected); @@ -1349,7 +1349,7 @@ $display_share->signal_connect('button-press-event' => sub { $display_share->signal_connect(key_press_event => sub { my (undef, $event) = @_; - return unless $event->keyval == $Gtk2::Gdk::Keysyms{Return}; + return unless $event->keyval == $Gtk3::Gdk::Keysyms{Return}; my ($selected) = $display_share->get_selected_indices; modify_entry($selected); return 1; @@ -1357,22 +1357,22 @@ $display_share->signal_connect(key_press_event => sub { # create menu my @items = get_items(); -my $factory = Gtk2::ItemFactory->new('Gtk2::MenuBar', '<main>', undef); +my $factory = Gtk3::ItemFactory->new('Gtk3::MenuBar', '<main>', undef); $factory->create_items('menu', @items); my $menu = $factory->get_widget('<main>'); my $okcancel = create_okcancel({ - cancel_clicked => sub { ugtk2->exit }, - ok_clicked => sub { &write_conf; ugtk2->exit }, + cancel_clicked => sub { ugtk3->exit }, + ok_clicked => sub { &write_conf; ugtk3->exit }, }, ); -gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), +gtkappend_page(my $nb = Gtk3::Notebook->new, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 0), 1, create_scrolled_window($display_share), 0, gtkpack_(create_vbox('start'), - 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => \&add_entry), - 0, Gtk2::HSeparator->new, - 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => \&add_entry), + 0, Gtk3::HSeparator->new, + 0, gtksignal_connect(Gtk3::Button->new(N("Modify")), clicked => sub { my ($selected) = $display_share->get_selected_indices; eval { modify_entry($selected) }; my $err = $@; @@ -1380,7 +1380,7 @@ gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack_(gtkset_border_width(Gtk2:: err_dialog(N("Error"), N("Failed to Modify Samba share.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { my ($selected) = $display_share->get_selected_indices; ask_okcancel("Remove entry ?", "Remove $display_share->{data}[$selected][1]") or return; eval { remove_entry($selected, $display_share) }; @@ -1391,19 +1391,19 @@ gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack_(gtkset_border_width(Gtk2:: }), ), ), - gtkshow(gtkpack_(Gtk2::HBox->new(0,0), - 0, Gtk2::Image->new_from_file($fileshare_icon), - 0, Gtk2::Label->new(N("File share")), + gtkshow(gtkpack_(Gtk3::HBox->new(0,0), + 0, Gtk3::Image->new_from_file($fileshare_icon), + 0, Gtk3::Label->new(N("File share")), ), ), ); -gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), +gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 0), 1, create_scrolled_window($printer_list), 0, gtkpack_(create_vbox('start'), - 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => \&add_printers_entry), - 0, Gtk2::HSeparator->new, - 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => \&add_printers_entry), + 0, Gtk3::HSeparator->new, + 0, gtksignal_connect(Gtk3::Button->new(N("Modify")), clicked => sub { my ($selected) = $printer_list->get_selected_indices; eval { modify_printers_entry($selected) }; my $err = $@; @@ -1411,7 +1411,7 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), err_dialog(N("Error"), N("Failed to Modify.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { my ($selected) = $printer_list->get_selected_indices; ask_okcancel("Remove entry ?", "Remove $printer_list->{data}[$selected][1]") or return; eval { remove_entry($selected, $printer_list) }; @@ -1422,25 +1422,25 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), }), ), ), - gtkshow(gtkpack_(Gtk2::HBox->new(0,0), - 0, Gtk2::Image->new_from_file($printershare_icon), - 0, Gtk2::Label->new(N("Printers")), + gtkshow(gtkpack_(Gtk3::HBox->new(0,0), + 0, Gtk3::Image->new_from_file($printershare_icon), + 0, Gtk3::Label->new(N("Printers")), ), ), ); -gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), +gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 0), 1, create_scrolled_window($user_list), 0, gtkpack_(create_vbox('start'), - 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => sub { eval { modify_user_info("", "", "add") }; my $err = $@; if ($err) { err_dialog(N("Error"), N("Failed to add user.") . "\n\n" . $err); } }), - 0, Gtk2::HSeparator->new, - 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { + 0, Gtk3::HSeparator->new, + 0, gtksignal_connect(Gtk3::Button->new(N("Modify")), clicked => sub { my ($selected) = $user_list->get_selected_indices; eval { modify_user_info($user_list->{data}[$selected][1], "", "change") }; my $err = $@; @@ -1448,7 +1448,7 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), err_dialog(N("Error"), N("Failed to change user password.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { my ($selected) = $user_list->get_selected_indices; ask_okcancel("Remove entry ?", "Remove $user_list->{data}[$selected][1]") or return; eval { @@ -1460,17 +1460,17 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), err_dialog(N("Error"), N("Failed to delete user.") . "\n\n" . $err); } }), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, # FIXME: Why do we have both an "add" button and a "userdrake" one ??? - 0, gtksignal_connect(Gtk2::Button->new(N("Userdrake")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Userdrake")), clicked => sub { run_program::raw({ detach => 1 }, 'userdrake'); } ), ), ), - gtkshow(gtkpack_(Gtk2::HBox->new(0,0), - 0, Gtk2::Image->new_from_file($sambauser_icon), - 0, Gtk2::Label->new(N("Samba Users"))), + gtkshow(gtkpack_(Gtk3::HBox->new(0,0), + 0, Gtk3::Image->new_from_file($sambauser_icon), + 0, Gtk3::Label->new(N("Samba Users"))), ), ); @@ -1485,10 +1485,10 @@ sub check_first_launch() { } # main interface -$W->add(gtkpack_(Gtk2::VBox->new(0,0), +$W->add(gtkpack_(Gtk3::VBox->new(0,0), 0, $menu, - 0, Gtk2::Banner->new($sambaicon, N("DrakSamba manage Samba shares")), - #if_($::isEmbedded, 0, Gtk2::Label->new("Here you can add, remove and alter Samba shares.")), + 0, Gtk3::Banner->new($sambaicon, N("DrakSamba manage Samba shares")), + #if_($::isEmbedded, 0, Gtk3::Label->new("Here you can add, remove and alter Samba shares.")), 1, $nb, 0, $okcancel, ), @@ -1496,4 +1496,4 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0), check_first_launch; $W->show_all; -Gtk2->main; +Gtk3->main; diff --git a/bin/net_applet b/bin/net_applet index 146b5b9..d9c502f 100755 --- a/bin/net_applet +++ b/bin/net_applet @@ -16,14 +16,14 @@ use network::connection::ethernet; use network::vpn; use run_program; use do_pkgs; -use mygtk2 qw(gtknew gtkset); +use mygtk3 qw(gtknew gtkset); use dbus_object; use network::monitor; use network::signal_strength; use detect_devices; -use Gtk2::Notify -init, 'NetApplet'; +use Gtk3::Notify -init, 'NetApplet'; -use ugtk2 qw(:create :helpers :wrappers :dialogs); +use ugtk3 qw(:create :helpers :wrappers :dialogs); my $onstartupfile = "$ENV{HOME}/.net_applet"; my $system_file = '/etc/sysconfig/drakx-net'; @@ -34,7 +34,7 @@ is_running('net_applet') and die "net_applet already running\n"; package network::net_applet; -use mygtk2 qw(gtknew gtkset); +use mygtk3 qw(gtknew gtkset); use common; our ($current_state, $current_interface); @@ -220,7 +220,7 @@ my %actions = ( ); -$icon = Gtk2::StatusIcon->new; +$icon = Gtk3::StatusIcon->new; eval { $dbus = dbus_object::system_bus() } if !defined($global_settings{NET_APPLET_DBUS}) || text2bool($global_settings{NET_APPLET_DBUS}); eval { $net->{monitor} = network::monitor->new($dbus) } if $dbus; @@ -240,10 +240,10 @@ if ($dbus) { } }); $dbus->{connection}->add_match("type='signal',interface='org.mageia.network'"); - dbus_object::set_gtk2_watch_helper($dbus); + dbus_object::set_gtk3_watch_helper($dbus); } -$notification_queue = Gtk2::Notify::Queue->new($icon); +$notification_queue = Gtk3::Notify::Queue->new($icon); $icon->signal_connect(activate => sub { my ($_icon, $button, $time) = @_; @@ -284,9 +284,9 @@ sub harvester { } while $pid > 0; } -Gtk2->main; +Gtk3->main; -ugtk2::exit(0); +ugtk3::exit(0); sub is_running { my ($name, $o_user) = @_; @@ -340,12 +340,12 @@ sub run_drakids() { sub generate_wireless_menuitem { my ($wnet) = @_; my $menuitem = {}; - $menuitem->{widget} = Gtk2::CheckMenuItem->new; + $menuitem->{widget} = Gtk3::CheckMenuItem->new; $menuitem->{widget}->set_draw_as_radio(1); $menuitem->{widget}->add(gtkpack_(gtkshow(gtknew('HBox')), 1, gtkset_alignment($menuitem->{label} = gtknew('Label'), 0, 0.5), - 0, $menuitem->{strength} = Gtk2::Image->new, - 0, $menuitem->{security} = Gtk2::Image->new, + 0, $menuitem->{strength} = Gtk3::Image->new, + 0, $menuitem->{security} = Gtk3::Image->new, )); $menuitem->{activate} = $menuitem->{widget}->signal_connect('activate' => sub { if ($net->{monitor} && exists $wnet->{id}) { @@ -466,7 +466,7 @@ sub create_menu_choices { my $choice = $_; my $label = $format ? $format->($choice) : $choice; my $w = gtkshow(gtkset_active(gtkadd( - Gtk2::CheckMenuItem->new, + Gtk3::CheckMenuItem->new, gtknew('HBox', children => [ 1, gtkset_alignment(gtknew('Label', text => $label), 0, 0.5), $get_icon ? @@ -488,12 +488,12 @@ sub create_action_item { gtkshow(create_menu($name, $actions{$action}{header} ? ( create_action_item($actions{$action}{header}), - gtkshow(Gtk2::SeparatorMenuItem->new), + gtkshow(Gtk3::SeparatorMenuItem->new), ) : (), @menu, )); } else { - gtksignal_connect(gtkshow(Gtk2::MenuItem->new_with_label($name)), activate => sub { $actions{$action}{launch}->($current_interface) }); + gtksignal_connect(gtkshow(Gtk3::MenuItem->new_with_label($name)), activate => sub { $actions{$action}{launch}->($current_interface) }); } } @@ -501,7 +501,7 @@ sub empty_menu { my ($menu) = @_; delete $_->{menuitems} foreach values %wireless_networks; $menu->destroy if $menu; - Gtk2::Menu->new; + Gtk3::Menu->new; } sub get_wireless_networks_sorted() { @@ -519,7 +519,7 @@ sub generate_simple_menu() { gtkappend($simple_menu, (map { generate_wireless_menuitem($_) } @valuable_networks), (@networks ? create_menu(N("More networks"), map { generate_wireless_menuitem($_) } @networks) : ()), - Gtk2::SeparatorMenuItem->new, + Gtk3::SeparatorMenuItem->new, ); } gtkappend($simple_menu, create_menu_choices('setInterface', 'allow_single_choice')); @@ -545,25 +545,25 @@ sub generate_menu() { push @settings, create_action_item('chooseProfile'); if (defined $interactive) { - $interactive_cb = gtkshow(gtksignal_connect(gtkset_active(Gtk2::CheckMenuItem->new_with_label(N("Interactive Firewall automatic mode")), + $interactive_cb = gtkshow(gtksignal_connect(gtkset_active(Gtk3::CheckMenuItem->new_with_label(N("Interactive Firewall automatic mode")), !$interactive), toggled => sub { eval { $ifw->set_interactive(to_bool(!$_[0]->get_active)) } })); push @settings, $interactive_cb; } - push @settings, gtkshow(gtksignal_connect(gtkset_active(Gtk2::CheckMenuItem->new_with_label(N("Always launch on startup")), getAutoStart()), + push @settings, gtkshow(gtksignal_connect(gtkset_active(Gtk3::CheckMenuItem->new_with_label(N("Always launch on startup")), getAutoStart()), toggled => sub { setAutoStart(uc(bool2text($_[0]->get_active))) })); - $menu->append(gtkshow(Gtk2::SeparatorMenuItem->new)); + $menu->append(gtkshow(Gtk3::SeparatorMenuItem->new)); if ($current_state ne 'unconfigured' && $wireless_device) { $menu->append(gtkshow(create_menu(N("Wireless networks"), create_action_item('wireless'), - gtkshow(Gtk2::SeparatorMenuItem->new), + gtkshow(Gtk3::SeparatorMenuItem->new), map { generate_wireless_menuitem($_) } get_wireless_networks_sorted()))); } if (my $vpn = create_action_item('chooseVPN')) { $menu->append($vpn) } if (my $set = $current_state ne 'unconfigured' && create_action_item('setInterface')) { $menu->append($set) } $menu->append(gtkshow(create_menu(N("Settings"), @settings))); - $menu->append(gtkshow(Gtk2::SeparatorMenuItem->new)); + $menu->append(gtkshow(Gtk3::SeparatorMenuItem->new)); $menu->append(create_action_item('help')); $menu->append(create_action_item('quit')); $menu; @@ -571,7 +571,7 @@ sub generate_menu() { sub mainQuit() { Glib::Source->remove($timeout) if $timeout; Glib::Source->remove($update_timeout) if $update_timeout; - Gtk2->main_quit; + Gtk3->main_quit; } sub getAutoStart() { my %p = getVarsFromSh($onstartupfile); diff --git a/bin/net_monitor b/bin/net_monitor index eb9a37a..d3704b8 100755 --- a/bin/net_monitor +++ b/bin/net_monitor @@ -29,14 +29,14 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla use c; use interactive; -use mygtk2 qw(gtknew gtkset); -use ugtk2 qw(:create :helpers :wrappers); +use mygtk3 qw(gtknew gtkset); +use ugtk3 qw(:create :helpers :wrappers); use common; use network::network; use network::tools; use POSIX; -$ugtk2::wm_icon = "/usr/share/mcc/themes/default/net_monitor-mdk.png"; +$ugtk3::wm_icon = "/usr/share/mcc/themes/default/net_monitor-mdk.png"; if ("@ARGV" =~ /--status/) { print network::tools::connected(); exit(0) } my $force = "@ARGV" =~ /--force/; @@ -57,7 +57,7 @@ if ($force) { $quiet and exit(0); -my $window1 = ugtk2->new(N("Network Monitoring")); +my $window1 = ugtk3->new(N("Network Monitoring")); $window1->{window}->signal_connect(delete_event => \&main_quit); unless ($::isEmbedded) { @@ -121,18 +121,18 @@ gtkadd($window1->{window}, 0, gtknew('HButtonBox', layout => 'edge', children_loose => [ my $button_close = gtknew('Button', text => N("Close"), clicked => \&main_quit), ]), - 0, my $statusbar = Gtk2::Statusbar->new + 0, my $statusbar = Gtk3::Statusbar->new ]), ); $window1->{window}->show_all; $window1->{window}->realize; -my $gct = Gtk2::Gdk::GC->new($window1->{window}->window); +my $gct = Gtk3::Gdk::GC->new($window1->{window}->window); $gct->set_foreground($colort); -my $gcr = Gtk2::Gdk::GC->new($window1->{window}->window); +my $gcr = Gtk3::Gdk::GC->new($window1->{window}->window); $gcr->set_foreground($colorr); -my $gca = Gtk2::Gdk::GC->new($window1->{window}->window); +my $gca = Gtk3::Gdk::GC->new($window1->{window}->window); $gca->set_foreground($colora); $statusbar->push(1, N("Wait please, testing your connection...")); @@ -180,7 +180,7 @@ sub main_quit() { } $config{use_same_scale} = bool2yesno($use_same_scale); setVarsInSh($cfg_file, \%config); - ugtk2->exit(0); + ugtk3->exit(0); } sub getcurrentintf() { @@ -383,7 +383,7 @@ sub get_val() { sub change_color { my ($color) = @_; my $dialog = _create_dialog(N("Color configuration")); - $dialog->vbox->add(my $colorsel = Gtk2::ColorSelection->new); + $dialog->vbox->add(my $colorsel = Gtk3::ColorSelection->new); $colorsel->set_current_color($color); $dialog->add_button(N("Cancel"), 'cancel'); $dialog->add_button(N("Ok"), 'ok'); @@ -408,7 +408,7 @@ sub color_button { $gc->set_rgb_fg_color($color); $_[0]->queue_draw; }, - child => gtksignal_connect(gtkshow(gtksize(gtkset(Gtk2::DrawingArea->new, width => 10, height => 10), 10, 10)), + child => gtksignal_connect(gtkshow(gtksize(gtkset(Gtk3::DrawingArea->new, width => 10, height => 10), 10, 10)), expose_event => sub { $_[0]->window->draw_rectangle($gc, 1, 0, 0, 10, 10) }) ); } @@ -432,7 +432,7 @@ sub update() { $monitor->{$intf}{initialt} = $monitor->{$intf}{val}[8]; $monitor->{$intf}{totalr} = 0; $monitor->{$intf}{totalt} = 0; - $darea->{$intf} = Gtk2::DrawingArea->new; + $darea->{$intf} = Gtk3::DrawingArea->new; $darea->{$intf}->set_events(["pointer_motion_mask"]); $notebook->append_page(gtkshow(my $page = gtknew('VBox', children => [ 0, gtknew('HBox', border_width => 5, children_tight => [ @@ -469,7 +469,7 @@ sub update() { gtknew('Label', text => $intf)); $monitor->{$intf}{page} = $notebook->page_num($page); $darea->{$intf}->realize; - $pixmap->{$intf} = Gtk2::Gdk::Pixmap->new($darea->{$intf}->window, $width, $height, $darea->{$intf}->window->get_depth); + $pixmap->{$intf} = Gtk3::Gdk::Pixmap->new($darea->{$intf}->window, $width, $height, $darea->{$intf}->window->get_depth); $monitor->{$intf}{referencer} = $monitor->{$intf}{val}[0]; $monitor->{$intf}{referencet} = $monitor->{$intf}{val}[8]; $pixmap->{$intf}->draw_rectangle($darea->{$intf}->style->black_gc, 1, 0, 0, $width, $height); @@ -485,7 +485,7 @@ sub update() { return if !$darea->{$intf}->window; $darea->{$intf}->window->draw_drawable($darea->{$intf}->style->bg_gc('normal'), $pixmap->{$intf}, 0, 0, 0, 0, $width, $height); }); - $gc_lines->{$intf} = Gtk2::Gdk::GC->new($darea->{$intf}->window); + $gc_lines->{$intf} = Gtk3::Gdk::GC->new($darea->{$intf}->window); $gc_lines->{$intf}->set_foreground($darea->{$intf}->style->white); $gc_lines->{$intf}->set_line_attributes(1, 'on-off-dash', 'not-last', 'round'); @@ -538,7 +538,7 @@ sub draw_monitor { my $gcl = $gc_lines->{$intf}; my $pixmap = $pixmap->{$intf}; my $gc = $darea->{$intf}->style->white_gc; - # fix race on ugtk2->exit that causes a crash (#33023) + # fix race on ugtk3->exit that causes a crash (#33023) return 0 if !$gc; $pixmap->draw_rectangle($darea->{$intf}->style->black_gc, 1, 0, 0, $width, $height); my $maxr = 0; |