From 2dcad8b8dd3e13db62e7de20293c5369dc5e9445 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 4 May 2009 05:20:54 +0000 Subject: Implement warning of prior errors. (bzr r7817) --- src/preferences.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/preferences.cpp') diff --git a/src/preferences.cpp b/src/preferences.cpp index a6409b5ba..071dbf91e 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -54,7 +54,8 @@ Preferences::Preferences() : _prefs_filename(""), _prefs_doc(0), _errorHandler(0), - _writable(false) + _writable(false), + _hasError(false) { // profile_path essentailly returns the argument prefixed by the profile directory. gchar *path = profile_path(NULL); @@ -224,6 +225,21 @@ void Preferences::save() sp_repr_save_file(_prefs_doc, utf8name.data()); } +bool Preferences::getLastError( Glib::ustring& primary, Glib::ustring& secondary ) +{ + bool result = _hasError; + if ( _hasError ) { + primary = _lastErrPrimary; + secondary = _lastErrSecondary; + _hasError = false; + _lastErrPrimary.clear(); + _lastErrSecondary.clear(); + } else { + primary.clear(); + secondary.clear(); + } + return result; +} // Now for the meat. @@ -610,6 +626,9 @@ void Preferences::_keySplit(Glib::ustring const &pref_path, Glib::ustring &node_ void Preferences::_reportError(Glib::ustring const &msg, Glib::ustring const &secondary) { + _hasError = true; + _lastErrPrimary = msg; + _lastErrSecondary = secondary; if (_errorHandler) { _errorHandler->handleError(msg, secondary); } -- cgit v1.2.3