From 2bbb9d04afdcceb813d2aee457fdf6ad7241870e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 6 Jan 2005 14:51:53 +0000 Subject: merge Window and Dialog creation --- perl-install/mygtk2.pm | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'perl-install/mygtk2.pm') diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 2472d12a9..14e1d7c94 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -394,12 +394,20 @@ sub _gtk__Frame { $w; } -sub _gtk__Window { - my ($w, $opts) = @_; +sub _gtk__Window { &_gtk_any_Window } +sub _gtk__Dialog { &_gtk_any_Window } +sub _gtk_any_Window { + my ($w, $opts, $class) = @_; if (!$w) { - $w = Gtk2::Window->new(delete $opts->{type} || 'toplevel'); + if ($class eq 'Window') { + $w = "Gtk2::$class"->new(delete $opts->{type} || 'toplevel'); + } else { + $w = "Gtk2::$class"->new; + } + $w->set_modal(delete $opts->{modal}) if exists $opts->{modal}; + $w->set_transient_for(delete $opts->{transient_for}) if exists $opts->{transient_for}; $w->set_border_width(delete $opts->{border_width}) if exists $opts->{border_width}; $w->set_shadow_type(delete $opts->{shadow_type}) if exists $opts->{shadow_type}; $w->set_position(delete $opts->{position_policy}) if exists $opts->{position_policy}; @@ -413,22 +421,6 @@ sub _gtk__Window { $w; } -sub _gtk__Dialog { - my ($w, $opts) = @_; - - if (!$w) { - $w = Gtk2::Dialog->new; - - $w->set_modal(delete $opts->{modal}) if exists $opts->{modal}; - $w->set_border_width(delete $opts->{border_width}) if exists $opts->{border_width}; - $w->set_transient_for(delete $opts->{transient_for}) if exists $opts->{transient_for}; - $w->set_position(delete $opts->{position_policy}) if exists $opts->{position_policy}; - } - $w->set_title(delete $opts->{title}) if exists $opts->{title}; - - $w; -} - sub _gtk__FileSelection { my ($w, $opts) = @_; -- cgit v1.2.1