From d6ff970c44ce7488f138a1cee3515b48c383d299 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 29 Mar 2010 07:22:26 +0000 Subject: added warning to mode selection git-svn-id: https://svn.helsinki.at/rhimport/trunk@29 7c65635b-ec39-4f67-a626-873dbafdd612 diff --git a/rhimport b/rhimport index c28d013..0b69652 100755 --- a/rhimport +++ b/rhimport @@ -137,10 +137,42 @@ sub set_mode_file_gui() sub toggle_mode_gui() { - if($POOL) { - set_mode_file_gui(); - } else { - set_mode_playlist_gui(); + if(!$guixml) { + print STDERR "no GUI definition found!\n"; + exit 0; + } + + my $co_dropbox = $guixml->get_widget('co_dropbox'); + my $to_cart = $allowed_dbs[$co_dropbox->get_active]->{'TO_CART'}; + + my $response = 'no'; + if(($to_cart == 0 && $POOL) || + ($to_cart != 0 && !$POOL)) { + my $question = "Diese Sendung hat "; + if($to_cart != 0) { + $question .= "nur ein Cart"; + } else { + $question .= "mehrere Carts"; + } + $question .= ". Soll der Modus trotzdem gewechselt werden?"; + + my $parent_window = $guixml->get_widget('appwin'); + my $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent', + 'question', 'yes-no', $question); + $dialog->set_default_response ('no'); + $response = $dialog->run; + $dialog->destroy; + } + else { + $response = 'yes'; + } + + if($response eq 'yes') { + if($POOL) { + set_mode_file_gui(); + } else { + set_mode_playlist_gui(); + } } } -- cgit v0.10.2