summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-12-02 21:14:59 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-12-02 21:14:59 +0000
commit9d5bf81652aff2d499b4a117e1c8beafa0593865 (patch)
tree937088d341c30a5ab2b4eb6a6d8a478a831d1ef5
parent0d43ba93de8a110f71853dd391e3c71af063e41f (diff)
downloaddrakx-9d5bf81652aff2d499b4a117e1c8beafa0593865.tar
drakx-9d5bf81652aff2d499b4a117e1c8beafa0593865.tar.gz
drakx-9d5bf81652aff2d499b4a117e1c8beafa0593865.tar.bz2
drakx-9d5bf81652aff2d499b4a117e1c8beafa0593865.tar.xz
drakx-9d5bf81652aff2d499b4a117e1c8beafa0593865.zip
replace "policy => [ horizpolicy, vertpolicy ]" with "h_policy => ..., v_policy => ..."
(both defaulting to "automatic")
-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;