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)
commit10f8c9198930c806fc01d1ca3e4efcf9a6c607d8 (patch)
treed101727f1ddea2113d86a40b352d3e65fc944f61 /rhimport
parenta1870821bb62b7a4379276798f11e43b33ce0d0e (diff)
added gui error callback (not working yet)
added progress callback to clear carts git-svn-id: https://svn.helsinki.at/rhimport/trunk@38 7c65635b-ec39-4f67-a626-873dbafdd612
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");
}