diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-07-09 16:01:00 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-07-09 16:01:00 +0000 |
commit | bdd3c581cde1d9fed4cf5c42062a83cec3fbb1ce (patch) | |
tree | 508433b3a3d1eea11fa8b96623b7cdde3616a01e /perl-install | |
parent | 2403c1c4d98749fbef5740c7dcaccc017da890a9 (diff) | |
download | drakx-backup-do-not-use-bdd3c581cde1d9fed4cf5c42062a83cec3fbb1ce.tar drakx-backup-do-not-use-bdd3c581cde1d9fed4cf5c42062a83cec3fbb1ce.tar.gz drakx-backup-do-not-use-bdd3c581cde1d9fed4cf5c42062a83cec3fbb1ce.tar.bz2 drakx-backup-do-not-use-bdd3c581cde1d9fed4cf5c42062a83cec3fbb1ce.tar.xz drakx-backup-do-not-use-bdd3c581cde1d9fed4cf5c42062a83cec3fbb1ce.zip |
switch from gtk2-perl to gtk2-perl-xs
Diffstat (limited to 'perl-install')
24 files changed, 285 insertions, 267 deletions
diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm index 5d448572a..cba2291e5 100644 --- a/perl-install/Xconfig/resolution_and_depth.pm +++ b/perl-install/Xconfig/resolution_and_depth.pm @@ -269,7 +269,7 @@ sub choose_gtk { ), ), ), - 0, gtkadd($W->create_okcancel(N("Ok"), N("Cancel"), '', if_($help_sub, [ N("Help"), $help_sub, 1 ]))), + 0, gtkadd($W->create_okcancel('gtk-ok', 'gtk-cancel', '', if_($help_sub, [ 'gtk-help', $help_sub, 1 ]))), )); $depth_combo->disable_activate; $depth_combo->set_use_arrows_always(1); diff --git a/perl-install/Xconfig/test.pm b/perl-install/Xconfig/test.pm index abcce4008..d14cca755 100644 --- a/perl-install/Xconfig/test.pm +++ b/perl-install/Xconfig/test.pm @@ -128,7 +128,7 @@ sub test { $ugtk2::force_focus = 1; my $text = Gtk2::Label->new; my $time = 12; - Gtk2->timeout_add(1000, sub { + Glib::Timeout->add(1000, sub { $text->set(sprintf(translate("%s"), $time)); $time-- or Gtk2->main_quit; 1; @@ -143,7 +143,6 @@ sub test { $pixbuf->render_to_drawable($pixmap, $gc, 0, 0, 0, 0, $w, $h, 'none', 0, 0); $root->set_back_pixmap($pixmap, 0); $root->clear; - $gc->unref; }; my $in = interactive::gtk->new; diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index f7575b7c6..7d674e263 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -150,7 +150,7 @@ sub add_kind2notebook { sub general_action_box { my ($box, $nowizard, $interactive_help) = @_; - $_->widget->destroy foreach $box->children; + $_->destroy foreach $box->get_children; gtkadd($box, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => $interactive_help)) if $interactive_help; @@ -165,7 +165,7 @@ sub general_action_box { } sub per_kind_action_box { my ($box, $kind) = @_; - $_->widget->destroy foreach $box->children; + $_->destroy foreach $box->get_children; $kind->{type} =~ /hd|lvm/ or return; @@ -177,7 +177,7 @@ sub per_kind_action_box { } sub per_entry_action_box { my ($box, $kind, $entry) = @_; - $_->widget->destroy foreach $box->children; + $_->destroy foreach $box->get_children; if ($entry) { my @buttons = map { @@ -200,7 +200,7 @@ I suggest you first resize that partition sub per_entry_info_box { my ($box, $kind, $entry) = @_; - $_->widget->destroy foreach $box->children; + $_->destroy foreach $box->get_children; my $info; if ($entry) { $info = diskdrake::interactive::format_part_info(kind2hd($kind), $entry); @@ -213,7 +213,7 @@ sub per_entry_info_box { sub current_kind_changed { my ($_in, $kind) = @_; - $_->widget->destroy foreach $kind->{display_box}->children; + $_->destroy foreach $kind->{display_box}->get_children; my $v = $kind->{val}; my @parts = diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm index 8197d9ed1..ff2ffee12 100644 --- a/perl-install/diskdrake/smbnfs_gtk.pm +++ b/perl-install/diskdrake/smbnfs_gtk.pm @@ -68,7 +68,7 @@ sub per_entry_info_box { sub per_entry_action_box { my ($box, $kind, $entry) = @_; - $_->widget->destroy foreach $box->children; + $_->destroy foreach $box->get_children; my @buttons; @@ -107,7 +107,7 @@ sub update { my ($kind) = @_; per_entry_action_box($kind->{action_box}, $kind, $current_entry); per_entry_info_box($kind->{info_box}, $kind, $current_entry); - $tree_model->set($current_leaf, [ 0 => export_icon($current_entry) ]) if $current_entry; + $tree_model->set($current_leaf, 0 => export_icon($current_entry)) if $current_entry; } sub find_fstab_entry { @@ -129,7 +129,7 @@ sub import_tree { my ($kind, $info_box) = @_; my (%servers_displayed, %wservers, %wexports); - $tree_model = Gtk2::TreeStore->new(Gtk2::GType->OBJECT, Gtk2::GType->STRING); + $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", "Glib::String"); my $tree = Gtk2::TreeView->new_with_model($tree_model); $tree->get_selection->set_mode('browse'); @@ -194,7 +194,6 @@ sub import_tree { my $path = $tree_model->get_path($node); $tree->expand_row($path, 0); - $path->free; foreach ($find_exports->($wservers{$tree_model->get_path_str($node)} || return)) { #- can't die here since insert_node provoque a tree_select_row before the %wservers is filled my $s = $kind->to_string($_); diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec index 3404fd417..55656e33a 100644 --- a/perl-install/drakxtools.spec +++ b/perl-install/drakxtools.spec @@ -1,14 +1,14 @@ Summary: The drakxtools (XFdrake, diskdrake, keyboarddrake, mousedrake...) Name: drakxtools Version: 9.2 -Release: 0.9mdk +Release: 0.10mdk Url: http://www.mandrakelinux.com/en/drakx.php2 Source0: %name-%version.tar.bz2 License: GPL Group: System/Configuration/Other # Temporary requires for tools that still use gtk+1 (that is net_monitor; drakcronat is being ported) Requires: perl-GTK >= 0.7008-29mdk, perl-GTK-GdkImlib, perl-GTK-GdkPixbuf -Requires: %{name}-newt = %version-%release, perl-GTK2 >= 0.0.cvs.2003.04.04.1, /usr/X11R6/bin/xtest, font-tools, usermode >= 1.63-5mdk, perl-MDK-Common >= 1.1.2-2mdk +Requires: %{name}-newt = %version-%release, perl-Gtk2 >= 0.26.cvs.2003.07.09.1-2mdk, /usr/X11R6/bin/xtest, font-tools, usermode >= 1.63-5mdk, perl-MDK-Common >= 1.1.2-2mdk Conflicts: drakconf < 9.1-14mdk BuildRequires: gettext, libgtk+-x11-2.0-devel, ldetect-devel >= 0.4.9, ncurses-devel, newt-devel, perl-devel >= 1:5.8.0-20mdk, libext2fs-devel, perl-MDK-Common-devel >= 1.1.3-1mdk BuildRoot: %_tmppath/%name-buildroot @@ -312,6 +312,10 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_datadir/harddrak %config(noreplace) %_sysconfdir/logrotate.d/drakxtools-http %changelog +* Wed Jul 9 2003 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.2-0.10mdk +- switch from gtk2-perl to gtk2-perl-xs +- a few more stock items + * Sun Jul 6 2003 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.2-0.9mdk - increase gui coherency of drakxtools vs other gtk+ apps: use stock icons - drakbackup: (stew) diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm index df0117638..3dad741fb 100644 --- a/perl-install/install_gtk.pm +++ b/perl-install/install_gtk.pm @@ -185,7 +185,7 @@ sub create_logo_window { my $w = bless {}, 'ugtk2'; $w->{rwindow} = $w->{window} = Gtk2::Window->new('toplevel'); - $w->{rwindow}->set_uposition(0, 0); +# $w->{rwindow}->set_position(0, 0); $w->{rwindow}->set_size_request($::logowidth, $::logoheight); $w->{rwindow}->set_name("logo"); $w->{rwindow}->set_title('skip'); @@ -199,7 +199,7 @@ sub create_logo_window { #------------------------------------------------------------------------------ sub init_gtk() { symlink("/tmp/stage2/etc/$_", "/etc/$_") foreach qw(gtk-2.0 pango fonts); - Gtk2->init(\@ARGV); + Gtk2::init(@ARGV); Gtk2->set_locale; } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 50da02ccd..9326f4906 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -518,7 +518,6 @@ sub installPackages { }; $draw_lay->($darea->style->black_gc, 0); $i == 0 and $draw_lay->($darea->style->black_gc, 1); - $layout->unref; $i++; } } diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index b636cc0c2..67f5ca7bf 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -67,7 +67,7 @@ sub create_treeview_list { my ($e, $may_go_to_next, $changed, $double_click) = @_; my $curr; - my $list = Gtk2::ListStore->new(Gtk2::GType->STRING); + my $list = Gtk2::ListStore->new("Glib::String"); my $list_tv = Gtk2::TreeView->new_with_model($list); $list_tv->set_headers_visible(0); $list_tv->get_selection->set_mode('browse'); @@ -85,7 +85,7 @@ sub create_treeview_list { my ($_w, $event) = @_; my $c = chr($event->keyval & 0xff); - Gtk2->timeout_remove($timeout) if $timeout; $timeout = ''; + Glib::Source->remove($timeout) if $timeout; $timeout = ''; if ($event->keyval >= 0x100) { &$may_go_to_next if member($event->keyval, (Gtk2::Gdk::Event::Key->Sym_Return, Gtk2::Gdk::Event::Key->Sym_KP_Enter)); @@ -109,24 +109,21 @@ sub create_treeview_list { if ($j == @l) { $starting_word = ''; } else { - my $path = Gtk2::TreePath->new_from_string(($j + $curr) % @l); - $select->($path); - $path->free; + $select->(Gtk2::TreePath->new_from_string(($j + $curr) % @l)); } - $timeout = Gtk2->timeout_add($forgetTime, sub { $timeout = $starting_word = ''; 0 }); + $timeout = Glib::Timeout->add($forgetTime, sub { $timeout = $starting_word = ''; 0 }); } 0; }); $list_tv->show; - $list->append_set([ 0 => $_ ])->free foreach @{$e->{formatted_list}}; + $list->append_set([ 0 => $_ ]) foreach @{$e->{formatted_list}}; $list_tv->get_selection->signal_connect(changed => sub { my ($model, $iter) = $_[0]->get_selected; $model && $iter or return; my $row = $model->get_path_str($iter); - $iter->free; ${$e->{val}} = $e->{list}[$curr = $row]; &$changed; }); @@ -139,9 +136,8 @@ sub create_treeview_list { my ($old_path) = $list_tv->get_cursor; if (!$old_path || $nb != $old_path->to_string) { $select->(my $path = Gtk2::TreePath->new_from_string($nb)); - $path->free; } - $old_path->free if $old_path; + undef $old_path if $old_path; }; }; } @@ -152,7 +148,7 @@ sub create_treeview_tree { $tree_expanded = to_bool($tree_expanded); #- to reduce "Use of uninitialized value", especially when debugging my $sep = quotemeta $e->{separator}; - my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->STRING, Gtk2::GType->OBJECT, Gtk2::GType->STRING); + my $tree_model = Gtk2::TreeStore->new("Glib::String", "Gtk2::Gdk::Pixbuf", "Glib::String"); my $tree = Gtk2::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)); @@ -168,7 +164,7 @@ sub create_treeview_tree { [ $text ? (0 => $text) : @{[]}, $image ? (1 => $to_unref = gtkcreate_pixbuf($image)) : @{[]} ]; }; - $clean_image = sub { $to_unref and $to_unref->unref }; + $clean_image = sub { undef $to_unref }; } else { $build_value = sub { [ 0 => $_[0] ] }; $clean_image = sub {}; @@ -195,23 +191,20 @@ sub create_treeview_tree { my $iter = $tree_model->append_set($parent->($root), $build_value->($leaf)); $clean_image->(); my $pathstr = $tree_model->get_path_str($iter); - $iter->free; $precomp{$pathstr} = { value => $leaf, fullvalue => $_[0], listvalue => $_[1] }; push @ordered_keys, $pathstr; $wleaves{$_[0]} = $pathstr; } $e->{formatted_list}, $e->{list}; - $_->free foreach values %wtree; + undef $_ foreach values %wtree; undef %wtree; my $select = sub { my ($path_str) = @_; + $tree->expand_to_path(Gtk2::TreePath->new_from_string($path_str)); my $path = Gtk2::TreePath->new_from_string($path_str); - $tree->expand_to_path($path); - $path->free; - $path = Gtk2::TreePath->new_from_string($path_str); $tree->set_cursor($path, undef, 0); $tree->scroll_to_cell($path, undef, 1, 0.5, 0); - $path->free; + }; my $curr = $tree_model->get_iter_first; #- default value @@ -220,7 +213,7 @@ sub create_treeview_tree { $tree->get_selection->signal_connect(changed => sub { my ($model, $iter) = $_[0]->get_selected; $model && $iter or return; - $curr->free if ref $curr; + undef $curr if ref $curr; my $path = $tree_model->get_path($curr = $iter); if (!$tree_model->iter_has_child($iter)) { ${$e->{val}} = $precomp{$path->to_string}{listvalue}; @@ -228,16 +221,14 @@ sub create_treeview_tree { } else { $tree->expand_row($path, 0) if $selected_via_click; } - $path->free; }); my ($starting_word, $start_reg) = ('', "^"); my $timeout; my $toggle = sub { if ($tree_model->iter_has_child($curr)) { - my $path = $tree_model->get_path($curr); - $tree->toggle_expansion($path, 0); - $path->free; + $tree->toggle_expansion($tree_model->get_path($curr), 0); + } else { &$may_go_to_next; } @@ -248,11 +239,11 @@ sub create_treeview_tree { $selected_via_click = 0; my $c = chr($event->keyval & 0xff); $curr or return; - Gtk2->timeout_remove($timeout) if $timeout; $timeout = ''; + Glib::Source->remove($timeout) if $timeout; $timeout = ''; if ($event->keyval >= 0x100) { - &$toggle if member($event->keyval, (Gtk2::Gdk::Event::Key->Sym_Return, Gtk2::Gdk::Event::Key->Sym_KP_Enter)); - $starting_word = '' if !member($event->keyval, (Gtk2::Gdk::Event::Key->Sym_Control_L, Gtk2::Gdk::Event::Key->Sym_Control_R)); + &$toggle if member($event->keyval, (0xFF0D, 0xFF8D)); # from gdk/gdkkeysyms.h + $starting_word = '' if !member($event->keyval, (0xFFE3, 0xFFE4)); # from gdk/gdkkeysyms.h } else { my $next; if (member('control-mask', @{$event->state})) { @@ -286,7 +277,7 @@ sub create_treeview_tree { $starting_word = ''; } - $timeout = Gtk2->timeout_add($forgetTime, sub { $timeout = $starting_word = ''; 0 }); + $timeout = Glib::Timeout->add($forgetTime, sub { $timeout = $starting_word = ''; 0 }); } 0; }); @@ -299,7 +290,7 @@ sub create_treeview_tree { my $v = may_apply($e->{format}, $_[0]); my ($model, $iter) = $tree->get_selection->get_selected; $select->($wleaves{$v} || return) if !$model || $wleaves{$v} ne $model->get_path_str($iter); - $iter->free if ref $iter; + undef $iter if ref $iter; }, $size; } @@ -441,7 +432,7 @@ sub ask_fromW { $mainw->{rwindow}->show; $set_all->(); }); - $set = sub { $w->child->set(may_apply($e->{format}, $_[0])) }; + $set = sub { $w->child->set_label(may_apply($e->{format}, $_[0])) }; $width = length may_apply($e->{format}, ${$e->{val}}); } elsif ($e->{type} eq 'range') { my $want_scale = !$::expert; @@ -474,7 +465,7 @@ sub ask_fromW { $e->{formatted_list} = [ map { may_apply($e->{format}, $_) } @{$e->{list}} ]; my $list = $w->get_model; $list->clear; - $list->append_set([ 0 => $_ ])->free foreach @{$e->{formatted_list}}; + $list->append_set([ 0 => $_ ]) foreach @{$e->{formatted_list}}; $changed->(); $buttons{$_}->set_sensitive(@{$e->{list}} != ()) foreach 'Modify', 'Remove'; }; @@ -543,7 +534,7 @@ sub ask_fromW { #- FIXME workaround gtk suckiness (set_text generates two 'change' signals, one when removing the whole, one for inserting the replacement..) my $idle; $w->signal_connect(changed => sub { - $idle ||= Gtk2->idle_add(sub { undef $idle; $changed->(); 0 }); + $idle ||= Glib::Idle->add(sub { undef $idle; $changed->(); 0 }); }); $set = sub { @@ -610,7 +601,7 @@ sub ask_fromW { sub { my ($w) = @_; $set_advanced->(!$advanced); - $w->child->set($advanced ? $common->{advanced_label_close} : $common->{advanced_label}); + $w->child->set_label($advanced ? $common->{advanced_label_close} : $common->{advanced_label}); } ]; my $create_widgets = sub { diff --git a/perl-install/interactive/newt.pm b/perl-install/interactive/newt.pm index 52ba9ce57..86c6ea4b2 100644 --- a/perl-install/interactive/newt.pm +++ b/perl-install/interactive/newt.pm @@ -296,8 +296,8 @@ sub ask_fromW_real { }; my ($ok, $cancel) = ($common->{ok}, $common->{cancel}); - $cancel = $::isWizard ? N("<- Previous") : N("Cancel") if !defined $cancel && !defined $ok; - $ok ||= $::isWizard ? ($::Wizard_finished ? N("Finish") : N("Next ->")) : N("Ok"); + $cancel = $::isWizard ? 'gtk-go-back"' : 'gtk-cancel' if !defined $cancel && !defined $ok; + $ok ||= $::isWizard ? ($::Wizard_finished ? N("Finish") : '"gtk-go-forward') : 'gtk-ok'; my @okcancel = grep { $_ } $ok, $cancel; @okcancel = reverse(@okcancel) if $::isWizard; diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index 63787d556..0a0a0503c 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -456,7 +456,6 @@ sub test_mouse { ($darea->allocation->width-$w)/2, ($darea->allocation->height-$height)/2 + $y, $layout); - $layout->unref; }; my $draw_pixbuf = sub { my ($p, $x, $y, $w, $h) = @_; @@ -501,8 +500,8 @@ sub test_mouse { $draw_pixbuf->($xpms{ad}, 102, 131, 6, 8); } $draw_pixbuf->($xpms{middle}, 98, 67, 13, 62); - $timeout and Gtk2->timeout_remove($timeout); - $timeout = Gtk2->timeout_add(100, sub { $drawarea->(); $timeout = 0; 0 }); + $timeout and Glib::Source->remove($timeout); + $timeout = Glib::Timeout->add(100, sub { $drawarea->(); $timeout = 0; 0 }); } }; diff --git a/perl-install/services.pm b/perl-install/services.pm index 166259b7c..aa55029a7 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -219,7 +219,7 @@ sub ask_standalone_gtk { gtkpack__(Gtk2::HBox->new(0,0), gtksignal_connect(Gtk2::Button->new_from_stock('gtk-dialog-info'), clicked => sub { $display->($infos) })), gtkpack__(Gtk2::HBox->new(0,0), gtkset_active(gtksignal_connect( Gtk2::CheckButton->new(N("On boot")), - clicked => sub { if ($_[0]->active) { + clicked => sub { if ($_[0]->get_active) { push @$on_services, $service if !member($service, @$on_services); } else { @$on_services = grep { $_ ne $service } @$on_services; diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ index 25af2a1cf..751c7bf58 100755 --- a/perl-install/standalone/drakTermServ +++ b/perl-install/standalone/drakTermServ @@ -531,7 +531,7 @@ sub make_nbi() { "via-rhine", "winbond-840", "xircom_cb", "xircom_tulip_cb", "yellowfin"); #- kernel/module info in tree view - my $model = Gtk2::TreeStore->new(Gtk2::GType->STRING); + my $model = Gtk2::TreeStore->new("Glib::String"); my $tree_kernels = Gtk2::TreeView->new_with_model($model); $tree_kernels->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $tree_kernels->set_headers_visible(0); @@ -546,7 +546,6 @@ sub make_nbi() { $model->append($k_detail, $t_kernel); $model->set($k_detail, [ 0 => $_ ]); } - $k_detail->free; } $tree_kernels->get_selection->signal_connect(changed => sub { @@ -566,7 +565,7 @@ sub make_nbi() { }); # existing nbi images in list - my $list_model = Gtk2::ListStore->new(Gtk2::GType->STRING); + my $list_model = Gtk2::ListStore->new("Glib::String"); my $list_nbis = Gtk2::TreeView->new_with_model($list_model); $list_nbis->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $list_nbis->set_headers_visible(0); @@ -671,7 +670,7 @@ sub maintain_users() { #- use /homes to filter system daemons my @homes = all("/home"); - my $list_model = Gtk2::ListStore->new(Gtk2::GType->STRING); + my $list_model = Gtk2::ListStore->new("Glib::String"); my $list_sys_users = Gtk2::TreeView->new_with_model($list_model); $list_sys_users->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $list_sys_users->set_headers_visible(0); @@ -686,7 +685,6 @@ sub maintain_users() { $list_model->set($iter, [ 0 => $s_label ]); } } - $iter->free; $list_sys_users->get_selection->signal_connect(changed => sub { my ($model, $iter) = $_[0]->get_selected; @@ -694,7 +692,7 @@ sub maintain_users() { $sys_user = $model->get($iter, 0); }); - $list_model = Gtk2::ListStore->new(Gtk2::GType->STRING); + $list_model = Gtk2::ListStore->new("Glib::String"); my $list_ts_users = Gtk2::TreeView->new_with_model($list_model); $list_ts_users->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $list_ts_users->set_headers_visible(0); @@ -757,7 +755,7 @@ sub maintain_clients() { my $button_delete; #- client info in tree view - my $model = Gtk2::TreeStore->new(Gtk2::GType->STRING); + my $model = Gtk2::TreeStore->new("Glib::String"); my $tree_clients = Gtk2::TreeView->new_with_model($model); $tree_clients->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $tree_clients->set_headers_visible(0); diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst index b46f89d3f..f181d1e97 100755 --- a/perl-install/standalone/drakautoinst +++ b/perl-install/standalone/drakautoinst @@ -317,7 +317,7 @@ sub create_entry_element { } else { $e = new Gtk2::Entry; $e->{value} = $value; - my $tag = Gtk2->timeout_add(1000, sub { $e->set_text($text); 0 }); + my $tag = Glib::Timeout->add(1000, sub { $e->set_text($text); 0 }); gtksignal_connect($e, changed => sub { my $exe = $e->{value} . "='" . $e->get_text . "'"; print "EXEC : $exe\n "; diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup index e0b1b01dd..8242a1c72 100755 --- a/perl-install/standalone/drakbackup +++ b/perl-install/standalone/drakbackup @@ -1036,7 +1036,7 @@ sub spawn_progress { $interactive and progress($pbar3, $plabel3, 0, translate($descr)); $interactive and $pbar3->set_fraction(0); - $interactive and $timer = Gtk2->timeout_add(2, \&progress_timeout); + $interactive and $timer = Glib::Timeout->add(2, \&progress_timeout); $log_buff .= "\n" . $descr . ":\n"; $log_buff .= $command . "\n\n"; @@ -1051,7 +1051,7 @@ sub spawn_progress { } } close TMP; - $interactive and Gtk2->timeout_remove($timer); + $interactive and Glib::Source->remove($timer); } sub progress_timeout() { @@ -1772,7 +1772,7 @@ sub advanced_what_other() { $iter = Gtk2::TreeIter->new; my $other_file; - $list_model = Gtk2::ListStore->new(Gtk2::GType->STRING); + $list_model = Gtk2::ListStore->new("Glib::String"); my $list_others = Gtk2::TreeView->new_with_model($list_model); $list_others->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $list_others->set_headers_visible(0); @@ -1795,8 +1795,8 @@ sub advanced_what_other() { 1, create_scrolled_window($list_others), ), 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'spread'), - gtksignal_connect(new Gtk2::Button(N("Add")), clicked => sub { filedialog() }), - gtksignal_connect(new Gtk2::Button(N("Remove Selected")), clicked => sub { + gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub { filedialog() }), + gtksignal_connect(Gtk2::Button->new(N("Remove Selected")), clicked => sub { $list_model->remove($file_iter); my $iindex = 0; foreach (@list_other) { @@ -1837,9 +1837,9 @@ sub advanced_what_entire_sys() { 1, new Gtk2::VBox(0, 5), 1, gtkpack_(new Gtk2::VBox(0, 15), 1, new Gtk2::VBox(0, 5), - 1, gtksignal_connect(my $button_what_other = new Gtk2::Button(), + 1, gtksignal_connect(my $button_what_other = Gtk2::Button->new, clicked => sub { destroy_widget(); message_underdevel() }), - 1, gtksignal_connect(my $button_what_all = new Gtk2::Button(), + 1, gtksignal_connect(my $button_what_all = Gtk2::Button->new, clicked => sub { destroy_widget(); message_underdevel() }), 1, new Gtk2::VBox(0, 5), ), @@ -1868,13 +1868,13 @@ sub advanced_what() { 1, new Gtk2::VBox(0, 5), 1, gtkpack_(new Gtk2::VBox(0, 15), 1, new Gtk2::VBox(0, 5), - 1, gtksignal_connect(my $button_what_sys = new Gtk2::Button(), + 1, gtksignal_connect(my $button_what_sys = Gtk2::Button->new, clicked => sub { $box_what->destroy; advanced_what_sys() }), - 1, gtksignal_connect(my $button_what_user = new Gtk2::Button(), + 1, gtksignal_connect(my $button_what_user = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_what_user() }), - 1, gtksignal_connect(my $button_what_other = new Gtk2::Button(), + 1, gtksignal_connect(my $button_what_other = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_what_other() }), -# 1, gtksignal_connect(my $button_what_all = new Gtk2::Button(), +# 1, gtksignal_connect(my $button_what_all = Gtk2::Button->new, # clicked => sub { destroy_widget(); advanced_what_entire_sys(); }), 1, new Gtk2::VBox(0, 5), ), @@ -1922,7 +1922,7 @@ sub advanced_where_net_types { 0, gtkpack_(new Gtk2::HBox(0,5), 0, gtkset_sensitive(my $check_use_expect = new Gtk2::CheckButton(N("Use Expect for SSH")), ($where_net && $net_proto eq 'ssh')), 0, gtkset_sensitive(my $check_xfer_keys = new Gtk2::CheckButton(N("Create/Transfer\nbackup keys for SSH")), ($where_net && $net_proto eq 'ssh')), - 0, gtkset_sensitive(my $button_xfer_keys = new Gtk2::Button(N(" Transfer \nNow")), $xfer_keys), + 0, gtkset_sensitive(my $button_xfer_keys = Gtk2::Button->new_from_stock(N(" Transfer \nNow")), $xfer_keys), 0, gtkset_sensitive(my $check_user_keys = new Gtk2::CheckButton(N("Other (not drakbackup)\nkeys in place already")), ($where_net && $net_proto eq 'ssh')), ), 0, new Gtk2::HSeparator, @@ -2076,7 +2076,7 @@ sub advanced_where_cd { 0, new Gtk2::VBox(0, 5), 0, gtkpack_(new Gtk2::HBox(0,10), 0, gtkset_sensitive(new Gtk2::Label(N("Please check if you want to erase your RW media (1st Session)")), $cdrw && $where_cd), - 0, gtkset_sensitive(my $button_erase_now = new Gtk2::Button(N(" Erase Now ")), $cdrw), + 0, gtkset_sensitive(my $button_erase_now = Gtk2::Button->new_from_stock(N(" Erase Now ")), $cdrw), 1, new Gtk2::VBox(0, 5), 0, gtkset_sensitive(my $check_cdrw_erase = new Gtk2::CheckButton(), $cdrw && $where_cd), ), @@ -2275,7 +2275,7 @@ sub advanced_where_hd { 0, gtkset_sensitive(new Gtk2::Label(N("Please enter the directory to save to:")), $where_hd), 1, new Gtk2::VBox(0, 6), 0, gtkset_size_request(gtkset_sensitive($save_path_entry = new Gtk2::Entry(), $where_hd), 152, 20), - 0, gtkset_sensitive($button = gtksignal_connect(new Gtk2::Button(), clicked => sub { + 0, gtkset_sensitive($button = gtksignal_connect(Gtk2::Button->new, clicked => sub { filedialog_where_hd() }), $where_hd), ), @@ -2327,11 +2327,11 @@ sub advanced_where() { 1, new Gtk2::VBox(0, 5), 1, gtkpack_(new Gtk2::VBox(0, 15), 1, new Gtk2::VBox(0, 5), - 1, gtksignal_connect(my $button_where_net = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_where_net = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_where_net_types(); }), - 1, gtksignal_connect(my $button_where_cd = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_where_cd = Gtk2::Button->new, clicked => sub { destroy_widget(); if (require_rpm("mkisofs", "cdrecord")) { advanced_where_cd(); @@ -2340,11 +2340,11 @@ sub advanced_where() { install_rpm(\&advanced_where); } }), - 1, gtksignal_connect(my $button_where_hd = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_where_hd = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_where_hd(); }), - 1, gtksignal_connect(my $button_where_tape = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_where_tape = Gtk2::Button->new, clicked => sub { destroy_widget(); # message_underdevel(); advanced_where_tape() }), @@ -2484,13 +2484,13 @@ sub advanced_box() { 1, new Gtk2::VBox(0, 5), 1, gtkpack_(new Gtk2::VBox(0, 15), 1, new Gtk2::VBox(0, 5), - 1, gtksignal_connect(my $button_what = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_what = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_what() }), - 1, gtksignal_connect(my $button_where = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_where = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_where() }), - 1, gtksignal_connect(my $button_when = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_when = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_when() }), - 1, gtksignal_connect(my $button_options = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_options = Gtk2::Button->new, clicked => sub { destroy_widget(); advanced_options() }), 1, new Gtk2::VBox(0, 5), ), @@ -2557,7 +2557,7 @@ sub wizard_step2() { 0, gtkpack_(new Gtk2::HBox(0, 15), 0, my $check_wizard_hd = new Gtk2::CheckButton(N("on Hard Drive")), 1, new Gtk2::VBox(0, 5), - 0, gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("Configure")), clicked => sub { + 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock(N("Configure")), clicked => sub { destroy_widget(); to_ok(); advanced_where_hd(\&wizard_step2); @@ -2567,7 +2567,7 @@ sub wizard_step2() { 0, gtkpack_(new Gtk2::HBox(0, 15), 0, my $check_wizard_net = new Gtk2::CheckButton(N("across Network")), 1, new Gtk2::VBox(0, 5), - 0, gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("Configure")), clicked => sub { + 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock(N("Configure")), clicked => sub { destroy_widget(); to_ok(); advanced_where_net_types(\&wizard_step2); @@ -2577,7 +2577,7 @@ sub wizard_step2() { 0, gtkpack_(new Gtk2::HBox(0, 15), 0, my $check_wizard_cd = new Gtk2::CheckButton(N("on CDROM")), 1, new Gtk2::VBox(0, 5), - 0, gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("Configure")), clicked => sub { + 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock(N("Configure")), clicked => sub { destroy_widget(); advanced_where_cd(\&wizard_step2); }), $where_cd), @@ -2585,7 +2585,7 @@ sub wizard_step2() { 0, gtkpack_(new Gtk2::HBox(0, 15), 0, my $check_wizard_tape = new Gtk2::CheckButton(N("on Tape Device")), 1, new Gtk2::VBox(0, 5), - 0, gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("Configure")), clicked => sub { + 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock(N("Configure")), clicked => sub { destroy_widget(); advanced_where_tape(\&wizard_step2); }), $where_tape), @@ -2631,7 +2631,7 @@ sub wizard() { 0, my $check_wizard_user = new Gtk2::CheckButton(N("Backup Users")), 0, gtkpack_(new Gtk2::HBox(0, 15), 1, new Gtk2::VBox(0, 5), - 0, gtksignal_connect(new Gtk2::Button(N("Select user manually")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock(N("Select user manually")), clicked => sub { destroy_widget(); advanced_what_user(\&wizard); }), @@ -2907,7 +2907,7 @@ sub show_backup_details { 0, new Gtk2::VScrollbar($text->vadj), ), 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'spread'), - gtksignal_connect(new Gtk2::Button(N("Done")), clicked => sub { + gtksignal_connect(Gtk2::Button->new_from_stock(N("Done")), clicked => sub { destroy_widget(); $function->() }), ), @@ -3132,7 +3132,7 @@ sub restore_step_user() { my @user_list_tmp; my $restore_row = new Gtk2::HBox(0,5); my $b = new Gtk2::CheckButton($name_complet); - my $details = new Gtk2::Button(" Details "); + my $details = Gtk2::Button->new_from_stock(" Details "); $restore_row->pack_start($b, 1, 1, 0); $restore_row->pack_end(new Gtk2::VBox(1,5), 0, 0, 0); @@ -3206,7 +3206,7 @@ sub restore_step_sys() { 0, gtkpack_(new Gtk2::HBox(0,10), 1, N("please choose the date to restore"), 0, $combo_restore_step_sys, - 0, my $details = new Gtk2::Button(" Details "), + 0, my $details = Gtk2::Button->new_from_stock(" Details "), 0, new Gtk2::HBox(0,10), ), 1, new Gtk2::VBox(0,10), @@ -3247,7 +3247,7 @@ sub restore_other_media_hd { 0, gtkset_sensitive(new Gtk2::Label(N("Please enter the directory to save:")), $where_hd), 1, new Gtk2::VBox(0, 6), 0, gtkset_size_request(gtkset_sensitive($save_path_entry = new Gtk2::Entry(), $where_hd), 152, 20), - 0, gtkset_sensitive($button = gtksignal_connect(new Gtk2::Button(), clicked => sub { + 0, gtkset_sensitive($button = gtksignal_connect(Gtk2::Button->new, clicked => sub { filedialog_where_hd() }), $where_hd), ), 0, new Gtk2::VBox(0, 6), @@ -3289,7 +3289,7 @@ sub restore_other_media() { 0, gtkset_sensitive(new Gtk2::Label(N("Please enter the directory where backups are stored")), $other_media_hd), 1, new Gtk2::VBox(0, 6), 0, gtkset_size_request(gtkset_sensitive($restore_find_path_entry = new Gtk2::Entry(), $other_media_hd), 152, 20), - 0, gtkset_sensitive($button = gtksignal_connect(new Gtk2::Button(), clicked => sub { + 0, gtkset_sensitive($button = gtksignal_connect(Gtk2::Button->new, clicked => sub { filedialog_restore_find_path(); }), $other_media_hd), ), @@ -3299,7 +3299,7 @@ sub restore_other_media() { # 0, new Gtk2::VBox(0, 6), # 1, gtkpack(new Gtk2::HBox(0,10), # new Gtk2::VBox(0, 6), -# gtkset_sensitive(gtksignal_connect(new Gtk2::Button("Network"), clicked => sub { +# gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock("Network"), clicked => sub { # destroy_widget(); # restore_find_net(\&restore_other_media);}), !$other_media_hd), # new Gtk2::VBox(0, 6), @@ -3357,7 +3357,7 @@ sub restore_step2() { 0, gtkpack_(new Gtk2::HBox(0,10), 0, my $check_restore_other_src = new Gtk2::CheckButton(N("Select another media to restore from")), 1, new Gtk2::HBox(0,10), - 0, gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("Other Media")), clicked => sub { + 0, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock(N("Other Media")), clicked => sub { destroy_widget(); restore_other_media(); }), $restore_other_src), @@ -3421,7 +3421,7 @@ sub catalog_restore() { my $restore_path_entry; #- catalog info in tree view - my $model = Gtk2::TreeStore->new(Gtk2::GType->STRING); + my $model = Gtk2::TreeStore->new("Glib::String"); my $tree_catalog = Gtk2::TreeView->new_with_model($model); $tree_catalog->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $tree_catalog->set_headers_visible(0); @@ -3478,7 +3478,6 @@ sub catalog_restore() { } $indexer++; } - $c_detail->free; } gtkpack($advanced_box, @@ -3490,7 +3489,7 @@ sub catalog_restore() { 1, create_scrolled_window($list_bu_files), ), 0, gtkpack_(new Gtk2::HBox(1, 10), - 1, gtksignal_connect(new Gtk2::Button(N("Restore Selected\nCatalog Entry")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Restore Selected\nCatalog Entry")), clicked => sub { if ($cat_entry) { my $media_check = restore_catalog_entry($cat_entry, ()); if ($media_check) { @@ -3500,7 +3499,7 @@ sub catalog_restore() { } } }), - 1, gtksignal_connect(new Gtk2::Button(N("Restore Selected\nFiles")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Restore Selected\nFiles")), clicked => sub { my $files = @restore_files; #- grab the array before the widget clears it my @passed_files = @restore_files; @@ -3517,7 +3516,7 @@ sub catalog_restore() { 0, new Gtk2::Label("Restore To Path"), 0, $restore_path_entry = new Gtk2::Entry(), ), - 1, gtksignal_connect(new Gtk2::Button(N("Change\nRestore Path")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Change\nRestore Path")), clicked => sub { filedialog_generic("Path To Restore To", \$restore_path_entry, \$restore_path); }), ), @@ -3903,7 +3902,7 @@ sub restore_box() { 1, gtkpack_(new Gtk2::VBox(0,10), 1, new Gtk2::VBox(0,10), 1, new Gtk2::VBox(0,10), - 1, gtksignal_connect(new Gtk2::Button(N("Restore all backups")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Restore all backups")), clicked => sub { $retore_box->destroy; button_box_restore(); @user_list_to_restore2 = sort @user_backuped; @@ -3912,7 +3911,7 @@ sub restore_box() { $restore_user = 1; restore_do() }), - 1, gtksignal_connect(new Gtk2::Button(N("Custom Restore")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Custom Restore")), clicked => sub { $retore_box->destroy; button_box_restore(); restore_step2(); @@ -3955,15 +3954,15 @@ sub restore_find_media_box() { 1, gtkpack(new Gtk2::HBox(0, 15), new Gtk2::VBox(0, 5), gtkpack(new Gtk2::VBox(0, 10), - gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("CD in place - continue.")), clicked => sub { + gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock(N("CD in place - continue.")), clicked => sub { $good_restore_path = 1; interactive_mode_box("restore"); }), $mount_media), $new_path_entry = gtkset_sensitive(new Gtk2::Entry(), $mount_media), - gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("Browse to new restore repository.")), clicked => sub { + gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock(N("Browse to new restore repository.")), clicked => sub { filedialog_generic("Directory To Restore From", \$new_path_entry, \$path_to_find_restore); }), $mount_media), - gtksignal_connect(new Gtk2::Button(N("Restore From Catalog")), clicked => sub { + gtksignal_connect(Gtk2::Button->new_from_stock(N("Restore From Catalog")), clicked => sub { $box2->destroy; catalog_restore(); }), @@ -4016,18 +4015,18 @@ sub button_box_adv() { $button_box_tmp->destroy; gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 0, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { interactive_mode_box(); }), - 0, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help); }), 1, new Gtk2::HBox(0, 1), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { destroy_widget(); $previous_widget->(); }), - 0, gtksignal_connect(new Gtk2::Button(N("Save")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-save'), clicked => sub { destroy_widget(); unless (check_pkg_needs()) { save_conf_file(); @@ -4043,19 +4042,19 @@ sub button_box_restore_main() { gtkpack($button_box, $button_box_tmp = gtkpack_(gtkpack_(new Gtk2::HButtonBox, - 0, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { destroy_widget(); interactive_mode_box(); }), - 0, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help); }), 1, new Gtk2::HBox(0, 1), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { destroy_widget(); interactive_mode_box() }), - 0, gtksignal_connect(new Gtk2::Button(N("Ok")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), clicked => sub { destroy_widget(); interactive_mode_box() }), ), @@ -4069,7 +4068,7 @@ sub button_box_log_main() { gtkpack($button_box, $button_box_tmp = gtkpack_(gtkpack_(new Gtk2::HButtonBox, 1, new Gtk2::HBox(0, 1), - 0, gtksignal_connect(new Gtk2::Button(N("Ok")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), clicked => sub { destroy_widget(); interactive_mode_box() }), ), @@ -4083,19 +4082,19 @@ sub button_box_backup_end() { gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 0, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { destroy_widget(); interactive_mode_box() }), - 0, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help) }), 1, new Gtk2::HBox(0, 1), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { destroy_widget(); $previous_widget->() }), - 0, gtksignal_connect(new Gtk2::Button(N("Build Backup")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock(N("Build Backup")), clicked => sub { destroy_widget(); build_backup_status(); build_backup_files(); @@ -4109,19 +4108,19 @@ sub button_box_wizard_end() { gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 0, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { destroy_widget(); interactive_mode_box(); }), - 0, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help); }), 1, new Gtk2::HBox(0, 1), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { destroy_widget(); $previous_widget->(); }), - 0, gtksignal_connect(new Gtk2::Button(N("Save")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-save'), clicked => sub { destroy_widget(); save_conf_file(); interactive_mode_box(); @@ -4135,19 +4134,19 @@ sub button_box_restore_end() { gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 0, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { destroy_widget(); interactive_mode_box(); }), - 0, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help); }), 1, new Gtk2::HBox(0, 1), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { destroy_widget(); $previous_widget->(); }), - 0, gtksignal_connect(new Gtk2::Button(N("Restore")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new(N("Restore")), clicked => sub { destroy_widget(); restore_backend(); }), @@ -4162,7 +4161,7 @@ sub button_box_build_backup_end() { $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, 1, new Gtk2::HBox(0, 5), 1, new Gtk2::HBox(0, 5), - 0, gtksignal_connect(new Gtk2::Button(N("Ok")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), clicked => sub { # destroy_widget(); interactive_mode_box(); }), @@ -4177,10 +4176,10 @@ sub button_box_restore_pbs_end() { $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, 1, new Gtk2::HBox(0, 5), 1, new Gtk2::HBox(0, 5), - 1, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help); }), - 0, gtksignal_connect(new Gtk2::Button(N("Ok")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'), clicked => sub { destroy_widget(); interactive_mode_box(); }), @@ -4193,19 +4192,19 @@ sub button_box_build_backup() { gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 1, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { destroy_widget(); interactive_mode_box(); }), - 1, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help); }), 1, new Gtk2::HBox(0, 0), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { destroy_widget(); $previous_widget->(); }), - 1, gtksignal_connect(new Gtk2::Button(N("Next")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-forward'), clicked => sub { destroy_widget(); $next_widget->(); }), @@ -4219,19 +4218,19 @@ sub button_box_restore() { gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 1, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { destroy_widget(); interactive_mode_box(); }), - 1, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help); }), 1, new Gtk2::HBox(0, 0), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { destroy_widget(); $previous_widget->(); }), - 1, gtksignal_connect(new Gtk2::Button(N("Next")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-forward'), clicked => sub { destroy_widget(); $next_widget->(); }), @@ -4248,20 +4247,20 @@ sub button_box_find_media { gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 1, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { $central_widget = \$box2; interactive_mode_box(); }), - 1, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { $central_widget = \$box2; adv_help(\&restore_find_media_box, $custom_help); }), 1, new Gtk2::HBox(0, 0), - 0, gtksignal_connect(new Gtk2::Button(N("Previous")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-back'), clicked => sub { $central_widget = \$box2; interactive_mode_box(); }), - 1, gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("Next")), clicked => sub { + 1, gtkset_sensitive(gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-forward'), clicked => sub { interactive_mode_box("restore"); }), $mount_media), ), @@ -4273,19 +4272,19 @@ sub button_box_wizard() { gtkpack($button_box, $button_box_tmp = gtkpack_(new Gtk2::HButtonBox, - 1, gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-cancel'), clicked => sub { destroy_widget(); interactive_mode_box() }), - 1, gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&$current_widget, $custom_help) }), 1, new Gtk2::HBox(0, 0), - 0, gtksignal_connect(new Gtk2::Button($next_widget ? N("Previous") : N("OK")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock($next_widget ? 'gtk-go-back' : 'gtk-ok'), clicked => sub { destroy_widget(); $previous_widget ? $previous_widget->() : $next_widget->(); }), - if_($next_widget, 1, gtksignal_connect(new Gtk2::Button(N("Next")), clicked => sub { + if_($next_widget, 1, gtksignal_connect(Gtk2::Button->new_from_stock('gtk-go-forward'), clicked => sub { destroy_widget(); $next_widget ? $next_widget->() : $previous_widget->(); })), @@ -4298,8 +4297,8 @@ sub button_box_main() { gtkpack($button_box, $button_box_tmp = gtkpack(gtkset_layout(new Gtk2::HButtonBox, 'start'), - gtksignal_connect(new Gtk2::Button(N("Close")), clicked => sub { ugtk2->exit(0) }), - gtksignal_connect(new Gtk2::Button(N("Help")), clicked => sub { + gtksignal_connect(Gtk2::Button->new_from_stock('gtk-close'), clicked => sub { ugtk2->exit(0) }), + gtksignal_connect(Gtk2::Button->new_from_stock('gtk-help'), clicked => sub { adv_help(\&interactive_mode_box, $custom_help) }), ), @@ -4352,7 +4351,7 @@ sub install_rpm { $box_what_user = gtkpack_(new Gtk2::VBox(0, 15), 0, N("The following packages need to be installed:\n") . join(' ', @list_of_rpm_to_install), 0, new Gtk2::HSeparator, - 0, gtksignal_connect(new Gtk2::Button(N("Install")), clicked => sub { + 0, gtksignal_connect(Gtk2::Button->new_from_stock(N("Install")), clicked => sub { system("/usr/sbin/urpmi --X @list_of_rpm_to_install"); destroy_widget(); $previous_widget->(); @@ -4635,12 +4634,12 @@ sub build_backup_box() { 1, new Gtk2::VBox(0, 5), 1, gtkpack_(new Gtk2::VBox(0, 15), 1, new Gtk2::VBox(0, 5), - 1, gtksignal_connect(my $button_from_conf_file = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_from_conf_file = Gtk2::Button->new, clicked => sub { destroy_widget(); build_backup_box_see_conf(); }), 0, new Gtk2::VBox(0, 5), - 1, gtksignal_connect(my $button_see_conf = new Gtk2::Button(), clicked => sub { + 1, gtksignal_connect(my $button_see_conf = Gtk2::Button->new, clicked => sub { destroy_widget(); build_backup_box_see_conf(); }), @@ -4683,33 +4682,33 @@ sub interactive_mode_box { 1, new Gtk2::VBox(0, 5), 1, gtkpack_(new Gtk2::VBox(0, 5), 1, new Gtk2::VBox(0, 5), - 1, gtksignal_connect(new Gtk2::Button(N("Wizard Configuration")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Wizard Configuration")), clicked => sub { destroy_widget(); read_conf_file(); wizard(); }), - 1, gtksignal_connect(new Gtk2::Button(N("Advanced Configuration")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Advanced Configuration")), clicked => sub { button_box_adv(); destroy_widget(); advanced_box(); }), - 1, gtksignal_connect(new Gtk2::Button(N("View Configuration")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("View Configuration")), clicked => sub { destroy_widget(); build_backup_box_see_conf("interactive"); }), - 1, gtksignal_connect(new Gtk2::Button(N("View Last Log")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("View Last Log")), clicked => sub { $results = cat_($log_file); button_box_log_main(); show_status(); }), - 1, gtksignal_connect(new Gtk2::Button(N("Backup Now")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Backup Now")), clicked => sub { if ($cfg_file_exist) { build_backup_box(); } else { message_noconf_box(); } }), - 1, gtksignal_connect(new Gtk2::Button(N("Restore")), clicked => sub { + 1, gtksignal_connect(Gtk2::Button->new_from_stock(N("Restore")), clicked => sub { destroy_widget(); restore_box(); }), @@ -4965,7 +4964,7 @@ backup data files by hand. 1, create_scrolled_window($text), 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'spread'), - gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { + gtksignal_connect(Gtk2::Button->new_from_stock(N("OK")), clicked => sub { destroy_widget(); $function->(); }), diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index 52942002f..db223eb1b 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -61,9 +61,8 @@ unless ($::isEmbedded) { ### menus definition # the menus are not shown but they provides shiny shortcut like C-q - my @menu_items = ({ path => N("/_File"), type => '<Branch>' }, - { - path => N("/File/_Quit"), accelerator => N("<control>Q"), callback => sub { ugtk2->exit(0) } }, + my @menu_items = ([ N("/_File"), undef, undef, undef, '<Branch>' ], + [ N("/File/_Quit"), N("<control>Q"), sub { ugtk2->exit(0) }, undef, '<Item>' ], ); create_factory_menu($w->{rwindow}, @menu_items); ######### menus end diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index d8801f32b..e6e5219ce 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -66,7 +66,7 @@ my $kernel_release = chomp_(`uname -r`); my $table = create_packtable({ col_spacings => 5, row_spacings => 10 }, [ new Gtk2::Label(N("Application:")), my $comb_app = gtkset_size_request(Gtk2::Combo->new, 270, -1) ], - [ new Gtk2::Label(N("Package: ")), my $package = new Gtk2::Entry("...") ], + [ new Gtk2::Label(N("Package: ")), my $package = new Gtk2::Entry("...") ], # complain on gtk-perl@ml [ Gtk2::Label->new(N("Kernel:")), gtkset_editable(Gtk2::Entry->new($kernel_release), 0) ], [ Gtk2::Label->new(N("Release: ")), gtkset_editable(Gtk2::Entry->new(mandrake_release()), 0) ] ); diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 79c8f3516..dc85bf894 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -81,6 +81,7 @@ $window1->{rwindow}->set_border_width(10); my $combo1 = new Gtk2::Combo; $combo1->set_popdown_strings(network::netconnect::get_profiles()); my $old_profile = $netcnx->{PROFILE}; + $combo1->entry->set_text($netcnx->{PROFILE} || "default"); $combo1->entry->set_editable(0); my $button_del = new Gtk2::Button(N("Del profile...")); @@ -164,7 +165,7 @@ $int_connect->signal_connect(clicked => sub { my $button_internet = gtksignal_connect(Gtk2::Button->new(N("Configure Internet Access...")), clicked => sub { configure_net('', $netcnx, $netc, $intf) }); -my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->OBJECT, map { Gtk2::GType->STRING } 2..6); +my $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", map { "Glib::String" } 2..6); my $list = Gtk2::TreeView->new_with_model($tree_model); $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererPixbuf->new, 'pixbuf' => 0)); each_index { @@ -269,19 +270,22 @@ $button_ok->signal_connect(clicked => sub { quit_global(); }); $bbox0->add($button_ok); -$combo1->entry->signal_connect('changed', sub { -# connected() and disconnect_backend(); - network::netconnect::set_profile($netcnx, $combo1->entry->get_text); - network::netconnect::load_conf($netcnx, $netc, $intf); - $netcnx->{$_} = $netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE); - update(); - $button_apply->set_sensitive(1); - }); + +$combo1->signal_connect(realize => sub { + $combo1->entry->signal_connect(changed => sub { + #connected() and disconnect_backend(); + network::netconnect::set_profile($netcnx, $combo1->entry->get_text); + network::netconnect::load_conf($netcnx, $netc, $intf); + $netcnx->{$_} = $netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE); + update(); + $button_apply->set_sensitive(1); + }); +}); $window1->{rwindow}->show_all; $_->hide foreach $button_internet, $button_lan; gtkflush(); -my $tag = Gtk2->timeout_add(4000, \&update2); +my $tag = Glib::Timeout->add(4000, \&update2); $window1->main; ugtk2->exit(0); @@ -302,7 +306,7 @@ sub build_list() { $ip = $intf->{"eth$i"}{IPADDR}; $state = "n/a"; } - $tree_model->append_set(undef, [ map_index { $::i => $_ } (gtkcreate_pixbuf("eth_card_mini2.png"), "eth$i", $ip , $intf->{"eth$i"}{BOOTPROTO}, $all_cards[$i][1], $state) ])->free; + $tree_model->append_set(undef, [ map_index { $::i => $_ } (gtkcreate_pixbuf("eth_card_mini2.png"), "eth$i", $ip , $intf->{"eth$i"}{BOOTPROTO}, $all_cards[$i][1], $state) ]); } } @@ -329,7 +333,7 @@ sub ethisup { `LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /sbin/ifconfig` =~ /eth$ my $to_update; sub update() { my $h = chomp_(`hostname`); - $label_host->set($h); + $label_host->set_label($h); $type_label->set($netcnx->{type}); $int_label->set($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:")); $interface_name->set($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE}); diff --git a/perl-install/standalone/drakfloppy b/perl-install/standalone/drakfloppy index 44f00fdc6..9d139555c 100755 --- a/perl-install/standalone/drakfloppy +++ b/perl-install/standalone/drakfloppy @@ -40,7 +40,7 @@ require_root_capability(); my $expert_mode = $::expert; -my $list_model = Gtk2::ListStore->new((Gtk2::GType->STRING) x 2); +my $list_model = Gtk2::ListStore->new(("Glib::String") x 2); my $list = Gtk2::TreeView->new_with_model($list_model); each_index { $list->append_column(my $col = Gtk2::TreeViewColumn->new_with_attributes($_, Gtk2::CellRendererText->new, 'text' => $::i)); @@ -87,7 +87,7 @@ $kernel_combo->entry->signal_connect(changed => sub { # Create root tree -my $tree_model = Gtk2::TreeStore->new((Gtk2::GType->STRING) x 2); +my $tree_model = Gtk2::TreeStore->new(("Glib::String") x 2); my $tree = Gtk2::TreeView->new_with_model($tree_model); #$tree->get_selection->set_mode('browse'); $tree->set_headers_visible(0); @@ -229,7 +229,6 @@ sub selected_tree { my ($model, $iter) = $select->get_selected; return unless $model; # no real selection my $file = $model->get($iter, 1); - $iter->free; return if -d $file; @@ -238,21 +237,26 @@ sub selected_tree { return if member($file, @modules); push @modules, $file; $file =~ s|/lib/modules/.*?/||g; - $list_model->append_set([ 0 => $file, 1 => $size ])->free; + $list_model->append_set([ 0 => $file, 1 => $size ]); } # Callback for expanding a tree - find subdirectories, files and add them to tree sub expand_tree { my ($tree, $parent_iter, $path) = @_; - + print "K 0\n"; my $dir = $tree_model->get($parent_iter, 1); + print "K 1\n"; my $child = $tree_model->iter_children($parent_iter); #- hackish: if first child has '' as name, then we need to expand on the fly + print "K 2 $child\n"; if ($child && $tree_model->get($child, 0) eq '') { + print "K 3\n"; $tree_model->remove($child); + print "K 4\n"; } + print "K 5\n"; unless ($child && $tree_model->iter_has_child($parent_iter)) { foreach my $dir_entry (all($dir)) { my $entry_path = $dir . "/" . $dir_entry; @@ -264,11 +268,12 @@ sub expand_tree { #- if leaf is void, we may create the parent and one child (to have the [+] in front of the parent in the ctree) #- though we use '' as the label of the child; then rpmdrake will connect on tree_expand, and whenever #- the first child has '' as the label, it will remove the child and add all the "right" children - $tree_model->append_set($iter, [ 0 => '' ])->free if has_sub_trees($entry_path); + $tree_model->append_set($iter, [ 0 => '' ]) if has_sub_trees($entry_path); } } } $tree->expand_row($path, 0); + print "K 9\n\n"; } diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index d954eed58..d2ccbc9f2 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -726,7 +726,7 @@ sub list_remove() { #- TODO : multi-selection sub advanced_install() { my $adv_box; - $model = Gtk2::TreeStore->new(Gtk2::GType->STRING); + $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)); $list->set_headers_visible(0); @@ -765,7 +765,7 @@ sub list_to_remove() { sub show_list_to_remove() { my $show_box; - my $model = Gtk2::TreeStore->new(Gtk2::GType->STRING); + 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)); $list->set_headers_visible(0); @@ -802,7 +802,7 @@ sub uninstall() { #- TODO : add item to right list with gtksignal_connect chk_empty_xfs_path(); #- left part - $left_model = Gtk2::TreeStore->new(Gtk2::GType->STRING); + $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_list->set_headers_visible(0); @@ -812,7 +812,7 @@ sub uninstall() { #- TODO : add item to right list with gtksignal_connect $left_model->append_set(undef, [ 0 => $_ ]) foreach @installed_fonts_path; #- right part - $right_model = Gtk2::TreeStore->new(Gtk2::GType->STRING);; + $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_list->set_headers_visible(0); diff --git a/perl-install/standalone/drakperm b/perl-install/standalone/drakperm index 2cdb6ca4d..aa9f5461f 100755 --- a/perl-install/standalone/drakperm +++ b/perl-install/standalone/drakperm @@ -32,7 +32,7 @@ my $w = ugtk2->new('drakperm'); $w->{rwindow}->set_size_request(550, 400) unless $::isEmbedded; my $W = $w->{window}; $W->signal_connect(delete_event => sub { ugtk2->exit }); -my $treeModel = Gtk2::TreeStore->new((Gtk2::GType->STRING) x 4); +my $treeModel = Gtk2::TreeStore->new(("Glib::String") x 4); my $permList = Gtk2::TreeView->new_with_model($treeModel); my @column_sizes = (150, 100, 100, 15, -1); @@ -65,7 +65,6 @@ my @buttons; sub del_callback() { my ($tree, $iter) = $permList->get_selection->get_selected; $tree->remove($iter); - $iter->free; sensitive_buttons(0); $modified++; } @@ -74,33 +73,26 @@ sub down_callback() { my ($model, $iter) = $permList->get_selection->get_selected; return unless $iter; my $new_iter = $model->iter_next($iter); - goto CLEAN1 unless $new_iter; + return if !$new_iter; $model->move_after($iter, $new_iter); $model->move_after($iter, $new_iter); $permList->get_selection->select_iter($iter); $permList->queue_draw; - $new_iter->free; - CLEAN1: $iter->free; } sub up_callback() { my ($model, $iter) = $permList->get_selection->get_selected; - return unless $iter; + return if !$iter; my $path = $model->get_path($iter); - goto CLEAN1 unless $path; + return if !$path; $path->prev; my $prev_iter = $model->get_iter($path); - $path->free; - goto CLEAN2 unless $prev_iter; + return if !$prev_iter; $model->move_before($iter, $prev_iter); $model->move_before($iter, $prev_iter); $permList->get_selection->select_iter($iter); $permList->queue_draw; - - $prev_iter->free; - CLEAN2: $path->free; - CLEAN1: $iter->free; } my $combo_sig = $combo_perm->entry->signal_connect(changed => sub { display_perm($combo_perm->entry->get_text , @_) }); @@ -110,7 +102,6 @@ $permList->signal_connect(button_press_event => sub { my (undef, $iter) = $permList->get_selection->get_selected; return unless $iter; row_setting_dialog($iter) if $event->type eq '2button-press'; - $iter->free; }); @@ -155,7 +146,6 @@ $permList->get_selection->signal_connect('changed' => sub { my $editable = $editable; $editable = 0 unless $iter; sensitive_buttons($editable); - $iter->free if $iter; }); $w->main; @@ -210,7 +200,6 @@ sub save_perm() { $treeModel->foreach(sub { my ($model, $_path, $iter) = @_; my $line = $model->get($iter, 0) . "\t" . $model->get($iter,1) . ($model->get($iter,2) ? "." . $model->get($iter,2) : "") . "\t" . $model->get($iter,3) . "\n"; - $iter->free; print F $line; return 0; }, $val); @@ -334,7 +323,6 @@ sub row_setting_dialog { $treeModel->set($iter, [ 3 => ($s || '') . $user . $group . $other ]); $dlg->destroy; $modified++; - $iter->free; }); $usr_check->signal_connect(clicked => sub { my $bool = $usr_check->get_active; diff --git a/perl-install/standalone/harddrake2 b/perl-install/standalone/harddrake2 index b3d7af71a..13212171c 100755 --- a/perl-install/standalone/harddrake2 +++ b/perl-install/standalone/harddrake2 @@ -97,11 +97,11 @@ my @menu_items = [ N("/_File"), undef, undef, undef, '<Branch>' ], [ N("/_File").N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<StockItem>', 'gtk-quit' ], [ join('', @{$menu_options{PRINTERS_DETECTION}}), undef, - sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->active }, undef, '<CheckItem>' ], + sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->get_active }, undef, '<CheckItem>' ], [ join('', @{$menu_options{MODEMS_DETECTION}}), undef, - sub { $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->active }, undef, '<CheckItem>' ], + sub { $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->get_active }, undef, '<CheckItem>' ], [ join('', @{$menu_options{JAZZ_DETECTION}}), undef, - sub { $options{JAZZ_DETECTION} = $check_boxes{JAZZ_DETECTION}->active }, undef, '<CheckItem>' ], + sub { $options{JAZZ_DETECTION} = $check_boxes{JAZZ_DETECTION}->get_active }, undef, '<CheckItem>' ], [ $menus{help}, undef, undef, undef, '<Branch>' ], [ $menus{help}.N("/_Help"), undef, sub { unless (fork()) { exec("drakhelp Drakxtools-Guide.html/harddrake.html") } }, undef, '<Item>' ], [ $menus{help}.N("/_Fields description"), undef, sub { @@ -148,7 +148,7 @@ if ($::isEmbedded) { $w->{window}->set_size_request(805, 550); } -my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->OBJECT, Gtk2::GType->STRING, Gtk2::GType->INT); +my $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", "Glib::String", "Glib::Int"); my ($statusbar, $sig_id); $w->{window}->add(gtkpack_(0, Gtk2::VBox->new(0, 0), if_(!$::isEmbedded, 0, $menubar), @@ -198,16 +198,15 @@ $tree->get_selection->signal_connect('changed' => sub { my ($model, $iter) = $select->get_selected; if ($model) { my $idx = $model->get($iter, 2); - $iter->free; $current_device = $data[$idx]; if ($idx ne -1) { + use Gtk2::Pango; gtktext_insert($text, [ map { - # The U+200E character is to force LTR display, as what what follows the colon is always in LTR (device names, paths, etc), # this ensures proper displaying of names like /dev/fd0 (otherwise it gets 'dev/fd0/'). # it must come *after* the space, as the space must follow the colon following the direction of writting. - if_($_ && $fields{$_}[0], [ $fields{$_}[0] . ": \x{200e}", { 'foreground' => 'royalblue3', 'weight' => Gtk2::Pango->WEIGHT_BOLD } ], + if_($_ && $fields{$_}[0], [ $fields{$_}[0] . ": \x{200e}", { 'foreground' => 'royalblue3', 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD } ], [ ($current_device->{$_} =~ /^(unknown)/ ? N("unknown") : $current_device->{$_} =~ /^(Unknown)/ ? N("Unknown") : $current_device->{$_} eq 'yes' ? N("Yes") : @@ -227,7 +226,7 @@ $tree->get_selection->signal_connect('changed' => sub { return 1; } } - $text->get_buffer->set_text(N("Click on a device in the left tree in order to display its information here."), -1); + $text->get_buffer->set_text(N("Click on a device in the left tree in order to display its information here.")); $config_button->hide; $module_cfg_button->hide; }); @@ -294,12 +293,11 @@ foreach (@harddrake::data::tree) { foreach my $field (qw(devfs_device device)) { $_->{$field} = '/dev/'.$_->{$field} if $_->{$field}; } - $tree_model->append_set($parent_iter, [ 1 => $custom_id, 2 => $index++ ])->free; + $tree_model->append_set($parent_iter, [ 1 => $custom_id, 2 => $index++ ]); push @data, $_; push @configurators, $configurator; } $tree->expand_row($tree_model->get_path($parent_iter), 1) unless $title eq N("Unknown/Others"); - $parent_iter->free; } $SIG{CHLD} = sub { @@ -327,7 +325,6 @@ $textcolumn->set_sizing('GTK_TREE_VIEW_COLUMN_AUTOSIZE');#GROW_ONLY my $path = Gtk2::TreePath->new_first; $path->down unless $::isEmbedded; $tree->get_selection->select_path($path); -$path->free; $w->{rwindow}->show_all; undef $wait; gtkset_mousecursor_normal(); diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake index 94fc15f9a..92b429a2f 100755 --- a/perl-install/standalone/logdrake +++ b/perl-install/standalone/logdrake @@ -142,6 +142,7 @@ my %files = ( ); my $yy = gtkset_sensitive(gtksignal_connect(new Gtk2::Button(N("search")) , clicked => \&search),0); +print "widget is $yy\n"; my $log_text = gtktext_insert(Gtk2::TextView->new, [ [ '' ] ]); my $log_buf = $log_text->get_buffer; @@ -168,7 +169,8 @@ gtkadd($my_win->{window}, map { $toggle{$_} = gtksignal_connect(new Gtk2::CheckButton($files{$_}{desc}), clicked => sub { $refcount_search++; - gtkset_sensitive($yy,$refcount_search); + print "widget is $yy\n"; + gtkset_sensitive($yy, $refcount_search); }) } keys %files, ) ), @@ -217,12 +219,12 @@ sub quit() { ugtk2->exit(0) } #------------------------------------------------------------- sub search() { $log_text->window->freeze_updates; - $log_buf->set_text('', -1); + $log_buf->set_text(''); if ($::isFile) { parse_file($::File); } else { foreach (keys %files) { - parse_file($files{$_}{file}, $files{$_}{desc}) if $toggle{$_}->active; + parse_file($files{$_}{file}, $files{$_}{desc}) if $toggle{$_}->get_active; } } $log_text->window->thaw_updates; @@ -298,7 +300,7 @@ sub parse_file { local $_; while (<F>) {}; #to prevent to output the file twice.. # $log_text->set_point($log_text->get_length()); - $timer ||= Gtk2->timeout_add(1000, sub { + $timer ||= Glib::Timeout->add(1000, sub { logcolorize($_) while <F>; seek F, 0, 1; }); @@ -362,7 +364,6 @@ sub logcolorize { sub log_output { gtktext_append($log_text, [ \@_ ]); $log_text->scroll_to_iter(my $iter = $log_buf->get_end_iter, 0, 1, 0.5, 0.5); - $iter->free; } @@ -479,7 +480,7 @@ print F $r; sub save() { $::isWizard = 0; - $yy = $in->ask_file(N("Save as.."), "/root") or return; + my $y = $in->ask_file(N("Save as.."), "/root") or return; my $buf = $log_text->get_buffer; - output($yy, $buf->get_text(($buf->get_bounds), 0)); + output($y, $buf->get_text(($buf->get_bounds), 0)); } diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake index 935d0db6c..635532c15 100755 --- a/perl-install/standalone/mousedrake +++ b/perl-install/standalone/mousedrake @@ -29,7 +29,7 @@ if (!$mouse || !$::auto) { if ($::isEmbedded && $in->isa('interactive::gtk')) { #- HACK: waiting for the ask_from_treelistf to attach itself #- and adding the nice test mouse to it - Gtk2->timeout_add(100, sub { + Glib::Timeout->add(100, sub { defined $::Plug && defined $::Plug->child or return 1; $test_hbox = Gtk2::HBox->new(0, 0); $::WizardTable->attach($test_hbox, 2, 3, 1, 2, ['fill', 'expand'], ['fill', 'expand'], 0, 0); diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index d5409bdbd..d0b0acebd 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -40,7 +40,7 @@ unless ($::no_ugtk_init) { !check_for_xserver() and die "Cannot be run in console mode.\n"; $::one_message_has_been_translated and warn("N() was called from $::one_message_has_been_translated BEFORE gtk2 initialisation, replace it with a N_() AND a translate() later.\n"), c::_exit(1); - Gtk2->init(\@ARGV); + Gtk2->init(); c::bind_textdomain_codeset($_, 'UTF8') foreach 'libDrakX', @::textdomains; $::need_utf8_i18n = 1; } @@ -58,7 +58,7 @@ $border = 5; # you're building. sub gtkdestroy { $_[0] and $_[0]->destroy } -sub gtkflush() { Gtk2->update_ui } +sub gtkflush() { Gtk2->main_iteration while Gtk2->events_pending } sub gtkhide { $_[0]->hide; $_[0] } sub gtkmove { $_[0]->window->move($_[1], $_[2]); $_[0] } sub gtkpack { gtkpowerpack(1, 1, @_) } @@ -150,7 +150,7 @@ sub gtkradio { sub gtkroot() { my $root if 0; - $root ||= Gtk2::Gdk::Window->foreign_new(Gtk2::Gdk->ROOT_WINDOW); + $root ||= Gtk2::Gdk->get_default_root_window(); } sub gtkset_text { @@ -167,8 +167,7 @@ sub gtkcombo_setpopdown_strings { sub gtkset_mousecursor { my ($type, $w) = @_; - ($w || gtkroot())->set_cursor(my $c = Gtk2::Gdk::Cursor->new($type)); - $c->unref; + ($w || gtkroot())->set_cursor(Gtk2::Gdk::Cursor->new($type)); } sub gtksignal_connect { @@ -402,13 +401,13 @@ sub create_vbox { gtkset_layout(Gtk2::VButtonBox->new, $_[0] || 'spread') } sub create_factory_menu_ { my ($type, $name, $window, @menu_items) = @_; my $widget = Gtk2::ItemFactory->new($type, $name, my $accel_group = Gtk2::AccelGroup->new); - $widget->create_items([ @menu_items ]); + $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->get_type, '<main>', @_) } -sub create_factory_menu { create_factory_menu_(Gtk2::MenuBar->get_type, '<main>', @_) } +sub create_factory_popup_menu { create_factory_menu_("Gtk2::Menu", '<main>', @_) } +sub create_factory_menu { create_factory_menu_("Gtk2::MenuBar", '<main>', @_) } sub create_menu { my $title = shift; @@ -531,25 +530,27 @@ sub gtktext_insert { my ($textview, $t, %opts) = @_; my $buffer = $textview->get_buffer; if (ref($t) eq 'ARRAY') { - $opts{append} or $buffer->set_text('', -1); + $opts{append} or $buffer->set_text(''); foreach my $token (@$t) { - my ($iter1, $iter2); + my $iter1 = $buffer->get_end_iter; my $c = $buffer->get_char_count; - $buffer->insert($iter1 = $buffer->get_end_iter, $token->[0], -1); - $iter1->free; + if ($token->[0] =~ /^Gtk2::Gdk::Pixbuf/) { + $buffer->insert_pixbuf($iter1, $token->[0]); + next; + } + $buffer->insert($iter1, $token->[0]); if ($token->[1]) { - my $tag = $buffer->create_tag(undef); + my $tag = $buffer->create_tag(rand()); $tag->set(%{$token->[1]}); - $buffer->apply_tag($tag, $iter1 = $buffer->get_iter_at_offset($c), $iter2 = $buffer->get_end_iter); - $iter1->free; $iter2->free; + $buffer->apply_tag($tag, $iter1 = $buffer->get_iter_at_offset($c), my $iter2 = $buffer->get_end_iter); } } } else { - $buffer->set_text($t, -1); + $buffer->set_text($t); } #- the following line is needed to move the cursor to the beginning, so that if the #- textview has a scrollbar, it won't scroll to the bottom when focusing (#3633) - $buffer->place_cursor(my $iter = $buffer->get_start_iter); $iter->free; + $buffer->place_cursor(my $iter = $buffer->get_start_iter); $textview->set_wrap_mode($opts{wrap_mode} || 'word'); $textview->set_editable($opts{editable} || 0); $textview->set_cursor_visible($opts{visible} || 0); @@ -560,14 +561,13 @@ sub gtktext_insert { sub gtkfontinfo { my ($widget) = @_; my $context = $widget->get_pango_context; - my $metrics = $context->get_metrics($widget->style->get_font_desc, $context->get_language); + my $metrics = $context->get_metrics($context->get_font_description, $context->get_language); my %fontinfo; foreach (qw(ascent descent approximate_char_width approximate_digit_width)) { no strict; my $func = "get_$_"; - $fontinfo{$_} = Gtk2::Pango->PANGO_PIXELS($metrics->$func); + $fontinfo{$_} = Gtk2::Pango->pixels($metrics->$func); } - $metrics->unref; %fontinfo; } @@ -624,7 +624,6 @@ sub string_size { my ($widget, $text) = @_; my $layout = $widget->create_pango_layout($text); my @size = $layout->get_pixel_size; - $layout->unref; @size; } @@ -749,7 +748,6 @@ sub gtkset_background { $root->set_background($color); my ($w, $h) = $root->get_size; $root->draw_rectangle($gc, 1, 0, 0, $w, $h); - $gc->unref; } sub add_icon_path { push @icon_paths, @_ } @@ -775,6 +773,7 @@ add_icon_path(@icon_paths, sub new { my ($type, $title, %opts) = @_; + my $o = bless { %opts }, $type; $o->_create_window($title); while (my $e = shift @tempory::objects) { $e->destroy } @@ -791,7 +790,6 @@ sub new { if ($::isWizard && !$o->{pop_it}) { $o->{isWizard} = 1; - $o->{window}->sink; $o->{rwindow}->sink; #- free memory $o->{window} = Gtk2::VBox->new(0,0); $o->{window}->set_border_width($::Wizard_splash ? 0 : 10); $o->{rwindow} = $o->{window}; @@ -806,8 +804,7 @@ sub new { $::WizardWindow->set_uposition($::stepswidth + $::windowwidth * 0.04, $::logoheight + $::windowheight * ($::logoheight ? 0.12 : 0.05)); $::WizardWindow->signal_connect(key_press_event => sub { my (undef, $event) = @_; - my $d = ${{ Gtk2::Gdk::Event::Key->Sym_F2 => 'screenshot' }}{$event->keyval}; - + my $d = ${{ 0xFFBF => 'screenshot' }}{$event->keyval}; # GDK_F2 from gdk/gdkkeysyms.h if ($d eq 'screenshot') { common::take_screenshot(); } elsif (chr($event->keyval) eq 'e' && member('mod1-mask', @{$event->state})) { #- alt-e @@ -832,7 +829,6 @@ sub new { 0, 0, 0, $height*$i, -1, -1, 'none', 0, 0); my $layout = $draw1->create_pango_layout($::Wizard_title); $draw1->window->draw_layout($draw1->style->white_gc, 40, 62, $layout); - $layout->unref; } }); $draw2->signal_connect(expose_event => sub { @@ -874,8 +870,8 @@ sub new { sub main { my ($o, $o_completed, $o_canceled) = @_; gtkset_mousecursor_normal(); - my $timeout = Gtk2->timeout_add(1000, sub { gtkset_mousecursor_normal(); 1 }); - my $_b = MDK::Common::Func::before_leaving { Gtk2->timeout_remove($timeout) }; + my $timeout = Glib::Timeout->add(1000, sub { gtkset_mousecursor_normal(); 1 }); + my $_b = MDK::Common::Func::before_leaving { Glib::Source->remove($timeout) }; $o->show; do { @@ -939,7 +935,7 @@ sub _create_window($$) { $w->signal_connect(size_allocate => sub { my (undef, $event) = @_; my $w_size = $event->values; - return if $w_size->[2] == $wi && $w_size->[3] == $he; + return if $w_size->[2] == $wi && $w_size->[3] == $he; #BUG (undef, undef, $wi, $he) = @$w_size; my ($X, $Y, $Wi, $He) = @{$force_center || $o->{force_center}}; @@ -960,7 +956,7 @@ sub _create_window($$) { sub ask_warn { my $w = ugtk2->new(shift @_, grab => 1); $w->_ask_warn(@_); main($w) } sub ask_yesorno { my $w = ugtk2->new(shift @_, grab => 1); $w->_ask_okcancel(@_, N("Yes"), N("No")); main($w) } -sub ask_okcancel { my $w = ugtk2->new(shift @_, grab => 1); $w->_ask_okcancel(@_, N("Is this correct?"), N("Ok"), N("Cancel")); main($w) } +sub ask_okcancel { my $w = ugtk2->new(shift @_, grab => 1); $w->_ask_okcancel(@_, N("Is this correct?"), 'gtk-ok', 'gtk-cancel'); main($w) } sub ask_from_entry { my $w = ugtk2->new(shift @_, grab => 1); $w->_ask_from_entry(@_); main($w) } sub ask_dir { my $w = ugtk2->new(shift @_, grab => 1); $w->_ask_dir(@_); main($w) } @@ -1004,7 +1000,8 @@ sub _ask_okcancel($@) { sub _ask_file { my ($o, $title, $path) = @_; - my ($modality, $position) = ($o->{rwindow}->get_modal, $o->{rwindow}->window_position); + my ($modality, $position) = ($o->{rwindow}->get_modal, $o->{rwindow}->get('window-position')); + print "position is $position\n"; my $f = $o->{rwindow} = Gtk2::FileSelection->new($title); $f->set_modal($modality); $f->set_position($position); @@ -1022,7 +1019,7 @@ sub _ask_dir { $f->selection_entry->get_parent->hide; $f->ok_button->signal_connect(clicked => sub { my ($model, $iter) = $f->dir_list->get_selection->get_selected; - if ($model) { $o->{retval} .= $model->get($iter, 0); $iter->free } + $o->{retval} .= $model->get($iter, 0) if $model; }); } @@ -1031,7 +1028,7 @@ sub ask_browse_tree_info { my $w = ugtk2->new($common->{title}); - my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->STRING, Gtk2::GType->OBJECT, Gtk2::GType->STRING); + my $tree_model = Gtk2::TreeStore->new("Glib::String", "Gtk2::Gdk::Pixbuf", "Glib::String"); my $tree = Gtk2::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)); @@ -1132,7 +1129,6 @@ sub ask_browse_tree_info_given_widgets { my @list = grep { $stats->{$_} > 0 } keys %$stats; my $new_state = @list == 1 ? $list[0] : 'semiselected'; $node_state{$parent_str} ne $new_state and $set_node_state_tree->($parent, $new_state); - $parent->free; } $w->{tree_model}->set($iter, [ 1 => $pix{$state} ]); $node_state{$iter_str} = $state; #- cache for efficiency @@ -1172,21 +1168,19 @@ sub ask_browse_tree_info_given_widgets { #- if leaf is void, we may create the parent and one child (to have the [+] in front of the parent in the ctree) #- though we use '' as the label of the child; then rpmdrake will connect on tree_expand, and whenever #- the first child has '' as the label, it will remove the child and add all the "right" children - $options->{nochild} or $w->{tree_model}->append_set($parent, [ 0 => '' ])->free; + $options->{nochild} or $w->{tree_model}->append_set($parent, [ 0 => '' ]); } }; my $clear_all_caches = sub { foreach (values %ptree) { foreach my $n (@$_) { delete $node_state{$w->{tree_model}->get_path_str($n)}; - $n->free; } } foreach (values %wtree) { my $iter_str = $w->{tree_model}->get_path_str($_); delete $node_state{$iter_str}; delete $state_stats{$iter_str}; - $_->free; } %ptree = %wtree = (); }; @@ -1222,13 +1216,11 @@ sub ask_browse_tree_info_given_widgets { delete $wtree{$_->[1]}; delete $node_state{$w->{tree_model}->get_path_str($_->[0])}; delete $state_stats{$w->{tree_model}->get_path_str($_->[0])}; - $_->[0]->free; } } } foreach (@to_remove) { delete $node_state{$w->{tree_model}->get_path_str($_)}; - $_->free; } @{$ptree{$_}} = difference2($ptree{$_}, \@to_remove); } @@ -1237,7 +1229,6 @@ sub ask_browse_tree_info_given_widgets { delete $node_state{$iter_str}; delete $state_stats{$iter_str}; $w->{tree_model}->remove($wtree{$cat}); - $wtree{$cat}->free; delete $wtree{$cat}; } &$update_size; @@ -1249,11 +1240,10 @@ sub ask_browse_tree_info_given_widgets { }; $common->{display_info} = sub { gtktext_insert($w->{info}, $common->{get_info}($curr)); 0 }; - my $children = sub { map { my $v = $w->{tree_model}->get($_, 0); $_->free; $v } gtktreeview_children($w->{tree_model}, $_[0]) }; + my $children = sub { map { my $v = $w->{tree_model}->get($_, 0); $v } gtktreeview_children($w->{tree_model}, $_[0]) }; my $toggle = sub { if (ref($curr) && !$_[0]) { $w->{tree}->toggle_expansion(my $path = $w->{tree_model}->get_path($curr)); - $path->free; } else { if (ref $curr) { my @_a = $children->($curr); @@ -1282,12 +1272,11 @@ sub ask_browse_tree_info_given_widgets { $w->{tree}->get_selection->signal_connect(changed => sub { my ($model, $iter) = $_[0]->get_selected; $model && $iter or return; - Gtk2->timeout_remove($idle) if $idle; + Glib::Source->remove($idle) if $idle; - $curr->free if ref $curr; if (!$model->iter_has_child($iter)) { $curr = $model->get($iter, 0); - $idle = Gtk2->timeout_add(100, $common->{display_info}); + $idle = Glib::Timeout->add(100, $common->{display_info}); } else { $curr = $iter; } @@ -1304,7 +1293,6 @@ sub ask_browse_tree_info_given_widgets { my ($returns, $path, $column) = $w->{tree}->get_path_at_pos($_[1]->x, $_[1]->y); if ($returns) { Gtk2->equals($column, $w->{pixcolumn}) and $mouse_toggle_pending = $w->{tree_model}->get($path, 0); - $path->free; } }); $common->{rebuild_tree}->(); @@ -1313,4 +1301,52 @@ sub ask_browse_tree_info_given_widgets { $w->{w}->main; } +# misc helpers: + +package Gtk2::TreeStore; +sub append_set { + my ($model, $parent, @values) = @_; + # compatibility: + @values = @{$values[0]} if $#values == 0 && ref($values[0]) eq 'ARRAY'; + my $iter = $model->append($parent); + $model->set($iter, @values); + return $iter; +} + +package Gtk2::ListStore; +# Append a new row, set the values, return the TreeIter +sub append_set { + my ($model, @values) = @_; + # compatibility: + @values = @{$values[0]} if $#values == 0 && ref($values[0]) eq 'ARRAY'; + my $iter = $model->append(); + $model->set($iter, @values); + return $iter; +} + +package Gtk2::TreeModel; +# gets the string representation of a TreeIter +sub get_path_str { + my ($self, $iter) = @_; + my $path = $self->get_path($iter); + $path or return; + $path->to_string; +} + +package Gtk2::Label; +sub set { + my ($label) = shift; + $label->set_label(@_); +} + +package Gtk2::Entry; +sub new_with_text { + shift; + my $entry = Gtk2::Entry::>new; + @_ and $entry->set_text(@_); + return $entry; +} + + 1; + |