[the-board] [ui] Use actions to set current page from ToolBoxPages
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Use actions to set current page from ToolBoxPages
- Date: Tue, 8 Feb 2011 00:09:54 +0000 (UTC)
commit e87d69b897cc13d257010637754d9e60d0d1a844
Author: Lucas Rocha <lucasr gnome org>
Date: Mon Feb 7 23:50:15 2011 +0000
[ui] Use actions to set current page from ToolBoxPages
src/js/ui/mainWindow.js | 9 +++++++--
src/js/ui/toolBoxPages.js | 11 +++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index da1dcfa..5f569cb 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -618,6 +618,12 @@ MainWindow.prototype = {
onComplete: Lang.bind(this, onComplete) });
},
+ _doAction : function(actionName, actionArgs) {
+ if (actionName == "setCurrentPage") {
+ this.setCurrentPage(actionArgs.pageModel);
+ }
+ },
+
_quitApp : function() {
let onModelSaved = function() {
this._setSavingOldCurrentPage(false);
@@ -668,8 +674,7 @@ MainWindow.prototype = {
_onToolbarAction : function(toolbar, actionName, actionArgs) {
if (toolbar == this._mainToolbar) {
- // FIXME: convert main toolbox group to use actions
- // instead of internally hardcoded handlers
+ this._doAction(actionName, actionArgs);
return;
}
diff --git a/src/js/ui/toolBoxPages.js b/src/js/ui/toolBoxPages.js
index e77b711..56477ef 100644
--- a/src/js/ui/toolBoxPages.js
+++ b/src/js/ui/toolBoxPages.js
@@ -350,14 +350,21 @@ ToolBoxPages.prototype = {
let pageManager = this._context.pageManager;
let newPageModel = pageManager.addPageModel();
- this._context.mainWindow.setCurrentPage(newPageModel);
+
+ this.emit("action",
+ "setCurrentPage",
+ { pageModel: newPageModel });
+
this.setCurrentPage(newPageModel);
this._startEditingTitle();
},
_onPageButtonClicked : function(pageButton) {
- this._context.mainWindow.setCurrentPage(pageButton.pageModel);
+ this.emit("action",
+ "setCurrentPage",
+ { pageModel: pageButton.pageModel });
+
this.setCurrentPage(pageButton.pageModel);
this._hidePagesList();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]