diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2012-08-01 17:16:30 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-11-24 21:28:33 +0100 |
commit | b9e700aea8f8dfae031d9ff923f00393b052fd3d (patch) | |
tree | 77874a7a36987e70b128aa303842ba623ec249e0 | |
parent | 2cfaaed875e7caeae898acf23630558077bb668a (diff) | |
download | drakx-b9e700aea8f8dfae031d9ff923f00393b052fd3d.tar drakx-b9e700aea8f8dfae031d9ff923f00393b052fd3d.tar.gz drakx-b9e700aea8f8dfae031d9ff923f00393b052fd3d.tar.bz2 drakx-b9e700aea8f8dfae031d9ff923f00393b052fd3d.tar.xz drakx-b9e700aea8f8dfae031d9ff923f00393b052fd3d.zip |
use Gtk3 namespace instead of Gtk2
27 files changed, 443 insertions, 443 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index a04c47f5e..a19b1c057 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -1027,7 +1027,7 @@ sub display_release_notes { return; } - require Gtk2::WebKit; + require Gtk3::WebKit; require ugtk3; ugtk3->import(':all'); require mygtk3; @@ -1037,13 +1037,13 @@ sub display_release_notes { my $w = ugtk3->new(N("Release Notes"), transient => $::main_window, modal => 1, pop_it => 1); gtkadd($w->{rwindow}, - gtkpack_(Gtk2::VBox->new, + gtkpack_(Gtk3::VBox->new, 1, create_scrolled_window(ugtk3::gtkset_border_width($view, 5), [ 'never', 'automatic' ], ), 0, gtkpack(create_hbox('end'), gtknew('Button', text => N("Close"), - clicked => sub { Gtk2->main_quit }) + clicked => sub { Gtk3->main_quit }) ), ), ); @@ -1201,7 +1201,7 @@ sub selectLanguage_standalone { ]); $locale->{utf8} = !$non_utf8; lang::set($locale); - Gtk2->set_locale if $in->isa('interactive::gtk'); + Gtk3->set_locale if $in->isa('interactive::gtk'); lang::lang_changed($locale) if $old_lang ne $locale->{lang}; } diff --git a/perl-install/common.pm b/perl-install/common.pm index 9d5763202..f0dcacff3 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -84,7 +84,7 @@ sub to_utf8 { $str; } -#- This is needed because text printed by Gtk2 will always be encoded +#- This is needed because text printed by Gtk3 will always be encoded #- in UTF-8; #- we first check if LC_ALL is defined, because if it is, changing #- only LC_COLLATE will have no effect. diff --git a/perl-install/dbus_object.pm b/perl-install/dbus_object.pm index a1038fc40..5c59de7e0 100644 --- a/perl-install/dbus_object.pm +++ b/perl-install/dbus_object.pm @@ -55,9 +55,9 @@ sub set_gtk3_watch_helper { my ($con, $watch) = @_; my $flags = $watch->get_flags; require Net::DBus::Binding::Watch; - require Gtk2::Helper; + require Gtk3::Helper; if ($flags & &Net::DBus::Binding::Watch::READABLE) { - Gtk2::Helper->add_watch($watch->get_fileno, 'in', sub { + Gtk3::Helper->add_watch($watch->get_fileno, 'in', sub { $watch->handle(&Net::DBus::Binding::Watch::READABLE); $con->dispatch; 1; diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index f552fb1af..5d3a5af4e 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -48,7 +48,7 @@ sub load_theme() { my $rc = "/usr/share/libDrakX/diskdrake.rc"; -r $rc or $rc = dirname(__FILE__) . "/../diskdrake.rc"; -r $rc or $rc = dirname(__FILE__) . "/../share/diskdrake.rc"; - Gtk2::Rc->parse($rc); + Gtk3::Rc->parse($rc); } sub main { @@ -68,16 +68,16 @@ sub main { # updateLoopback(); gtkadd($w->{window}, - gtkpack_(Gtk2::VBox->new(0,7), + gtkpack_(Gtk3::VBox->new(0,7), 0, gtknew(($::isInstall ? ('Title1', 'label') : ('Label_Left', 'text')) => N("Click on a partition, choose a filesystem type then choose an action"), # workaround infamous 6 years old gnome bug #101968: width => mygtk3::get_label_width() ), - 1, (my $notebook_widget = Gtk2::Notebook->new), + 1, (my $notebook_widget = Gtk3::Notebook->new), 0, (my $per_kind_action_box = gtknew('HButtonBox', layout => 'edge')), 0, (my $per_kind_action_box2 = gtknew('HButtonBox', layout => 'end')), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, 0, (my $general_action_box = gtknew('HBox', spacing => 5)), ), ); @@ -150,7 +150,7 @@ sub try_ { } $update_all->($refresh); - Gtk2->main_quit if $v && member($name, 'Done'); + Gtk3->main_quit if $v && member($name, 'Done'); } sub get_action_box_size() { @@ -164,11 +164,11 @@ sub add_kind2notebook { my ($notebook_widget, $kind) = @_; die if $kind->{main_box}; - $kind->{display_box} = gtkset_size_request(Gtk2::HBox->new(0,0), $width, $height); - $kind->{action_box} = gtkset_size_request(Gtk2::VBox->new, get_action_box_size()); - $kind->{info_box} = Gtk2::VBox->new(0,0); + $kind->{display_box} = gtkset_size_request(Gtk3::HBox->new(0,0), $width, $height); + $kind->{action_box} = gtkset_size_request(Gtk3::VBox->new, get_action_box_size()); + $kind->{info_box} = Gtk3::VBox->new(0,0); my $box = - gtkpack_(Gtk2::VBox->new(0,7), + gtkpack_(Gtk3::VBox->new(0,7), 0, $kind->{display_box}, 0, filesystems_button_box(), 1, $kind->{info_box}); @@ -203,7 +203,7 @@ sub general_action_box { N_("Done")); my $box_end = gtknew('HButtonBox', layout => 'end', spacing => 5); foreach my $s (@actions) { - my $button = Gtk2::Button->new(translate($s)); + my $button = Gtk3::Button->new(translate($s)); $done_button = $button if $s eq 'Done'; gtkadd($box_end, gtksignal_connect($button, clicked => sub { try($s) })); } @@ -217,12 +217,12 @@ sub per_kind_action_box { foreach my $s (diskdrake::interactive::hd_possible_actions_base($in)) { gtkadd($box, - gtksignal_connect(Gtk2::Button->new(translate($s)), + gtksignal_connect(Gtk3::Button->new(translate($s)), clicked => sub { try($s, kind2hd($kind)) })); } foreach my $s (diskdrake::interactive::hd_possible_actions_extra($in)) { gtkadd($box2, - gtksignal_connect(Gtk2::Button->new(translate($s)), + gtksignal_connect(Gtk3::Button->new(translate($s)), clicked => sub { try($s, kind2hd($kind)) })); } } @@ -233,18 +233,18 @@ sub per_entry_action_box { if ($entry) { my @buttons = map { my $s = $_; - my $w = Gtk2::Button->new(translate($s)); + my $w = Gtk3::Button->new(translate($s)); $w->signal_connect(clicked => sub { try($s, kind2hd($kind), $entry) }); $w; } diskdrake::interactive::part_possible_actions($in, kind2hd($kind), $entry, $all_hds); - gtkadd($box, create_scrolled_window(gtkpack__(Gtk2::VBox->new, @buttons), undef, 'none')) if @buttons; + gtkadd($box, create_scrolled_window(gtkpack__(Gtk3::VBox->new, @buttons), undef, 'none')) if @buttons; } else { my $txt = !$::isStandalone && fsedit::is_one_big_fat_or_NT($all_hds->{hds}) ? N("You have one big Microsoft Windows partition. I suggest you first resize that partition (click on it, then click on \"Resize\")") : N("Please click on a partition"); - gtkpack($box, gtktext_insert(Gtk2::TextView->new, $txt)); + gtkpack($box, gtktext_insert(Gtk3::TextView->new, $txt)); } } @@ -338,7 +338,7 @@ sub create_buttons4partitions { } my $info = $entry->{mntpoint} || $entry->{device_LABEL}; $info .= "\n" . ($entry->{size} ? formatXiB($entry->{size}, 512) : N("Unknown")) if $info; - my $w = Gtk2::ToggleButton->new_with_label($info) or internal_error('new_with_label'); + my $w = Gtk3::ToggleButton->new_with_label($info) or internal_error('new_with_label'); $w->signal_connect(clicked => sub { $current_button != $w or return; current_entry_changed($kind, $entry); @@ -406,7 +406,7 @@ sub filesystems_button_box() { N_("Other"), N_("Empty")); my %name2fs_type = (Ext3 => 'ext3', Ext4 => 'ext4', 'XFS' => 'xfs', Swap => 'swap', Other => 'other', "Windows" => 'vfat', HFS => 'hfs'); - gtkpack(Gtk2::HBox->new, + gtkpack(Gtk3::HBox->new, map { my $t = $name2fs_type{$_}; my $w = gtknew('Button', text => translate($_), widget_name => 'PART_' . ($t || 'empty'), diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm index e29101b44..ff50e0a18 100644 --- a/perl-install/diskdrake/smbnfs_gtk.pm +++ b/perl-install/diskdrake/smbnfs_gtk.pm @@ -42,7 +42,7 @@ sub try_ { $in->ask_warn(N("Error"), formatError($err)); } update($kind); - Gtk2->main_quit if member($name, 'Cancel', 'Done'); + Gtk3->main_quit if member($name, 'Cancel', 'Done'); } sub raw_hd_options { @@ -127,14 +127,14 @@ sub import_tree { my ($kind, $info_box) = @_; my (%servers_displayed, %wservers, %wexports); - $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", "Glib::String"); - my $tree = Gtk2::TreeView->new_with_model($tree_model); + $tree_model = Gtk3::TreeStore->new("Gtk3::Gdk::Pixbuf", "Glib::String"); + my $tree = Gtk3::TreeView->new_with_model($tree_model); $tree->get_selection->set_mode('browse'); - my $col = Gtk2::TreeViewColumn->new; - $col->pack_start(my $pixrender = Gtk2::CellRendererPixbuf->new, 0); + my $col = Gtk3::TreeViewColumn->new; + $col->pack_start(my $pixrender = Gtk3::CellRendererPixbuf->new, 0); $col->add_attribute($pixrender, 'pixbuf', 0); - $col->pack_start(my $texrender = Gtk2::CellRendererText->new, 1); + $col->pack_start(my $texrender = Gtk3::CellRendererText->new, 1); $col->add_attribute($texrender, 'text', 1); $tree->append_column($col); diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm index 935ecb5bc..86b06f72e 100644 --- a/perl-install/fs/partitioning_wizard.pm +++ b/perl-install/fs/partitioning_wizard.pm @@ -300,14 +300,14 @@ sub create_display_box { my $width = 540; my $minwidth = 40; - my $display_box = ugtk3::gtkset_size_request(Gtk2::HBox->new(0,0), -1, 26); + my $display_box = ugtk3::gtkset_size_request(Gtk3::HBox->new(0,0), -1, 26); my $sep_count = @parts - 1; #- ratio used to compute initial partition pixel width (each partition should be > min_width) #- though, the pixel/sectors ratio cannot be the same for all the partitions my $initial_ratio = $totalsectors ? ($width - @parts * $minwidth - $sep_count) / $totalsectors : 1; - my $vbox = Gtk2::VBox->new; + my $vbox = Gtk3::VBox->new; my $part_sep; my $desc; @@ -315,9 +315,9 @@ sub create_display_box { my $last = $resize && $resize->[-1]; foreach my $entry (@parts) { - my $part_info = Gtk2::Label->new($entry->{device_LABEL}); + my $part_info = Gtk3::Label->new($entry->{device_LABEL}); my @colorized_fs_types = qw(ext2 ext3 ext4 xfs swap vfat ntfs ntfs-3g); - my $part_widget = Gtk2::EventBox->new; + my $part_widget = Gtk3::EventBox->new; $entry->{width} = int($entry->{size} * $initial_ratio) + $minwidth; if ($last && $last->{device} eq $entry->{device}) { #- entry is the last resizable partition @@ -329,11 +329,11 @@ sub create_display_box { $part_widget->set_name("PART_vfat"); $part_info->set_size_request(ceil($ratio * $entry->{min_win}), 0); - my $mdv_widget = gtkadd(gtkset_name(Gtk2::EventBox->new, "PART_new"), + my $mdv_widget = gtkadd(gtkset_name(Gtk3::EventBox->new, "PART_new"), gtkset_size_request(gtknew("Image", file => "small-logo"), $ratio * MB(600), 0)); - my $hpane = Gtk2::HPaned->new; + my $hpane = Gtk3::HPaned->new; $hpane->add1($part_widget); $hpane->child1_shrink(0); $hpane->add2($mdv_widget); @@ -345,17 +345,17 @@ sub create_display_box { my $add_part_size_info = sub { my ($name, $label) = @_; ugtk3::gtkpack__($desc, - gtkadd(gtkset_name(Gtk2::EventBox->new, $name), - Gtk2::Label->new(" " x 4)), + gtkadd(gtkset_name(Gtk3::EventBox->new, $name), + Gtk3::Label->new(" " x 4)), gtkset_size_request(gtkset_alignment($label, 0, 0.5), 150, 20)); }; - $desc = Gtk2::HBox->new(0,0); + $desc = Gtk3::HBox->new(0,0); - my $win_size_label = Gtk2::Label->new; + my $win_size_label = Gtk3::Label->new; $add_part_size_info->("PART_vfat", $win_size_label); - my $mdv_size_label = Gtk2::Label->new; + my $mdv_size_label = Gtk3::Label->new; $add_part_size_info->("PART_new", $mdv_size_label); my $update_size_labels = sub { @@ -400,8 +400,8 @@ sub create_display_box { } $part_widget->add($part_info); - $part_sep = gtkadd(Gtk2::EventBox->new, - gtkset_size_request(Gtk2::Label->new("."), 1, 0)); + $part_sep = gtkadd(Gtk3::EventBox->new, + gtkset_size_request(Gtk3::Label->new("."), 1, 0)); gtkpack__($display_box, $part_sep); } $display_box->remove($part_sep) if $part_sep; @@ -409,11 +409,11 @@ sub create_display_box { my @types = (N_("Ext2/3/4"), N_("XFS"), N_("Swap"), arch() =~ /sparc/ ? N_("SunOS") : arch() eq "ppc" ? N_("HFS") : N_("Windows"), N_("Other"), N_("Empty")); my %name2fs_type = ('Ext2/3/4' => 'ext3', 'XFS' => 'xfs', Swap => 'swap', Other => 'other', "Windows" => 'vfat', HFS => 'hfs'); - $desc = ugtk3::gtkpack(Gtk2::HBox->new, + $desc = ugtk3::gtkpack(Gtk3::HBox->new, map { my $t = $name2fs_type{$_}; - my $ev = Gtk2::EventBox->new; - my $w = Gtk2::Label->new(translate($_)); + my $ev = Gtk3::EventBox->new; + my $w = Gtk3::Label->new(translate($_)); $ev->add($w); $ev->set_name('PART_' . ($t || 'empty')); $ev; @@ -461,7 +461,7 @@ sub display_choices { $item = create_display_box($mainw->{kind}, $solutions{$s}[3], undef, $button); } elsif ($s eq 'existing_part') { } elsif ($s eq 'wipe_drive') { - $item = Gtk2::EventBox->new; + $item = Gtk3::EventBox->new; my $b2 = gtknew("Image", file => "small-logo"); $item->add($b2); $item->set_size_request(540,26); @@ -507,17 +507,17 @@ sub main { require diskdrake::hd_gtk; diskdrake::hd_gtk::load_theme(); - my $mainbox = Gtk2::VBox->new; + my $mainbox = Gtk3::VBox->new; my @kinds = map { diskdrake::hd_gtk::hd2kind($_) } sort { $a->{is_removable} <=> $b->{is_removable} } @{ $all_hds->{hds} }; push @kinds, diskdrake::hd_gtk::raid2real_kind($_) foreach @{$all_hds->{raids}}; push @kinds, map { diskdrake::hd_gtk::lvm2kind($_) } @{$all_hds->{lvms}}; - my $hdchoice = Gtk2::HBox->new; + my $hdchoice = Gtk3::HBox->new; - my $hdchoicelabel = Gtk2::Label->new(N("Here is the content of your disk drive ")); + my $hdchoicelabel = Gtk3::Label->new(N("Here is the content of your disk drive ")); - my $combobox = Gtk2::ComboBox->new_text; + my $combobox = Gtk3::ComboBox->new_text; foreach (@kinds) { my $info = $_->{val}{info} || $_->{val}{device}; $info =~ s|^(?:.*/)?(.{24}).*|$1|; @@ -531,11 +531,11 @@ sub main { ugtk3::gtkpack2__($mainbox, $hdchoice); - my $contentbox = Gtk2::VBox->new(0, 12); + my $contentbox = Gtk3::VBox->new(0, 12); - my $scroll = Gtk2::ScrolledWindow->new; + my $scroll = Gtk3::ScrolledWindow->new; $scroll->set_policy('never', 'automatic'), - my $vp = Gtk2::Viewport->new; + my $vp = Gtk3::Viewport->new; $vp->set_shadow_type('none'); $vp->add($contentbox); $scroll->add($vp); diff --git a/perl-install/install/gtk.pm b/perl-install/install/gtk.pm index a1fa46ebf..dedb66af2 100644 --- a/perl-install/install/gtk.pm +++ b/perl-install/install/gtk.pm @@ -59,7 +59,7 @@ sub load_rc { my $f = $name; -r $name or $f = find { -r $_ } map { "$_/themes-$name.rc" } ("share", $ENV{SHARE_PATH}, dirname(__FILE__) . '/..'); if ($f) { - Gtk2::Rc->parse_string($o->{doc} ? $theme_overriding_for_doc : scalar cat_($f)); + Gtk3::Rc->parse_string($o->{doc} ? $theme_overriding_for_doc : scalar cat_($f)); } } @@ -68,7 +68,7 @@ sub load_font { my ($o) = @_; if (defined($::WizardWindow) && lang::text_direction_rtl()) { - Gtk2::Widget->set_default_direction('rtl'); + Gtk3::Widget->set_default_direction('rtl'); my ($x, $y) = $::WizardWindow->get_position; my ($width) = $::WizardWindow->get_size; $::WizardWindow->move($::rootwidth - $width - $x, $y); @@ -76,7 +76,7 @@ sub load_font { my $font = lang::l2pango_font($o->{locale}{lang}); my $s = qq(gtk-font-name="$font"); - Gtk2::Rc->parse_string($s); + Gtk3::Rc->parse_string($s); mkdir("/root"); output("/root/.gtkrc-2.0", $s); } @@ -169,7 +169,7 @@ sub update_steps_position { exists $steps{steps}{$_} or next; if ($o->{steps}{$_}{entered} && !$o->{steps}{$_}{done}) { # we need to flush the X queue since else we got a temporary Y position of -1 when switching locales: - mygtk3::flush(); #- for auto_installs which never go through the Gtk2 main loop + mygtk3::flush(); #- for auto_installs which never go through the Gtk3 main loop $o->{steps_widget}->move_selection($steps{steps}{$_}{text}); if ($last_step) { @@ -179,7 +179,7 @@ sub update_steps_position { } $last_step = $_; } - mygtk3::flush(); #- for auto_installs which never go through the Gtk2 main loop + mygtk3::flush(); #- for auto_installs which never go through the Gtk3 main loop } #------------------------------------------------------------------------------ @@ -199,14 +199,14 @@ q(<fontconfig> $ENV{FONTCONFIG_FILE} = '/tmp/fonts.conf'; } - Gtk2->init; - Gtk2->set_locale; + Gtk3->init; + Gtk3->set_locale; } #------------------------------------------------------------------------------ sub init_sizes { my ($o) = @_; - ($::rootwidth, $::rootheight) = (Gtk2::Gdk->screen_width, Gtk2::Gdk->screen_height); + ($::rootwidth, $::rootheight) = (Gtk3::Gdk->screen_width, Gtk3::Gdk->screen_height); $::stepswidth = $::rootwidth <= 640 ? 0 : 196; ($::logowidth, $::logoheight) = $::rootwidth <= 640 ? (0, 0) : (800, 75); ($o->{windowwidth}, $o->{windowheight}) = ($::rootwidth - $::stepswidth, $::rootheight); diff --git a/perl-install/install/steps_gtk.pm b/perl-install/install/steps_gtk.pm index d88fa2106..f57c9cecc 100644 --- a/perl-install/install/steps_gtk.pm +++ b/perl-install/install/steps_gtk.pm @@ -180,7 +180,7 @@ sub leavingStep { sub charsetChanged { my ($o) = @_; - Gtk2->set_locale; + Gtk3->set_locale; install::gtk::load_font($o); install::gtk::create_steps_window($o); } @@ -264,11 +264,11 @@ sub reallyChooseDesktop { $prev->signal_connect(key_press_event => sub { my (undef, $event) = @_; if (!$event || ($event->keyval & 0x7f) == 0xd) { - Gtk2->main_quit; + Gtk3->main_quit; } }); my $img = gtksignal_connect( - gtkadd(Gtk2::EventBox->new, gtknew('Image', file => "desktop-$val->[0]")), + gtkadd(Gtk3::EventBox->new, gtknew('Image', file => "desktop-$val->[0]")), 'button-press-event' => sub { my %title = ( KDE => N("KDE Desktop"), @@ -286,7 +286,7 @@ sub reallyChooseDesktop { 1, gtknew('Image', file => "desktop-$val->[0]-big"), 0, gtknew('HSeparator'), 0, gtknew('HButtonBox', layout => 'end', children_loose => [ - gtknew('Button', text => N("Close"), clicked => sub { Gtk2->main_quit }) + gtknew('Button', text => N("Close"), clicked => sub { Gtk3->main_quit }) ]), ]), ); @@ -355,7 +355,7 @@ sub reallyChooseGroups { gtknew('Install_Button', text => N("Help"), clicked => sub { interactive::gtk::display_help($o, { interactive_help_id => 'choosePackageGroups' }) }), gtknew('Button', text => N("Unselect All"), clicked => sub { $_->set_active(0) foreach @entries }), - gtknew('Button', text => N("Next"), clicked => sub { Gtk2->main_quit }), + gtknew('Button', text => N("Next"), clicked => sub { Gtk3->main_quit }), ]), ]), ) @@ -572,7 +572,7 @@ sub installPackages { my $pl = $f; $pl =~ s/\.png$/.pl/; eval(cat_($pl)) if -e $pl; $banner->{text} = $title; - Gtk2::Banner::update_text($banner); + Gtk3::Banner::update_text($banner); } }; @@ -788,7 +788,7 @@ It will then continue from the hard disk drive and the packages will remain avai 0, gtknew('HButtonBox', layout => 'edge', children_tight => [ gtknew('Install_Button', text => N("Help"), clicked => sub { interactive::gtk::display_help($o, { interactive_help_id => 'choosePackagesTree' }) }), - gtknew('Button', text => N("Next"), clicked => sub { Gtk2->main_quit }), + gtknew('Button', text => N("Next"), clicked => sub { Gtk3->main_quit }), ]), ]), ); 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 = ''; diff --git a/perl-install/mygtk3.pm b/perl-install/mygtk3.pm index 0c4798e4c..b4e3522f5 100644 --- a/perl-install/mygtk3.pm +++ b/perl-install/mygtk3.pm @@ -11,13 +11,13 @@ use c; use log; use common; -use Gtk2; +use Gtk3; sub init() { !check_for_xserver() and print("Cannot be run in console mode.\n"), c::_exit(0); $::one_message_has_been_translated and warn("N() was called from $::one_message_has_been_translated BEFORE gtk3 initialisation, replace it with a N_() AND a translate() later.\n"), c::_exit(1); - Gtk2->init; + Gtk3->init; Locale::gettext::bind_textdomain_codeset($_, 'UTF8') foreach 'libDrakX', if_(!$::isInstall, 'libDrakX-standalone'), if_($::isRestore, 'draksnapshot'), if_($::isInstall, 'urpmi'), 'drakx-net', 'drakx-kbd-mouse-x11', # shared translation @@ -52,7 +52,7 @@ sub gtkset { } my %opts = @_; - $class =~ s/^(Gtk2|Gtk2::Gdk|mygtk3)::// or internal_error("gtkset unknown class $class"); + $class =~ s/^(Gtk3|Gtk3::Gdk|mygtk3)::// or internal_error("gtkset unknown class $class"); _gtk($w, $class, 'gtkset', \%opts); } @@ -67,7 +67,7 @@ sub gtkadd { internal_error("gtkadd $class: $r should be a string in @_"); } my %opts = @_; - $class =~ s/^(Gtk2|Gtk2::Gdk|mygtk3)::// or internal_error("gtkadd unknown class $class"); + $class =~ s/^(Gtk3|Gtk3::Gdk|mygtk3)::// or internal_error("gtkadd unknown class $class"); _gtk($w, $class, 'gtkadd', \%opts); } @@ -122,7 +122,7 @@ sub _gtk { $w->signal_connect(realize => delete $opts->{realize}) if exists $opts->{realize}; (delete $opts->{size_group})->add_widget($w) if $opts->{size_group}; if (my $tip = delete $opts->{tip}) { - $global_tooltips ||= Gtk2::Tooltips->new; + $global_tooltips ||= Gtk3::Tooltips->new; $global_tooltips->set_tip($w, $tip); } @@ -170,10 +170,10 @@ sub _gtk_any_Button { if ($class eq 'RadioButton') { @radio_options = delete $opts->{group}; } - $w = $opts->{child} ? "Gtk2::$class"->new(@radio_options) : - delete $opts->{mnemonic} ? "Gtk2::$class"->new_with_mnemonic(@radio_options, delete $opts->{text} || '') : - $opts->{text} ? "Gtk2::$class"->new_with_label(@radio_options, delete $opts->{text} || '') : - "Gtk2::$class"->new(@radio_options); + $w = $opts->{child} ? "Gtk3::$class"->new(@radio_options) : + delete $opts->{mnemonic} ? "Gtk3::$class"->new_with_mnemonic(@radio_options, delete $opts->{text} || '') : + $opts->{text} ? "Gtk3::$class"->new_with_label(@radio_options, delete $opts->{text} || '') : + "Gtk3::$class"->new(@radio_options); $w->{format} = delete $opts->{format} if exists $opts->{format}; } @@ -223,9 +223,9 @@ sub _gtk__CheckMenuItem { if (!$w) { add2hash_($opts, { mnemonic => 1 }); - $w = $opts->{image} || !exists $opts->{text} ? "Gtk2::$class"->new : - delete $opts->{mnemonic} ? "Gtk2::$class"->new_with_label(delete $opts->{text}) : - "Gtk2::$class"->new_with_mnemonic(delete $opts->{text}); + $w = $opts->{image} || !exists $opts->{text} ? "Gtk3::$class"->new : + delete $opts->{mnemonic} ? "Gtk3::$class"->new_with_label(delete $opts->{text}) : + "Gtk3::$class"->new_with_mnemonic(delete $opts->{text}); } $w->set_active(delete $opts->{active}) if exists $opts->{active}; @@ -239,9 +239,9 @@ sub _gtk__SpinButton { if (!$w) { $opts->{adjustment} ||= do { add2hash_($opts, { step_increment => 1, page_increment => 5, page_size => 1, value => delete $opts->{lower} }); - Gtk2::Adjustment->new(delete $opts->{value}, delete $opts->{lower}, delete $opts->{upper}, delete $opts->{step_increment}, delete $opts->{page_increment}, delete $opts->{page_size}); + Gtk3::Adjustment->new(delete $opts->{value}, delete $opts->{lower}, delete $opts->{upper}, delete $opts->{step_increment}, delete $opts->{page_increment}, delete $opts->{page_size}); }; - $w = Gtk2::SpinButton->new(delete $opts->{adjustment}, delete $opts->{climb_rate} || 0, delete $opts->{digits} || 0); + $w = Gtk3::SpinButton->new(delete $opts->{adjustment}, delete $opts->{climb_rate} || 0, delete $opts->{digits} || 0); } $w->signal_connect(value_changed => delete $opts->{value_changed}) if exists $opts->{value_changed}; @@ -255,9 +255,9 @@ sub _gtk__HScale { $opts->{adjustment} ||= do { add2hash_($opts, { step_increment => 1, page_increment => 5, page_size => 1 }); add2hash_($opts, { value => $opts->{lower} }) if !exists $opts->{value}; - Gtk2::Adjustment->new(delete $opts->{value}, delete $opts->{lower}, (delete $opts->{upper}) + 1, delete $opts->{step_increment}, delete $opts->{page_increment}, delete $opts->{page_size}); + Gtk3::Adjustment->new(delete $opts->{value}, delete $opts->{lower}, (delete $opts->{upper}) + 1, delete $opts->{step_increment}, delete $opts->{page_increment}, delete $opts->{page_size}); }; - $w = Gtk2::HScale->new(delete $opts->{adjustment}); + $w = Gtk3::HScale->new(delete $opts->{adjustment}); } $w->set_digits(delete $opts->{digits}) if exists $opts->{digits}; @@ -277,7 +277,7 @@ sub _gtk__ProgressBar { my ($w, $opts) = @_; if (!$w) { - $w = Gtk2::ProgressBar->new; + $w = Gtk3::ProgressBar->new; } if (my $fraction_ref = delete $opts->{fraction_ref}) { @@ -299,7 +299,7 @@ sub _gtk__DrawingArea { my ($w, $_opts) = @_; if (!$w) { - $w = Gtk2::DrawingArea->new; + $w = Gtk3::DrawingArea->new; } $w; } @@ -311,9 +311,9 @@ sub _gtk__Pixbuf { my $name = delete $opts->{file} or internal_error("missing file"); my $file = _find_imgfile($name) or internal_error("cannot find image $name"); if (my $size = delete $opts->{size}) { - $w = Gtk2::Gdk::Pixbuf->new_from_file_at_scale($file, $size, $size, 1); + $w = Gtk3::Gdk::Pixbuf->new_from_file_at_scale($file, $size, $size, 1); } else { - $w = Gtk2::Gdk::Pixbuf->new_from_file($file); + $w = Gtk3::Gdk::Pixbuf->new_from_file($file); } $w = $w->flip(1) if delete $opts->{flip}; } @@ -328,7 +328,7 @@ sub _gtk__Image { my ($w, $opts, $class) = @_; if (!$w) { - $w = Gtk2::Image->new; + $w = Gtk3::Image->new; $w->{format} = delete $opts->{format} if exists $opts->{format}; $w->set_from_stock(delete $opts->{stock}, 'button') if exists $opts->{stock}; @@ -414,7 +414,7 @@ sub _gtk__Label { if ($w) { $w->set_text(delete $opts->{text}) if exists $opts->{text}; } else { - $w = exists $opts->{text} ? Gtk2::Label->new(delete $opts->{text}) : Gtk2::Label->new; + $w = exists $opts->{text} ? Gtk3::Label->new(delete $opts->{text}) : Gtk3::Label->new; $w->set_selectable(delete $opts->{selectable}) if exists $opts->{selectable}; $w->set_ellipsize(delete $opts->{ellipsize}) if exists $opts->{ellipsize}; $w->set_justify(delete $opts->{justify}) if exists $opts->{justify}; @@ -444,7 +444,7 @@ sub _gtk__Alignment { my ($w, $_opts) = @_; if (!$w) { - $w = Gtk2::Alignment->new(0, 0, 0, 0); + $w = Gtk3::Alignment->new(0, 0, 0, 0); } $w; } @@ -472,7 +472,7 @@ sub _gtk__Install_Title { 0, gtknew('Label', padding => [ 6, 0 ]), 1, gtknew('VBox', widget_name => 'Banner', children_tight => [ _gtk__Title2($w, $opts), - if_($::isInstall, Gtk2::HSeparator->new), + if_($::isInstall, Gtk3::HSeparator->new), ]), 0, gtknew('Label', padding => [ 6, 0 ]), ]); @@ -495,9 +495,9 @@ sub _gtk__Title2 { sub _gtk__Sexy_IconEntry { my ($w, $opts) = @_; - require Gtk2::Sexy; + require Gtk3::Sexy; if (!$w) { - $w = Gtk2::Sexy::IconEntry->new; + $w = Gtk3::Sexy::IconEntry->new; $w->set_editable(delete $opts->{editable}) if exists $opts->{editable}; } @@ -521,7 +521,7 @@ sub _gtk__Entry { my ($w, $opts) = @_; if (!$w) { - $w = Gtk2::Entry->new; + $w = Gtk3::Entry->new; $w->set_editable(delete $opts->{editable}) if exists $opts->{editable}; } @@ -573,7 +573,7 @@ sub _gtk__TextView { my ($w, $opts, $_class, $action) = @_; if (!$w) { - $w = Gtk2::TextView->new; + $w = Gtk3::TextView->new; $w->set_editable(delete $opts->{editable}) if exists $opts->{editable}; $w->set_wrap_mode(delete $opts->{wrap_mode}) if exists $opts->{wrap_mode}; $w->set_cursor_visible(delete $opts->{cursor_visible}) if exists $opts->{cursor_visible}; @@ -586,7 +586,7 @@ sub _gtk__TextView { sub _gtk__WebKit_View { my ($w, $opts, $_class, $_action) = @_; if (!$w) { - $w = Gtk2::WebKit::WebView->new; + $w = Gtk3::WebKit::WebView->new; } # disable contextual menu: @@ -605,14 +605,14 @@ sub _gtk__ComboBox { my ($w, $opts, $_class, $action) = @_; if (!$w) { - $w = Gtk2::ComboBox->new_text; + $w = Gtk3::ComboBox->new_text; $w->{format} = delete $opts->{format} if exists $opts->{format}; } my $set_list = sub { $w->{formatted_list} = $w->{format} ? [ map { $w->{format}($_) } @{$w->{list}} ] : $w->{list}; $w->get_model->clear; - $w->{strings} = $w->{formatted_list}; # used by Gtk2::ComboBox wrappers such as get_text() in ugtk3 + $w->{strings} = $w->{formatted_list}; # used by Gtk3::ComboBox wrappers such as get_text() in ugtk3 $w->append_text($_) foreach @{$w->{formatted_list}}; }; if (my $list_ref = delete $opts->{list_ref}) { @@ -653,29 +653,29 @@ sub _gtk__ScrolledWindow { my ($w, $opts, $_class, $action) = @_; if (!$w) { - $w = Gtk2::ScrolledWindow->new(undef, undef); + $w = Gtk3::ScrolledWindow->new(undef, undef); $w->set_policy(delete $opts->{h_policy} || 'automatic', delete $opts->{v_policy} || 'automatic'); } my $faked_w = $w; if (my $child = delete $opts->{child}) { - if (member(ref($child), qw(Gtk2::Layout Gtk2::Html2::View Gtk2::SimpleList Gtk2::SourceView::View Gtk2::Text Gtk2::TextView Gtk2::TreeView Gtk2::WebKit::WebView))) { + if (member(ref($child), qw(Gtk3::Layout Gtk3::Html2::View Gtk3::SimpleList Gtk3::SourceView::View Gtk3::Text Gtk3::TextView Gtk3::TreeView Gtk3::WebKit::WebView))) { $w->add($child); } else { $w->add_with_viewport($child); } $child->set_focus_vadjustment($w->get_vadjustment) if $child->can('set_focus_vadjustment'); - $child->set_left_margin(6) if ref($child) =~ /Gtk2::TextView/ && $child->get_left_margin <= 6; + $child->set_left_margin(6) if ref($child) =~ /Gtk3::TextView/ && $child->get_left_margin <= 6; $child->show; $w->child->set_shadow_type(delete $opts->{shadow_type}) if exists $opts->{shadow_type}; - if (ref($child) eq 'Gtk2::TextView' && delete $opts->{to_bottom}) { + if (ref($child) eq 'Gtk3::TextView' && delete $opts->{to_bottom}) { $child->{to_bottom} = _allow_scroll_TextView_to_bottom($w, $child); } - if (!delete $opts->{no_shadow} && $action eq 'gtknew' && ref($child) =~ /Gtk2::(Html2|SimpleList|TextView|TreeView|WebKit::WebView)/) { + if (!delete $opts->{no_shadow} && $action eq 'gtknew' && ref($child) =~ /Gtk3::(Html2|SimpleList|TextView|TreeView|WebKit::WebView)/) { $faked_w = gtknew('Frame', shadow_type => 'in', child => $w); } } @@ -688,7 +688,7 @@ sub _gtk__Frame { if ($w) { $w->set_label(delete $opts->{text}) if exists $opts->{text}; } else { - $w = Gtk2::Frame->new(delete $opts->{text}); + $w = Gtk3::Frame->new(delete $opts->{text}); $w->set_border_width(delete $opts->{border_width}) if exists $opts->{border_width}; $w->set_shadow_type(delete $opts->{shadow_type}) if exists $opts->{shadow_type}; } @@ -706,7 +706,7 @@ sub _gtk__Expander { if ($w) { $w->set_label(delete $opts->{text}) if exists $opts->{text}; } else { - $w = Gtk2::Expander->new(delete $opts->{text}); + $w = Gtk3::Expander->new(delete $opts->{text}); } $w->signal_connect(activate => delete $opts->{activate}) if exists $opts->{activate}; @@ -776,7 +776,7 @@ sub _gtk__MDV_Notebook { $box->set_size_request($width, $requisition->height); }); $_->set_property('no-show-all', 1) foreach $selection_bar, $selection_arrow; - bless($w, 'Gtk2::MDV_Notebook'); + bless($w, 'Gtk3::MDV_Notebook'); add2hash($w, { arrow_x => $arrow_x, layout => $layout, @@ -792,7 +792,7 @@ sub _gtk__Fixed { my ($w, $opts, $_class, $_action) = @_; if (!$w) { - $w = Gtk2::Fixed->new; + $w = Gtk3::Fixed->new; $w->set_has_window(delete $opts->{has_window}) if exists $opts->{has_window}; _gtknew_handle_layout_children($w, $opts); } @@ -803,7 +803,7 @@ sub _gtk__Layout { my ($w, $opts, $_class, $_action) = @_; if (!$w) { - $w = Gtk2::Layout->new; + $w = Gtk3::Layout->new; _gtknew_handle_layout_children($w, $opts); } $w; @@ -836,17 +836,17 @@ sub _gtk_any_Window { if (!$w) { if ($class eq 'Window') { - $w = "Gtk2::$class"->new(delete $opts->{type} || 'toplevel'); + $w = "Gtk3::$class"->new(delete $opts->{type} || 'toplevel'); } elsif ($class eq 'Plug') { $opts->{socket_id} or internal_error("cannot create a Plug without a socket_id"); - $w = "Gtk2::$class"->new(delete $opts->{socket_id}); + $w = "Gtk3::$class"->new(delete $opts->{socket_id}); } elsif ($class eq 'FileChooserDialog') { my $action = delete $opts->{action} || internal_error("missing action for FileChooser"); - $w = Gtk2::FileChooserDialog->new(delete $opts->{title}, delete $opts->{transient_for} || $::main_window, + $w = Gtk3::FileChooserDialog->new(delete $opts->{title}, delete $opts->{transient_for} || $::main_window, $action, N("Cancel") => 'cancel', delete $opts->{button1} || N("Ok") => 'ok', ); } else { - $w = "Gtk2::$class"->new; + $w = "Gtk3::$class"->new; } if ($::isInstall || $::set_dialog_hint) { @@ -894,7 +894,7 @@ sub _gtk__MagicWindow { my $pop_it = delete $opts->{pop_it} || !$::isWizard && !$::isEmbedded || $::WizardTable && do { #- do not take into account the wizard banner # FIXME!!! - any { !$_->isa('Gtk2::DrawingArea') && $_->visible } $::WizardTable->get_children; + any { !$_->isa('Gtk3::DrawingArea') && $_->visible } $::WizardTable->get_children; }; my $pop_and_reuse = delete $opts->{pop_and_reuse} && $pop_it; @@ -927,7 +927,7 @@ sub _gtk__MagicWindow { my $banner; if (!$::isEmbedded && !$::isInstall && $::Wizard_title) { if (_find_imgfile($opts->{icon_no_error})) { - $banner = Gtk2::Banner->new($opts->{icon_no_error}, $::Wizard_title); + $banner = Gtk3::Banner->new($opts->{icon_no_error}, $::Wizard_title); } else { log::l("ERROR: missing wizard banner $opts->{icon_no_error}"); } @@ -974,7 +974,7 @@ sub _gtk__AboutDialog { my ($w, $opts) = @_; if (!$w) { - $w = Gtk2::AboutDialog->new; + $w = Gtk3::AboutDialog->new; $w->signal_connect(response => sub { $_[0]->destroy }); $w->set_program_name(delete $opts->{name}) if exists $opts->{name}; $w->set_version(delete $opts->{version}) if exists $opts->{version}; @@ -991,7 +991,7 @@ sub _gtk__AboutDialog { }); if (my $url = delete $opts->{website}) { - $url =~ s/^https:/http:/; # Gtk2::About doesn't like "https://..." like URLs + $url =~ s/^https:/http:/; # Gtk3::About doesn't like "https://..." like URLs $w->set_website($url); } $w->set_license(delete $opts->{license}) if exists $opts->{license}; @@ -1013,7 +1013,7 @@ sub _gtk__FileSelection { my ($w, $opts) = @_; if (!$w) { - $w = Gtk2::FileSelection->new(delete $opts->{title} || ''); + $w = Gtk3::FileSelection->new(delete $opts->{title} || ''); gtkset($w->ok_button, %{delete $opts->{ok_button}}) if exists $opts->{ok_button}; gtkset($w->cancel_button, %{delete $opts->{cancel_button}}) if exists $opts->{cancel_button}; } @@ -1029,7 +1029,7 @@ sub _gtk__FileChooser { if (!$w) { my $action = delete $opts->{action} || internal_error("missing action for FileChooser"); - $w = Gtk2::FileChooserWidget->new($action); + $w = Gtk3::FileChooserWidget->new($action); my $file = $opts->{file} && delete $opts->{file}; @@ -1053,7 +1053,7 @@ sub _gtk_any_Paned { my ($w, $opts, $class, $action) = @_; if (!$w) { - $w = "Gtk2::$class"->new; + $w = "Gtk3::$class"->new; $w->set_border_width(delete $opts->{border_width}) if exists $opts->{border_width}; $w->set_position(delete $opts->{position}) if exists $opts->{position}; } elsif ($action eq 'gtkset') { @@ -1074,7 +1074,7 @@ sub _gtk_any_Box { my ($w, $opts, $class, $action) = @_; if (!$w) { - $w = "Gtk2::$class"->new; + $w = "Gtk3::$class"->new; $w->set_homogeneous(delete $opts->{homogenous}) if exists $opts->{homogenous}; $w->set_spacing(delete $opts->{spacing}) if exists $opts->{spacing}; $w->set_border_width(delete $opts->{border_width}) if exists $opts->{border_width}; @@ -1092,7 +1092,7 @@ sub _gtk_any_ButtonBox { my ($w, $opts, $class, $action) = @_; if (!$w) { - $w = "Gtk2::$class"->new; + $w = "Gtk3::$class"->new; $w->set_homogeneous(delete $opts->{homogenous}) if exists $opts->{homogenous}; $w->set_border_width(delete $opts->{border_width}) if exists $opts->{border_width}; $w->set_spacing(delete $opts->{spacing}) if exists $opts->{spacing}; @@ -1109,7 +1109,7 @@ sub _gtk__Notebook { my ($w, $opts) = @_; if (!$w) { - $w = Gtk2::Notebook->new; + $w = Gtk3::Notebook->new; $w->set_property('show-tabs', delete $opts->{show_tabs}) if exists $opts->{show_tabs}; $w->set_property('show-border', delete $opts->{show_border}) if exists $opts->{show_border}; } @@ -1131,7 +1131,7 @@ sub _gtk__Table { if (!$w) { add2hash_($opts, { xpadding => 5, ypadding => 0, border_width => $::isInstall ? 3 : 10 }); - $w = Gtk2::Table->new(0, 0, delete $opts->{homogeneous} || 0); + $w = Gtk3::Table->new(0, 0, delete $opts->{homogeneous} || 0); $w->set_col_spacings(delete $opts->{col_spacings} || 0); $w->set_row_spacings(delete $opts->{row_spacings} || 0); $w->set_border_width(delete $opts->{border_width}); @@ -1143,11 +1143,11 @@ sub _gtk__Table { each_index { my $j = $::i; if ($_) { - ref $_ or $_ = Gtk2::WrappedLabel->new($_); + ref $_ or $_ = Gtk3::WrappedLabel->new($_); $w->attach($_, $j, $j + 1, $i, $i + 1, $j != $#$l && !$w->{mcc} ? ('fill', 'fill', $w->{xpadding}, $w->{ypadding}) : - (['expand', 'fill'], ref($_) eq 'Gtk2::ScrolledWindow' || $_->get_data('must_grow') ? + (['expand', 'fill'], ref($_) eq 'Gtk3::ScrolledWindow' || $_->get_data('must_grow') ? ['expand', 'fill'] : [], 0, 0)); $_->show; } @@ -1160,7 +1160,7 @@ sub _gtk__Table { sub _gtk_any_simple { my ($w, $_opts, $class) = @_; - $w ||= "Gtk2::$class"->new; + $w ||= "Gtk3::$class"->new; } sub _gtknew_handle_children { @@ -1178,7 +1178,7 @@ sub _gtknew_handle_children { foreach (@child) { my ($fill, $child) = @$_; $fill eq '0' || $fill eq '1' || $fill eq 'fill' || $fill eq 'expand' or internal_error("odd {children} parameter must be 0 or 1 (got $fill)"); - ref $child or $child = Gtk2::WrappedLabel->new($child); + ref $child or $child = Gtk3::WrappedLabel->new($child); my $expand = $fill && $fill ne 'fill' ? 1 : 0; $w->pack_start($child, $expand, $fill, $padding || 0); $child->show; @@ -1240,8 +1240,8 @@ sub quit_callback { $w->destroy; die 'wizcancel'; } else { - if (Gtk2->main_level) { - Gtk2->main_quit; + if (Gtk3->main_level) { + Gtk3->main_quit; } else { # block window deletion if not in main loop (eg: while starting the GUI) return 1; @@ -1355,11 +1355,11 @@ sub _text_insert { foreach my $token (@$t) { my ($item, $tag) = @$token; my $iter1 = $buffer->get_end_iter; - if (ref($item) =~ /^Gtk2::Gdk::Pixbuf/) { + if (ref($item) =~ /^Gtk3::Gdk::Pixbuf/) { $buffer->insert_pixbuf($iter1, $item); next; } - if (ref($item) =~ /^Gtk2::/) { + if (ref($item) =~ /^Gtk3::/) { my $anchor = $buffer->create_child_anchor($iter1); $textview->add_child_at_anchor($item, $anchor); $textview->{anchors} ||= []; @@ -1446,7 +1446,7 @@ sub main { my $destroyed; $window->signal_connect(destroy => sub { $destroyed = 1 }); $window->show; - do { Gtk2->main } while (!$destroyed && $o_verif && !$o_verif->()); + do { Gtk3->main } while (!$destroyed && $o_verif && !$o_verif->()); may_destroy($window); flush(); } @@ -1458,7 +1458,7 @@ sub sync { } sub flush() { - Gtk2->main_iteration while Gtk2->events_pending; + Gtk3->main_iteration while Gtk3->events_pending; } sub enable_sync_flush { @@ -1491,12 +1491,12 @@ sub may_destroy { sub root_window() { state $root; - $root ||= Gtk2::Gdk->get_default_root_window; + $root ||= Gtk3::Gdk->get_default_root_window; } sub rgb2color { my ($r, $g, $b) = @_; - my $color = Gtk2::Gdk::Color->new($r, $g, $b); + my $color = Gtk3::Gdk::Color->new($r, $g, $b); root_window()->get_colormap->rgb_find_color($color); $color; } @@ -1504,7 +1504,7 @@ sub rgb2color { sub set_root_window_background { my ($r, $g, $b) = @_; my $root = root_window(); - my $gc = Gtk2::Gdk::GC->new($root); + my $gc = Gtk3::Gdk::GC->new($root); my $color = rgb2color($r, $g, $b); $gc->set_rgb_fg_color($color); set_root_window_background_with_gc($gc); @@ -1521,7 +1521,7 @@ sub set_root_window_background_with_gc { sub _new_alpha_pixbuf { my ($pixbuf) = @_; my ($height, $width) = ($pixbuf->get_height, $pixbuf->get_width); - my $new_pixbuf = Gtk2::Gdk::Pixbuf->new('rgb', 1, 8, $width, $height); + my $new_pixbuf = Gtk3::Gdk::Pixbuf->new('rgb', 1, 8, $width, $height); $new_pixbuf->fill(0x00000000); # transparent white $width, $height, $new_pixbuf; } @@ -1537,19 +1537,19 @@ sub pixmap_from_pixbuf { my ($widget, $pixbuf) = @_; my $window = $widget->window or internal_error("you can't use this function if the widget is not realised"); my ($width, $height) = ($pixbuf->get_width, $pixbuf->get_height); - my $pixmap = Gtk2::Gdk::Pixmap->new($window, $width, $height, $window->get_depth); + my $pixmap = Gtk3::Gdk::Pixmap->new($window, $width, $height, $window->get_depth); $pixbuf->render_to_drawable($pixmap, $widget->style->fg_gc('normal'), 0, 0, 0, 0, $width, $height, 'max', 0, 0); $pixmap; } sub import_style_ressources() { if (!$::isInstall) { - Gtk2::Rc->parse_string(scalar cat_('/usr/share/libDrakX/themes-galaxy.rc')); # FIXME DEBUG + Gtk3::Rc->parse_string(scalar cat_('/usr/share/libDrakX/themes-galaxy.rc')); # FIXME DEBUG } } sub text_direction_rtl() { - Gtk2::Widget->get_default_direction eq 'rtl'; + Gtk3::Widget->get_default_direction eq 'rtl'; } sub _get_weakness_icon { @@ -1576,8 +1576,8 @@ sub _get_weakness_tooltip { return $weakness_tooltip; } -package Gtk2::MDV_Notebook; # helper functions for installer & mcc -our @ISA = qw(Gtk2::Widget); +package Gtk3::MDV_Notebook; # helper functions for installer & mcc +our @ISA = qw(Gtk3::Widget); sub hide_selection { my ($w) = @_; diff --git a/perl-install/services.pm b/perl-install/services.pm index 1c3200c99..54dd5efec 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -229,10 +229,10 @@ sub ask_standalone_gtk { my $display = sub { my ($text) = @_; $nopop->(); - gtkshow(gtkadd($w_popup = Gtk2::Window->new('popup'), - gtksignal_connect(gtkadd(Gtk2::EventBox->new, - gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'etched_out'), - gtkset_justify(Gtk2::Label->new($text), 'left'))), + gtkshow(gtkadd($w_popup = Gtk3::Window->new('popup'), + gtksignal_connect(gtkadd(Gtk3::EventBox->new, + gtkadd(gtkset_shadow_type(Gtk3::Frame->new, 'etched_out'), + gtkset_justify(Gtk3::Label->new($text), 'left'))), button_press_event => sub { $nopop->() } )))->move($x, $y) if $text; }; @@ -241,7 +241,7 @@ sub ask_standalone_gtk { my $started = is_service_running($service); $label->set_label($started ? N("running") : N("stopped")); }; - my $b = Gtk2::EventBox->new; + my $b = Gtk3::EventBox->new; $b->set_events('pointer_motion_mask'); gtkadd($W->{window}, gtkadd($b, gtkpack_($W->create_box_with_title, 0, mygtk3::gtknew('Title1', label => N("Services and daemons")), @@ -251,14 +251,14 @@ sub ask_standalone_gtk { my $is_xinetd_service = member($service, @xinetd_services); my $infos = warp_text(description($_), 40); $infos ||= N("No additional information\nabout this service, sorry."); - my $label = gtkset_justify(Gtk2::Label->new, 'left'); + my $label = gtkset_justify(Gtk3::Label->new, 'left'); $update_service->($service, $label) if !$is_xinetd_service; - [ gtkpack__(Gtk2::HBox->new(0,0), $_), - gtkpack__(Gtk2::HBox->new(0,0), $label), - gtkpack__(Gtk2::HBox->new(0,0), gtksignal_connect(Gtk2::Button->new(N("Info")), clicked => sub { $display->($infos) })), + [ gtkpack__(Gtk3::HBox->new(0,0), $_), + gtkpack__(Gtk3::HBox->new(0,0), $label), + gtkpack__(Gtk3::HBox->new(0,0), gtksignal_connect(Gtk3::Button->new(N("Info")), clicked => sub { $display->($infos) })), - gtkpack__(Gtk2::HBox->new(0,0), gtkset_active(gtksignal_connect( - Gtk2::CheckButton->new($is_xinetd_service ? N("Start when requested") : N("On boot")), + gtkpack__(Gtk3::HBox->new(0,0), gtkset_active(gtksignal_connect( + Gtk3::CheckButton->new($is_xinetd_service ? N("Start when requested") : N("On boot")), clicked => sub { if ($_[0]->get_active) { push @$on_services, $service if !member($service, @$on_services); } else { @@ -266,7 +266,7 @@ sub ask_standalone_gtk { } }), member($service, @$on_services))), map { my $a = $_; - gtkpack__(Gtk2::HBox->new(0,0), gtksignal_connect(Gtk2::Button->new(translate($a)), + gtkpack__(Gtk3::HBox->new(0,0), gtksignal_connect(Gtk3::Button->new(translate($a)), clicked => sub { my $action = $a eq "Start" ? 'restart' : 'stop'; log::explanations(qq(GP_LANG="UTF-8" service $service $action)); @@ -280,7 +280,7 @@ sub ask_standalone_gtk { ]; } @$l), [ $::isEmbedded ? 'automatic' : 'never', 'automatic' ]), -1, $::isEmbedded ? -1 : 400), - 0, gtkpack(gtkset_border_width(Gtk2::HBox->new(0,0),5), $W->create_okcancel) + 0, gtkpack(gtkset_border_width(Gtk3::HBox->new(0,0),5), $W->create_okcancel) )) ); $b->signal_connect(motion_notify_event => sub { my ($w, $e) = @_; diff --git a/perl-install/share/po/translation_size.pl b/perl-install/share/po/translation_size.pl index 178baaefd..adc0f968b 100755 --- a/perl-install/share/po/translation_size.pl +++ b/perl-install/share/po/translation_size.pl @@ -26,20 +26,20 @@ use install_gtk; !@ARGV and die "Usage: LANGUAGE=lang_to_test $0 string_to_translate\n(for example: LANGUAGE=ja $0 Advanced)\n"; install_gtk::load_font({ locale => { lang => 'en_US' } }); -$l1 = Gtk2::Label->new($ARGV[0]); -my $v = Gtk2::VBox->new(1, 0); +$l1 = Gtk3::Label->new($ARGV[0]); +my $v = Gtk3::VBox->new(1, 0); $v->pack_start($l1, 0, 0, 0); -my $window = Gtk2::Window->new('toplevel'); +my $window = Gtk3::Window->new('toplevel'); $window->set_size_request(200, 50); $window->set_position('center'); -$window->signal_connect(key_press_event => sub { Gtk2->main_quit }); +$window->signal_connect(key_press_event => sub { Gtk3->main_quit }); $window->add($v); $window->show_all; install_gtk::load_font({ locale => { lang => $ENV{LANGUAGE} } }); -$l2 = Gtk2::Label->new(translate($ARGV[0])); +$l2 = Gtk3::Label->new(translate($ARGV[0])); $v->pack_start($l2, 0, 0, 0); $window->show_all; -Gtk2->main; +Gtk3->main; diff --git a/perl-install/standalone/display_help b/perl-install/standalone/display_help index bc219eb8a..bd857d092 100755 --- a/perl-install/standalone/display_help +++ b/perl-install/standalone/display_help @@ -24,7 +24,7 @@ use common; use any; use mygtk3 qw(gtknew); use ugtk3 qw(:wrappers :create); -use Gtk2::WebKit; +use Gtk3::WebKit; my $view = gtknew('WebKit_View', no_popup_menu => 1); @@ -54,17 +54,17 @@ if (!$is_firstime) { my $w = ugtk3->new(N("Help"), width => $default_width, height => $default_height); gtkadd($w->{rwindow}, - gtkpack_(Gtk2::VBox->new, + gtkpack_(Gtk3::VBox->new, if_(!$is_firstime, 0, gtknew('Title2', label => N("Help")), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, ), 1, create_scrolled_window(gtkset_border_width($view, 5), [ 'never', 'automatic' ]), #1, gtknew('ScrolledWindow', child => $view, border_width => 5, h_policy => 'never'); - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, if_(!$is_firstime, 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 }) ), ), ), diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst index 63b8c4974..2648cf4bd 100755 --- a/perl-install/standalone/drakautoinst +++ b/perl-install/standalone/drakautoinst @@ -141,34 +141,34 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) { my $W = ugtk3->new('$o edition'); my @box_to_hide; my $nb_pages=0; - my $notebook = Gtk2::Notebook->new; + my $notebook = Gtk3::Notebook->new; $notebook->set_show_border(0); $notebook->set_show_tabs(0); - $notebook->append_page(gtkpack_(gtkset_border_width(Gtk2::VBox->new(0,0), 10), - 1, Gtk2::VBox->new(0,0), - 0, gtkpack_(Gtk2::HBox->new(0,0), - 1, Gtk2::VBox->new(0,0), - 0, gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'etched-in'), + $notebook->append_page(gtkpack_(gtkset_border_width(Gtk3::VBox->new(0,0), 10), + 1, Gtk3::VBox->new(0,0), + 0, gtkpack_(Gtk3::HBox->new(0,0), + 1, Gtk3::VBox->new(0,0), + 0, gtkadd(gtkset_shadow_type(Gtk3::Frame->new, 'etched-in'), gtkcreate_img('mdk_logo')), - 1, Gtk2::VBox->new(0,0), + 1, Gtk3::VBox->new(0,0), ), 0, N("\nWelcome.\n\nThe parameters of the auto-install are available in the sections on the left"), - 1, Gtk2::VBox->new(0,0), + 1, Gtk3::VBox->new(0,0), ), undef); $notebook->show_all; $notebook->set_current_page(0); gtkadd($W->{window}, - gtkpack_(Gtk2::VBox->new(0,5), - 1, gtkpack_(Gtk2::HBox->new(0,0), - 0, gtkadd(gtkset_size_request(gtkset_shadow_type(Gtk2::Frame->new, 'in'), 130, 470), - gtkpack_(Gtk2::VBox->new(0,0), + gtkpack_(Gtk3::VBox->new(0,5), + 1, gtkpack_(Gtk3::HBox->new(0,0), + 0, gtkadd(gtkset_size_request(gtkset_shadow_type(Gtk3::Frame->new, 'in'), 130, 470), + gtkpack_(Gtk3::VBox->new(0,0), map { - my $box = Gtk2::VBox->new(0,0); + my $box = Gtk3::VBox->new(0,0); push @box_to_hide, $box; $box->{vis} = 0; my @button_to_hide; - 0, gtksignal_connect(Gtk2::Button->new($_), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new($_), clicked => sub { if ($box->{vis}) { $box->hide; $box->{vis} = 0; $notebook->set_current_page(0) } else { $_->hide, $_->{vis}=0 foreach @box_to_hide; @@ -177,7 +177,7 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) { } }), 1, gtkpack__($box, map { - my $button = gtkset_relief(Gtk2::ToggleButton->new, 'none'); + my $button = gtkset_relief(Gtk3::ToggleButton->new, 'none'); push @button_to_hide, $button; my $gru = $_->[0]; $notebook->append_page(gtkshow($_->[2]), undef); @@ -190,7 +190,7 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) { my $b; if ($_->[1] ne "") { $b = gtkcreate_img($_->[1]) } else { undef $b } gtksignal_connect(gtkadd($button, - gtkpack__(Gtk2::VBox->new(0,3), + gtkpack__(Gtk3::VBox->new(0,3), $b, translate($gru), ) @@ -208,10 +208,10 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) { ), 1, $notebook, ), - 0, Gtk2::HSeparator->new, - 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'end'), 5), - gtksignal_connect(Gtk2::Button->new(N("Accept")), clicked => sub { Gtk2->main_quit }), - gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $o = $o_old; Gtk2->main_quit; quit_global($in, 0) }), + 0, Gtk3::HSeparator->new, + 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk3::HButtonBox->new, 'end'), 5), + gtksignal_connect(Gtk3::Button->new(N("Accept")), clicked => sub { Gtk3->main_quit }), + gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => sub { $o = $o_old; Gtk3->main_quit; quit_global($in, 0) }), ) ) ); @@ -220,7 +220,7 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) { # gtkadd($W->{window}, # gtkpack_($W->create_box_with_title(N("Edit variables")), # 1, my $notebook = create_notebook( map { h2widget($o->{$_}, "\$o->\{$_\}"), $_ } keys %$o ), -# 0, gtkpack(gtkset_border_width(Gtk2::HBox->new(0,0),5), $W->create_okcancel), +# 0, gtkpack(gtkset_border_width(Gtk3::HBox->new(0,0),5), $W->create_okcancel), # ), # ); # $notebook->set_tab_pos('left'); @@ -270,8 +270,8 @@ sub h2widget { my @list_keys = keys(%$k); if (ref($k->{$list_keys[0]}) =~ /HASH/) { $i++; - $w = gtkpack_(Gtk2::VBox->new(0,0), - 1, create_scrolled_window(gtkpack__($vb = Gtk2::VBox->new(0,10), + $w = gtkpack_(Gtk3::VBox->new(0,0), + 1, create_scrolled_window(gtkpack__($vb = Gtk3::VBox->new(0,10), $widget_list[$i] = create_packtable({ col_spacings => 10, row_spacings => 3 }, map { my $e; @@ -302,9 +302,9 @@ sub h2widget { my $vb; my @widget_list; my $i = -1; - $w = gtkpack_(Gtk2::VBox->new(0,0), + $w = gtkpack_(Gtk3::VBox->new(0,0), 1, create_scrolled_window( - gtkpack__($vb = Gtk2::VBox->new(0,5), + gtkpack__($vb = Gtk3::VBox->new(0,5), map { $i++; $widget_list[$i] = h2widget($_, "$label\[$i]") } @$k, ) ), @@ -332,7 +332,7 @@ sub create_entry_element { } elsif (ref $text =~ /ARRAY/) { return [ "$label : ", h2widget($text, $label) ]; } else { - $e = Gtk2::Entry->new; + $e = Gtk3::Entry->new; $e->{value} = $value; my $_tag = Glib::Timeout->add(1000, sub { $e->set_text($text); 0 }); gtksignal_connect($e, changed => sub { @@ -351,15 +351,15 @@ sub control_buttons { ref($ref_local_k) =~ /HASH/ or return(); my %local_k = %$ref_local_k; my ($button_remove); - 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'spread'), 5), - gtksignal_connect(Gtk2::Button->new(N("Add an item")), clicked => sub { + 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk3::HButtonBox->new, 'spread'), 5), + gtksignal_connect(Gtk3::Button->new(N("Add an item")), clicked => sub { $local_k{$_} = undef foreach keys %local_k; $i++; $local_gui->($vb, \@widget_list, \%local_k, $i) or $i--, return; $i >= 0 and $button_remove->set_sensitive(1); } ), - gtksignal_connect($button_remove = Gtk2::Button->new(N("Remove the last item")), clicked => sub { + gtksignal_connect($button_remove = Gtk3::Button->new(N("Remove the last item")), clicked => sub { $i >= 0 or return; $widget_list[$i]->destroy; $i--; diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index dc2b2267b..e9f6cf348 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -182,7 +182,7 @@ sub autologin_choice() { push @users, $user; } my $user_combo = gtknew('ComboBox', text => $user, list => \@users); - my $desktop_combo = Gtk2::ComboBox->new_with_strings(\@sessions, if_(member($auto_mode->{desktop}, @sessions), $auto_mode->{desktop})); + my $desktop_combo = Gtk3::ComboBox->new_with_strings(\@sessions, if_(member($auto_mode->{desktop}, @sessions), $auto_mode->{desktop})); my $auto_box = gtknew('Table', col_spacings => 5, row_spacings => 5, homogeneous => 1, children => [ [ gtknew('Label_Left', text => N("Default user")), $user_combo ], diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index a960a248d..fe8866df4 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -96,15 +96,15 @@ my $bugzilla_url = 'http://bugs.mageia.org/enter_bug.cgi'; my $wizard_name = "Bugzilla"; $table = create_packtable({ col_spacings => 5, row_spacings => 10 }, - [ gtknew('Label_Left', text => N("Select %s Tool:", N("Mageia"))), $comb_app = Gtk2::ComboBox->new_text, $comb_app->set_wrap_width(3) ], + [ gtknew('Label_Left', text => N("Select %s Tool:", N("Mageia"))), $comb_app = Gtk3::ComboBox->new_text, $comb_app->set_wrap_width(3) ], [ gtknew('Label_Left', text => N("or Application Name\n(or Full Path):")), - gtkpack_(Gtk2::HBox->new(0, 5), - 1, $com_app = gtkset_editable(Gtk2::Entry->new, 1), - 0, $button_pkg = Gtk2::Button->new(N("Find Package")), - 0, $button_browse = Gtk2::FileChooserButton->new(N("Browse"), 'GTK_FILE_CHOOSER_ACTION_OPEN'), + gtkpack_(Gtk3::HBox->new(0, 5), + 1, $com_app = gtkset_editable(Gtk3::Entry->new, 1), + 0, $button_pkg = Gtk3::Button->new(N("Find Package")), + 0, $button_browse = Gtk3::FileChooserButton->new(N("Browse"), 'GTK_FILE_CHOOSER_ACTION_OPEN'), ) ], - [ gtknew('Label_Left', text => N("Package: ")), $package = Gtk2::Entry->new_with_text("...") ], # complain on gtk-perl@ml - [ gtknew('Label_Left', text => N("Kernel:")), gtkset_editable(Gtk2::Entry->new_with_text($kernel_release), 0) ] + [ gtknew('Label_Left', text => N("Package: ")), $package = Gtk3::Entry->new_with_text("...") ], # complain on gtk-perl@ml + [ gtknew('Label_Left', text => N("Kernel:")), gtkset_editable(Gtk3::Entry->new_with_text($kernel_release), 0) ] ); $comb_app->set_popdown_strings("", uniq(sort(@generic_tool), if_($prog, $prog))); $comb_app->set_text(""); @@ -127,7 +127,7 @@ my $parent_uid = get_parent_uid(); my $width = 600; gtkadd($window->{window}, - gtkpack_(Gtk2::VBox->new(0, 5), + gtkpack_(Gtk3::VBox->new(0, 5), 0, gtknew('Title1', label => $mageia_release, width => $width), 1, create_scrolled_window( gtknew('TextView', editable => 0, height => 150, @@ -167,15 +167,15 @@ gtkadd($window->{window}, if_(!$error, 0, gtkadd($table), ), - 0, gtkpack(Gtk2::HSeparator->new), + 0, gtkpack(Gtk3::HSeparator->new), 0, gtkpack(create_hbox('edge'), gtksignal_connect( - Gtk2::Button->new(N("Help")), clicked => sub { + Gtk3::Button->new(N("Help")), clicked => sub { run_program::raw({ detach => 1, setuid => $parent_uid }, 'drakhelp', '--id', 'drakbug'); }), gtkpack(create_hbox('end'), - gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => \&report_bug_to_bugzilla), - gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk3->exit(0) }), + gtksignal_connect(Gtk3::Button->new(N("Report")), clicked => \&report_bug_to_bugzilla), + gtksignal_connect(Gtk3::Button->new(N("Close")), clicked => sub { ugtk3->exit(0) }), )))); if (defined $prog) { diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock index 71653b7b1..962474341 100755 --- a/perl-install/standalone/drakclock +++ b/perl-install/standalone/drakclock @@ -55,9 +55,9 @@ if (!@timezones) { my $drawing_area; -my $adjh = Gtk2::Adjustment->new(0.0, 0.0, 23.0, 1.0, 5.0, 0.0); -my $adjm = Gtk2::Adjustment->new(0.0, 0.0, 59.0, 1.0, 5.0, 0.0); -my $adjs = Gtk2::Adjustment->new(0.0, 0.0, 59.0, 1.0, 5.0, 0.0); +my $adjh = Gtk3::Adjustment->new(0.0, 0.0, 23.0, 1.0, 5.0, 0.0); +my $adjm = Gtk3::Adjustment->new(0.0, 0.0, 59.0, 1.0, 5.0, 0.0); +my $adjs = Gtk3::Adjustment->new(0.0, 0.0, 59.0, 1.0, 5.0, 0.0); my ($button_reset, $check_ntp, $hb_ntp, $combo_ntpserver, $ntp); my $mode = 0; @@ -82,18 +82,18 @@ $my_win->{window}->add(gtknew('VBox', border_width => $::isEmbedded ? 0 : 5, chi }), 0, $hb_ntp = gtknew('HBox', border_width => 5, children => [ 0, gtknew('Label', text => N("Server:")), - 1, $combo_ntpserver = Gtk2::Combo->new + 1, $combo_ntpserver = Gtk3::Combo->new ]) ])) ]), 0, gtknew('VBox', children => [ 0, gtknew('HBox', children => [ - 0, $drawing_area = gtkset_size_request(Gtk2::DrawingArea->new, @image_size), + 0, $drawing_area = gtkset_size_request(Gtk3::DrawingArea->new, @image_size), ]), 0, my $time_box = gtknew('HBox', homogenous => 1, children => [ - 0, my $spinner_h = Gtk2::SpinButton->new($adjh, 0, 0), - 0, my $spinner_m = Gtk2::SpinButton->new($adjm, 0, 0), - 0, my $spinner_s = Gtk2::SpinButton->new($adjs, 0, 0), + 0, my $spinner_h = Gtk3::SpinButton->new($adjh, 0, 0), + 0, my $spinner_m = Gtk3::SpinButton->new($adjm, 0, 0), + 0, my $spinner_s = Gtk3::SpinButton->new($adjs, 0, 0), ]), 1, gtknew('Frame', text => N("Timezone"), shadow_type => 'etched_in', child => gtknew('VBox', border_width => 5, children_tight => [ @@ -194,7 +194,7 @@ $drawing_area->set_events([ 'button_press_mask', 'button_release_mask', "pointer $drawing_area->signal_connect(expose_event => \&expose_event); $drawing_area->signal_connect(realize => sub { my $window = $drawing_area->window; - $pixmap = Gtk2::Gdk::Pixmap->new($window, @image_size, $window->get_depth); + $pixmap = Gtk3::Gdk::Pixmap->new($window, @image_size, $window->get_depth); }); $drawing_area->signal_connect(button_press_event => sub { $pressed = 1 }); diff --git a/perl-install/standalone/drakdvb b/perl-install/standalone/drakdvb index 9ed351b71..bcbf4a9c9 100755 --- a/perl-install/standalone/drakdvb +++ b/perl-install/standalone/drakdvb @@ -25,7 +25,7 @@ use standalone; use mygtk3; use interactive; use ugtk3 qw(:create :helpers :wrappers); -use Gtk2::SimpleList; +use Gtk3::SimpleList; my $title = N("DVB"); $ugtk3::wm_icon = "/usr/share/mcc/themes/default/tv-mdk.png"; @@ -36,7 +36,7 @@ my $in = 'interactive'->vnew; my $config_file = "$ENV{HOME}/.mplayer/channels.conf"; -my $channel_list = Gtk2::SimpleList->new(N("Channel") => "text", "id" => "hidden"); +my $channel_list = Gtk3::SimpleList->new(N("Channel") => "text", "id" => "hidden"); my %buttons; my $pid; my $wait; @@ -49,7 +49,7 @@ sub get_selected_channel() { sub exitapp() { local $SIG{TERM} = 'IGNORE'; kill TERM => -$$; - Gtk2->main_quit; + Gtk3->main_quit; } sub detect_channels() { @@ -142,7 +142,7 @@ sub launch_tv() { gtkadd($w->{window}, gtknew('VBox', spacing => 5, children => [ - $::isEmbedded ? () : (0, Gtk2::Banner->new($ugtk3::wm_icon, $title)), + $::isEmbedded ? () : (0, Gtk3::Banner->new($ugtk3::wm_icon, $title)), 1, gtknew('ScrolledWindow', width => 300, height => 400, child => $channel_list), 0, gtknew('HButtonBox', layout => 'end', children_loose => [ $buttons{detect} = gtknew('Button', text => N("Detect Channels"), clicked => \&detect_channels), diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy index 11597c6aa..74a9105ea 100755 --- a/perl-install/standalone/drakfloppy +++ b/perl-install/standalone/drakfloppy @@ -119,18 +119,18 @@ sub pref_dialog() { # Create root tree: - $tree_model = Gtk2::TreeStore->new(("Glib::String") x 2, "Glib::Int"); - $tree = Gtk2::TreeView->new_with_model($tree_model); + $tree_model = Gtk3::TreeStore->new(("Glib::String") x 2, "Glib::Int"); + $tree = Gtk3::TreeView->new_with_model($tree_model); $tree->set_headers_visible(0); - $tree->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); + $tree->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => 0)); $tree->signal_connect('row-expanded', \&expand_tree); $tree->get_selection->signal_connect('changed' => \&selected_tree); # Create modules list: - $list_model = Gtk2::ListStore->new(("Glib::String") x 3); # relative path, size, (hidden full path) - $list = Gtk2::TreeView->new_with_model($list_model); + $list_model = Gtk3::ListStore->new(("Glib::String") x 3); # relative path, size, (hidden full path) + $list = Gtk3::TreeView->new_with_model($list_model); each_index { - $list->append_column(my $col = Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i)); + $list->append_column(my $col = Gtk3::TreeViewColumn->new_with_attributes($_, Gtk3::CellRendererText->new, 'text' => $::i)); $col->set_sort_column_id($::i); $col->set_min_width((200, 50)[$::i]); } (N("Module name"), N("Size")); @@ -150,7 +150,7 @@ sub pref_dialog() { gtknew('ScrolledWindow', child => $tree), 200, $::isEmbedded ? 0 : 175), gtknew('VBox', children => [ - 1, gtkadd(Gtk2::ScrolledWindow->new, + 1, gtkadd(Gtk3::ScrolledWindow->new, $list ), 0, $remove_but = gtknew('Button', text => N("Remove a module"), diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index 4599d76f7..14584c1a4 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -486,15 +486,15 @@ sub interactive_mode() { local $::Wizard_no_previous = 1; gtkadd($window1->{window}, - gtkpack_(Gtk2::VBox->new(0, 2), - if_(!$::isEmbedded, 0, Gtk2::Banner->new("drakfont", N("DrakFont"))), + gtkpack_(Gtk3::VBox->new(0, 2), + if_(!$::isEmbedded, 0, Gtk3::Banner->new("drakfont", N("DrakFont"))), 0, gtknew('Title2', label => N("Font List")), - 1, Gtk2::FontSelection->new, + 1, Gtk3::FontSelection->new, 0, gtkadd(create_hbox(), - gtksignal_connect(Gtk2::Button->new(N("Get Windows Fonts")), clicked => sub { $windows = 1; import_status(); $windows = 0 }), + gtksignal_connect(Gtk3::Button->new(N("Get Windows Fonts")), clicked => sub { $windows = 1; import_status(); $windows = 0 }), ), 0, create_okcancel(my $oc = { - ok_clicked => sub { Gtk2->main_quit }, + ok_clicked => sub { Gtk3->main_quit }, }, undef, undef, '', if_(0, [ N("About"), \&help, 1 ]), @@ -541,14 +541,14 @@ sub appli_choice() { dialog(N("Options"), [ 0, gtknew('Title2', label => N("Choose the applications that will support the fonts:")), - 0, Gtk2::WrappedLabel->new(formatAlaTeX(license_msg())), + 0, Gtk3::WrappedLabel->new(formatAlaTeX(license_msg())), (map { my ($label, $ref) = @$_; - (0, gtkpack_(Gtk2::HBox->new, + (0, gtkpack_(Gtk3::HBox->new, 0, $label, - 1, Gtk2::HBox->new, + 1, Gtk3::HBox->new, # BUG: that code never had supported canceling - 0, gtksignal_connect(gtkset_active(Gtk2::CheckButton->new, $$ref), toggled => sub { $$ref = $$ref ? 0 : 1 }), + 0, gtksignal_connect(gtkset_active(Gtk3::CheckButton->new, $$ref), toggled => sub { $$ref = $$ref ? 0 : 1 }), ), ); } ([ N("Ghostscript"), \$gs ], @@ -559,7 +559,7 @@ sub appli_choice() { ), ], [ - gtksignal_connect(Gtk2::Button->new(N("Ok")), + gtksignal_connect(Gtk3::Button->new(N("Ok")), clicked => \&exitdialog, ), ], @@ -569,10 +569,10 @@ sub appli_choice() { sub font_choice() { my $file_dialog; my $_select_font_msg = N("Select the font file or directory and click on 'Add'"); - $file_dialog = Gtk2::FileChooserDialog->new(N("File Selection"), $::main_window, 'open', N("Cancel") => 'cancel', N("Ok") => 'ok'); # 'select_folder' + $file_dialog = Gtk3::FileChooserDialog->new(N("File Selection"), $::main_window, 'open', N("Cancel") => 'cancel', N("Ok") => 'ok'); # 'select_folder' $file_dialog->set_select_multiple(1); - my $filter = Gtk2::FileFilter->new; + my $filter = Gtk3::FileFilter->new; $filter->set_name(N("Fonts")); $filter->add_pattern("*.$_") foreach @font_extensions, map { uc($_) } @font_extensions; $file_dialog->add_filter($filter); @@ -604,7 +604,7 @@ sub list_remove() { #- TODO : multi-selection $treeStore->remove($iter); } -sub exitdialog() { Gtk2->main_quit } +sub exitdialog() { Gtk3->main_quit } sub dialog { my ($title, $widgets, $buttons, $o_main_loop, $o_options) = @_; @@ -620,7 +620,7 @@ sub dialog { gtkflush(); $o_main_loop->(); } else { - Gtk2->main; + Gtk3->main; } $dialog->destroy if $dialog; undef $dialog; @@ -628,9 +628,9 @@ sub dialog { sub advanced_install() { my $button; - $model = Gtk2::TreeStore->new("Glib::String"); - $list = Gtk2::TreeView->new_with_model($model); - $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); + $model = Gtk3::TreeStore->new("Glib::String"); + $list = Gtk3::TreeView->new_with_model($model); + $list->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => 0)); $list->set_headers_visible(0); $list->get_selection->set_mode('browse'); $list->set_rules_hint(1); @@ -643,14 +643,14 @@ sub advanced_install() { 1, gtknew('HBox', children => [ 1, create_scrolled_window($list), 0, gtknew('VBox', children_tight => [ - gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => \&font_choice), - gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => \&list_remove), + gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => \&font_choice), + gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => \&list_remove), ]), ]), ], [ - gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => \&exitdialog), - gtksignal_connect($button = gtkset_sensitive(Gtk2::Button->new(N("Install")), 0), + gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => \&exitdialog), + gtksignal_connect($button = gtkset_sensitive(Gtk3::Button->new(N("Install")), 0), clicked => sub { import_status() if @install; }), @@ -670,9 +670,9 @@ sub list_to_remove() { } sub show_list_to_remove() { - my $model = Gtk2::TreeStore->new("Glib::String"); - my $list = Gtk2::TreeView->new_with_model($model); - $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); + my $model = Gtk3::TreeStore->new("Glib::String"); + my $list = Gtk3::TreeView->new_with_model($model); + $list->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => 0)); $list->set_headers_visible(0); $list->get_selection->set_mode('browse'); $list->set_rules_hint(1); @@ -681,13 +681,13 @@ sub show_list_to_remove() { dialog(N("Warning"), [ - 0, Gtk2::Label->new(N("Are you sure you want to uninstall the following fonts?")), - 1, gtkpack_(Gtk2::HBox->new(0, 4), 1, create_scrolled_window($list)), + 0, Gtk3::Label->new(N("Are you sure you want to uninstall the following fonts?")), + 1, gtkpack_(Gtk3::HBox->new(0, 4), 1, create_scrolled_window($list)), ], [ - gtksignal_connect(Gtk2::Button->new(N("Yes")), + gtksignal_connect(Gtk3::Button->new(N("Yes")), clicked => sub { import_status_uninstall(); exitdialog() }), - gtksignal_connect(Gtk2::Button->new(N("No")), + gtksignal_connect(Gtk3::Button->new(N("No")), clicked => \&exitdialog ), ], @@ -701,9 +701,9 @@ sub uninstall() { #- TODO : add item to right list with gtksignal_connect chk_empty_xfs_path(); #- left part - $left_model = Gtk2::TreeStore->new("Glib::String"); - $left_list = Gtk2::TreeView->new_with_model($left_model); - $left_list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); + $left_model = Gtk3::TreeStore->new("Glib::String"); + $left_list = Gtk3::TreeView->new_with_model($left_model); + $left_list->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => 0)); $left_list->set_headers_visible(0); $left_list->set_rules_hint(1); $left_list->get_selection->set_mode('multiple'); @@ -711,29 +711,29 @@ sub uninstall() { #- TODO : add item to right list with gtksignal_connect $left_model->append_set(undef, [ 0 => $_ ]) foreach sort @installed_fonts_path; #- right part - $right_model = Gtk2::TreeStore->new("Glib::String"); - $right_list = Gtk2::TreeView->new_with_model($right_model); - $right_list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); + $right_model = Gtk3::TreeStore->new("Glib::String"); + $right_list = Gtk3::TreeView->new_with_model($right_model); + $right_list->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => 0)); $right_list->set_headers_visible(0); $right_list->get_selection->set_mode('multiple'); $right_list->set_rules_hint(1); dialog(N("Uninstall"), [ - 1, gtkpack_(Gtk2::HBox->new(0, 4), + 1, gtkpack_(Gtk3::HBox->new(0, 4), 1, create_scrolled_window($left_list), #1, create_scrolled_window($right_list) ), ], [ - gtksignal_connect(Gtk2::Button->new(N("Unselect All")), + gtksignal_connect(Gtk3::Button->new(N("Unselect All")), clicked => sub { $left_list->get_selection->unselect_all } ), - gtksignal_connect(Gtk2::Button->new(N("Select All")), + gtksignal_connect(Gtk3::Button->new(N("Select All")), clicked => sub { $left_list->get_selection->select_all } ), - gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { exitdialog(); list_to_remove() }), - gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => \&exitdialog), + gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { exitdialog(); list_to_remove() }), + gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => \&exitdialog), ], undef, { size => [ -1, 300 ] } @@ -742,10 +742,10 @@ sub uninstall() { #- TODO : add item to right list with gtksignal_connect } sub import_status() { - $pbar = Gtk2::ProgressBar->new; - $pbar1 = Gtk2::ProgressBar->new; - $pbar2 = Gtk2::ProgressBar->new; - $pbar3 = Gtk2::ProgressBar->new; + $pbar = Gtk3::ProgressBar->new; + $pbar1 = Gtk3::ProgressBar->new; + $pbar2 = Gtk3::ProgressBar->new; + $pbar3 = Gtk3::ProgressBar->new; dialog(N("Importing fonts"), [ 0, create_packtable({ col_spacings => 10, row_spacings => 50 }, @@ -762,9 +762,9 @@ sub import_status() { } sub import_status_uninstall() { - $pbar = Gtk2::ProgressBar->new; - $pbar1 = Gtk2::ProgressBar->new; - $pbar2 = Gtk2::ProgressBar->new; + $pbar = Gtk3::ProgressBar->new; + $pbar1 = Gtk3::ProgressBar->new; + $pbar2 = Gtk3::ProgressBar->new; dialog(N("Removing fonts"), [ 0, create_packtable({ col_spacings => 10, row_spacings => 50 }, diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm index c7fae3143..5dd9d9198 100755 --- a/perl-install/standalone/drakperm +++ b/perl-install/standalone/drakperm @@ -34,17 +34,17 @@ my $w = ugtk3->new(N("Security Permissions")); $w->{rwindow}->set_size_request(620, 400) unless $::isEmbedded; my $W = $w->{window}; $W->signal_connect(delete_event => sub { ugtk3->exit }); -my $model = Gtk2::ListStore->new("Gtk2::Gdk::Pixbuf", ("Glib::String") x 5); -my $permList = Gtk2::TreeView->new_with_model($model); +my $model = Gtk3::ListStore->new("Gtk3::Gdk::Pixbuf", ("Glib::String") x 5); +my $permList = Gtk3::TreeView->new_with_model($model); my $pixbuf = gtknew('Pixbuf', file => 'non-editable'); my @column_sizes = (150, 100, 100, 15, -1); # TreeView layout is (Editable, Path, User, Group, Permissions, [hidden]index_id) -$permList->append_column(Gtk2::TreeViewColumn->new_with_attributes(N("Editable"), Gtk2::CellRendererPixbuf->new, 'pixbuf' => 0)); +$permList->append_column(Gtk3::TreeViewColumn->new_with_attributes(N("Editable"), Gtk3::CellRendererPixbuf->new, 'pixbuf' => 0)); each_index { - my $col = Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i + 1); + my $col = Gtk3::TreeViewColumn->new_with_attributes($_, Gtk3::CellRendererText->new, 'text' => $::i + 1); $col->set_min_width($column_sizes[$::i+1]); $permList->append_column($col); } (N("Path"), N("User"), N("Group"), N("Permissions")); @@ -103,10 +103,10 @@ $permList->signal_connect(button_press_event => sub { }); -my $tips = Gtk2::Tooltips->new; +my $tips = Gtk3::Tooltips->new; $W->add(gtknew('VBox', spacing => 5, children => [ - if_(!$::isEmbedded, 0, Gtk2::Banner->new('/usr/share/mcc/themes/default/drakperm-mdk.png', N("Permissions"))), + if_(!$::isEmbedded, 0, Gtk3::Banner->new('/usr/share/mcc/themes/default/drakperm-mdk.png', N("Permissions"))), 0, gtknew('Label_Left', text => N("Here you can see files to use in order to fix permissions, owners, and groups via msec.\nYou can also edit your own rules which will overwrite the default rules."), alignment => [ 0.5, 0 ]), 1, gtknew('VBox', border_width => 0, children => [ 0, gtknew('Label_Left', text => N("The current security level is %s. diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index b4d99469f..6a262bc2b 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -71,8 +71,8 @@ sub wait_msg { $mainw->{rwindow}->show_all; gtkset_mousecursor_wait($mainw->{rwindow}->window); # ugly workaround for gtk+ not displaying subdialog contents: - Glib::Timeout->add(300, sub { Gtk2->main_quit; 0 }); - Gtk2->main; + Glib::Timeout->add(300, sub { Gtk3->main_quit; 0 }); + Gtk3->main; $mainw; } @@ -89,7 +89,7 @@ my $window = $w->{window}; ############################ MAIN WINDOW ################################### -# Set different options to Gtk2::Window +# Set different options to Gtk3::Window unless ($::isEmbedded) { $w->{rwindow}->set_position('center'); $w->{rwindow}->set_title("DrakSec"); @@ -197,7 +197,7 @@ my %descr = ( ####################### OK CANCEL BUTTONS ################################## gtkpack_($vbox, 0, gtkshow(gtknew('VBox', spacing => 5, children => [ - if_(!$::isEmbedded, 0, Gtk2::Banner->new('/usr/share/mcc/themes/default/drakperm-mdk.png', N("Permissions"))), + if_(!$::isEmbedded, 0, Gtk3::Banner->new('/usr/share/mcc/themes/default/drakperm-mdk.png', N("Permissions"))), 0, gtknew('Label', text => $auth_string, alignment => [ 0.5, 0 ]) ])), 1, gtkshow(create_scrolled_window( diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups index 266c6fd1b..61f0a66a7 100755 --- a/perl-install/standalone/drakups +++ b/perl-install/standalone/drakups @@ -197,7 +197,7 @@ sub edit_row { my ($model, $o_iter) = @_; # create new item if needed (that is when adding a new one) at end of list my $iter = $o_iter || $model->append; - my $dialog = Gtk2::Dialog->new; + my $dialog = Gtk3::Dialog->new; $dialog->set_transient_for($w->{real_window}); $dialog->set_modal(1); @@ -207,14 +207,14 @@ sub edit_row { ); gtkadd($dialog->action_area, - gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { + gtksignal_connect(Gtk3::Button->new(N("Ok")), clicked => sub { # create new item if needed (that is when adding a new one) at end of list $iter ||= $model->append; # $model->set($iter, 1 => $file->get_text); # FILL ME $dialog->destroy; # $modified++; }), - gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $dialog->destroy }), + gtksignal_connect(Gtk3::Button->new(N("Cancel")), clicked => sub { $dialog->destroy }), ); $dialog->show_all; @@ -338,9 +338,9 @@ if (!$::isEmbedded) { my $_msg = N("Welcome to the UPS configuration tools"); -$w->{window}->add(gtkpack_(Gtk2::VBox->new, - if_(!$::isEmbedded, 0, Gtk2::Banner->new('drakups', N("DrakUPS"))), - 1, my $nb = Gtk2::Notebook->new, +$w->{window}->add(gtkpack_(Gtk3::VBox->new, + if_(!$::isEmbedded, 0, Gtk3::Banner->new('drakups', N("DrakUPS"))), + 1, my $nb = Gtk3::Notebook->new, 0, create_okcancel( { ok_clicked => sub { @@ -358,18 +358,18 @@ $w->{window}->add(gtkpack_(Gtk2::VBox->new, # build the notebook foreach my $i (@pages) { - my $model = $models{$i->{id}} = Gtk2::ListStore->new("Glib::Int", ("Glib::String") x listlength(@{$i->{columns}})); + my $model = $models{$i->{id}} = Gtk3::ListStore->new("Glib::Int", ("Glib::String") x listlength(@{$i->{columns}})); my (%buttons, $list); $indexes{$i->{name}} = 0; my $idx = \$indexes{$i->{name}}; my $getindex = sub { $$idx++ }; - $nb->append_page(gtkpack_(Gtk2::VBox->new, - 1, create_scrolled_window($list = Gtk2::TreeView->new_with_model($model), + $nb->append_page(gtkpack_(Gtk3::VBox->new, + 1, create_scrolled_window($list = Gtk3::TreeView->new_with_model($model), [ 'automatic', 'automatic' ]), - 0, gtkpack(Gtk2::HButtonBox->new, + 0, gtkpack(Gtk3::HButtonBox->new, (map { my ($id, $label, $sub) = @$_; - gtksignal_connect($buttons{$id} = Gtk2::Button->new($label), clicked => sub { + gtksignal_connect($buttons{$id} = Gtk3::Button->new($label), clicked => sub { $sub->($model, $list, $getindex); }); } ([ 'add', N("Add"), $i->{callbacks}{add} || \&add_callback ], @@ -378,15 +378,15 @@ foreach my $i (@pages) { ) ) #(map { - # gtksignal_connect(Gtk2::Button->new($_), clicked => $i->{callbacks}{$_}), + # gtksignal_connect(Gtk3::Button->new($_), clicked => $i->{callbacks}{$_}), #} keys %{$i->{callbacks}}) ), ), - Gtk2::Label->new($i->{name}), + Gtk3::Label->new($i->{name}), ); #$i->{list} = $list; each_index { - $list->append_column(Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i + 1)); + $list->append_column(Gtk3::TreeViewColumn->new_with_attributes($_, Gtk3::CellRendererText->new, 'text' => $::i + 1)); } @{$i->{columns}}; my @u = $i->{load}->(); foreach my $line (@u) { diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2 index 4a605c480..c857dbb03 100755 --- a/perl-install/standalone/harddrake2 +++ b/perl-install/standalone/harddrake2 @@ -261,23 +261,23 @@ $::noborderWhenEmbedded = 1; my ($menubar, $factory) = create_factory_menu($w->{real_window}, @menu_items); $w->{window}->set_size_request(805, 550) if !$::isEmbedded; -my $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", "Glib::String", "Glib::Int"); -$w->{window}->add(gtkpack_(0, Gtk2::VBox->new(0, 0), +my $tree_model = Gtk3::TreeStore->new("Gtk3::Gdk::Pixbuf", "Glib::String", "Glib::Int"); +$w->{window}->add(gtkpack_(0, Gtk3::VBox->new(0, 0), 0, $menubar, - 0, Gtk2::Banner->new("/usr/share/mcc/themes/default/harddrake-mdk.png", translate("Hardware")), - 1, create_hpaned(gtkadd(Gtk2::Frame->new(N("Detected hardware")), - create_scrolled_window(gtkset_size_request(my $tree = Gtk2::TreeView->new_with_model($tree_model), 350, -1), ['automatic', 'automatic'])), - gtkpack_(0, Gtk2::VBox->new(0, 0), - 1, gtkadd(my $frame = Gtk2::Frame->new(N("Information")), - create_scrolled_window(my $text = Gtk2::TextView->new)), - 0, my $module_cfg_button = gtksignal_connect(Gtk2::Button->new(N("Set current driver options")), + 0, Gtk3::Banner->new("/usr/share/mcc/themes/default/harddrake-mdk.png", translate("Hardware")), + 1, create_hpaned(gtkadd(Gtk3::Frame->new(N("Detected hardware")), + create_scrolled_window(gtkset_size_request(my $tree = Gtk3::TreeView->new_with_model($tree_model), 350, -1), ['automatic', 'automatic'])), + gtkpack_(0, Gtk3::VBox->new(0, 0), + 1, gtkadd(my $frame = Gtk3::Frame->new(N("Information")), + create_scrolled_window(my $text = Gtk3::TextView->new)), + 0, my $module_cfg_button = gtksignal_connect(Gtk3::Button->new(N("Set current driver options")), clicked => sub { local $SIG{CHLD} = undef; require modules::interactive; modules::interactive::config_window($in, $current_device); gtkset_mousecursor_normal(); }), - 0, my $config_button = gtksignal_connect(Gtk2::Button->new(N("Run config tool")), + 0, my $config_button = gtksignal_connect(Gtk3::Button->new(N("Run config tool")), # we've a configurator, let's add a button for it and show it clicked => sub { return 1 if defined $pid; @@ -292,7 +292,7 @@ $text->set_wrap_mode('word'); $frame->set_size_request(300, 450) unless $::isEmbedded; # $tree->set_column_auto_resize(0, 1); my (@data, @configurators); -$tree->append_column(my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::MDV::CellRendererPixWithLabel->new, 'pixbuf' => 0, label => 1)); +$tree->append_column(my $textcolumn = Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::MDV::CellRendererPixWithLabel->new, 'pixbuf' => 0, label => 1)); $tree->set_headers_visible(0); sub fill_default_text { @@ -373,7 +373,7 @@ $tree->get_selection->signal_connect('changed' => sub { # show the main window earlier (so that sub dialogs can use main # window's icon and so that no Gtk+ critical message got displayed): $w->{rwindow}->show_all; -my $flush_guard = Gtk2::GUI_Update_Guard->new; +my $flush_guard = Gtk3::GUI_Update_Guard->new; $_->hide foreach $module_cfg_button, $config_button; # hide buttons while no device my $wait = $in->wait_message(N("Please wait"), N("Detection in progress")); gtkflush() if !$::isEmbedded; @@ -516,7 +516,7 @@ $textcolumn->set_min_width(350); #$textcolumn->set_minmax_width(400); $textcolumn->set_sizing('GTK_TREE_VIEW_COLUMN_AUTOSIZE');#GROW_ONLY #$tree->columns_autosize(); -$tree->signal_connect(realize => sub { $tree->get_selection->select_path(Gtk2::TreePath->new_first) }); +$tree->signal_connect(realize => sub { $tree->get_selection->select_path(Gtk3::TreePath->new_first) }); { $SIG{CHLD} = undef; diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake index 2c420affd..f2e9d0120 100755 --- a/perl-install/standalone/logdrake +++ b/perl-install/standalone/logdrake @@ -60,12 +60,12 @@ unless ($::isEmbedded) { } $my_win->{window}->signal_connect(delete_event => \&quit); -my $cal = gtkset_sensitive(Gtk2::Calendar->new, 0); +my $cal = gtkset_sensitive(Gtk3::Calendar->new, 0); my $mday = (localtime(time()))[3]; $cal->select_day($mday); my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); my $cal_mode = 0; -my $cal_butt = gtksignal_connect(Gtk2::CheckButton->new(N("Show only for the selected day")), clicked => sub { $cal_mode = !$cal_mode; gtkset_sensitive($cal,$cal_mode) }); +my $cal_butt = gtksignal_connect(Gtk3::CheckButton->new(N("Show only for the selected day")), clicked => sub { $cal_mode = !$cal_mode; gtkset_sensitive($cal,$cal_mode) }); ### menus definition # the menus are not shown @@ -117,9 +117,9 @@ my %files = ( "explanations" => { file => "/var/log/explanations", desc => $explain_title } ); -my $yy = gtkset_sensitive(gtksignal_connect(Gtk2::Button->new(N("search")) , clicked => \&search),0); +my $yy = gtkset_sensitive(gtksignal_connect(Gtk3::Button->new(N("search")) , clicked => \&search),0); -my $log_text = gtktext_insert(Gtk2::TextView->new, [ [ '' ] ]); +my $log_text = gtktext_insert(Gtk3::TextView->new, [ [ '' ] ]); my $log_buf = $log_text->get_buffer; my $refcount_search; @@ -128,19 +128,19 @@ my $refcount_search; my %toggle; gtkadd($my_win->{window}, - gtkpack_(Gtk2::VBox->new(0,0), + gtkpack_(Gtk3::VBox->new(0,0), if_(!$::isEmbedded, 0, gtknew('Title1', label => N("A tool to monitor your logs"))), - if_(!$isFile, 0, gtkpack__(Gtk2::VBox->new(0,2), + if_(!$isFile, 0, gtkpack__(Gtk3::VBox->new(0,2), gtknew('Title2', label => N("Settings")), # N("Show lines"), - gtkpack__(Gtk2::HBox->new(0,0), - " " . N("Matching") . " ", my $e_yes = Gtk2::Entry->new, - " " . N("but not matching") . " ", my $e_no = Gtk2::Entry->new + gtkpack__(Gtk3::HBox->new(0,0), + " " . N("Matching") . " ", my $e_yes = Gtk3::Entry->new, + " " . N("but not matching") . " ", my $e_no = Gtk3::Entry->new ), - gtkpack_(Gtk2::HBox->new(0,0), - 1, gtkadd(gtkset_border_width(Gtk2::Frame->new(N("Choose file")),2), - gtkpack(gtkset_border_width(Gtk2::VBox->new(0,0),0), - map { $toggle{$_} = gtksignal_connect(Gtk2::CheckButton->new($files{$_}{desc}), + gtkpack_(Gtk3::HBox->new(0,0), + 1, gtkadd(gtkset_border_width(Gtk3::Frame->new(N("Choose file")),2), + gtkpack(gtkset_border_width(Gtk3::VBox->new(0,0),0), + map { $toggle{$_} = gtksignal_connect(Gtk3::CheckButton->new($files{$_}{desc}), clicked => sub { $refcount_search++; gtkset_sensitive($yy, $refcount_search); @@ -150,8 +150,8 @@ gtkadd($my_win->{window}, } sort keys %files, ) ), - 0, gtkadd(gtkset_border_width(Gtk2::Frame->new(N("Calendar")),2), - gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,0),5), + 0, gtkadd(gtkset_border_width(Gtk3::Frame->new(N("Calendar")),2), + gtkpack__(gtkset_border_width(Gtk3::VBox->new(0,0),5), $cal_butt, $cal ) ) @@ -162,8 +162,8 @@ gtkadd($my_win->{window}, !$isExplain ? (0, gtknew('Title2', label => N("Content of the file")), 1, create_scrolled_window($log_text) ) : (1, create_scrolled_window($log_text)), - 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk2::HButtonBox->new, 'end'), 5), - if_(!$isFile, gtksignal_connect(Gtk2::Button->new(N("Mail alert")), + 0, gtkadd(gtkset_border_width(gtkset_layout(Gtk3::HButtonBox->new, 'end'), 5), + if_(!$isFile, gtksignal_connect(Gtk3::Button->new(N("Mail alert")), clicked => sub { eval { alert_config() }; my $err = $@; @@ -174,8 +174,8 @@ gtkadd($my_win->{window}, . "\n\n" . $err); } })), - gtksignal_connect(Gtk2::Button->new(N("Save")), clicked => \&save), - gtksignal_connect(Gtk2::Button->new($::isEmbedded ? N("Cancel") : N("Quit")), clicked => \&quit) + gtksignal_connect(Gtk3::Button->new(N("Save")), clicked => \&save), + gtksignal_connect(Gtk3::Button->new($::isEmbedded ? N("Cancel") : N("Quit")), clicked => \&quit) ) ) ); @@ -220,10 +220,10 @@ sub parse_file { my ($pbar, $win_pb); unless ($::isEmbedded && $isExplain) { local $::main_window = $my_win->{real_window}; - gtkadd($win_pb = gtkset_modal(Gtk2::Window->new('toplevel'), 1), - gtkpack(Gtk2::VBox->new(2,0), - Gtk2::Label->new(" " . N("please wait, parsing file: %s", $descr) . " "), - $pbar = Gtk2::ProgressBar->new + gtkadd($win_pb = gtkset_modal(Gtk3::Window->new('toplevel'), 1), + gtkpack(Gtk3::VBox->new(2,0), + Gtk3::Label->new(" " . N("please wait, parsing file: %s", $descr) . " "), + $pbar = Gtk3::ProgressBar->new ) ); $win_pb->set_transient_for($my_win->{real_window}); @@ -355,7 +355,7 @@ sub logcolorize { } -# log_output (Gtk2::TextView, [ [ ... ] ]) +# log_output (Gtk3::TextView, [ [ ... ] ]) sub log_output { my ($text, $font, $col) = @_; my $tag = join('', $font, $col); diff --git a/perl-install/ugtk3.pm b/perl-install/ugtk3.pm index 9ad1cc2cb..d9c2b783c 100644 --- a/perl-install/ugtk3.pm +++ b/perl-install/ugtk3.pm @@ -38,7 +38,7 @@ use log; use common; use mygtk3 qw(gtknew); #- do not import gtkadd which conflicts with ugtk3 version -use Gtk2; +use Gtk3; $border = 5; @@ -146,7 +146,7 @@ sub gtkradio { my $def = shift; my $radio; map { - my $w = gtkset_active($radio = Gtk2::RadioButton->new_with_label($radio ? $radio->get_group : undef, $_), $_ eq $def); + my $w = gtkset_active($radio = Gtk3::RadioButton->new_with_label($radio ? $radio->get_group : undef, $_), $_ eq $def); $w->get_child->set_line_wrap(1); $w; } @_; @@ -170,7 +170,7 @@ sub gtkcombo_setpopdown_strings { sub gtkset_mousecursor { my ($type, $w) = @_; - ($w || gtkroot())->set_cursor(Gtk2::Gdk::Cursor->new($type)); + ($w || gtkroot())->set_cursor(Gtk3::Gdk::Cursor->new($type)); $w; } @@ -268,7 +268,7 @@ sub create_pixbutton { sub create_adjustment { my ($val, $min, $max) = @_; - Gtk2::Adjustment->new($val, $min, $max + 1, 1, ($max - $min + 1) / 10, 1); + Gtk3::Adjustment->new($val, $min, $max + 1, 1, ($max - $min + 1) / 10, 1); } sub create_scrolled_window { @@ -286,7 +286,7 @@ sub n_line_size { # Glib::Markup::escape_text() if no use for us because it'll do extra # s/X/&foobar;/ (such as s/'/'/) that are suitable for -# Gtk2::Labels but are not for Gtk2::TextViews, resulting in +# Gtk3::Labels but are not for Gtk3::TextViews, resulting in # displaying the raw enriched text instead... # sub escape_text_for_TextView_markup_format { @@ -403,7 +403,7 @@ sub create_dialog { gtkpack($dialog->vbox, gtknew('HBox', children => [ if_($o_options->{stock}, - 0, Gtk2::Image->new_from_stock($o_options->{stock}, 'dialog'), + 0, Gtk3::Image->new_from_stock($o_options->{stock}, 'dialog'), 0, gtknew('Label', text => " "), ), 1, $o_options->{scroll} ? create_scrolled_window($text, [ 'never', 'automatic' ]) : $text, @@ -413,19 +413,19 @@ sub create_dialog { if ($o_options->{cancel}) { $dialog->action_area->pack_start( gtknew('Button', text => N("Cancel"), - clicked => sub { $ret = 0; $dialog->destroy; Gtk2->main_quit }, + clicked => sub { $ret = 0; $dialog->destroy; Gtk3->main_quit }, can_default => 1), 1, 1, 0); } my $button = gtknew('Button', text => N("Ok"), can_default => 1, - clicked => sub { $ret = 1; $dialog->destroy; Gtk2->main_quit }); + clicked => sub { $ret = 1; $dialog->destroy; Gtk3->main_quit }); $dialog->action_area->pack_start($button, 1, 1, 0); $button->grab_default; $dialog->set_has_separator(0); $dialog->show_all; - Gtk2->main; + Gtk3->main; $ret; } @@ -455,19 +455,19 @@ sub create_vbox { gtknew('VButtonBox', layout => $_[0]) } sub create_factory_menu_ { my ($type, $name, $window, @menu_items) = @_; - my $widget = Gtk2::ItemFactory->new($type, $name, my $accel_group = Gtk2::AccelGroup->new); + my $widget = Gtk3::ItemFactory->new($type, $name, my $accel_group = Gtk3::AccelGroup->new); $widget->create_items($window, @menu_items); $window->add_accel_group($accel_group); ($widget->get_widget($name), $widget); } -sub create_factory_popup_menu { create_factory_menu_("Gtk2::Menu", '<main>', @_) } -sub create_factory_menu { create_factory_menu_("Gtk2::MenuBar", '<main>', @_) } +sub create_factory_popup_menu { create_factory_menu_("Gtk3::Menu", '<main>', @_) } +sub create_factory_menu { create_factory_menu_("Gtk3::MenuBar", '<main>', @_) } sub create_menu { my $title = shift; - my $w = Gtk2::MenuItem->new($title); - $w->set_submenu(gtkshow(gtkappend(Gtk2::Menu->new, @_))); + my $w = Gtk3::MenuItem->new($title); + $w->set_submenu(gtkshow(gtkappend(Gtk3::Menu->new, @_))); $w; } @@ -482,7 +482,7 @@ sub create_notebook { sub create_packtable { my ($options, @l) = @_; - my $w = Gtk2::Table->new(0, 0, $options->{homogeneous} || 0); + my $w = Gtk3::Table->new(0, 0, $options->{homogeneous} || 0); add2hash_($options, { xpadding => 5, ypadding => 0 }); each_index { my ($i, $l) = ($::i, $_); @@ -494,7 +494,7 @@ sub create_packtable { $w->attach($_, $j, $j + 1, $i, $i + 1, 'fill', 'fill', $options->{xpadding}, $options->{ypadding}) : $w->attach($_, $j, $j + 1, $i, $i + 1, - ['expand', 'fill'], ref($_) eq 'Gtk2::ScrolledWindow' || $_->get_data('must_grow') ? ['expand', 'fill'] : [], 0, 0); + ['expand', 'fill'], ref($_) eq 'Gtk3::ScrolledWindow' || $_->get_data('must_grow') ? ['expand', 'fill'] : [], 0, 0); $_->show; } } @$l; @@ -517,11 +517,11 @@ sub create_okcancel { $cancel = $::isWizard ? N("Previous") : N("Cancel"); } my $ok = defined $o_ok ? $o_ok : $::isWizard ? ($::Wizard_finished ? N("Finish") : N("Next")) : N("Ok"); - my $bok = $ok && ($w->{ok} = gtknew('Button', text => $ok, clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk2->main_quit })); + my $bok = $ok && ($w->{ok} = gtknew('Button', text => $ok, clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk3->main_quit })); my $bprev; if ($cancel) { $bprev = $w->{cancel} = gtknew('Button', text => $cancel, clicked => $w->{cancel_clicked} || - sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk2->main_quit }); + sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk3->main_quit }); } $w->{wizcancel} = gtknew('Button', text => ($::Wizard_skip ? N("Skip") : N("Cancel")), clicked => sub { die 'wizcancel' }) if $::isWizard && !$::isInstall && !$::Wizard_no_cancel; if (!defined $wm_is_kde) { @@ -529,7 +529,7 @@ sub create_okcancel { my $wm = any::running_window_manager(); $wm_is_kde = !$::isInstall && ($wm eq "kwin" || $wm eq "compiz" && fuzzy_pidofs(qr/\bkde-window-decorator\b/)) || 0; } - my $f = sub { $w->{buttons}{$_[0][0]} = ref($_[0][0]) =~ /Gtk2::Button/ ? + my $f = sub { $w->{buttons}{$_[0][0]} = ref($_[0][0]) =~ /Gtk3::Button/ ? $_[0][0] : gtknew('Button', text => $_[0][0], clicked => $_[0][1]) }; my @left = ((map { $f->($_) } grep { $_->[2] && !$_->[3] } @other), @@ -580,11 +580,11 @@ sub _setup_paned { } sub create_vpaned { - _setup_paned(Gtk2::VPaned->new, @_); + _setup_paned(Gtk3::VPaned->new, @_); } sub create_hpaned { - _setup_paned(Gtk2::HPaned->new, @_); + _setup_paned(Gtk3::HPaned->new, @_); } sub gtkcreate_frame { @@ -674,7 +674,7 @@ sub set_back_pixbuf { my ($widget, $pixbuf) = @_; my $window = $widget->window; my ($width, $height) = ($pixbuf->get_width, $pixbuf->get_height); - my $pixmap = Gtk2::Gdk::Pixmap->new($window, $width, $height, $window->get_depth); + my $pixmap = Gtk3::Gdk::Pixmap->new($window, $width, $height, $window->get_depth); $pixbuf->render_to_drawable($pixmap, $widget->style->fg_gc('normal'), 0, 0, 0, 0, $width, $height, 'max', 0, 0); $window->set_back_pixmap($pixmap, 0); } @@ -683,7 +683,7 @@ sub set_back_pixmap { my ($w) = @_; return if !$w->realized; my $window = $w->window; - my $pixmap = $w->{back_pixmap} ||= Gtk2::Gdk::Pixmap->new($window, 1, 2, $window->get_depth); + my $pixmap = $w->{back_pixmap} ||= Gtk3::Gdk::Pixmap->new($window, 1, 2, $window->get_depth); my $style = $w->get_style; $pixmap->draw_points($style->bg_gc('normal'), 0, 0); @@ -741,7 +741,7 @@ sub new { title => $title || '', pop_it => $o->{pop_it}, $::isInstall ? (banner => gtknew('Install_Title', text => $title || get_default_step_items())) : (), - $::isStandalone && $banner_title && $icon ? (banner => Gtk2::Banner->new($icon, $banner_title)) : (), + $::isStandalone && $banner_title && $icon ? (banner => Gtk3::Banner->new($icon, $banner_title)) : (), width => $opts{width}, height => $opts{height}, default_width => $opts{default_width}, default_height => $opts{default_height}, modal => (!$o->{pop_it} && !$::isInstall) && ($opts{modal} || $grab || $o->{grab}) || $o->{modal}, no_Window_Manager => exists $opts{no_Window_Manager} ? $opts{no_Window_Manager} : !$::isStandalone, @@ -785,7 +785,7 @@ sub sync { sub flush() { gtkflush() } sub shrink_topwindow { my ($o) = @_; - $o->{real_window}->signal_emit('size_allocate', Gtk2::Gdk::Rectangle->new(-1, -1, -1, -1)); + $o->{real_window}->signal_emit('size_allocate', Gtk3::Gdk::Rectangle->new(-1, -1, -1, -1)); } sub exit { gtkset_mousecursor_normal(); #- for restoring a normal in any case @@ -816,9 +816,9 @@ sub ask_dir { my $w = ugtk3->new(shift @_, grab => 1); $w->_ask_dir(@_); sub _ask_from_entry($$@) { my ($o, @msgs) = @_; my $entry = gtknew('Entry'); - my $f = sub { $o->{retval} = $entry->get_text; Gtk2->main_quit }; + my $f = sub { $o->{retval} = $entry->get_text; Gtk3->main_quit }; $o->{ok_clicked} = $f; - $o->{cancel_clicked} = sub { undef $o->{retval}; Gtk2->main_quit }; + $o->{cancel_clicked} = sub { undef $o->{retval}; Gtk3->main_quit }; gtkadd($o->{window}, gtkpack($o->create_box_with_title(@msgs), @@ -832,7 +832,7 @@ sub _ask_warn($@) { my ($o, @msgs) = @_; gtkadd($o->{window}, gtkpack($o->create_box_with_title(@msgs), - my $w = gtknew('Button', text => N("Ok"), clicked => sub { Gtk2->main_quit }), + my $w = gtknew('Button', text => N("Ok"), clicked => sub { Gtk3->main_quit }), ), ); $w->grab_focus; @@ -903,12 +903,12 @@ sub ask_browse_tree_info { my $w = ugtk3->new($common->{title}); - my $tree_model = Gtk2::TreeStore->new("Glib::String", "Gtk2::Gdk::Pixbuf", "Glib::String"); - my $tree = Gtk2::TreeView->new_with_model($tree_model); + my $tree_model = Gtk3::TreeStore->new("Glib::String", "Gtk3::Gdk::Pixbuf", "Glib::String"); + my $tree = Gtk3::TreeView->new_with_model($tree_model); $tree->get_selection->set_mode('browse'); - $tree->append_column(my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); - $tree->append_column(my $pixcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererPixbuf->new, 'pixbuf' => 1)); - $tree->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 2)); + $tree->append_column(my $textcolumn = Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => 0)); + $tree->append_column(my $pixcolumn = Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererPixbuf->new, 'pixbuf' => 1)); + $tree->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => 2)); $tree->set_headers_visible(0); $tree->set_rules_hint(1); $textcolumn->set_min_width(200); @@ -924,20 +924,20 @@ sub ask_browse_tree_info { 0, gtknew('Frame', text => N("Info"), child => gtknew('ScrolledWindow', child => my $info = gtknew('TextView', editable => 0, height => 100)), ) ]), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, 0, my $status = gtknew('Label'), if_($common->{auto_deps}, 0, gtknew('CheckButton', text => $common->{auto_deps}, active_ref => \$common->{state}{auto_deps}) ), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, 0, my $box2 = gtknew('HBox', spacing => 10), ])); gtkpack__($box2, gtknew(($::isInstall ? 'Install_Button' : 'Button'), text => N("Help"), clicked => $common->{interactive_help})) if $common->{interactive_help}; - #gtkpack__($box2, my $toolbar = Gtk2::Toolbar->new('horizontal', 'icons')); - gtkpack__($box2, my $toolbar = Gtk2::Toolbar->new); + #gtkpack__($box2, my $toolbar = Gtk3::Toolbar->new('horizontal', 'icons')); + gtkpack__($box2, my $toolbar = Gtk3::Toolbar->new); my @l = ([ $common->{ok}, 1 ], if_($common->{cancel}, [ $common->{cancel}, 0 ])); @l = reverse @l if !$::isInstall; @@ -945,7 +945,7 @@ sub ask_browse_tree_info { my ($t, $val) = @$_; $box2->pack_end(my $w = gtknew('Button', text => $t, clicked => sub { $w->{retval} = $val; - Gtk2->main_quit; + Gtk3->main_quit; }), 0, 1, 20); $w->show; $w; @@ -1239,7 +1239,7 @@ sub gtk_new_TextView_get_log { # misc helpers: -package Gtk2::TreeStore; +package Gtk3::TreeStore; sub append_set { my ($model, $parent, @values) = @_; # compatibility: @@ -1250,7 +1250,7 @@ sub append_set { } -package Gtk2::ListStore; +package Gtk3::ListStore; # Append a new row, set the values, return the TreeIter sub append_set { my ($model, @values) = @_; @@ -1262,7 +1262,7 @@ sub append_set { } -package Gtk2::TreeModel; +package Gtk3::TreeModel; # gets the string representation of a TreeIter sub get_path_str { my ($self, $iter) = @_; @@ -1278,7 +1278,7 @@ sub iter_each_children { } } -package Gtk2::TreeView; +package Gtk3::TreeView; # likewise gtk-1.2 function sub toggle_expansion { my ($self, $path, $b_open_all) = @_; @@ -1309,17 +1309,17 @@ sub toggle_expansion { # This layer try to make OptionMenu and ComboBox look being api # compatible with Combo since its API is quite nice. -package Gtk2::OptionMenu; +package Gtk3::OptionMenu; use MDK::Common; # try to get combox <==> option menu mapping sub set_popdown_strings { my ($w, @strs) = @_; - my $menu = Gtk2::Menu->new; + my $menu = Gtk3::Menu->new; # keep string list around for ->set_text compatibilty helper $w->{strings} = \@strs; #$w->set_menu((ugtk3::create_factory_menu($window, [ "File", (undef) x 3, '<Branch>' ], map { [ "File/" . $_, (undef) x 3, '<Item>' ] } @strs))[0]); - $menu->append(ugtk3::gtkshow(Gtk2::MenuItem->new_with_label($_))) foreach @strs; + $menu->append(ugtk3::gtkshow(Gtk3::MenuItem->new_with_label($_))) foreach @strs; $w->set_menu($menu); $w; } @@ -1355,7 +1355,7 @@ sub set_text { -package Gtk2::ComboBox; +package Gtk3::ComboBox; use MDK::Common; # try to get combox <==> option menu mapping @@ -1396,28 +1396,28 @@ sub set_text { } -package Gtk2::Label; +package Gtk3::Label; sub set { my ($label, $text) = @_; mygtk3::gtkset($label, text => $text); } -package Gtk2::WrappedLabel; +package Gtk3::WrappedLabel; sub new { my ($_type, $o_text, $o_align) = @_; mygtk3::gtknew('WrappedLabel', text => $o_text || '', alignment => [ $o_align || 0, 0.5 ]); } -package Gtk2::Entry; +package Gtk3::Entry; sub new_with_text { my ($_class, $o_text) = @_; mygtk3::gtknew('Entry', text => $o_text); } -package Gtk2::Banner; +package Gtk3::Banner; use MDK::Common; use mygtk3 qw(gtknew); @@ -1484,13 +1484,13 @@ sub new { } -package Gtk2::MDV::CellRendererPixWithLabel; +package Gtk3::MDV::CellRendererPixWithLabel; use MDK::Common; -use Glib::Object::Subclass "Gtk2::CellRenderer", +use Glib::Object::Subclass "Gtk3::CellRenderer", properties => [ Glib::ParamSpec->string("label", "Label", "A meaningfull label", "", [qw(readable writable)]), - Glib::ParamSpec->object("pixbuf", "Pixbuf file", "Something nice to display", 'Gtk2::Gdk::Pixbuf', [qw(readable writable)]), + Glib::ParamSpec->object("pixbuf", "Pixbuf file", "Something nice to display", 'Gtk3::Gdk::Pixbuf', [qw(readable writable)]), ]; my $x_padding = 2; @@ -1574,12 +1574,12 @@ sub RENDER { # not that efficient... 1; -package Gtk2::Notify::Queue; +package Gtk3::Notify::Queue; sub new { my ($class, $statusicon) = @_; - require Gtk2::Notify; + require Gtk3::Notify; my $self = bless { queue => [], @@ -1604,9 +1604,9 @@ sub add { } sub show { - my ($self) = @_; # perl_checker: $self = Gtk2::Notify->new + my ($self) = @_; # perl_checker: $self = Gtk3::Notify->new my $info = $self->{queue}[0]; - my $notification = Gtk2::Notify->new($info->{title}, $info->{message}, $self->{statusicon}); + my $notification = Gtk3::Notify->new($info->{title}, $info->{message}, $self->{statusicon}); $notification->set_icon_from_pixbuf($info->{pixbuf}) if $info->{pixbuf}; $notification->set_urgency($info->{urgency}) if $info->{urgency}; foreach my $a (@{$info->{actions} || []}) { @@ -1630,7 +1630,7 @@ sub show { 1; -package Gtk2::GUI_Update_Guard; +package Gtk3::GUI_Update_Guard; use MDK::Common::Func qw(before_leaving); use ugtk3; diff --git a/perl-install/unused/migrate-ugtk2-to-mygtk2.pl b/perl-install/unused/migrate-ugtk2-to-mygtk2.pl index 620ff4578..aabeb8a36 100755 --- a/perl-install/unused/migrate-ugtk2-to-mygtk2.pl +++ b/perl-install/unused/migrate-ugtk2-to-mygtk2.pl @@ -23,7 +23,7 @@ $b = 1; while ($b) { $b = 0; - if (my ($before, $class, undef, $new, $arg, $after, $after2) = /(.*?)Gtk2::(\w+(::\w+)*)->(new\w*)(?:\(($re)\)(.*)|([^(].*))/s) { + if (my ($before, $class, undef, $new, $arg, $after, $after2) = /(.*?)Gtk3::(\w+(::\w+)*)->(new\w*)(?:\(($re)\)(.*)|([^(].*))/s) { $after ||= $after2; my $s; |