summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2013-11-28 16:31:29 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2013-12-03 12:43:24 +0100
commit06018d427cc8667dc8f8eb96de43685ad9fb5a19 (patch)
tree24b13a7c8f9f74e1b6af86f8f61a1b2dfe73289c /drakpxelinux.pl
parent748c943c61ed8cdb6e5e6f428e1e6657d48e0e41 (diff)
downloaddrakpxelinux-06018d427cc8667dc8f8eb96de43685ad9fb5a19.tar
drakpxelinux-06018d427cc8667dc8f8eb96de43685ad9fb5a19.tar.gz
drakpxelinux-06018d427cc8667dc8f8eb96de43685ad9fb5a19.tar.bz2
drakpxelinux-06018d427cc8667dc8f8eb96de43685ad9fb5a19.tar.xz
drakpxelinux-06018d427cc8667dc8f8eb96de43685ad9fb5a19.zip
use Gtk3 namespace instead of Gtk2
Diffstat (limited to 'drakpxelinux.pl')
-rwxr-xr-xdrakpxelinux.pl106
1 files changed, 53 insertions, 53 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index c4a3bd5..c407e5c 100755
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -37,13 +37,13 @@ use interactive;
# must come *after* definition of textdomains for proper initialisation
use ugtk3 qw(:ask :helpers :wrappers :create :dialogs);
use mygtk3 qw(gtknew);
-use Gtk2::SimpleList;
-use Gtk2::Helper;
+use Gtk3::SimpleList;
+use Gtk3::Helper;
use run_program;
use Data::Dumper;
our $model = create_model();
-our $treeview = Gtk2::TreeView->new_with_model($model);
+our $treeview = Gtk3::TreeView->new_with_model($model);
# ie of entry menu in PXE:
#label linux
@@ -137,7 +137,7 @@ sub restart_dialog {
sub set_help_tip {
my ($entry, $key) = @_;
- gtkset_tip(new Gtk2::Tooltips, $entry, formatAlaTeX($help{$key}));
+ gtkset_tip(new Gtk3::Tooltips, $entry, formatAlaTeX($help{$key}));
}
if (!$::testing && !$in->do_pkgs->ensure_is_installed('pxe', $network::pxe::pxe_config_file)) {
@@ -261,8 +261,8 @@ sub set_pxelinux_entry_at_iter {
sub create_model() {
-# my $model = Gtk2::ListStore->new(("Glib::String") x NUM_COLUMNS);
- my $model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
+# my $model = Gtk3::ListStore->new(("Glib::String") x NUM_COLUMNS);
+ my $model = Gtk3::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
# set_pxelinux_entry_at_iter($model, $model->append, $_) foreach @{$pxelinux_conf->{entries}};
set_pxelinux_entry_at_iter($model, $model->append, $_) foreach @{$pxelinux_conf->{entries}};
return $model;
@@ -438,7 +438,7 @@ sub clone_box_item {
push @{$pxelinux_conf->{entries}}, $newentry_data;
set_pxelinux_entry_at_iter($model, $model->append, $newentry_data);
write_conf($pxelinux_conf, $treeview);
- Gtk2->main_quit;
+ Gtk3->main_quit;
};
gtkadd($w->{window},
gtknew('VBox', children_loose => [
@@ -464,15 +464,15 @@ sub edit_box_item {
my $i = ($path->get_indices)[0];
my $entry = $pxelinux_conf->{entries}[$i];
- my $dialog = new Gtk2::Dialog();
+ my $dialog = new Gtk3::Dialog();
$dialog->set_modal(1);
$dialog->set_resizable(0);
$entry->{label} =~ /local/ and info_dialog(N("Local"), N("You can't modify local entry.")) and return 0;
- my $label = Gtk2::Label->new($entry->{label});
+ my $label = Gtk3::Label->new($entry->{label});
# my $oldlabel = $label;
- my $info = Gtk2::Entry->new;
+ my $info = Gtk3::Entry->new;
$info->set_text($entry->{info});
# $info->set_sensitive(0);
set_help_tip($info, 'info');
@@ -484,7 +484,7 @@ sub edit_box_item {
chdir($network::pxe::pxelinux_client_root . "/pxelinux.cfg/profiles/");
} else { chdir($network::pxe::pxelinux_client_root);
}
- my $fd = new Gtk2::FileSelection(N("Selection"));
+ my $fd = new Gtk3::FileSelection(N("Selection"));
$fd->set_modal(1);
$fd->signal_connect("destroy", sub { $fd->hide });
$fd->ok_button->signal_connect(clicked => sub {
@@ -527,85 +527,85 @@ sub edit_box_item {
};
- my $kernel = Gtk2::Entry->new;
+ my $kernel = Gtk3::Entry->new;
$kernel->set_text($entry->{kernel});
$kernel->set_sensitive(0);
set_help_tip($kernel, 'kernel');
my $file_dialogk = $fdwidget->($kernel, "", "kernel", $entry->{label});
# button kernel
- my $buttonkernel = Gtk2::Button->new(N("Select kernel to boot"));
+ my $buttonkernel = Gtk3::Button->new(N("Select kernel to boot"));
$buttonkernel->signal_connect(clicked => sub { $file_dialogk->show });
- my $initrd = Gtk2::Entry->new;
+ my $initrd = Gtk3::Entry->new;
$initrd->set_sensitive(0);
$initrd->set_text($entry->{initrd});
set_help_tip($initrd, 'initrd');
- my $auto_install = Gtk2::Entry->new;
+ my $auto_install = Gtk3::Entry->new;
$auto_install->set_text($entry->{auto_install});
set_help_tip($auto_install, 'auto_install');
my $profile = get_selected_profile();
my $profile_selection = $fdwidget->($auto_install, "", "auto_install", $entry->{label}, $profile);
- my $buttonprofil = Gtk2::Button->new("Select auto_install.pl");
+ my $buttonprofil = Gtk3::Button->new("Select auto_install.pl");
$buttonprofil->signal_connect(clicked => sub { $profile_selection->show });
my $file_dialog = $fdwidget->($initrd, "", "initrd", $entry->{label});
- my $buttoninitrd = Gtk2::Button->new(N("Select associated initrd"));
+ my $buttoninitrd = Gtk3::Button->new(N("Select associated initrd"));
$buttoninitrd->signal_connect(clicked => sub { $file_dialog->show });
# combo box to pop down automatic installation
- my $automatic = Gtk2::OptionMenu->new;
+ my $automatic = Gtk3::OptionMenu->new;
$automatic->set_popdown_strings(@list_method);
$automatic->entry->set_text($entry->{method});
set_help_tip($automatic, 'automatic');
# combo box to pop down list of network interface
- my $interface = new Gtk2::OptionMenu();
+ my $interface = new Gtk3::OptionMenu();
$interface->set_popdown_strings(@list_eth);
$interface->entry->set_text($entry->{interface});
set_help_tip($interface, 'interface');
-# my $network = Gtk2::Entry->new;
+# my $network = Gtk3::Entry->new;
# $network->set_text($entry->{network});
# set_help_tip($network, 'network');
- my $server = Gtk2::Entry->new;
+ my $server = Gtk3::Entry->new;
$server->set_text($entry->{server});
set_help_tip($server, 'server');
- my $directory = Gtk2::Entry->new;
+ my $directory = Gtk3::Entry->new;
$directory->set_text($entry->{directory});
set_help_tip($directory, 'directory');
my $file_dialogd = $fdwidget->($directory, "dir");
- my $buttondir = Gtk2::Button->new(N("Select directory"));
+ my $buttondir = Gtk3::Button->new(N("Select directory"));
$buttondir->signal_connect(clicked => sub { $file_dialogd->show });
- my $ramdisk_size = new Gtk2::OptionMenu();
+ my $ramdisk_size = new Gtk3::OptionMenu();
$ramdisk_size->set_popdown_strings(@list_ram);
if ($entry->{ramdisk_size} eq "") { $entry->{ramdisk_size} = "128000" }
$ramdisk_size->entry->set_text($entry->{ramdisk_size});
set_help_tip($ramdisk_size, 'ramsize');
- my $vga = new Gtk2::OptionMenu();
+ my $vga = new Gtk3::OptionMenu();
$vga->set_popdown_strings(sort keys %network::pxe::vga_resolution_to_bios);
$vga->entry->set_text($network::pxe::vga_bios_to_resolution{$entry->{vga}});
set_help_tip($vga, 'vga');
- my $display = Gtk2::Entry->new;
+ my $display = Gtk3::Entry->new;
$display->set_text($entry->{display});
set_help_tip($display, 'display');
- my $others = Gtk2::Entry->new;
+ my $others = Gtk3::Entry->new;
if ($entry->{others} eq "") { $entry->{others} = "root=/dev/ram3 rw" }
$others->set_text($entry->{others});
set_help_tip($others, 'others');
- 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,5),
+ gtkpack_(Gtk3::HBox->new(0,5),
0, gtkadd_widget($size_groups{label}, $label),
1, gtkadd_widget($size_groups{widget}, $widget),
2, gtkadd_widget($size_groups{button}, $button),
@@ -613,8 +613,8 @@ sub edit_box_item {
};
# display IPADDRESS only if dhcp is not selected
- my $ipaddr = Gtk2::Entry->new;
- my $toggledhcp = Gtk2::CheckButton->new(N("DHCP or IP address"));
+ my $ipaddr = Gtk3::Entry->new;
+ my $toggledhcp = Gtk3::CheckButton->new(N("DHCP or IP address"));
if ($entry->{network} eq "dhcp") { $toggledhcp->set_active(1);
$ipaddr->set_sensitive(0);
} else {
@@ -634,27 +634,27 @@ sub edit_box_item {
# ok, lets create the dialog box :-)
gtkpack_($dialog->vbox,
- 0, gtkadd(Gtk2::Frame->new(N("PXE entry")),
- gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5),
+ 0, gtkadd(Gtk3::Frame->new(N("PXE entry")),
+ gtkpack_(gtkset_border_width(Gtk3::VBox->new, 5),
0, $label_and_widgets->(N("Label"), $label, ""),
0, $label_and_widgets->(N("Entry description"), $info, ""),
- 0, Gtk2::VSeparator->new,
+ 0, Gtk3::VSeparator->new,
0, $label_and_widgets->(N("Kernel image: ") . $network::pxe::pxelinux_client_root . "/", $kernel, $buttonkernel),
0, $label_and_widgets->(N("Initrd image: ") . $network::pxe::pxelinux_client_root . "/", $initrd, $buttoninitrd),
),
),
- 0, gtkadd(Gtk2::Frame->new(N("Mageia installer options")),
- gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5),
+ 0, gtkadd(Gtk3::Frame->new(N("Mageia installer options")),
+ gtkpack_(gtkset_border_width(Gtk3::VBox->new, 5),
0, $label_and_widgets->(N("Ramdisk size"), $ramdisk_size, ""),
0, $label_and_widgets->(N("Custom options"), $others, ""),
0, $label_and_widgets->(N("Frame buffer resolution"), $vga, ""),
0, $label_and_widgets->(N("Remote IP of X server"), $display, ""),
- 0, gtkadd(Gtk2::Frame->new(N("Automatic Options")),
- gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5),
+ 0, gtkadd(Gtk3::Frame->new(N("Automatic Options")),
+ gtkpack_(gtkset_border_width(Gtk3::VBox->new, 5),
0, $label_and_widgets->(N("Installation method"), $automatic, ""),
0, $label_and_widgets->(N("Network interface"), $interface, ""),
- 0, gtkpack_(Gtk2::HBox->new(0,5),
+ 0, gtkpack_(Gtk3::HBox->new(0,5),
0, gtkadd_widget($size_groups{label}, $toggledhcp),
1, gtkadd_widget($size_groups{widget}, $ipaddr),
2, gtkadd_widget($size_groups{button}, ""),
@@ -707,9 +707,9 @@ sub edit_box_item {
}
sub show_help() { info_dialog("help",
- gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3),
+ gtkpack_(gtkset_border_width(Gtk3::VBox->new, 3),
0, $help,
- 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("online PXE documentation")), 'helponline'),
+ 0, gtksignal_connect(set_help_tip(Gtk3::Button->new(N("online PXE documentation")), 'helponline'),
clicked => sub { system("/usr/bin/www-browser http://people.mandriva.com/~aginies/doc/pxe/ &") }
),
),
@@ -857,7 +857,7 @@ sub add_columns {
my $treeview = shift;
my $model = $treeview->get_model;
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);
@@ -870,7 +870,7 @@ my $mac_regexp = '(?:[0-9a-f]{2}:){5}[0-9a-f]{2}';
my $profiles_conf = network::pxe::read_profiles();
sub create_systems_list() {
- my $systems = Gtk2::SimpleList->new(
+ my $systems = Gtk3::SimpleList->new(
N("MAC address") => 'text',
N("Installation profile") => 'text',
N("Boot profile") => 'text',
@@ -899,7 +899,7 @@ sub sort_by_column {
}
sub create_profiles_list() {
- my $profiles = Gtk2::SimpleList->new("Profile name" => 'text');
+ my $profiles = Gtk3::SimpleList->new("Profile name" => 'text');
$profiles->set_headers_visible(1);
$profiles->get_selection->set_mode('browse');
$profiles->get_selection->signal_connect(changed => sub {
@@ -1045,7 +1045,7 @@ sub add_profile() {
network::pxe::profile_exists($profiles_conf, $profile) and err_dialog(N("Add profile"), N("The %s profile already exists!", $profile)), return;
network::pxe::add_empty_profile($profiles_conf, $profile);
refresh_profiles();
- Gtk2->main_quit;
+ Gtk3->main_quit;
};
gtkadd($w->{window},
gtknew('VBox', children_loose => [
@@ -1136,7 +1136,7 @@ $treeview->signal_connect(button_press_event => sub {
});
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>');
@@ -1153,8 +1153,8 @@ my $okcancel = create_okcancel({
# main interface
gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
0, $menu,
- if_(!$::isEmbedded, 0, Gtk2::Banner->new('IC-Dhost-48', N("Drakpxelinux manage your PXE server"))),
- if_($::isEmbedded, 0, Gtk2::Label->new("Here you can manage your PXE server.")),
+ if_(!$::isEmbedded, 0, Gtk3::Banner->new('IC-Dhost-48', N("Drakpxelinux manage your PXE server"))),
+ if_($::isEmbedded, 0, Gtk3::Label->new("Here you can manage your PXE server.")),
1, gtknew('Notebook', children => [
gtknew('Label', text => N("PXE configuration file")),
gtknew('VBox', spacing => 0, children => [
@@ -1189,7 +1189,7 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
]
),
0, gtknew('HButtonBox', layout => 'start', children => [
- 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Add a PXE entry")), 'addpxe'), clicked => sub {
+ 0, gtksignal_connect(set_help_tip(Gtk3::Button->new(N("Add a PXE entry")), 'addpxe'), clicked => sub {
my $pxelinux_conf = get_pxelinux_conf_from_profile();
my $profile = get_selected_profile;
if ($profile eq "local") { $in->ask_warn(N("Info"), N("Local profile is special, and doesn't need a new entry.")) and return };
@@ -1203,17 +1203,17 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [
err_dialog(N("Error"), N("The PXE entry wizard has unexpectedly failed:") . "\n\n" . $err);
}
}),
- 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Remove PXE entry")), 'removepxe'), clicked => sub {
+ 0, gtksignal_connect(set_help_tip(Gtk3::Button->new(N("Remove PXE entry")), 'removepxe'), clicked => sub {
my $pxelinux_conf = get_pxelinux_conf_from_profile();
remove_item($model, $treeview, $pxelinux_conf);
#write_conf($pxelinux_conf, $treeview);
}),
- 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Edit PXE entry")), 'editb'), clicked => sub {
+ 0, gtksignal_connect(set_help_tip(Gtk3::Button->new(N("Edit PXE entry")), 'editb'), clicked => sub {
my $pxelinux_conf = get_pxelinux_conf_from_profile();
edit_box_item($model, $treeview, $pxelinux_conf);
#write_conf($pxelinux_conf, $treeview);
}),
- 0, gtksignal_connect(Gtk2::Button->new(N("Clone PXE entry")), clicked => sub {
+ 0, gtksignal_connect(Gtk3::Button->new(N("Clone PXE entry")), clicked => sub {
my $pxelinux_conf = get_pxelinux_conf_from_profile();
clone_box_item($model, $treeview, $pxelinux_conf);
}),
@@ -1266,4 +1266,4 @@ Glib::Timeout->add(60000, \&get_mac_addresses_from_dhcp_log);
refresh_profiles();
$w->show;
-Gtk2->main;
+Gtk3->main;