diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-08-27 17:49:46 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2014-09-05 06:47:51 +0200 |
commit | a3bcda98b48834cbdcc0404c1a634bac78c01d99 (patch) | |
tree | 98be035c31730f936dbf4f92474680c0e1e037f3 | |
parent | a7c54188c5a236a07bc6aeb504f1b384960f802d (diff) | |
download | urpmi-a3bcda98b48834cbdcc0404c1a634bac78c01d99.tar urpmi-a3bcda98b48834cbdcc0404c1a634bac78c01d99.tar.gz urpmi-a3bcda98b48834cbdcc0404c1a634bac78c01d99.tar.bz2 urpmi-a3bcda98b48834cbdcc0404c1a634bac78c01d99.tar.xz urpmi-a3bcda98b48834cbdcc0404c1a634bac78c01d99.zip |
fix crashing when choosing to save file
aka port from FileSelection to FileChooser
(FileSelection no more exists in Gtk3...)
-rw-r--r-- | NEWS | 1 | ||||
-rwxr-xr-x | gurpmi | 15 |
2 files changed, 9 insertions, 7 deletions
@@ -3,6 +3,7 @@ improves installing gnome in a chroot from 14m to 11m - update bash completion - gurpmi: + o fix crashing when choosing to save file o fix segfaulting when managing exceptions o report crashes through drakbug - fix some warnings with perl 5.20 @@ -18,7 +18,7 @@ use utf8 'valid'; use Encode '_utf8_on'; use Gtk3; use gurpmi; -use urpm::util 'basename'; +use urpm::util qw(basename member); # For other distros w/o exception support: eval { Glib->enable_exceptions3 }; @@ -123,19 +123,20 @@ Proceed?", all_descriptions(@all_rpms)) proceed(); }); $save_button and $save_button->signal_connect(clicked => sub { - my $file_dialog = Gtk3::FileSelection->new(N("Choose location to save file")); + my $file_dialog = Gtk3::FileChooserDialog->new(N("Choose location to save file"), $mainw, 'select_folder', N("Cancel") => 'cancel', N("Ok") => 'ok'); $file_dialog->set_modal(1); $file_dialog->set_position('center'); my $filename = @$srpms > 0 ? $srpms->[0] : $rpms->[0]; $file_dialog->set_filename($filename); - $file_dialog->hide_fileop_buttons; - $file_dialog->ok_button->signal_connect(clicked => sub { + $file_dialog->show; + my $answer = $file_dialog->run; + if (member($answer, qw(apply ok yes))) { my $location = $file_dialog->get_filename; quit(); $location and exec '/bin/mv', '-f', $filename, $location; - }); - $file_dialog->cancel_button->signal_connect(clicked => \&quit); - $file_dialog->show; + } elsif (member($answer, qw(cancel delete-event))) { + quit(); + } }); $ccel_button->signal_connect(clicked => \&cancel_n_quit); add_button_box($mainbox, grep { defined $_ } $inst_button, $save_button, $ccel_button); |