[glom] Show correct error message when document could not be loaded from disk
- From: Armin Burgmeier <arminb src gnome org>
- To: svn-commits-list gnome org
- Subject: [glom] Show correct error message when document could not be loaded from disk
- Date: Fri, 26 Jun 2009 14:40:31 +0000 (UTC)
commit 3bff83699f4bc3d89a7103ba3fe419a80f49f8bc
Author: Armin Burgmeier <armin arbur net>
Date: Fri Jun 26 16:26:21 2009 +0200
Show correct error message when document could not be loaded from disk
* glom/libglom/document/bakery/document.h: Document that failure_code
should be >= 1, so that we can detect whether the document could not
be opened because it couldn't be read from disk, or a custom error
code was set.
* glom/libglom/document/document.h: Set the value of
LOAD_FAILURE_CODE_FILE_VERSION_TOO_NEW to 1, to honor the requirement
explained above. This fixes showing the wrong error message when the
document could not be loaded from disk.
ChangeLog | 12 ++++++++++++
glom/libglom/document/bakery/document.h | 6 +++---
glom/libglom/document/document.h | 3 ++-
3 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8f745f8..ec24b08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2009-06-26 Armin Burgmeier <armin openismus com>
+ * glom/libglom/document/bakery/document.h: Document that failure_code
+ should be >= 1, so that we can detect whether the document could not
+ be opened because it couldn't be read from disk, or a custom error
+ code was set.
+
+ * glom/libglom/document/document.h: Set the value of
+ LOAD_FAILURE_CODE_FILE_VERSION_TOO_NEW to 1, to honor the requirement
+ explained above. This fixes showing the wrong error message when the
+ document could not be loaded from disk.
+
+2009-06-26 Armin Burgmeier <armin openismus com>
+
* glom/application.cc (existing_or_new_new): When the new database
could be created successfully, then add the document to the recent
files list.
diff --git a/glom/libglom/document/bakery/document.h b/glom/libglom/document/bakery/document.h
index 5ca2b40..61dbf11 100644
--- a/glom/libglom/document/bakery/document.h
+++ b/glom/libglom/document/bakery/document.h
@@ -47,13 +47,13 @@ public:
/* Loads data from disk, using the URI (set with set_file_uri()) then asks the View to update itself.
* bool indicates success.
- * @param failure_code Used to return a custom error code that is understood by your application.
+ * @param failure_code Used to return a custom error code that is understood by your application. This must be greater than zero.
*/
bool load(int& failure_code);
/* Loads data from disk, using the URI (set with set_file_uri()) then asks the View to update itself.
* bool indicates success.
- * @param failure_code Used to return a custom error code that is understood by your application.
+ * @param failure_code Used to return a custom error code that is understood by your application. This must be greater than zero.
*/
bool load_from_data(const guchar* data, std::size_t length, int& failure_code);
@@ -111,7 +111,7 @@ protected:
/** overrideable.
* Does anything which should be done after the data has been loaded from disk, but before updating the View.
- * @param failure_code Used to return a custom error code that is understood by your application.
+ * @param failure_code Used to return a custom error code that is understood by your application. This must be greater than zero.
*/
virtual bool load_after(int& failure_code);
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index 9d1dad8..e2d4274 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -439,7 +439,8 @@ public:
/// Failure codes that could be returned by load_after()
enum load_failure_codes
{
- LOAD_FAILURE_CODE_FILE_VERSION_TOO_NEW
+ // The error codes must start at 1, so do that here:
+ LOAD_FAILURE_CODE_FILE_VERSION_TOO_NEW = 1
};
private:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]