Reorganized the stuff which allows editing the config file when the
authentication server is not found. closes #1658; related to #1627
This commit is contained in:
parent
18ad289b0f
commit
31b06e2911
8 changed files with 183 additions and 45 deletions
|
@ -82,7 +82,10 @@ class OptionsContainer
|
||||||
authenticationPath,
|
authenticationPath,
|
||||||
storageServer,
|
storageServer,
|
||||||
storagePort,
|
storagePort,
|
||||||
storagePath } OptionItemString;
|
storagePath,
|
||||||
|
schedulerServer,
|
||||||
|
schedulerPort,
|
||||||
|
schedulerPath } OptionItemString;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -214,6 +214,24 @@ OptionsContainer :: selectNode(OptionItemString optionItem,
|
||||||
"webStorage/location/@path");
|
"webStorage/location/@path");
|
||||||
isAttribute = true;
|
isAttribute = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case schedulerServer :
|
||||||
|
targetNode = getNode("schedulerClientFactory/"
|
||||||
|
"schedulerDaemonXmlRpcClient/@xmlRpcHost");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case schedulerPort :
|
||||||
|
targetNode = getNode("schedulerClientFactory/"
|
||||||
|
"schedulerDaemonXmlRpcClient/@xmlRpcPort");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case schedulerPath :
|
||||||
|
targetNode = getNode("schedulerClientFactory/"
|
||||||
|
"schedulerDaemonXmlRpcClient/@xmlRpcUri");
|
||||||
|
isAttribute = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return targetNode;
|
return targetNode;
|
||||||
|
|
|
@ -445,17 +445,15 @@ GLiveSupport :: checkConfiguration(void) throw ()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// === NON-FATAL ERRORS ===
|
|
||||||
|
|
||||||
// check if the authentication server is available
|
// check if the authentication server is available
|
||||||
try {
|
try {
|
||||||
authentication->getVersion();
|
authentication->getVersion();
|
||||||
authenticationAvailable = true;
|
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
authenticationAvailable = false;
|
displayAuthenticationServerMissingMessage();
|
||||||
displayMessageWindow(getResourceUstring(authenticationNotReachableKey));
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// === NON-FATAL ERRORS ===
|
||||||
|
|
||||||
// check if the storage server is available
|
// check if the storage server is available
|
||||||
try {
|
try {
|
||||||
|
@ -488,10 +486,10 @@ LiveSupport :: GLiveSupport ::
|
||||||
GLiveSupport :: displayMessageWindow(Ptr<Glib::ustring>::Ref message)
|
GLiveSupport :: displayMessageWindow(Ptr<Glib::ustring>::Ref message)
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
DialogWindow * window = widgetFactory->createDialogWindow(message,
|
Ptr<DialogWindow>::Ref window(widgetFactory->createDialogWindow(
|
||||||
getBundle());
|
message,
|
||||||
|
getBundle()));
|
||||||
window->run();
|
window->run();
|
||||||
delete window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1635,3 +1633,47 @@ GLiveSupport :: uploadToHub(Ptr<Playable>::Ref playable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Display a message that the authentication server is not available.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LiveSupport :: GLiveSupport ::
|
||||||
|
GLiveSupport :: displayAuthenticationServerMissingMessage(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<Glib::ustring>::Ref message;
|
||||||
|
try {
|
||||||
|
message = getResourceUstring("authenticationNotReachableMsg");
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "authentication not available -- would you like to edit the options?"
|
||||||
|
Ptr<DialogWindow>::Ref question(widgetFactory->createDialogWindow(
|
||||||
|
message,
|
||||||
|
getBundle(),
|
||||||
|
DialogWindow::noButton
|
||||||
|
| DialogWindow::yesButton ));
|
||||||
|
DialogWindow::ButtonType answer = question->run();
|
||||||
|
|
||||||
|
if (answer == DialogWindow::yesButton) {
|
||||||
|
Ptr<ResourceBundle>::Ref bundle;
|
||||||
|
try {
|
||||||
|
bundle = getBundle("optionsWindow");
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<OptionsWindow>::Ref optionsWindow(new OptionsWindow(
|
||||||
|
shared_from_this(),
|
||||||
|
bundle,
|
||||||
|
0));
|
||||||
|
optionsWindow->run();
|
||||||
|
|
||||||
|
if (optionsContainer->isTouched()) {
|
||||||
|
optionsContainer->writeToFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,11 +327,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
*/
|
*/
|
||||||
Ptr<OptionsContainer>::Ref optionsContainer;
|
Ptr<OptionsContainer>::Ref optionsContainer;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the authentication component is available.
|
|
||||||
*/
|
|
||||||
bool authenticationAvailable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the storage component is available.
|
* Whether the storage component is available.
|
||||||
*/
|
*/
|
||||||
|
@ -342,6 +337,13 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
*/
|
*/
|
||||||
bool schedulerAvailable;
|
bool schedulerAvailable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a message that the authentication server is not available.
|
||||||
|
* And offer a chance to edit the options to fix it.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
displayAuthenticationServerMissingMessage(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -1174,15 +1176,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
void
|
void
|
||||||
loadWindowContents(ContentsStorable * window) throw ();
|
loadWindowContents(ContentsStorable * window) throw ();
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether the authentication component is available.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
isAuthenticationAvailable(void) throw()
|
|
||||||
{
|
|
||||||
return authenticationAvailable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the storage component is available.
|
* Return whether the storage component is available.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -311,6 +311,7 @@ MasterPanelWindow :: changeLanguage(Ptr<ResourceBundle>::Ref bundle)
|
||||||
Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
|
Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
|
||||||
5, 0);
|
5, 0);
|
||||||
|
|
||||||
|
if (gLiveSupport->isStorageAvailable()) {
|
||||||
// re-bind events to the buttons
|
// re-bind events to the buttons
|
||||||
liveModeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
liveModeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
&MasterPanelWindow::onLiveModeButtonClicked));
|
&MasterPanelWindow::onLiveModeButtonClicked));
|
||||||
|
@ -325,6 +326,16 @@ MasterPanelWindow :: changeLanguage(Ptr<ResourceBundle>::Ref bundle)
|
||||||
&MasterPanelWindow::onSchedulerButtonClicked));
|
&MasterPanelWindow::onSchedulerButtonClicked));
|
||||||
searchButton->signal_clicked().connect(sigc::mem_fun(*this,
|
searchButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
&MasterPanelWindow::onSearchButtonClicked));
|
&MasterPanelWindow::onSearchButtonClicked));
|
||||||
|
} else {
|
||||||
|
// gray out all the buttons except Options
|
||||||
|
liveModeButton->set_sensitive(false);
|
||||||
|
uploadFileButton->set_sensitive(false);
|
||||||
|
scratchpadButton->set_sensitive(false);
|
||||||
|
simplePlaylistMgmtButton->set_sensitive(false);
|
||||||
|
schedulerButton->set_sensitive(false);
|
||||||
|
searchButton->set_sensitive(false);
|
||||||
|
}
|
||||||
|
|
||||||
optionsButton->signal_clicked().connect(sigc::mem_fun(*this,
|
optionsButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
&MasterPanelWindow::onOptionsButtonClicked));
|
&MasterPanelWindow::onOptionsButtonClicked));
|
||||||
}
|
}
|
||||||
|
@ -645,6 +656,7 @@ MasterPanelWindow :: showAnonymousUI(void) throw ()
|
||||||
simplePlaylistMgmtButton->hide();
|
simplePlaylistMgmtButton->hide();
|
||||||
schedulerButton->hide();
|
schedulerButton->hide();
|
||||||
searchButton->hide();
|
searchButton->hide();
|
||||||
|
optionsButton->hide();
|
||||||
|
|
||||||
if (liveModeWindow.get()) {
|
if (liveModeWindow.get()) {
|
||||||
if (liveModeWindow->is_visible()) {
|
if (liveModeWindow->is_visible()) {
|
||||||
|
|
|
@ -163,9 +163,8 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
|
||||||
// show everything
|
// show everything
|
||||||
set_name(windowName);
|
set_name(windowName);
|
||||||
set_default_size(700, 450);
|
set_default_size(700, 500);
|
||||||
set_modal(false);
|
set_modal(false);
|
||||||
property_window_position().set_value(Gtk::WIN_POS_NONE);
|
|
||||||
|
|
||||||
show_all_children();
|
show_all_children();
|
||||||
}
|
}
|
||||||
|
@ -677,10 +676,56 @@ OptionsWindow :: constructServersSection(void) throw ()
|
||||||
storageTable->attach(*storagePortEntry, 2, 3, 1, 2);
|
storageTable->attach(*storagePortEntry, 2, 3, 1, 2);
|
||||||
storageTable->attach(*storagePathEntry, 2, 3, 2, 3);
|
storageTable->attach(*storagePathEntry, 2, 3, 2, 3);
|
||||||
|
|
||||||
|
// the settings for the scheduler
|
||||||
|
Gtk::Table * schedulerTable = Gtk::manage(new Gtk::Table);
|
||||||
|
schedulerTable->set_row_spacings(5);
|
||||||
|
schedulerTable->set_col_spacings(5);
|
||||||
|
|
||||||
|
Gtk::Label * schedulerLabel;
|
||||||
|
Gtk::Label * schedulerServerLabel;
|
||||||
|
Gtk::Label * schedulerPortLabel;
|
||||||
|
Gtk::Label * schedulerPathLabel;
|
||||||
|
try {
|
||||||
|
schedulerLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("schedulerLabel") ));
|
||||||
|
schedulerServerLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("serverLabel") ));
|
||||||
|
schedulerPortLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("portLabel") ));
|
||||||
|
schedulerPathLabel = Gtk::manage(new Gtk::Label(
|
||||||
|
*getResourceUstring("pathLabel") ));
|
||||||
|
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
// TODO: signal error
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
schedulerTable->attach(*schedulerLabel,
|
||||||
|
0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 5, 0);
|
||||||
|
schedulerTable->attach(*schedulerServerLabel,
|
||||||
|
1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
schedulerTable->attach(*schedulerPortLabel,
|
||||||
|
1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
schedulerTable->attach(*schedulerPathLabel,
|
||||||
|
1, 2, 2, 3, Gtk::SHRINK, Gtk::SHRINK);
|
||||||
|
|
||||||
|
EntryBin * schedulerServerEntry = createEntry(
|
||||||
|
OptionsContainer::schedulerServer);
|
||||||
|
EntryBin * schedulerPortEntry = createEntry(
|
||||||
|
OptionsContainer::schedulerPort);
|
||||||
|
EntryBin * schedulerPathEntry = createEntry(
|
||||||
|
OptionsContainer::schedulerPath);
|
||||||
|
|
||||||
|
schedulerTable->attach(*schedulerServerEntry, 2, 3, 0, 1);
|
||||||
|
schedulerTable->attach(*schedulerPortEntry, 2, 3, 1, 2);
|
||||||
|
schedulerTable->attach(*schedulerPathEntry, 2, 3, 2, 3);
|
||||||
|
|
||||||
// make a new box and pack the components into it
|
// make a new box and pack the components into it
|
||||||
Gtk::VBox * section = Gtk::manage(new Gtk::VBox);
|
Gtk::VBox * section = Gtk::manage(new Gtk::VBox);
|
||||||
section->pack_start(*authenticationTable, Gtk::PACK_SHRINK, 10);
|
section->pack_start(*authenticationTable, Gtk::PACK_SHRINK, 10);
|
||||||
section->pack_start(*storageTable, Gtk::PACK_SHRINK, 10);
|
section->pack_start(*storageTable, Gtk::PACK_SHRINK, 10);
|
||||||
|
section->pack_start(*schedulerTable, Gtk::PACK_SHRINK, 10);
|
||||||
|
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
@ -867,3 +912,16 @@ OptionsWindow :: resetEditedKeyBinding(void) throw ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Show the window and return when the user hides it.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
OptionsWindow :: run(void) throw ()
|
||||||
|
{
|
||||||
|
mainNotebook->activatePage(2); // "Servers"
|
||||||
|
property_window_position().set_value(Gtk::WIN_POS_CENTER_ALWAYS);
|
||||||
|
show_all();
|
||||||
|
Gtk::Main::run(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -409,6 +409,14 @@ class OptionsWindow : public GuiWindow
|
||||||
{
|
{
|
||||||
return backupView ? backupView->getBackupList() : 0;
|
return backupView ? backupView->getBackupList() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the window and return when the user hides it.
|
||||||
|
* This is used by GLiveSupport when the authentication server
|
||||||
|
* address is wrong. It opens the window to the "Servers" tab.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
run(void) throw ();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
/* ================================================= external data structures */
|
||||||
|
|
|
@ -21,11 +21,14 @@ root:table
|
||||||
elapsedTimeLabel:string { "elapsed" }
|
elapsedTimeLabel:string { "elapsed" }
|
||||||
remainingTimeLabel:string { "remaining" }
|
remainingTimeLabel:string { "remaining" }
|
||||||
|
|
||||||
localeNotAvailableMsg:string { "Locale {0} not available" }
|
localeNotAvailableMsg:string { "Locale {0} is not available." }
|
||||||
schedulerNotReachableMsg:string { "Scheduler server not available" }
|
schedulerNotReachableMsg:string { "The scheduler server is not available." }
|
||||||
storageNotReachableMsg:string { "Storage server not available" }
|
storageNotReachableMsg:string { "The storage server is not available." }
|
||||||
authenticationNotReachableMsg:string
|
authenticationNotReachableMsg:string
|
||||||
{ "Authentication server not available" }
|
{ "The authentication server is not "
|
||||||
|
"available.\n"
|
||||||
|
"Would you like to edit the server "
|
||||||
|
"settings?" }
|
||||||
audioErrorMsg { "Audio player error: " }
|
audioErrorMsg { "Audio player error: " }
|
||||||
sureToExitMsg:string { "Are you sure you want to exit?" }
|
sureToExitMsg:string { "Are you sure you want to exit?" }
|
||||||
|
|
||||||
|
@ -283,6 +286,7 @@ root:table
|
||||||
|
|
||||||
authenticationLabel:string { "Authentication server" }
|
authenticationLabel:string { "Authentication server" }
|
||||||
storageLabel:string { "Storage server" }
|
storageLabel:string { "Storage server" }
|
||||||
|
schedulerLabel:string { "Scheduler server" }
|
||||||
serverLabel:string { "address:" }
|
serverLabel:string { "address:" }
|
||||||
portLabel:string { "port:" }
|
portLabel:string { "port:" }
|
||||||
pathLabel:string { "path:" }
|
pathLabel:string { "path:" }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue