diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-02-15 16:35:17 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-02-15 16:35:17 +0000 |
commit | 604deb114bf992137e1027980f8d94edd734e250 (patch) | |
tree | cc36aa066e184eb288b4a9052d6b3b51a56bf2c7 /perl-install | |
parent | 709dfb77c4ae0fd89a2255e3c7bed8248fcc697a (diff) | |
download | drakx-604deb114bf992137e1027980f8d94edd734e250.tar drakx-604deb114bf992137e1027980f8d94edd734e250.tar.gz drakx-604deb114bf992137e1027980f8d94edd734e250.tar.bz2 drakx-604deb114bf992137e1027980f8d94edd734e250.tar.xz drakx-604deb114bf992137e1027980f8d94edd734e250.zip |
add FileChooser creation and rollback ugly ->run thing (hopefully now unneeded)
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/mygtk2.pm | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index c1dcb2b0c..e45994098 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -501,6 +501,28 @@ sub _gtk__FileSelection { $w; } +sub _gtk__FileChooser { + my ($w, $opts) = @_; + + #- no nice way to have a {file_ref} on a FileChooser since selection_changed only works for browsing, not file/folder creation + + if (!$w) { + my $action = delete $opts->{action} || internal_error("missing action for FileChooser"); + $w = Gtk2::FileChooserWidget->new($action); + + my $file = $opts->{file} && delete $opts->{file}; + + if (my $dir = delete $opts->{directory} || $file && dirname($file)) { + $w->set_current_folder($dir); + } + if ($file) { + my $meth = $action =~ /save|create/ ? 'set_current_name' : 'set_filename'; + $w->$meth($file); + } + } + $w; +} + sub _gtk__VBox { &_gtk_any_Box } sub _gtk__HBox { &_gtk_any_Box } sub _gtk_any_Box { @@ -816,13 +838,7 @@ sub main { my $destroyed; $window->signal_connect(destroy => sub { $destroyed = 1 }); $window->show; - do { - if ($window->isa('Gtk2::FileSelection')) { - $window->run; - } else { - Gtk2->main; - } - } while (!$destroyed && $o_verif && !$o_verif->()); + do { Gtk2->main } while (!$destroyed && $o_verif && !$o_verif->()); may_destroy($window); flush(); } |