[the-board] [ui] Change MainWindow to listen to actions from ToolBoxGroup
- From: Lucas Almeida Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Change MainWindow to listen to actions from ToolBoxGroup
- Date: Sun, 7 Nov 2010 23:21:20 +0000 (UTC)
commit f22b5ee164f917013db14722759d25c8acebe527
Author: Lucas Rocha <lucasr gnome org>
Date: Sun Nov 7 21:40:21 2010 +0000
[ui] Change MainWindow to listen to actions from ToolBoxGroup
src/js/ui/mainWindow.js | 21 +++++++++++++++++++++
src/js/ui/thing.js | 4 ++++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index c57a9b3..95d85ad 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -324,6 +324,9 @@ MainWindow.prototype = {
if (this._activeToolBoxGroup) {
this._activeToolBoxGroup.disconnect(this._toolBoxGroupActiveChangedId);
delete this._toolBoxGroupActiveChangedId;
+
+ this._activeToolBoxGroup.disconnect(this._toolBoxGroupActionId);
+ delete this._toolBoxGroupActionId;
}
this._activeToolBoxGroup = activeToolBoxGroup;
@@ -333,6 +336,11 @@ MainWindow.prototype = {
this._activeToolBoxGroup.connect("active-changed",
Lang.bind(this,
this._onToolBoxGroupActiveChanged));
+
+ this._toolBoxGroupActionId =
+ this._activeToolBoxGroup.connect("action",
+ Lang.bind(this,
+ this._onToolBoxGroupAction));
}
},
@@ -595,6 +603,19 @@ MainWindow.prototype = {
}
},
+ _onToolBoxGroupAction : function(toolBoxGroup, actionName, actionArgs) {
+ if (toolBoxGroup == this._mainToolBoxGroup) {
+ // FIXME: convert main toolbox group to use actions
+ // instead of internally hardcoded handlers
+ return;
+ }
+
+ if (this._currentPage &&
+ this._currentPage.activeThing) {
+ this._currentPage.activeThing.doAction(actionName, actionArgs);
+ }
+ },
+
_onClipboardTextReceived : function(clipboard, text, data) {
if (!text) {
return;
diff --git a/src/js/ui/thing.js b/src/js/ui/thing.js
index 8c29a27..457fb77 100644
--- a/src/js/ui/thing.js
+++ b/src/js/ui/thing.js
@@ -342,6 +342,10 @@ Thing.prototype = {
// do nothing by default
},
+ doAction : function(actionName, actionArgs) {
+ // do nothing by default
+ },
+
activate : function() {
throw new Error('Things should implement activate method');
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]