summaryrefslogtreecommitdiffstats
path: root/bin/drakhosts
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2013-11-07 16:57:13 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2013-11-24 11:00:40 +0100
commit4a4453328a1a2051307f44e6c1c200625666ba16 (patch)
tree9fb9eb5089abd561cf1c857e448e3c63fcc4465e /bin/drakhosts
parent7bf101337af175668274aaae14b6320a5224f480 (diff)
downloaddrakx-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/drakhosts')
-rwxr-xr-xbin/drakhosts44
1 files changed, 22 insertions, 22 deletions
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;