[the-board] [model] Use wrapper for g_file_load_contents_finish()
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [model] Use wrapper for g_file_load_contents_finish()
- Date: Tue, 12 Apr 2011 21:56:29 +0000 (UTC)
commit 2e88494c62c47c70b0a02a9f9db78f7f267bc62e
Author: Lucas Rocha <lucasr gnome org>
Date: Tue Apr 12 22:54:10 2011 +0100
[model] Use wrapper for g_file_load_contents_finish()
Fixes this JS exception (on app startup):
JS ERROR: !!! Exception was: Error: FIXME: Only supporting zero-terminated ARRAYs
JS ERROR: !!! lineNumber = '0'
JS ERROR: !!! fileName = 'gjs_throw'
JS ERROR: !!! stack = '("FIXME: Only supporting zero-terminated ARRAYs")@gjs_throw:0
([object _private_GObject_GLocalFile],[object_private_Gio_SimpleAsyncResult])@/usr/share/the-board/js/model/pageModel.js:148
([object _private_GObject_GLocalFile],[object_private_Gio_SimpleAsyncResult])@/usr/share/gjs-1.0/lang.js:110run()@/usr/share/the-board/js/ui/main.js:21 main c:2
src/js/model/pageModel.js | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/js/model/pageModel.js b/src/js/model/pageModel.js
index 8815ef3..d3bdeeb 100644
--- a/src/js/model/pageModel.js
+++ b/src/js/model/pageModel.js
@@ -144,18 +144,20 @@ PageModel.prototype = {
_onLoadContentsAsync : function(file, result, data) {
log('PageModel: file.load_contents_finish()');
- let [success, content, length, etagOut] =
- file.load_contents_finish(result);
- // discard cancellable
- delete this._contentLoadingCancellable;
+ let content = "";
- if (!success) {
+ try {
+ content = TheBoard.g_file_load_contents_finish(file, result);
+ } catch(e) {
// FIXME: report io error in some way
log('PageModel: failed to read file');
return;
}
+ // discard cancellable
+ delete this._contentLoadingCancellable;
+
try {
let newContent = JSON.JSON.parse(content);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]