summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/mygtk2.pm2
-rw-r--r--perl-install/unused/migrate-ugtk2-to-mygtk2.pl20
2 files changed, 19 insertions, 3 deletions
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm
index cb93ef680..30c3efcdc 100644
--- a/perl-install/mygtk2.pm
+++ b/perl-install/mygtk2.pm
@@ -335,7 +335,7 @@ sub _gtk__ScrolledWindow {
if (!$w) {
$w = Gtk2::ScrolledWindow->new(undef, undef);
- $w->set_policy(@{delete $opts->{policy} || [ 'automatic', 'automatic' ]});
+ $w->set_policy(delete $opts->{h_policy} || 'automatic', delete $opts->{v_policy} || 'automatic');
}
if (my $child = delete $opts->{child}) {
diff --git a/perl-install/unused/migrate-ugtk2-to-mygtk2.pl b/perl-install/unused/migrate-ugtk2-to-mygtk2.pl
index 8292e8aa6..ad98b61e2 100644
--- a/perl-install/unused/migrate-ugtk2-to-mygtk2.pl
+++ b/perl-install/unused/migrate-ugtk2-to-mygtk2.pl
@@ -1,3 +1,5 @@
+use MDK::Common;
+
BEGIN {
@ARGV or warn(<<EOF), exit 1;
usage: unused/migrate-ugtk2-to-mygtk2.pl -pi <file.pm>
@@ -103,8 +105,22 @@ while ($b) {
$b = 1 if s/create_hbox\((['"].*?['"])\)/gtknew('HButtonBox', layout => $1)/ ||
s/create_hbox\(\)/gtknew('HButtonBox')/;
- $b = 1 if s/create_scrolled_window\(($re)\s*,\s*($re)\)/gtknew('ScrolledWindow', policy => $2, child => $1)/ ||
- s/create_scrolled_window\(($re)\)/gtknew('ScrolledWindow', child => $1)/;
+ if (my ($arg) = /create_scrolled_window\(($re)\)/) {
+ my $val;
+ if (my ($child, $policy) = $arg =~ /^($re)\s*,\s*($re)$/) {
+ if (my ($h, $v) = $policy =~ /^\[\s*($re)\s*,\s*($re)\s*\]$/) {
+ foreach ($h, $v) {
+ $_ = /never/i ? 'never' : /always/ ? 'always' : '';
+ }
+ $val = join(', ', if_($h, "h_policy => '$h'"), if_($v, "v_policy => '$v'"), "child => $child");
+ } else {
+ #- ???
+ }
+ } else {
+ $val = "child => $arg";
+ }
+ $b = 1 if $val && s/create_scrolled_window\($re\)/gtknew('ScrolledWindow', $val)/;
+ }
$b = 1 if s/create_packtable\(\{($re)\},/my $s = prepost_chomp($1); "gtknew('Table', " . ($s ? "$s, " : '') . "children => ["/e;