link: Remove

The looking glass is the only consumer of the Link, and it's such a
basic wrapper around a button that it's not worth it.

https://bugzilla.gnome.org/show_bug.cgi?id=679944
This commit is contained in:
Jasper St. Pierre 2012-07-14 18:49:06 -04:00
parent 4f7c554d8d
commit 75d0362cd8
3 changed files with 27 additions and 39 deletions

View File

@ -57,7 +57,6 @@ nobase_dist_js_DATA = \
ui/keyringPrompt.js \ ui/keyringPrompt.js \
ui/layout.js \ ui/layout.js \
ui/lightbox.js \ ui/lightbox.js \
ui/link.js \
ui/lookingGlass.js \ ui/lookingGlass.js \
ui/magnifier.js \ ui/magnifier.js \
ui/magnifierDBus.js \ ui/magnifierDBus.js \

View File

@ -1,21 +0,0 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
const Signals = imports.signals;
const St = imports.gi.St;
const Link = new Lang.Class({
Name: 'Link',
_init : function(props) {
let realProps = { reactive: true,
track_hover: 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);
this.actor = new St.Button(realProps);
}
});
Signals.addSignalMethods(Link.prototype);

View File

@ -17,7 +17,6 @@ const System = imports.system;
const History = imports.misc.history; const History = imports.misc.history;
const ExtensionSystem = imports.ui.extensionSystem; const ExtensionSystem = imports.ui.extensionSystem;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Link = imports.ui.link;
const ShellEntry = imports.ui.shellEntry; const ShellEntry = imports.ui.shellEntry;
const Tweener = imports.ui.tweener; const Tweener = imports.ui.tweener;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -264,7 +263,6 @@ function objectToString(o) {
const ObjLink = new Lang.Class({ const ObjLink = new Lang.Class({
Name: 'ObjLink', Name: 'ObjLink',
Extends: Link.Link,
_init: function(o, title) { _init: function(o, title) {
let text; let text;
@ -275,7 +273,10 @@ const ObjLink = new Lang.Class({
text = GLib.markup_escape_text(text, -1); text = GLib.markup_escape_text(text, -1);
this._obj = o; this._obj = o;
this.parent({ label: text }); this.actor = new St.Button({ reactive: true,
track_hover: true,
style_class: 'shell-link',
label: text });
this.actor.get_child().single_line_mode = true; this.actor.get_child().single_line_mode = true;
this.actor.connect('clicked', Lang.bind(this, this._onClicked)); this.actor.connect('clicked', Lang.bind(this, this._onClicked));
}, },
@ -799,24 +800,33 @@ const Extensions = new Lang.Class({
text: this._stateToString(extension.state) }); text: this._stateToString(extension.state) });
metaBox.add(state); metaBox.add(state);
let viewsource = new Link.Link({ label: _("View Source") }); let viewsource = new St.Button({ reactive: true,
viewsource.actor._extension = extension; track_hover: true,
viewsource.actor.connect('clicked', Lang.bind(this, this._onViewSource)); style_class: 'shell-link',
metaBox.add(viewsource.actor); label: _("View Source") });
viewsource._extension = extension;
viewsource.connect('clicked', Lang.bind(this, this._onViewSource));
metaBox.add(viewsource);
if (extension.metadata.url) { if (extension.metadata.url) {
let webpage = new Link.Link({ label: _("Web Page") }); let webpage = new St.Button({ reactive: true,
webpage.actor._extension = extension; track_hover: true,
webpage.actor.connect('clicked', Lang.bind(this, this._onWebPage)); style_class: 'shell-link',
metaBox.add(webpage.actor); label: _("Web Page") });
webpage._extension = extension;
webpage.connect('clicked', Lang.bind(this, this._onWebPage));
metaBox.add(webpage);
} }
let viewerrors = new Link.Link({ label: _("Show Errors") }); let viewerrors = new St.Button({ reactive: true,
viewerrors.actor._extension = extension; track_hover: true,
viewerrors.actor._parentBox = box; style_class: 'shell-link',
viewerrors.actor._isShowing = false; label: _("Show Errors") });
viewerrors.actor.connect('clicked', Lang.bind(this, this._onViewErrors)); viewerrors._extension = extension;
metaBox.add(viewerrors.actor); viewerrors._parentBox = box;
viewerrors._isShowing = false;
viewerrors.connect('clicked', Lang.bind(this, this._onViewErrors));
metaBox.add(viewerrors);
return box; return box;
} }