diff options
Diffstat (limited to 'rhimport')
-rwxr-xr-x | rhimport | 45 |
1 files changed, 37 insertions, 8 deletions
@@ -220,12 +220,19 @@ sub start_import_gui() exit 2; } + my $b_apply = $guixml->get_widget('b_apply'); + my $b_close = $guixml->get_widget('b_close'); + $b_apply->set_sensitive(0); + $b_close->set_sensitive(0); + if(!rhimport::check_key_file()) { my $parent_window = $guixml->get_widget('appwin'); my $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent', 'error', 'ok', "Es wurde kein Import Key gefunden."); $dialog->run; $dialog->destroy; + $b_apply->set_sensitive(1); + $b_close->set_sensitive(1); return 0; } @@ -239,6 +246,8 @@ sub start_import_gui() } else { $l_status->set_label("Keine Audio Datei ausgewählt!"); } + $b_apply->set_sensitive(1); + $b_close->set_sensitive(1); return 0; } $filechooser->unselect_all; @@ -255,18 +264,34 @@ 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, $gui_progress_cb); + $log = rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb); } - ($ret, $log) = rhimport::import_playlist($file, $dropbox, $gui_progress_cb, $gui_error_cb); + my $import_log; + ($ret, $import_log) = rhimport::import_playlist($file, $dropbox, $gui_progress_cb, $gui_error_cb); + $log .= $import_log; } else { - rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb); - ($ret, $log) = rhimport::import_single($file, $dropbox, $gui_progress_cb, $gui_error_cb); + $log = rhimport::clear_carts($dbh, $group, $to_cart, $gui_progress_cb); + my $import_log; + ($ret, $import_log) = rhimport::import_single($file, $dropbox, $gui_progress_cb, $gui_error_cb); + $log .= $import_log; } + my $parent_window = $guixml->get_widget('appwin'); + my $dialog; if(!$ret) { $l_status->set_label("Fehler beim Importieren"); + $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent', + 'error', 'ok', "Fehler beim Importieren."); + } else { + $l_status->set_label(""); + $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent', + 'info', 'ok', "Der Import wurde erfolgreich abgeschlossen!"); } + $dialog->run; + $dialog->destroy; + $b_apply->set_sensitive(1); + $b_close->set_sensitive(1); return $ret; } @@ -405,13 +430,17 @@ my $ret; my $log; if($POOL) { if(!$KEEPCARTS) { - rhimport::clear_carts($dbh, $group, $to_cart); + $log = rhimport::clear_carts($dbh, $group, $to_cart); } - ($ret, $log) = rhimport::import_playlist($FILE, $DROPBOX, 0, $cl_error_cb); + my $import_log; + ($ret, $import_log) = rhimport::import_playlist($FILE, $DROPBOX, 0, $cl_error_cb); + $log .= $import_log; } else { - rhimport::clear_carts($dbh, $group, $to_cart); - ($ret, $log) = rhimport::import_single($FILE, $DROPBOX, 0); + $log = rhimport::clear_carts($dbh, $group, $to_cart); + my $import_log; + ($ret, $import_log) = rhimport::import_single($FILE, $DROPBOX, 0); + $log .= $import_log; } $dbh->disconnect(); |