summaryrefslogtreecommitdiffstats
path: root/perl-install/interactive/gtk.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/interactive/gtk.pm')
-rw-r--r--perl-install/interactive/gtk.pm94
1 files changed, 47 insertions, 47 deletions
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm
index d3b36abc3..c1b196f8f 100644
--- a/perl-install/interactive/gtk.pm
+++ b/perl-install/interactive/gtk.pm
@@ -44,9 +44,9 @@ sub ask_fileW {
sub create_boxradio {
my ($e, $onchange_f, $double_click) = @_;
- my $boxradio = gtkpack2__(Gtk2::VBox->new,
+ my $boxradio = gtkpack2__(Gtk3::VBox->new,
my @radios = gtkradio('', @{$e->{formatted_list}}));
- my $tips = Gtk2::Tooltips->new;
+ my $tips = Gtk3::Tooltips->new;
mapn {
my ($txt, $w) = @_;
# workaround infamous 6 years old gnome bug #101968:
@@ -78,11 +78,11 @@ sub create_treeview_list {
my ($e, $onchange_f, $double_click) = @_;
my $curr;
- my $list = Gtk2::ListStore->new("Glib::String");
- my $list_tv = Gtk2::TreeView->new_with_model($list);
+ my $list = Gtk3::ListStore->new("Glib::String");
+ my $list_tv = Gtk3::TreeView->new_with_model($list);
$list_tv->set_headers_visible(0);
$list_tv->get_selection->set_mode('browse');
- my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, my $renderer = Gtk2::CellRendererText->new, 'text' => 0);
+ my $textcolumn = Gtk3::TreeViewColumn->new_with_attributes(undef, my $renderer = Gtk3::CellRendererText->new, 'text' => 0);
$list_tv->append_column($textcolumn);
$renderer->set_property('ellipsize', 'end');
@@ -124,7 +124,7 @@ sub create_treeview_list {
if ($j == @l) {
$starting_word = '';
} else {
- $select->(Gtk2::TreePath->new_from_string(($j + $curr) % @l));
+ $select->(Gtk3::TreePath->new_from_string(($j + $curr) % @l));
}
$timeout = Glib::Timeout->add($forgetTime, sub { $timeout = $starting_word = ''; 0 });
@@ -151,7 +151,7 @@ sub create_treeview_list {
my $nb = find_index { $_ eq $v } @{$e->{list}};
my ($old_path) = $list_tv->get_cursor;
if (!$old_path || $nb != $old_path->to_string) {
- $select->(Gtk2::TreePath->new_from_string($nb));
+ $select->(Gtk3::TreePath->new_from_string($nb));
}
undef $old_path if $old_path;
};
@@ -162,7 +162,7 @@ sub __create_tree_model {
my ($e) = @_;
my $sep = quotemeta $e->{separator};
- my $tree_model = Gtk2::TreeStore->new("Glib::String", if_($e->{image2f}, "Gtk2::Gdk::Pixbuf"));
+ my $tree_model = Gtk3::TreeStore->new("Glib::String", if_($e->{image2f}, "Gtk3::Gdk::Pixbuf"));
my $build_value = sub {
my ($v) = @_;
@@ -203,14 +203,14 @@ sub create_treeview_tree {
my ($e, $onchange_f, $double_click) = @_;
my $tree_model = __create_tree_model($e);
- my $tree = Gtk2::TreeView->new_with_model($tree_model);
+ my $tree = Gtk3::TreeView->new_with_model($tree_model);
$tree->get_selection->set_mode('browse');
{
- my $col = Gtk2::TreeViewColumn->new;
- $col->pack_start(my $texrender = Gtk2::CellRendererText->new, 0);
+ my $col = Gtk3::TreeViewColumn->new;
+ $col->pack_start(my $texrender = Gtk3::CellRendererText->new, 0);
$col->add_attribute($texrender, text => 0);
if ($e->{image2f}) {
- $col->pack_start(my $pixrender = Gtk2::CellRendererPixbuf->new, 0);
+ $col->pack_start(my $pixrender = Gtk3::CellRendererPixbuf->new, 0);
$col->add_attribute($pixrender, pixbuf => 1);
}
$tree->append_column($col);
@@ -219,7 +219,7 @@ sub create_treeview_tree {
my $select = sub {
my ($path_str) = @_;
- my $path = Gtk2::TreePath->new_from_string($path_str);
+ my $path = Gtk3::TreePath->new_from_string($path_str);
$tree->expand_to_path($path);
$tree->set_cursor($path, undef, 0);
gtkflush(); #- workaround gtk3 bug not honouring centering on the given row if node was closed
@@ -331,7 +331,7 @@ sub create_treeview_tree {
}
#- $actions is a ref list of $action
-#- $action is a { kind => $kind, action => sub { ... }, button => Gtk2::Button->new(...) }
+#- $action is a { kind => $kind, action => sub { ... }, button => Gtk3::Button->new(...) }
#- where $kind is one of '', 'modify', 'remove', 'add'
sub add_modify_remove_action {
my ($button, $buttons, $e, $treelist) = @_;
@@ -371,13 +371,13 @@ sub create_widget {
my ($w, $real_w, $focus_w, $set);
if ($e->{type} eq 'iconlist') {
- $w = Gtk2::Button->new;
+ $w = Gtk3::Button->new;
$set = sub {
gtkdestroy($e->{icon});
my $f = $e->{icon2f}->($_[0]);
$e->{icon} = -e $f ?
gtkcreate_img($f) :
- Gtk2::WrappedLabel->new(may_apply($e->{format}, $_[0]));
+ Gtk3::WrappedLabel->new(may_apply($e->{format}, $_[0]));
$w->add(gtkshow($e->{icon}));
};
$w->signal_connect(clicked => sub {
@@ -387,14 +387,14 @@ sub create_widget {
if ($e->{alignment} eq 'right') {
$real_w = gtknew('HButtonBox', layout => 'start', children_tight => [ $w ]);
} else {
- $real_w = gtkpack_(Gtk2::HBox->new(0,10), 1, Gtk2::HBox->new(0,0), 0, $w, 1, Gtk2::HBox->new(0,0));
+ $real_w = gtkpack_(Gtk3::HBox->new(0,10), 1, Gtk3::HBox->new(0,0), 0, $w, 1, Gtk3::HBox->new(0,0));
}
} elsif ($e->{type} eq 'bool') {
if ($e->{image}) {
- $w = ugtk3::gtkadd(Gtk2::CheckButton->new, gtkshow(gtkcreate_img($e->{image})));
+ $w = ugtk3::gtkadd(Gtk3::CheckButton->new, gtkshow(gtkcreate_img($e->{image})));
} else {
#- warn "\"text\" member should have been used instead of \"label\" one at:\n", common::backtrace(), "\n" if $e->{label} && !$e->{text};
- $w = Gtk2::CheckButton->new_with_label($e->{text});
+ $w = Gtk3::CheckButton->new_with_label($e->{text});
}
$w->signal_connect(clicked => $onchange->(sub { $w->get_active }));
$set = sub { $w->set_active($_[0]) };
@@ -419,16 +419,16 @@ sub create_widget {
$set = sub {
my $w = $w->child;
# handle Install_Buttons:
- if (ref($w) =~ /Gtk2::HBox/) {
- ($w) = find { ref($_) =~ /Gtk2::Label/ } $w->get_children;
+ if (ref($w) =~ /Gtk3::HBox/) {
+ ($w) = find { ref($_) =~ /Gtk3::Label/ } $w->get_children;
}
# guard against 'advanced' widgets that are now in their own dialog
# (instead of in another block child of an expander):
return if !$w;
$w->set_label(may_apply($e->{format}, $_[0])) };
} elsif ($e->{type} eq 'range') {
- my $adj = Gtk2::Adjustment->new(${$e->{val}}, $e->{min}, $e->{max} + ($e->{SpinButton} ? 0 : 1), 1, ($e->{max} - $e->{min}) / 10, 1);
- $w = $e->{SpinButton} ? Gtk2::SpinButton->new($adj, 10, 0) : Gtk2::HScale->new($adj);
+ my $adj = Gtk3::Adjustment->new(${$e->{val}}, $e->{min}, $e->{max} + ($e->{SpinButton} ? 0 : 1), 1, ($e->{max} - $e->{min}) / 10, 1);
+ $w = $e->{SpinButton} ? Gtk3::SpinButton->new($adj, 10, 0) : Gtk3::HScale->new($adj);
$w->set_size_request($e->{SpinButton} ? 100 : 200, -1);
$w->set_digits(0);
$adj->signal_connect(value_changed => $onchange->(sub { $adj->get_value }));
@@ -458,7 +458,7 @@ sub create_widget {
push @buttons, map { if_($actions->{$_}, 'gtk-go-' . $_) } qw(Up Down);
@buttons = map {
my $button = /^gtk-/ ? gtknew('Button', image => gtknew('Image', stock => lc($_)))
- : Gtk2::Button->new(translate($_));
+ : Gtk3::Button->new(translate($_));
my $kind = $_;
$kind =~ s/^gtk-go-//;
{ kind => lc $kind, action => $actions->{$kind}, button => $button, real_kind => $_ };
@@ -479,9 +479,9 @@ sub create_widget {
add_modify_remove_sensitive(\@buttons, $e);
my ($images, $real_buttons) = partition { $_->{real_kind} =~ /^gtk-/ } @buttons;
- $real_w = gtkpack_(Gtk2::HBox->new(0,0),
+ $real_w = gtkpack_(Gtk3::HBox->new(0,0),
1, create_scrolled_window($w),
- 0, gtkpack__(Gtk2::VBox->new(0,0),
+ 0, gtkpack__(Gtk3::VBox->new(0,0),
(map { $_->{button} } @$real_buttons),
if_($images,
gtknew('HButtonBox',
@@ -518,23 +518,23 @@ sub create_widget {
if (!$e->{separator}) {
if ($e->{not_edit}) {
- $real_w = $w = Gtk2::ComboBox->new_text;
+ $real_w = $w = Gtk3::ComboBox->new_text;
# FIXME: the following causes Gtk-CRITICAL but not solvable at realize time:
first($w->child->get_cell_renderers)->set_property('ellipsize', 'end') if !$e->{do_not_ellipsize};
$w->set_wrap_width($e->{gtk}{wrap_width}) if exists $e->{gtk}{wrap_width};
} else {
- $w = Gtk2::ComboBoxEntry->new_text;
+ $w = Gtk3::ComboBoxEntry->new_text;
($real_w, $w) = ($w, $w->child);
}
$real_w->set_popdown_strings(@formatted_list);
} else {
$model = __create_tree_model($e);
- $real_w = $w = Gtk2::ComboBox->new_with_model($model);
+ $real_w = $w = Gtk3::ComboBox->new_with_model($model);
- $w->pack_start(my $texrender = Gtk2::CellRendererText->new, 0);
+ $w->pack_start(my $texrender = Gtk3::CellRendererText->new, 0);
$w->add_attribute($texrender, text => 0);
if ($e->{image2f}) {
- $w->pack_start(my $pixrender = Gtk2::CellRendererPixbuf->new, 0);
+ $w->pack_start(my $pixrender = Gtk3::CellRendererPixbuf->new, 0);
$w->add_attribute($pixrender, pixbuf => 1);
}
}
@@ -568,21 +568,21 @@ sub create_widget {
$w = gtknew('WeaknessCheckEntry');
}
else {
- $w = Gtk2::Entry->new;
+ $w = Gtk3::Entry->new;
}
$w->signal_connect(changed => $onchange->(sub { $w->get_text }));
$w->signal_connect(focus_in_event => sub { $w->select_region(0, -1) });
$w->signal_connect(focus_out_event => sub { $w->select_region(0, 0) });
$set = sub { $w->set_text($_[0]) if $_[0] ne $w->get_text };
if ($e->{type} eq 'file') {
- my $button = gtksignal_connect(Gtk2::Button->new_from_stock('gtk-open'), clicked => sub {
+ my $button = gtksignal_connect(Gtk3::Button->new_from_stock('gtk-open'), clicked => sub {
my $file = $o->ask_fileW({
title => $e->{label},
want_a_dir => to_bool($e->{want_a_dir}),
});
$set->($file) if $file;
});
- $real_w = gtkpack_(Gtk2::HBox->new(0,0), 1, $w, 0, $button);
+ $real_w = gtkpack_(Gtk3::HBox->new(0,0), 1, $w, 0, $button);
}
}
$w->signal_connect(key_press_event => $e->{may_go_to_next});
@@ -628,9 +628,9 @@ sub all_title_entries {
sub create_widgets_block {
my ($o, $common, $l, $update, $ignore_ref) = @_;
- my $label_sizegrp = Gtk2::SizeGroup->new('horizontal');
- my $right_label_sizegrp = Gtk2::SizeGroup->new('horizontal');
- my $realw_sizegrp = Gtk2::SizeGroup->new('horizontal');
+ my $label_sizegrp = Gtk3::SizeGroup->new('horizontal');
+ my $right_label_sizegrp = Gtk3::SizeGroup->new('horizontal');
+ my $realw_sizegrp = Gtk3::SizeGroup->new('horizontal');
@$l = map_index {
if ($::i && ($_->{type} eq 'expander' || $_->{title})) {
@@ -667,7 +667,7 @@ sub create_widgets_block {
my $eater = if_($e->{alignment} eq 'right' && !$label_w, gtknew('Label'));
- $e->{real_w} = gtkpack_(Gtk2::HBox->new,
+ $e->{real_w} = gtkpack_(Gtk3::HBox->new,
if_($e->{icon}, 0, eval { gtkcreate_img($e->{icon}) }),
if_($eater, 1, $eater),
if_($label_w, $e->{alignment} eq 'right', $label_w),
@@ -700,7 +700,7 @@ sub create_widgets {
my $ok_clicked = sub {
!$mainw->{ok} || $mainw->{ok}->get_property('sensitive') or return;
$mainw->{retval} = 1;
- Gtk2->main_quit;
+ Gtk3->main_quit;
};
my @all = all_entries($l);
@@ -718,7 +718,7 @@ sub create_widgets {
$mainw->{rwindow}->hide;
if (my $v = $e->{clicked_may_quit}()) {
$mainw->{retval} = $v;
- Gtk2->main_quit;
+ Gtk3->main_quit;
}
$mainw->{rwindow}->show;
$update->();
@@ -750,7 +750,7 @@ sub create_widgets {
my $box = create_widgets_block($o, $common, $l, $update, \$ignore);
- my $tooltips = Gtk2::Tooltips->new;
+ my $tooltips = Gtk3::Tooltips->new;
foreach my $e (@all) {
$tooltips->set_tip($e->{w}, $e->{help}) if $e->{help} && !ref($e->{help});
}
@@ -804,20 +804,20 @@ sub get_html_file {
sub display_help_window {
my ($o, $common) = @_;
if (my $file = $common->{interactive_help_id}) {
- require Gtk2::WebKit;
+ require Gtk3::WebKit;
my $view = gtknew('WebKit_View');
load_from_uri($view, $file);
my $w = ugtk3->new(N("Help"), modal => 1);
gtkadd($w->{rwindow},
- gtkpack_(Gtk2::VBox->new,
+ gtkpack_(Gtk3::VBox->new,
1, create_scrolled_window(gtkset_border_width($view, 5),
[ 'never', 'automatic' ],
),
- 0, Gtk2::HSeparator->new,
+ 0, Gtk3::HSeparator->new,
0, gtkpack(create_hbox('end'),
- gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit })
+ gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit })
),
),
);
@@ -875,7 +875,7 @@ sub ask_fromW {
my $entry_to_focus = find { $_->{focus} && $_->{focus}() } @$l;
my $widget_to_focus = $entry_to_focus ? $entry_to_focus->{focus_w} :
$common->{focus_cancel} ? $mainw->{cancel} :
- @$l && (!$mainw->{ok} || @$l == 1 && member(ref($l->[0]{focus_w}), "Gtk2::TreeView", "Gtk2::RadioButton")) ?
+ @$l && (!$mainw->{ok} || @$l == 1 && member(ref($l->[0]{focus_w}), "Gtk3::TreeView", "Gtk3::RadioButton")) ?
$l->[0]{focus_w} :
$mainw->{ok};
$widget_to_focus->grab_focus if $widget_to_focus;
@@ -918,7 +918,7 @@ my $reuse_timeout;
sub wait_messageW {
my ($o, $title, $message, $message_modifiable) = @_;
- my $to_modify = Gtk2::Label->new(scalar warp_text(ref $message_modifiable ? '' : $message_modifiable));
+ my $to_modify = Gtk3::Label->new(scalar warp_text(ref $message_modifiable ? '' : $message_modifiable));
Glib::Source->remove($reuse_timeout) if $reuse_timeout; $reuse_timeout = '';