From 4473fb769b8aa88daede1eaaa4c65e74cbd17401 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 19 Nov 2013 21:37:27 +0100 Subject: use Gtk3 namespace instead of Gtk2 --- rpmdrake.pm | 94 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'rpmdrake.pm') diff --git a/rpmdrake.pm b/rpmdrake.pm index da349b36..e5697957 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -130,14 +130,14 @@ sub rpmdrake::prompt::prompt { gtkadd( $d->{window}, gtkpack( - Gtk2::VBox->new(0, 5), - Gtk2::WrappedLabel->new($self->{title}), + Gtk3::VBox->new(0, 5), + Gtk3::WrappedLabel->new($self->{title}), (map { gtkpack( - Gtk2::HBox->new(0, 5), - Gtk2::Label->new($self->{prompts}[$_]), + Gtk3::HBox->new(0, 5), + Gtk3::Label->new($self->{prompts}[$_]), $answers[$_] = gtkset_visibility(gtkentry(), !$self->{hidden}[$_]), ) } 0 .. $#{$self->{prompts}}), - gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit }), + gtksignal_connect(Gtk3::Button->new(N("Ok")), clicked => sub { Gtk3->main_quit }), ), ); $d->main; @@ -236,7 +236,7 @@ sub getbanner() { install => N("Software Packages Installation"), }; } - Gtk2::Banner->new($ugtk3::wm_icon, $::MODE eq 'update' ? N("Software Packages Update") : N("Software Management")); + Gtk3::Banner->new($ugtk3::wm_icon, $::MODE eq 'update' ? N("Software Packages Update") : N("Software Management")); } # return value: @@ -259,11 +259,11 @@ sub interactive_msg { gtkadd( $d->{window}, gtkpack_( - Gtk2::VBox->new(0, 5), + Gtk3::VBox->new(0, 5), 1, ( $options{scroll} ? - ($text_w = create_scrolled_window(gtktext_insert(Gtk2::TextView->new, $contents))) + ($text_w = create_scrolled_window(gtktext_insert(Gtk3::TextView->new, $contents))) : ($text_w = gtknew('WrappedLabel', text_markup => $contents)) ), if_($options{widget}, 0, $options{widget}), @@ -274,24 +274,24 @@ sub interactive_msg { ref($options{yesno}) eq 'ARRAY' ? map { my $label = $_; gtksignal_connect( - $button_yes = Gtk2::Button->new($label), - clicked => sub { $d->{retval} = $label; Gtk2->main_quit } + $button_yes = Gtk3::Button->new($label), + clicked => sub { $d->{retval} = $label; Gtk3->main_quit } ); } @{$options{yesno}} : ( $options{yesno} ? ( gtksignal_connect( - Gtk2::Button->new($options{text}{no} || N("No")), - clicked => sub { $d->{retval} = 0; Gtk2->main_quit } + Gtk3::Button->new($options{text}{no} || N("No")), + clicked => sub { $d->{retval} = 0; Gtk3->main_quit } ), gtksignal_connect( - $button_yes = Gtk2::Button->new($options{text}{yes} || N("Yes")), - clicked => sub { $d->{retval} = 1; Gtk2->main_quit } + $button_yes = Gtk3::Button->new($options{text}{yes} || N("Yes")), + clicked => sub { $d->{retval} = 1; Gtk3->main_quit } ), ) : gtksignal_connect( - $button_yes = Gtk2::Button->new(N("Ok")), - clicked => sub { Gtk2->main_quit } + $button_yes = Gtk3::Button->new(N("Ok")), + clicked => sub { Gtk3->main_quit } ) ) ) @@ -313,8 +313,8 @@ sub interactive_packtable { my $packtable = create_packtable({}, @$lines); gtkadd($w->{window}, - gtkpack_(Gtk2::VBox->new(0, 5), - if_($top_label, 0, Gtk2::Label->new($top_label)), + gtkpack_(Gtk3::VBox->new(0, 5), + if_($top_label, 0, Gtk3::Label->new($top_label)), 1, create_scrolled_window($packtable), 0, gtkpack__(create_hbox(), @$action_buttons))); my $preq = $packtable->size_request; @@ -337,29 +337,29 @@ sub interactive_list { my $n = $_[1]; [ $_[0], gtksignal_connect( - Gtk2::Button->new(but(N("Info..."))), + Gtk3::Button->new(but(N("Info..."))), clicked => sub { $callback->($n) }, ) ]; } \@radios, $list, - ) : gtkpack__(Gtk2::VBox->new(0, 0), @radios); + ) : gtkpack__(Gtk3::VBox->new(0, 0), @radios); my $choice; my $button_ok; gtkadd( $d->{window}, gtkpack__( - Gtk2::VBox->new(0,5), - Gtk2::Label->new($contents), + Gtk3::VBox->new(0,5), + Gtk3::Label->new($contents), int(@$list) > 8 ? gtkset_size_request(create_scrolled_window($vbradios), 250, 320) : $vbradios, gtkpack__( create_hbox(), if_(!$options{nocancel}, gtksignal_connect( - Gtk2::Button->new(N("Cancel")), clicked => sub { Gtk2->main_quit }), + Gtk3::Button->new(N("Cancel")), clicked => sub { Gtk3->main_quit }), ), gtksignal_connect( - $button_ok=Gtk2::Button->new(N("Ok")), clicked => sub { + $button_ok=Gtk3::Button->new(N("Ok")), clicked => sub { each_index { $_->get_active and $choice = $::i } @radios; - Gtk2->main_quit; + Gtk3->main_quit; } ) ) @@ -384,11 +384,11 @@ sub wait_msg { local $::isEmbedded; my $mainw = ugtk3->new(N("Please wait"), grab => 1, if_(exists $options{transient}, transient => $options{transient})); $mainw->{real_window}->set_position($options{transient} ? 'center_on_parent' : 'center_always'); - my $label = ref($msg) =~ /^Gtk/ ? $msg : Gtk2::WrappedLabel->new($msg); + my $label = ref($msg) =~ /^Gtk/ ? $msg : Gtk3::WrappedLabel->new($msg); gtkadd( $mainw->{window}, gtkpack__( - gtkset_border_width(Gtk2::VBox->new(0, 5), 6), + gtkset_border_width(Gtk3::VBox->new(0, 5), 6), $label, if_(exists $options{widgets}, @{$options{widgets}}), ) @@ -669,16 +669,16 @@ by Mageia Official Updates.")), %options my $w = ugtk3->new(N("Mirror choice"), grab => 1, @transient_options); $w->{rwindow}->set_position($options{transient} ? 'center_on_parent' : 'center_always'); - my $tree_model = Gtk2::TreeStore->new("Glib::String"); - my $tree = Gtk2::TreeView->new_with_model($tree_model); + my $tree_model = Gtk3::TreeStore->new("Glib::String"); + my $tree = Gtk3::TreeView->new_with_model($tree_model); $tree->get_selection->set_mode('browse'); - $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->set_headers_visible(0); gtkadd( $w->{window}, gtkpack_( - Gtk2::VBox->new(0,5), + Gtk3::VBox->new(0,5), 0, N("Please choose the desired mirror."), 1, create_scrolled_window($tree), 0, gtkpack( @@ -686,13 +686,13 @@ by Mageia Official Updates.")), %options map { my $retv = $_->[1]; gtksignal_connect( - Gtk2::Button->new(but($_->[0])), + Gtk3::Button->new(but($_->[0])), clicked => sub { if ($retv) { my ($model, $iter) = $tree->get_selection->get_selected; $model and $w->{retval} = { sel => $model->get($iter, 0) }; } - Gtk2->main_quit; + Gtk3->main_quit; }, ); } [ N("Cancel"), 0 ], [ N("Ok"), 1 ] @@ -706,7 +706,7 @@ by Mageia Official Updates.")), %options $w->{window}->set_size_request(500, 400); $w->{rwindow}->show_all; - my $path = Gtk2::TreePath->new_first; + my $path = Gtk3::TreePath->new_first; $tree->expand_row($path, 0); $path->down; $tree->get_selection->select_path($path); @@ -754,21 +754,21 @@ sub show_urpm_progress { } } } - Gtk2->main_iteration while Gtk2->events_pending; + Gtk3->main_iteration while Gtk3->events_pending; } sub update_sources { my ($urpm, %options) = @_; my $cancel = 0; my $w; my $label; $w = wait_msg( - $label = Gtk2::Label->new(N("Please wait, updating media...")), + $label = Gtk3::Label->new(N("Please wait, updating media...")), no_wait_cursor => 1, widgets => [ - my $pb = gtkset_size_request(Gtk2::ProgressBar->new, 300, -1), + my $pb = gtkset_size_request(Gtk3::ProgressBar->new, 300, -1), gtkpack( create_hbox(), gtksignal_connect( - Gtk2::Button->new(N("Cancel")), + Gtk3::Button->new(N("Cancel")), clicked => sub { $cancel = 1; $urpm->{error}->(N("Canceled")); @@ -831,35 +831,35 @@ sub update_sources_interactive { gtkadd( $w->{window}, gtkpack_( - 0, Gtk2::VBox->new(0,5), - 0, Gtk2::Label->new(N("Select the media you wish to update:")), + 0, Gtk3::VBox->new(0,5), + 0, Gtk3::Label->new(N("Select the media you wish to update:")), 1, gtknew('ScrolledWindow', height => 300, child => # FIXME: using a listview would be just better: gtknew('VBox', spacing => 5, children_tight => [ @buttons = map { - Gtk2::CheckButton->new_with_label($_->{name}); + Gtk3::CheckButton->new_with_label($_->{name}); } @media ]) ), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, 0, gtkpack( create_hbox(), gtksignal_connect( - Gtk2::Button->new(N("Cancel")), - clicked => sub { $w->{retval} = 0; Gtk2->main_quit }, + Gtk3::Button->new(N("Cancel")), + clicked => sub { $w->{retval} = 0; Gtk3->main_quit }, ), gtksignal_connect( - Gtk2::Button->new(N("Select all")), + Gtk3::Button->new(N("Select all")), clicked => sub { $_->set_active(1) foreach @buttons }, ), gtksignal_connect( - Gtk2::Button->new(N("Update")), + Gtk3::Button->new(N("Update")), clicked => sub { $w->{retval} = any { $_->get_active } @buttons; # list of media listed in the checkbox panel my @buttonmedia = grep { !$_->{ignore} } @{$urpm->{media}}; @media = map_index { if_($_->get_active, $buttonmedia[$::i]{name}) } @buttons; - Gtk2->main_quit; + Gtk3->main_quit; }, ), ) -- cgit v1.2.1