[gnome-shell] Make link.js into a St.Button, delete unused link imports
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Make link.js into a St.Button, delete unused link imports
- Date: Fri, 18 Dec 2009 16:21:25 +0000 (UTC)
commit c0ff0066e6eb2c9f2f0251e3e2277f596557e261
Author: Colin Walters <walters verbum org>
Date: Wed Dec 2 12:13:24 2009 -0500
Make link.js into a St.Button, delete unused link imports
It's actually totally unused at the moment, but a future patch will use it.
https://bugzilla.gnome.org/show_bug.cgi?id=599661
data/theme/gnome-shell.css | 9 ++++++
js/ui/genericDisplay.js | 1 -
js/ui/link.js | 67 +++----------------------------------------
js/ui/overview.js | 1 -
4 files changed, 14 insertions(+), 64 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 3c2a6dc..62684f5 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -17,6 +17,15 @@
* Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
+.shell-link {
+ color: #0000ff;
+ text-decoration: underline;
+}
+
+.shell-link:hover {
+ color: #0000e0;
+}
+
StScrollBar
{
padding: 0px;
diff --git a/js/ui/genericDisplay.js b/js/ui/genericDisplay.js
index 939d989..aaa0189 100644
--- a/js/ui/genericDisplay.js
+++ b/js/ui/genericDisplay.js
@@ -14,7 +14,6 @@ const Shell = imports.gi.Shell;
const St = imports.gi.St;
const DND = imports.ui.dnd;
-const Link = imports.ui.link;
const Main = imports.ui.main;
const RedisplayFlags = { NONE: 0,
diff --git a/js/ui/link.js b/js/ui/link.js
index fb8ecd8..414df38 100644
--- a/js/ui/link.js
+++ b/js/ui/link.js
@@ -3,78 +3,21 @@
const Clutter = imports.gi.Clutter;
const Lang = imports.lang;
const Signals = imports.signals;
+const St = imports.gi.St;
-// Link is a clickable link. Right now it just handles properly capturing
-// press and release events and short-circuiting the button handling in
-// ClutterText, but more features like different colors for hover/pressed states
-// or a different mouse cursor could be implemented.
-//
-// The properties passed in are forwarded to the Clutter.Text() constructor,
-// so can include, 'text', 'font_name', etc.
function Link(props) {
this._init(props);
}
Link.prototype = {
_init : function(props) {
- let realProps = { reactive: true };
+ let realProps = { reactive: true,
+ style_class: 'shell-link' };
// The user can pass in reactive: false to override the above and get
// a non-reactive link (a link to the current page, perhaps)
- Lang.copyProperties(props, realProps);
+ Lang.copyProperties(props, realProps);
- this.actor = new Clutter.Text(realProps);
- this.actor._delegate = this;
- this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
- this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
- this.actor.connect('enter-event', Lang.bind(this, this._onEnter));
- this.actor.connect('leave-event', Lang.bind(this, this._onLeave));
-
- this._buttonDown = false;
- this._havePointer = false;
- },
-
- // Update the text of the link
- setText : function(text) {
- this.actor.text = text;
- },
-
- // We want to react on buttonDown, but if we override button-release-event for
- // ClutterText, but not button-press-event, we get a stuck grab. Tracking
- // buttonDown and doing the grab isn't really necessary, but doing it makes
- // the behavior perfectly correct if the user clicks on one actor, drags
- // to another and releases - that should not trigger either actor.
- _onButtonPress : function(actor, event) {
- this._buttonDown = true;
- this._havePointer = true; // Hack to work around poor enter/leave tracking in Clutter
- Clutter.grab_pointer(actor);
-
- return true;
- },
-
- _onButtonRelease : function(actor, event) {
- if (this._buttonDown) {
- this._buttonDown = false;
- Clutter.ungrab_pointer(actor);
-
- if (this._havePointer)
- this.emit('clicked');
- }
-
- return true;
- },
-
- _onEnter : function(actor, event) {
- if (event.get_source() == actor)
- this._havePointer = true;
-
- return false;
- },
-
- _onLeave : function(actor, event) {
- if (event.get_source() == actor)
- this._havePointer = false;
-
- return false;
+ this.actor = new St.Button(realProps);
}
};
diff --git a/js/ui/overview.js b/js/ui/overview.js
index a9697ff..43ff6d7 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -12,7 +12,6 @@ const Lang = imports.lang;
const AppDisplay = imports.ui.appDisplay;
const DocDisplay = imports.ui.docDisplay;
const GenericDisplay = imports.ui.genericDisplay;
-const Link = imports.ui.link;
const Main = imports.ui.main;
const Panel = imports.ui.panel;
const Dash = imports.ui.dash;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]