renamed the 'changed' variable in the OptionsContainer to the more descriptive 'touched';
removed the unused variable 'isChanged' from the OptionsWindow
This commit is contained in:
parent
29c3c2b045
commit
bf448e90e1
5 changed files with 12 additions and 19 deletions
|
@ -97,9 +97,9 @@ class OptionsContainer
|
||||||
Ptr<const Glib::ustring>::Ref configFileName;
|
Ptr<const Glib::ustring>::Ref configFileName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remember if we have been changed.
|
* Remember if we have been touched.
|
||||||
*/
|
*/
|
||||||
bool changed;
|
bool touched;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
|
@ -172,17 +172,17 @@ class OptionsContainer
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report if the object has been changed.
|
* Report if the object has been touched.
|
||||||
*
|
*
|
||||||
* It returns true if there has been any calls to setOptionItem()
|
* It returns true if there has been any calls to setOptionItem()
|
||||||
* since its construction or the last call to writeToFile().
|
* since its construction or the last call to writeToFile().
|
||||||
*
|
*
|
||||||
* @return whether the options have been changed
|
* @return whether the options have been touched
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
isChanged(void) throw ()
|
isTouched(void) throw ()
|
||||||
{
|
{
|
||||||
return changed;
|
return touched;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ OptionsContainer :: OptionsContainer(
|
||||||
Ptr<const Glib::ustring>::Ref configFileName)
|
Ptr<const Glib::ustring>::Ref configFileName)
|
||||||
throw ()
|
throw ()
|
||||||
: configFileName(configFileName),
|
: configFileName(configFileName),
|
||||||
changed(false)
|
touched(false)
|
||||||
{
|
{
|
||||||
optionsDocument.create_root_node_by_import(&optionsElement, true);
|
optionsDocument.create_root_node_by_import(&optionsElement, true);
|
||||||
// true == recursive
|
// true == recursive
|
||||||
|
@ -83,14 +83,14 @@ OptionsContainer :: setOptionItem(OptionItemString optionItem,
|
||||||
xmlpp::Attribute * attr = dynamic_cast<xmlpp::Attribute*>(targetNode);
|
xmlpp::Attribute * attr = dynamic_cast<xmlpp::Attribute*>(targetNode);
|
||||||
if (attr != 0) {
|
if (attr != 0) {
|
||||||
attr->set_value(*value);
|
attr->set_value(*value);
|
||||||
changed = true;
|
touched = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xmlpp::TextNode * text = dynamic_cast<xmlpp::TextNode*>(targetNode);
|
xmlpp::TextNode * text = dynamic_cast<xmlpp::TextNode*>(targetNode);
|
||||||
if (text != 0) {
|
if (text != 0) {
|
||||||
text->set_content(*value);
|
text->set_content(*value);
|
||||||
changed = true;
|
touched = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ OptionsContainer :: setKeyboardShortcutItem(
|
||||||
xmlpp::Attribute * attr = dynamic_cast<xmlpp::Attribute*>(targetNode);
|
xmlpp::Attribute * attr = dynamic_cast<xmlpp::Attribute*>(targetNode);
|
||||||
if (attr != 0) {
|
if (attr != 0) {
|
||||||
attr->set_value(*value);
|
attr->set_value(*value);
|
||||||
changed = true;
|
touched = true;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -274,7 +274,7 @@ OptionsContainer :: writeToFile(void) throw ()
|
||||||
std::ofstream file(configFileName->c_str());
|
std::ofstream file(configFileName->c_str());
|
||||||
if (file.good()) {
|
if (file.good()) {
|
||||||
optionsDocument.write_to_stream_formatted(file, "utf-8");
|
optionsDocument.write_to_stream_formatted(file, "utf-8");
|
||||||
changed = false;
|
touched = false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -570,7 +570,7 @@ GLiveSupport :: logout(void) throw ()
|
||||||
authentication->logout(sessionId);
|
authentication->logout(sessionId);
|
||||||
sessionId.reset();
|
sessionId.reset();
|
||||||
|
|
||||||
if (optionsContainer->isChanged()) {
|
if (optionsContainer->isTouched()) {
|
||||||
optionsContainer->writeToFile();
|
optionsContainer->writeToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,6 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
LocalizedObject(bundle),
|
LocalizedObject(bundle),
|
||||||
gLiveSupport(gLiveSupport)
|
gLiveSupport(gLiveSupport)
|
||||||
{
|
{
|
||||||
isChanged = false;
|
|
||||||
|
|
||||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -137,11 +137,6 @@ class OptionsWindow : public WhiteWindow, public LocalizedObject
|
||||||
*/
|
*/
|
||||||
Ptr<GLiveSupport>::Ref gLiveSupport;
|
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||||
|
|
||||||
/**
|
|
||||||
* Signals if any changes have been made.
|
|
||||||
*/
|
|
||||||
bool isChanged;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new user entry field item.
|
* Create a new user entry field item.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue