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/net_monitor | |
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/net_monitor')
-rwxr-xr-x | bin/net_monitor | 30 |
1 files changed, 15 insertions, 15 deletions
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; |