From 122658abc05374cbdbac4eef563265a1673da984 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 18 Nov 2013 02:45:58 +0100 Subject: use Gtk3 namespace instead of Gtk2 --- control-center | 82 +++++++++++++++++++++++++++---------------------------- drakconsole | 4 +-- mdkwebadmin.pl | 12 ++++---- menus_launcher.pl | 24 ++++++++-------- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/control-center b/control-center index e8314014..1ee9e60d 100755 --- a/control-center +++ b/control-center @@ -38,7 +38,7 @@ POSIX::sigprocmask(SIG_BLOCK, POSIX::SigSet->new(SIGCHLD)); BEGIN { unshift @::textdomains, 'drakconf' } use mygtk3 qw(gtknew); use ugtk3 qw(:create :dialogs :helpers :wrappers); -use Gtk2::WebKit; +use Gtk3::WebKit; use MDV::Control_Center; @@ -88,7 +88,7 @@ add_icon_path("$themes_dir/default") if $theme ne 'default'; # fall back if them mygtk3::import_style_ressources(); my $rc = find { -r $_ } ("$themes_dir/$theme/gtkrc", if_($theme ne 'default', "$themes_dir/default/gtkrc")); -Gtk2::Rc->parse($rc) if -r $rc; +Gtk3::Rc->parse($rc) if -r $rc; my $branding = N("Mageia"); my $product_id = common::parse_LDAP_namespace_structure(cat_('/etc/product.id')); @@ -98,7 +98,7 @@ $branding = translate($product_id->{distribution}); #------------------------------------------------------------- # Splash window: please wait ... -my $window_splash = Gtk2::Window->new('popup'); +my $window_splash = Gtk3::Window->new('popup'); $window_splash->signal_connect(delete_event => \&quit_global); $window_splash->set_title(N("%s Control Center", $branding)); $window_splash->set_position('center_always'); @@ -592,7 +592,7 @@ my ($timeout, %check_boxes, $emb_socket); # set default size: -my $window_global = gtkset_size_request(Gtk2::Window->new('toplevel'), $min_width, $min_height); +my $window_global = gtkset_size_request(Gtk3::Window->new('toplevel'), $min_width, $min_height); mygtk3::register_main_window($window_global); if ($geometry) { @@ -710,16 +710,16 @@ $view->signal_connect('load-finished' => sub { load_program() if $program; }); # so that it exists when building steps: -my $banner_notebook = Gtk2::Notebook->new; +my $banner_notebook = Gtk3::Notebook->new; build_list(); gtkadd($window_global, - gtkpack_(Gtk2::VBox->new(0, 0), + gtkpack_(Gtk3::VBox->new(0, 0), 0, $menu, #0, $banner_notebook, - 0, Gtk2::HSeparator->new, - # 0, gtkset_size_request(Gtk2::VBox->new(10, 10), -1, 2), - 1, gtkpack_(Gtk2::HBox->new(0, 0), + 0, Gtk3::HSeparator->new, + # 0, gtkset_size_request(Gtk3::VBox->new(10, 10), -1, 2), + 1, gtkpack_(Gtk3::HBox->new(0, 0), 1, $steps = gtknew('MDV_Notebook', parent_window => $window_global, children => [ #Layout Fixed # 145 is the vertical offset in order to be below the actual logo: [ gtknew('VBox', widget_name => 'Steps', spacing => 0, width => (192 - $offset), @@ -731,14 +731,14 @@ gtkadd($window_global, } @buttons ]), 0, 100 ], ], right_child => gtknew('ScrolledWindow', child => gtkset_border_width($view, 5), no_shadow => 1, h_policy => 'never')), - 1, gtkpack(my $emb_box = Gtk2::VBox->new(0, 0), - my $wait_darea = gtkset_size_request(Gtk2::DrawingArea->new, -1, -1), + 1, gtkpack(my $emb_box = Gtk3::VBox->new(0, 0), + my $wait_darea = gtkset_size_request(Gtk3::DrawingArea->new, -1, -1), ), ), - 0, Gtk2::HSeparator->new, - 0, my $buttons = gtkadd(gtkset_layout(Gtk2::HButtonBox->new, 'start'), + 0, Gtk3::HSeparator->new, + 0, my $buttons = gtkadd(gtkset_layout(Gtk3::HButtonBox->new, 'start'), map { gtkset_border_width($_, 3) } - gtksignal_connect(my $cancel = Gtk2::Button->new(N("Cancel")), + gtksignal_connect(my $cancel = Gtk3::Button->new(N("Cancel")), clicked => sub { stop_wait_area(); kill_children(); @@ -752,8 +752,8 @@ $view->set_size_request(-1, -1); $window_global->signal_connect(delete_event => \&quit_global); -my $accel = Gtk2::AccelGroup->new; -$accel->connect(Gtk2::Gdk->keyval_from_name('F1'), [], ['visible'], \&run_help); +my $accel = Gtk3::AccelGroup->new; +$accel->connect(Gtk3::Gdk->keyval_from_name('F1'), [], ['visible'], \&run_help); $window_global->add_accel_group($accel); my (undef, $nodename) = POSIX::uname(); @@ -768,11 +768,11 @@ foreach my $notebook ($banner_notebook) { # banner : -#add2notebook($banner_notebook, "", Gtk2::Banner->new("/usr/share/icons/large/drakconf.png", +#add2notebook($banner_notebook, "", Gtk3::Banner->new("/usr/share/icons/large/drakconf.png", # N("Welcome to the %s Control Center", $branding))); -my ($_hand_cursor, $wait_cursor) = map { Gtk2::Gdk::Cursor->new($_) } qw(hand2 watch); +my ($_hand_cursor, $wait_cursor) = map { Gtk3::Gdk::Cursor->new($_) } qw(hand2 watch); my $left_locked = 0; @@ -1103,7 +1103,7 @@ $SIG{TERM} = \&quit_global; $window_splash->destroy; undef $window_splash; -Gtk2->main; +Gtk3->main; sub load_program() { if (my $sub = $tool_callbacks{$program}) { @@ -1161,10 +1161,10 @@ sub create_hidden_socket { my ($icon, $label) = @_; my $banner; gtkpack_($emb_box, - 0, $banner = gtkpack__(Gtk2::VBox->new(0, 0), Gtk2::Banner->new($icon, $label), - Gtk2::HSeparator->new, + 0, $banner = gtkpack__(Gtk3::VBox->new(0, 0), Gtk3::Banner->new($icon, $label), + Gtk3::HSeparator->new, ), - 1, gtksignal_connect($emb_socket = Gtk2::Socket->new, 'plug-removed' => sub { + 1, gtksignal_connect($emb_socket = Gtk3::Socket->new, 'plug-removed' => sub { $menu->show if $application_driven_menu; $banner->destroy; child_just_exited(); @@ -1348,7 +1348,7 @@ sub quit_global() { THEME => $theme, }); gtkset_mousecursor_normal(); - Gtk2::exit(0); + Gtk3::exit(0); standalone::exit(0); } @@ -1399,12 +1399,12 @@ sub splash_warning { sub new_dialog { my ($title, $o_no_button) = @_; - my $dialog = gtkset_border_width(Gtk2::Dialog->new, 10); + my $dialog = gtkset_border_width(Gtk3::Dialog->new, 10); $dialog->set_transient_for($window_global); $dialog->set_position('center-on-parent'); $dialog->set_title($title); - $dialog->action_area->pack_start(gtkadd(Gtk2::HButtonBox->new, - gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { $dialog->destroy }) + $dialog->action_area->pack_start(gtkadd(Gtk3::HButtonBox->new, + gtksignal_connect(Gtk3::Button->new(N("Close")), clicked => sub { $dialog->destroy }) ), 0,0,0) unless $o_no_button; gtkset_modal($dialog, 1); @@ -1413,9 +1413,9 @@ sub new_dialog { sub more_themes() { my $window_about = new_dialog(N("More themes")); gtkpack_($window_about->vbox, - 0, Gtk2::Label->new(N("Getting new themes")), - 0, gtkadd(gtkset_shadow_type(gtkset_border_width(Gtk2::Frame->new(N("Additional themes")), 10), 'etched_out'), - gtkpack(Gtk2::HBox->new(0, 5), + 0, Gtk3::Label->new(N("Getting new themes")), + 0, gtkadd(gtkset_shadow_type(gtkset_border_width(Gtk3::Frame->new(N("Additional themes")), 10), 'etched_out'), + gtkpack(Gtk3::HBox->new(0, 5), N("Get additional themes on www.damz.net"), ) ) @@ -1425,11 +1425,11 @@ sub more_themes() { sub about_mga_cc() { my $window_about = new_dialog(N("About - %s Control Center", $branding)); - my $tree_model = Gtk2::TreeStore->new("Glib::String", "Glib::String", "Glib::String"); - my $credits = Gtk2::TextView->new; - my $list = Gtk2::TreeView->new_with_model($tree_model); + my $tree_model = Gtk3::TreeStore->new("Glib::String", "Glib::String", "Glib::String"); + my $credits = Gtk3::TextView->new; + my $list = Gtk3::TreeView->new_with_model($tree_model); $list->can_focus(0); - each_index { $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => $::i)) } 0..1; + each_index { $list->append_column(Gtk3::TreeViewColumn->new_with_attributes(undef, Gtk3::CellRendererText->new, 'text' => $::i)) } 0..1; $list->set_headers_visible(0); foreach my $row ([ N("Authors: "), '' ], @@ -1460,7 +1460,7 @@ sub about_mga_cc() { chomp($contributor); if ($previous_type ne $type) { gtktext_append($credits, [ [ join('', if_($not_first_title, "\n"), translate(common::to_utf8($type)), "\n"), - { 'weight' => Pango->PANGO_WEIGHT_BOLD, scale => Gtk2::Pango->scale_large } ] ]); + { 'weight' => Pango->PANGO_WEIGHT_BOLD, scale => Gtk3::Pango->scale_large } ] ]); $previous_type = $type; $not_first_title = 1; } @@ -1492,18 +1492,18 @@ sub about_mga_cc() { $list->get_selection->set_mode('none'); gtkpack_($window_about->vbox, - (0, Gtk2::Banner->new('/usr/share/icons/large/drakconf.png', + (0, Gtk3::Banner->new('/usr/share/icons/large/drakconf.png', #-PO: Here, first %s will be replaced by 'Mageia' #-PO: second %s will be replaced by the version (eg: "Mageia 1 (Free) Control Center") N("%s %s (%s) Control Center", $branding, @$release{qw(version product)}))), - 0, Gtk2::Label->new(""), - 0, Gtk2::Label->new( + 0, Gtk3::Label->new(""), + 0, Gtk3::Label->new( #-PO: here %s is eg: "1999-2008" N("Copyright (C) %s Mandriva SA", '1999-2008') . "\n" . N("Copyright (C) %s Mageia", '2011-2015') . "\n"), - 0, Gtk2::HSeparator->new, - 0, Gtk2::Label->new(""), - 1, my $n = Gtk2::Notebook->new, + 0, Gtk3::HSeparator->new, + 0, Gtk3::Label->new(""), + 1, my $n = Gtk3::Notebook->new, ); add2notebook($n, N("Authors"), $list); @@ -1533,7 +1533,7 @@ sub hide_buttons() { sub create_packtable2 { my ($options, @l) = @_; - my $w = Gtk2::Table->new(0, 0, 1); + my $w = Gtk3::Table->new(0, 0, 1); add2hash_($options, { xpadding => 5, ypadding => 0 }); each_index { my ($i, $l) = ($::i, $_); diff --git a/drakconsole b/drakconsole index 49e004cb..cb258667 100755 --- a/drakconsole +++ b/drakconsole @@ -26,9 +26,9 @@ use Gnome2::Vte; my $w = ugtk3->new(N("DrakConsole")); -$w->{rwindow}->add(gtkpack_(Gtk2::VBox->new(0, 0), +$w->{rwindow}->add(gtkpack_(Gtk3::VBox->new(0, 0), 1, my $vte = gtksignal_connect(Gnome2::Vte::Terminal->new, 'child-exited' => sub { ugtk3->exit }), - 0, gtkpack__(create_hbox('end'), gtksignal_connect(Gtk2::Button->new(N("Close")), + 0, gtkpack__(create_hbox('end'), gtksignal_connect(Gtk3::Button->new(N("Close")), clicked => sub { ugtk3->exit }) ) ), diff --git a/mdkwebadmin.pl b/mdkwebadmin.pl index 85959189..60de0c06 100755 --- a/mdkwebadmin.pl +++ b/mdkwebadmin.pl @@ -39,16 +39,16 @@ unless ($::isEmbedded) { } gtkadd($w->{window}, - gtkpack_(Gtk2::VBox->new(0,5), - 1, Gtk2::Label->new(N("Enter the webmin address server below \n")), - 1, $ent = Gtk2::Entry->new(), - 0, Gtk2::HSeparator->new, + gtkpack_(Gtk3::VBox->new(0,5), + 1, Gtk3::Label->new(N("Enter the webmin address server below \n")), + 1, $ent = Gtk3::Entry->new(), + 0, Gtk3::HSeparator->new, 0, gtkpack(create_hbox(), - gtksignal_connect(Gtk2::Button->new(N("Connect")), clicked => sub { + gtksignal_connect(Gtk3::Button->new(N("Connect")), clicked => sub { $link = 'https://' . $ent->get_text() . ':10000/'; exec "$execbin $link"; }), - gtksignal_connect(Gtk2::Button->new(N("Abort")), clicked => \&quit)))); + gtksignal_connect(Gtk3::Button->new(N("Abort")), clicked => \&quit)))); $w->{window}->show_all; $w->main; diff --git a/menus_launcher.pl b/menus_launcher.pl index 3d0bf852..4aa82f92 100755 --- a/menus_launcher.pl +++ b/menus_launcher.pl @@ -20,29 +20,29 @@ $my_win->{rwindow}->set_title(N("Menu Configuration Center")) unless $::isEmbedd $my_win->{window}->signal_connect(delete_event => sub { ugtk3->exit(0); }); -my $table = Gtk2::Table->new(3, 2, 0); +my $table = Gtk3::Table->new(3, 2, 0); $table->set_border_width(5); $table->set_row_spacings(5); $table->set_col_spacings(5); -$table->attach(Gtk2::Label->new(N("System menu")), 0, 1, 0, 1, 'fill', 'fill', 0, 0); -my $b1 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), clicked => sub { system("$bindir/menudrake --systemmenu &") }); +$table->attach(Gtk3::Label->new(N("System menu")), 0, 1, 0, 1, 'fill', 'fill', 0, 0); +my $b1 = gtksignal_connect(Gtk3::Button->new(N("Configure...")), clicked => sub { system("$bindir/menudrake --systemmenu &") }); $table->attach($b1, 1, 2, 0, 1, 'fill', 'fill', 0, 0); -$table->attach(Gtk2::Label->new(N("User menu")), 0, 1, 1, 2, 'fill', 'fill', 0, 0); +$table->attach(Gtk3::Label->new(N("User menu")), 0, 1, 1, 2, 'fill', 'fill', 0, 0); -my $combo = Gtk2::OptionMenu->new; +my $combo = Gtk3::OptionMenu->new; $combo->set_popdown_strings("root", sort(list_users())); $table->attach($combo, 2, 3, 1, 2, 'fill', 'fill', 0, 0); -my $b2 = gtksignal_connect(Gtk2::Button->new(N("Configure...")), +my $b2 = gtksignal_connect(Gtk3::Button->new(N("Configure...")), clicked => sub { my $a = $combo->entry->get_text(); system($a eq "root" ? "$bindir/menudrake --usermenu &" : " su $a -c \"$bindir/menudrake\" &") }); $table->attach($b2, 1, 2, 1, 2, 'fill', 'fill', 0, 0); -$my_win->{window}->add(gtkpack(Gtk2::VBox->new(0, 0), - Gtk2::Label->new(N("Menu Configuration Center") . N("\n\nChoose which menu you want to configure")), - Gtk2::HSeparator->new, +$my_win->{window}->add(gtkpack(Gtk3::VBox->new(0, 0), + Gtk3::Label->new(N("Menu Configuration Center") . N("\n\nChoose which menu you want to configure")), + Gtk3::HSeparator->new, $table, - Gtk2::HSeparator->new, - gtkpack(gtkset_layout(Gtk2::HButtonBox->new, 'end'), - gtkcan_default(gtksignal_connect(Gtk2::Button->new_from_stock('gtk-close'), clicked => sub { ugtk3->exit(0) }), 1) + Gtk3::HSeparator->new, + gtkpack(gtkset_layout(Gtk3::HButtonBox->new, 'end'), + gtkcan_default(gtksignal_connect(Gtk3::Button->new_from_stock('gtk-close'), clicked => sub { ugtk3->exit(0) }), 1) ), ), ); -- cgit v1.2.1