This commit is contained in:
fgerlits 2006-08-14 17:16:57 +00:00
parent 23ea0af3a6
commit c4ff6b2a2d
3 changed files with 38 additions and 3 deletions

View file

@ -115,6 +115,21 @@ SchedulerWindow :: SchedulerWindow (
showContents(); showContents();
show_all_children(); show_all_children();
// set up the dialog window
Ptr<Glib::ustring>::Ref confirmationMessage;
try {
confirmationMessage.reset(new Glib::ustring(
*getResourceUstring("stopCurrentlyPlayingDialogMsg") ));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
dialogWindow.reset(new DialogWindow(confirmationMessage,
DialogWindow::noButton |
DialogWindow::yesButton,
gLiveSupport->getBundle() ));
} }
@ -382,6 +397,18 @@ SchedulerWindow :: onDeleteItem(void) throw ()
void void
SchedulerWindow :: onStopCurrentlyPlayingButtonClicked(void) throw () SchedulerWindow :: onStopCurrentlyPlayingButtonClicked(void) throw ()
{ {
DialogWindow::ButtonType result = dialogWindow->run();
switch (result) {
case DialogWindow::yesButton: break;
case DialogWindow::noButton: return;
break;
// can happen if the window is closed with Alt-F4 -- treated as No
default : return;
break;
}
Ptr<SessionId>::Ref sessionId = gLiveSupport->getSessionId(); Ptr<SessionId>::Ref sessionId = gLiveSupport->getSessionId();
Ptr<SchedulerClientInterface>::Ref Ptr<SchedulerClientInterface>::Ref
scheduler = gLiveSupport->getScheduler(); scheduler = gLiveSupport->getScheduler();
@ -390,7 +417,8 @@ SchedulerWindow :: onStopCurrentlyPlayingButtonClicked(void) throw ()
scheduler->stopCurrentlyPlaying(sessionId); scheduler->stopCurrentlyPlaying(sessionId);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
// TODO: signal error here Ptr<Glib::ustring>::Ref errorMessage(new Glib::ustring(e.what()));
gLiveSupport->displayMessageWindow(errorMessage);
} }
} }

View file

@ -50,6 +50,7 @@
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/DialogWindow.h"
#include "GuiWindow.h" #include "GuiWindow.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
@ -207,6 +208,12 @@ class SchedulerWindow : public GuiWindow
*/ */
Gtk::Button * closeButton; Gtk::Button * closeButton;
/**
* The "are you sure you want to stop the currently playing item?"
* dialog window.
*/
Ptr<DialogWindow>::Ref dialogWindow;
/** /**
* Signal handler for when a date is selected in the calendar. * Signal handler for when a date is selected in the calendar.
*/ */

View file

@ -170,8 +170,8 @@ root:table
stopCurrentlyPlayingText:string stopCurrentlyPlayingText:string
{ "Currently playing in scheduler:" } { "Currently playing in scheduler:" }
stopCurrentlyPlayingButtonLabel:string stopCurrentlyPlayingButtonLabel:string { "Stop" }
{ "Stop" } stopCurrentlyPlayingDialogMsg:string { "Are you sure?" }
closeButtonLabel:string { "Close" } closeButtonLabel:string { "Close" }
} }