diff options
author | Christian Pointner <equinox@helsinki.at> | 2010-04-12 14:23:11 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2010-04-12 14:23:11 (GMT) |
commit | fab3db99c09a2b452fb9cc9da4d9201a393ec7ea (patch) | |
tree | d101727f1ddea2113d86a40b352d3e65fc944f61 /rhimport | |
parent | 08110a869ce2a4d14ccf5414f9d3057348c8d4f5 (diff) |
added gui error callback (not working yet)
added progress callback to clear carts
Diffstat (limited to 'rhimport')
-rwxr-xr-x | rhimport | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -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"); } |