summaryrefslogtreecommitdiff
path: root/rhimport
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport')
-rwxr-xr-xrhimport28
1 files changed, 24 insertions, 4 deletions
diff --git a/rhimport b/rhimport
index 15a030b..e25a1d3 100755
--- a/rhimport
+++ b/rhimport
@@ -192,6 +192,26 @@ my $gui_progress_cb = sub {
Gtk2::Gdk->flush;
};
+my $gui_error_cb = sub {
+ my ($text) = @_;
+
+ if(!$guixml) {
+ print STDERR "no GUI definition found!\n";
+ exit 2;
+ }
+ $text . "\n\nVorgang abbrechen?";
+ my $parent_window = $guixml->get_widget('appwin');
+ my $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent',
+ 'error', 'yes-no', $text);
+ $dialog->set_default_response ('no');
+ my $response = $dialog->run;
+ $dialog->destroy;
+
+ return 0 if($response eq 'yes');
+
+ return 1;
+};
+
sub start_import_gui()
{
if(!$guixml) {
@@ -224,14 +244,14 @@ sub start_import_gui()
if($POOL) {
my $cb_clear_carts = $guixml->get_widget('cb_clear_carts');
if($cb_clear_carts->get_active) {
- rhimport::clear_carts($dbh, $group, $to_cart);
+ rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb);
}
- $ret = rhimport::import_playlist($file, $dropbox, $gui_progress_cb);
+ $ret = rhimport::import_playlist($file, $dropbox, $gui_progress_cb, $gui_error_cb);
} else {
- $ret = rhimport::import_single($file, $dropbox, $gui_progress_cb);
+ $ret = rhimport::import_single($file, $dropbox, $gui_progress_cb, $gui_error_cb);
}
- if($ret) {
+ if(!$ret) {
$l_status->set_label("Fehler beim Importieren");
}