[the-board] [ui] Use click action on Page's main box
- From: Lucas Almeida Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Use click action on Page's main box
- Date: Fri, 12 Nov 2010 23:07:35 +0000 (UTC)
commit 09320c44e32a3cfab9843d1c98b489810bd5e2e5
Author: Lucas Rocha <lucasr gnome org>
Date: Fri Nov 12 23:00:20 2010 +0000
[ui] Use click action on Page's main box
Instead of tracking button presses. Handling clicks is more robust.
src/js/ui/mainWindow.js | 18 +++++++++---------
src/js/ui/page.js | 13 ++++++++-----
2 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 7878dd2..ea19525 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -706,7 +706,7 @@ MainWindow.prototype = {
this._updateThingToolbar();
},
- _onPageButtonPressEvent : function() {
+ _onPageClicked : function() {
this._activeToolbar.deactivate();
this._mainBox.grab_key_focus();
},
@@ -734,8 +734,8 @@ MainWindow.prototype = {
oldCurrentPage.disconnect(this._pageActiveThingChangedId);
delete this._pageActiveThingChangedId;
- oldCurrentPage.disconnect(this._pageButtonPressEventId);
- delete this._pageButtonPressEventId;
+ oldCurrentPage.disconnect(this._pageClickedId);
+ delete this._pageClickedId;
oldCurrentPage.disconnect(this._pageLoadedChangedId);
delete this._pageLoadedChangedId;
@@ -752,9 +752,9 @@ MainWindow.prototype = {
this._currentPage.connect("active-thing-changed",
Lang.bind(this, this._onPageActiveThingChanged));
- this._pageButtonPressEventId =
- this._currentPage.connect("button-press-event",
- Lang.bind(this, this._onPageButtonPressEvent));
+ this._pageClickedId =
+ this._currentPage.connect("clicked",
+ Lang.bind(this, this._onPageClicked));
this._pageLoadedChangedId =
this._currentPage.connect("loaded-changed",
@@ -801,9 +801,9 @@ MainWindow.prototype = {
this._setActiveToolbar(null);
- if (this._pageButtonPressEventId) {
- this._currentPage.disconnect(this._pageButtonPressEventId);
- delete this._pageButtonPressEventId;
+ if (this._pageClickedId) {
+ this._currentPage.disconnect(this._pageClickedId);
+ delete this._pageClickedId;
}
if (this._pageLoadedChangedId) {
diff --git a/src/js/ui/page.js b/src/js/ui/page.js
index 157f51b..cdb5e1d 100644
--- a/src/js/ui/page.js
+++ b/src/js/ui/page.js
@@ -78,8 +78,12 @@ Page.prototype = {
reactive: true,
name: "page-main-box" });
- this._mainBox.connect("button-press-event",
- Lang.bind(this, this._onMainBoxButtonPressEvent));
+ let clickAction = new Clutter.ClickAction();
+
+ clickAction.connect("clicked",
+ Lang.bind(this, this._onMainBoxClicked));
+
+ this._mainBox.add_action(clickAction);
},
_createDimBox : function() {
@@ -329,10 +333,9 @@ Page.prototype = {
transition: _ADD_THING_TRANSITION });
},
- _onMainBoxButtonPressEvent : function(o, event) {
+ _onMainBoxClicked : function(o, event) {
this.setActiveThing(null);
-
- this.emit("button-press-event", event);
+ this.emit("clicked");
},
_onModelStateChanged : function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]