summaryrefslogtreecommitdiff
path: root/rhimport
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-04-12 14:23:11 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-04-12 14:23:11 (GMT)
commitfab3db99c09a2b452fb9cc9da4d9201a393ec7ea (patch)
treed101727f1ddea2113d86a40b352d3e65fc944f61 /rhimport
parent08110a869ce2a4d14ccf5414f9d3057348c8d4f5 (diff)
added gui error callback (not working yet)
added progress callback to clear carts
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");
}