Compare commits
171 Commits
Author | SHA1 | Date | |
---|---|---|---|
86bd5b281d | |||
ad3e9ab205 | |||
02bbf409ea | |||
f56e4e177e | |||
fc26559f2c | |||
fdaddbd1e0 | |||
04f61567ba | |||
a0785cdbc1 | |||
94101e8bb8 | |||
f13dbf2f26 | |||
bae6f06e4e | |||
d8b9e23502 | |||
7d59eaa67e | |||
c0a453f64f | |||
5336175736 | |||
2997e4950b | |||
a49fb90d86 | |||
ffc0eb1de2 | |||
853c81eb62 | |||
594cc7cbef | |||
0932324d39 | |||
2d6cf236c4 | |||
642107a28f | |||
581b38ecf4 | |||
fbc03cc262 | |||
a6ff195893 | |||
f411724064 | |||
39f43a4cd4 | |||
c82cb918ae | |||
38cdaa6c20 | |||
0327069e83 | |||
7601b029c8 | |||
fb509dfc25 | |||
874a91968f | |||
0963ccddba | |||
c4e0f6df08 | |||
58aafe9520 | |||
a46df7f8ec | |||
1dd16618d1 | |||
a4190f83ac | |||
a8e17f73ec | |||
86a741c1ee | |||
5cc6fef689 | |||
522a5fe480 | |||
b1239b1257 | |||
58063d9ee1 | |||
d7aba2dece | |||
35fced27df | |||
be76b19300 | |||
376d696b8b | |||
695d61968d | |||
d6d09fd3c8 | |||
f1b1501f9b | |||
cdbc99e992 | |||
69afe7785d | |||
b99e304f1e | |||
c29bd46e7a | |||
5fcf40b973 | |||
a198dfe3d8 | |||
5b10d157fe | |||
5cc42b18b0 | |||
cb4252e888 | |||
09d3cdb023 | |||
71515a8a11 | |||
11ca8dd54f | |||
e00f22ebe6 | |||
13390543b0 | |||
de95ced92c | |||
f6a08472a0 | |||
9f7b101437 | |||
9c0707d4dc | |||
78a92fb6be | |||
01509cf1a5 | |||
61e9f51274 | |||
201bd9d42e | |||
8a78f08f6c | |||
a5e54f9712 | |||
526834e39b | |||
bdde2476d2 | |||
3171f9debe | |||
0e2aeac5f9 | |||
788fb5547c | |||
c4d2c0ee64 | |||
977686a77a | |||
44b29f210c | |||
36c7d65ccf | |||
b81d24fdb4 | |||
bfdbee8115 | |||
4a17c8f4a9 | |||
d4f67a7d42 | |||
d5769ae409 | |||
f356b61e5a | |||
398768dcbd | |||
272d5b6e4a | |||
a479aa2594 | |||
f48d620ac5 | |||
0684b42f67 | |||
190a31dd5f | |||
cccfc7faca | |||
5e9e4f8c73 | |||
b28e48094b | |||
01bad21704 | |||
aab9a20b6a | |||
201c5b23f3 | |||
b79e11bef8 | |||
81dfcb85ca | |||
c8e69a2154 | |||
3ee50adad9 | |||
d1386ee8e4 | |||
6b994602d5 | |||
00039bbb47 | |||
0195b2f7c0 | |||
adc60f3212 | |||
579f59816f | |||
9e0df3c5c6 | |||
c6b14ef97e | |||
59e535244f | |||
720b9dd3d2 | |||
60df5b4381 | |||
94a4dc4576 | |||
dbda223858 | |||
822875d5c3 | |||
b11b28b83b | |||
ea0770ae22 | |||
bdc9f293be | |||
922d73a09b | |||
46292fbdc5 | |||
3b1330880f | |||
213e38c2ef | |||
76f09b1e49 | |||
cff0b81f32 | |||
23d6c4dcc0 | |||
66c86109dd | |||
2e45be96b6 | |||
5d1626aba1 | |||
b7f083b1da | |||
2bce1f1510 | |||
1683f4953e | |||
1b2c67a726 | |||
e1d9bdbbd6 | |||
58827ba36d | |||
9ef1bc7273 | |||
a347ed9912 | |||
99d32d2add | |||
2d03e1974a | |||
07cae5377a | |||
436cac4134 | |||
117fcc9743 | |||
6d969250ca | |||
d68d1d1371 | |||
7d8b9b257a | |||
f237e42737 | |||
ca095acd34 | |||
630c70f13c | |||
ebb39bcbe2 | |||
9cf2ec8bd2 | |||
5f6745cad0 | |||
d8fd7b5a44 | |||
f8abe073eb | |||
0608413b96 | |||
7f8a1ec1fb | |||
e859fc8f16 | |||
2f9b0f8820 | |||
d66fcb60b1 | |||
2937cd7e77 | |||
c62e7a6a82 | |||
92f1aec3dd | |||
bc4462cd0c | |||
1ce5ed8685 | |||
433b28b223 | |||
3fe45e29e4 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,6 +1,3 @@
|
||||
[submodule "data/theme/gnome-shell-sass"]
|
||||
path = data/theme/gnome-shell-sass
|
||||
url = https://git.gnome.org/browse/gnome-shell-sass
|
||||
[submodule "subprojects/gvc"]
|
||||
path = subprojects/gvc
|
||||
url = https://git.gnome.org/browse/libgnome-volume-control
|
||||
|
@ -1,19 +1,16 @@
|
||||
Coding guide
|
||||
============
|
||||
# Coding guide
|
||||
|
||||
Our goal is to have all JavaScript code in GNOME follow a consistent style. In
|
||||
a dynamic language like JavaScript, it is essential to be rigorous about style
|
||||
(and unit tests), or you rapidly end up with a spaghetti-code mess.
|
||||
|
||||
A quick note
|
||||
------------
|
||||
## A quick note
|
||||
|
||||
Life isn't fun if you can't break the rules. If a rule seems unnecessarily
|
||||
restrictive while you're coding, ignore it, and let the patch reviewer decide
|
||||
what to do.
|
||||
|
||||
Indentation and whitespace
|
||||
--------------------------
|
||||
## Indentation and whitespace
|
||||
|
||||
Use four-space indents. Braces are on the same line as their associated
|
||||
statements. You should only omit braces if *both* sides of the statement are
|
||||
@ -22,7 +19,7 @@ on one line.
|
||||
* One space after the `function` keyword. No space between the function name
|
||||
* in a declaration or a call. One space before the parens in the `if`
|
||||
* statements, or `while`, or `for` loops.
|
||||
|
||||
```javascript
|
||||
function foo(a, b) {
|
||||
let bar;
|
||||
|
||||
@ -39,22 +36,20 @@ on one line.
|
||||
print(20);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Semicolons
|
||||
----------
|
||||
## Semicolons
|
||||
|
||||
JavaScript allows omitting semicolons at the end of lines, but don't. Always
|
||||
end statements with a semicolon.
|
||||
|
||||
js2-mode
|
||||
--------
|
||||
## js2-mode
|
||||
|
||||
If using Emacs, do not use js2-mode. It is outdated and hasn't worked for a
|
||||
while. emacs now has a built-in JavaScript mode, js-mode, based on
|
||||
espresso-mode. It is the de facto emacs mode for JavaScript.
|
||||
|
||||
File naming and creation
|
||||
------------------------
|
||||
## File naming and creation
|
||||
|
||||
For JavaScript files, use lowerCamelCase-style names, with a `.js` extension.
|
||||
|
||||
@ -67,14 +62,13 @@ library name followed by a dash, e.g. `shell-app-system.c`. Create a
|
||||
`-private.h` header when you want to share code internally in the
|
||||
library. These headers are not installed, distributed or introspected.
|
||||
|
||||
Imports
|
||||
-------
|
||||
## Imports
|
||||
|
||||
Use UpperCamelCase when importing modules to distinguish them from ordinary
|
||||
variables, e.g.
|
||||
|
||||
```javascript
|
||||
const GLib = imports.gi.GLib;
|
||||
|
||||
```
|
||||
Imports should be categorized into one of two places. The top-most import block
|
||||
should contain only "environment imports". These are either modules from
|
||||
gobject-introspection or modules added by gjs itself.
|
||||
@ -85,7 +79,7 @@ e.g. `imports.ui.popupMenu`.
|
||||
|
||||
Each import block should be sorted alphabetically. Don't import modules you
|
||||
don't use.
|
||||
|
||||
```javascript
|
||||
const GLib = imports.gi.GLib;
|
||||
const Gio = imports.gi.Gio;
|
||||
const Lang = imports.lang;
|
||||
@ -95,23 +89,22 @@ don't use.
|
||||
const Params = imports.misc.params;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const Util = imports.misc.util;
|
||||
|
||||
```
|
||||
The alphabetical ordering should be done independently of the location of the
|
||||
location. Never reference `imports` in actual code.
|
||||
|
||||
Constants
|
||||
---------
|
||||
## Constants
|
||||
|
||||
We use CONSTANTS_CASE to define constants. All constants should be directly
|
||||
under the imports:
|
||||
|
||||
```javascript
|
||||
const MY_DBUS_INTERFACE = 'org.my.Interface';
|
||||
```
|
||||
|
||||
Variable declaration
|
||||
--------------------
|
||||
## Variable declaration
|
||||
|
||||
Always use either `const` or `let` when defining a variable.
|
||||
|
||||
```javascript
|
||||
// Iterating over an array
|
||||
for (let i = 0; i < arr.length; ++i) {
|
||||
let item = arr[i];
|
||||
@ -121,31 +114,32 @@ Always use either `const` or `let` when defining a variable.
|
||||
for (let prop in someobj) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
If you use "var" then the variable is added to function scope, not block scope.
|
||||
See [What's new in JavaScript 1.7](https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.7#Block_scope_with_let_%28Merge_into_let_Statement%29)
|
||||
|
||||
Classes
|
||||
-------
|
||||
## Classes
|
||||
|
||||
There are many approaches to classes in JavaScript. We use our own class framework
|
||||
(sigh), which is built in gjs. The advantage is that it supports inheriting from
|
||||
GObjects, although this feature isn't used very often in the Shell itself.
|
||||
|
||||
```javascript
|
||||
var IconLabelMenuItem = new Lang.Class({
|
||||
Name: 'IconLabelMenuItem',
|
||||
Extends: PopupMenu.PopupMenuBaseItem,
|
||||
|
||||
_init: function(icon, label) {
|
||||
_init(icon, label) {
|
||||
this.parent({ reactive: false });
|
||||
this.actor.add_child(icon);
|
||||
this.actor.add_child(label);
|
||||
},
|
||||
|
||||
open: function() {
|
||||
open() {
|
||||
log("menu opened!");
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
* 'Name' is required. 'Extends' is optional. If you leave it out, you will
|
||||
automatically inherit from Object.
|
||||
@ -162,35 +156,34 @@ GObjects, although this feature isn't used very often in the Shell itself.
|
||||
still a giant function call, even though it may resemble a more
|
||||
conventional syntax.
|
||||
|
||||
GObject Introspection
|
||||
---------------------
|
||||
## GObject Introspection
|
||||
|
||||
GObject Introspection is a powerful feature that allows us to have native
|
||||
bindings for almost any library built around GObject. If a library requires
|
||||
you to inherit from a type to use it, you can do so:
|
||||
|
||||
```javascript
|
||||
var MyClutterActor = new Lang.Class({
|
||||
Name: 'MyClutterActor',
|
||||
Extends: Clutter.Actor,
|
||||
|
||||
vfunc_get_preferred_width: function(actor, forHeight) {
|
||||
vfunc_get_preferred_width(actor, forHeight) {
|
||||
return [100, 100];
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(actor, forWidth) {
|
||||
vfunc_get_preferred_height(actor, forWidth) {
|
||||
return [100, 100];
|
||||
},
|
||||
|
||||
vfunc_paint: function(actor) {
|
||||
vfunc_paint(actor) {
|
||||
let alloc = this.get_allocation_box();
|
||||
Cogl.set_source_color4ub(255, 0, 0, 255);
|
||||
Cogl.rectangle(alloc.x1, alloc.y1,
|
||||
alloc.x2, alloc.y2);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Translatable strings, `environment.js`
|
||||
--------------------------------------
|
||||
## Translatable strings, `environment.js`
|
||||
|
||||
We use gettext to translate the GNOME Shell into all the languages that GNOME
|
||||
supports. The `gettext` function is aliased globally as `_`, you do not need to
|
||||
@ -204,8 +197,7 @@ and "double quotes" for strings that the user may see. This allows us to
|
||||
quickly find untranslated or mistranslated strings by grepping through the
|
||||
sources for double quotes without a gettext call around them.
|
||||
|
||||
`actor` and `_delegate`
|
||||
-----------------------
|
||||
## `actor` and `_delegate`
|
||||
|
||||
gjs allows us to set so-called "expando properties" on introspected objects,
|
||||
allowing us to treat them like any other. Because the Shell was built before
|
||||
@ -214,21 +206,22 @@ that has a property called `actor`. We call this wrapper class the "delegate".
|
||||
|
||||
We sometimes use expando properties to set a property called `_delegate` on
|
||||
the actor itself:
|
||||
|
||||
```javascript
|
||||
var MyClass = new Lang.Class({
|
||||
Name: 'MyClass',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.Button({ text: "This is a button" });
|
||||
this.actor._delegate = this;
|
||||
|
||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||
this.actor.connect('clicked', this._onClicked.bind(this));
|
||||
},
|
||||
|
||||
_onClicked: function(actor) {
|
||||
_onClicked(actor) {
|
||||
actor.set_label("You clicked the button!");
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
The 'delegate' property is important for anything which trying to get the
|
||||
delegate object from an associated actor. For instance, the drag and drop
|
||||
@ -236,57 +229,60 @@ system calls the `handleDragOver` function on the delegate of a "drop target"
|
||||
when the user drags an item over it. If you do not set the `_delegate`
|
||||
property, your actor will not be able to be dropped onto.
|
||||
|
||||
Functional style
|
||||
----------------
|
||||
## Functional style
|
||||
|
||||
JavaScript Array objects offer a lot of common functional programming
|
||||
capabilities such as forEach, map, filter and so on. You can use these when
|
||||
they make sense, but please don't have a spaghetti mess of function programming
|
||||
messed in a procedural style. Use your best judgment.
|
||||
|
||||
Closures
|
||||
--------
|
||||
## Closures
|
||||
|
||||
`this` will not be captured in a closure, it is relative to how the closure is
|
||||
invoked, not to the value of this where the closure is created, because "this"
|
||||
is a keyword with a value passed in at function invocation time, it is not a
|
||||
variable that can be captured in closures.
|
||||
|
||||
All closures should be wrapped with a Lang.bind.
|
||||
|
||||
All closures should be wrapped with Function.prototype.bind or use arrow
|
||||
notation.
|
||||
```javascript
|
||||
const Lang = imports.lang;
|
||||
|
||||
let closure = Lang.bind(this, function() { this._fnorbate(); });
|
||||
let closure1 = () => { this._fnorbate(); };
|
||||
let closure2 = this._fnorbate.bind(this);
|
||||
```
|
||||
|
||||
A more realistic example would be connecting to a signal on a method of a
|
||||
prototype:
|
||||
|
||||
```javascript
|
||||
const Lang = imports.lang;
|
||||
const FnorbLib = imports.fborbLib;
|
||||
|
||||
var MyClass = new Lang.Class({
|
||||
_init: function() {
|
||||
_init() {
|
||||
let fnorb = new FnorbLib.Fnorb();
|
||||
fnorb.connect('frobate', Lang.bind(this, this._onFnorbFrobate));
|
||||
fnorb.connect('frobate', this._onFnorbFrobate.bind(this));
|
||||
},
|
||||
|
||||
_onFnorbFrobate: function(fnorb) {
|
||||
_onFnorbFrobate(fnorb) {
|
||||
this._updateFnorb();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Object literal syntax
|
||||
---------------------
|
||||
## Object literal syntax
|
||||
|
||||
In JavaScript, these are equivalent:
|
||||
|
||||
```javascript
|
||||
foo = { 'bar': 42 };
|
||||
foo = { bar: 42 };
|
||||
```
|
||||
|
||||
and so are these:
|
||||
|
||||
```javascript
|
||||
var b = foo['bar'];
|
||||
var b = foo.bar;
|
||||
```
|
||||
|
||||
If your usage of an object is like an object, then you're defining "member
|
||||
variables." For member variables, use the no-quotes no-brackets syntax: `{ bar:
|
||||
@ -296,20 +292,19 @@ If your usage of an object is like a hash table (and thus conceptually the keys
|
||||
can have special chars in them), don't use quotes, but use brackets: `{ bar: 42
|
||||
}`, `foo['bar']`.
|
||||
|
||||
Getters, setters, and Tweener
|
||||
-----------------------------
|
||||
## Getters, setters, and Tweener
|
||||
|
||||
Getters and setters should be used when you are dealing with an API that is
|
||||
designed around setting properties, like Tweener. If you want to animate an
|
||||
arbitrary property, create a getter and setter, and use Tweener to animate the
|
||||
property.
|
||||
|
||||
```javascript
|
||||
var ANIMATION_TIME = 2000;
|
||||
|
||||
var MyClass = new Lang.Class({
|
||||
Name: 'MyClass',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.BoxLayout();
|
||||
this._position = 0;
|
||||
},
|
||||
@ -329,3 +324,4 @@ property.
|
||||
{ position: 100,
|
||||
time: ANIMATION_TIME,
|
||||
transition: 'easeOutQuad' });
|
||||
```
|
@ -1,7 +0,0 @@
|
||||
Owen Taylor
|
||||
E-mail: otaylor@redhat.com
|
||||
Userid: otaylor
|
||||
|
||||
Colin Walters
|
||||
E-mail: walters@verbum.org
|
||||
Userid: walters
|
112
NEWS
112
NEWS
@ -1,3 +1,115 @@
|
||||
3.29.2
|
||||
======
|
||||
* Guard against untimely keyboard map changes [Carlos; #240]
|
||||
* Fix icons in search provider results [Florian; #249]
|
||||
* Fix blurriness of OSD under some resolutions [Silvère; #782011]
|
||||
* Fix lagging pointer when zoomed [Daniel; #682013]
|
||||
* Misc. bug fixes [Milan, Xiaoguang, Florian, Mario, Ole; #244, #787871,
|
||||
#781471, #136, #214, #294]
|
||||
|
||||
Contributors:
|
||||
Ole Jørgen Brønner, Milan Crha, Carlos Garnacho, Yussuf Khalil,
|
||||
Silvère Latchurié, Florian Müllner, Mario Sanchez Prada, Ray Strode,
|
||||
Daniel van Vugt, Xiaoguang Wang
|
||||
|
||||
Translators:
|
||||
Rafael Fontenelle [pt_BR], Kukuh Syafaat [id], Marcos Lans [gl],
|
||||
Anders Jonsson [sv], Mingcong Bai [zh_CN]
|
||||
|
||||
3.29.1
|
||||
======
|
||||
* Support icons in app-menu [Florian; #760985]
|
||||
* Misc. bug fixes [Marco, Florian, Lubomir; #792687, #221, !63]
|
||||
|
||||
Contributors:
|
||||
Piotr Drąg, Takao Fujiwara, Christian Kellner, Florian Müllner,
|
||||
Mario Sanchez Prada, Lubomir Rintel, Didier Roche, Marco Trevisan (Treviño),
|
||||
verdre
|
||||
|
||||
Translators:
|
||||
gogo [hr], Stas Solovey [ru], Matej Urbančič [sl], Daniel Șerbănescu [ro],
|
||||
Fabio Tomat [fur], Marek Cernocky [cs], Daniel Mustieles [es]
|
||||
|
||||
3.28.1
|
||||
======
|
||||
* Fix compose characters in shell entries [Carlos; #115]
|
||||
* Don't show authentication dialogs on lock screen [Florian; #179, #166]
|
||||
* Fix handling of UTC timezone in world clock [Florian; #150]
|
||||
* Fix keyboard navigation in overview when hovering windows [Florian; #50]
|
||||
* Misc. bug fixes [Florian; #127, #788908, #763886, !39]
|
||||
|
||||
Contributors:
|
||||
Jeremy Bicha, Carlos Garnacho, Andy Holmes, Florian Müllner, Bastien Nocera
|
||||
|
||||
Translators:
|
||||
Stas Solovey [ru], Daniel Șerbănescu [ro], Dušan Kazik [sk],
|
||||
Rafael Fontenelle [pt_BR], Nathan Follens [nl], Dz Chen [zh_CN],
|
||||
Matej Urbančič [sl], Hannie Dumoleyn [nl], Khaled Hosny [ar],
|
||||
Guillaume Bernard [fr]
|
||||
|
||||
3.28.0
|
||||
======
|
||||
|
||||
Translators:
|
||||
A S Alam [pa], gogo [hr], Chao-Hsiung Liao [zh_TW], Jordi Mas [ca],
|
||||
Anders Jonsson [sv], Balázs Úr [hu]
|
||||
|
||||
3.27.92
|
||||
=======
|
||||
* Misc. bug fixes [Florian; #64, #66, #72]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Christian Kellner, Florian Müllner
|
||||
|
||||
Translators:
|
||||
Daniel Mustieles [es], Wolfgang Stöggl [de], Cheng-Chia Tseng [zh_TW],
|
||||
Dušan Kazik [sk], Changwoo Ryu [ko], Furkan Ahmet Kara [tr], Balázs Úr [hu],
|
||||
Trần Ngọc Quân [vi], Milo Casagrande [it], GNOME Translation Robot [gd, nl],
|
||||
Marek Cernocky [cs], Aurimas Černius [lt], Alain Lojewski [fr],
|
||||
Rūdolfs Mazurs [lv], Stas Solovey [ru], Alan Mortensen [da]
|
||||
|
||||
3.27.91
|
||||
=======
|
||||
* Fix wrong bluetooth state when disabled by HW airplane mode [Mario; #789110]
|
||||
* Dump javascript stack on aborts, traps and segfaults [Marco; #789237]
|
||||
* Allow Escape to "cancel" top bar focus [Stefano; #671121]
|
||||
* Fix leaving the overview erroneously on window hover [Carlos; #784545]
|
||||
* Add keyboard accessibility dialog [Olivier; #788564]
|
||||
* Port to libnm [Lubomir, Florian; #789811]
|
||||
* Don't pop up on-screen-keyboard on touch events [Florian, Carlos; #788188]
|
||||
* Improve the on-screen-keyboard [Carlos; !9, #46]
|
||||
* Add Thunderbolt support [Christian; !14]
|
||||
* Don't lock immediately on login after a wayland session crash [Florian; !17]
|
||||
* Respect cursor's hot x/y coordinates when recording [Florian Z.; #792860]
|
||||
* Allow closing windows and apps during <alt>Tab [Florian, Mario; #620106]
|
||||
* Fix small app folder icons when using HiDPI [Nikita; #792259]
|
||||
* Make sassc a mandatory build dependency [Mario; #792822]
|
||||
* Misc. bug fixes [Florian, Marco, Alessandro, Gautier, Jeremy, Bastien, Ray,
|
||||
Carlos, Didier, Exalm, Rafal; #789231, #789277, #788542, #789103, #779974,
|
||||
#788931, #776940, #786987, #791007, #791233, #791148, #706191, #791655,
|
||||
#791487, #779413, #787845, #10, #788627, #792354, #792616, #781329, #780957,
|
||||
#33, #740142, !38, !23]
|
||||
|
||||
Contributors:
|
||||
Jeremy Bicha, Alessandro Bono, Nikita Churaev, Piotr Drąg, Exalm,
|
||||
Stefano Facchini, Olivier Fourdan, Carlos Garnacho, Christian Kellner,
|
||||
Rafal Luzynski, Iñigo Martínez, Florian Müllner, Bastien Nocera,
|
||||
Gautier Pelloux-Prayer, Mario Sanchez Prada, Lubomir Rintel, Didier Roche,
|
||||
Jakub Steiner, Ray Strode, Marco Trevisan (Treviño), Florian Zwoch
|
||||
|
||||
Translators:
|
||||
Mingcong Bai [zh_CN], Hannie Dumoleyn [nl], Khaled Hosny [ar],
|
||||
Kjartan Maraas [nb], Petr Kovar [cs], Marek Cernocky [cs],
|
||||
Aurimas Černius [lt], Yosef Or Boczko [he], Kukuh Syafaat [id],
|
||||
Sveinn í Felli [is], Jordi Mas [ca], Daniel Mustieles [es], Fabio Tomat [fur],
|
||||
Rūdolfs Mazurs [lv], Emin Tufan Çetin [tr], Anders Jonsson [sv],
|
||||
Matej Urbančič [sl], Jiri Grönroos [fi], Tim Sabsch [de], Gil Forcada [ca],
|
||||
Dušan Kazik [sk], Balázs Meskó [hu], Piotr Drąg [pl], Tong Hui [zh_CN],
|
||||
Fran Dieguez [gl], Enrico Nicoletto [pt_BR], gogo [hr],
|
||||
Baurzhan Muftakhidinov [kk], Robert Antoni Buj Gelonch [ca],
|
||||
Bruce Cowan [en_GB], Борисав Живановић [sr], Милош Поповић [sr@latin],
|
||||
Марко Костић [sr]
|
||||
|
||||
3.27.1
|
||||
======
|
||||
* Fix using icon-name strings with PopupImageMenuItems [Florian; #789018]
|
||||
|
@ -1,3 +1,4 @@
|
||||
# GNOME Shell
|
||||
GNOME Shell provides core user interface functions for the GNOME 3 desktop,
|
||||
like switching to windows and launching applications. GNOME Shell takes
|
||||
advantage of the capabilities of modern graphics hardware and introduces
|
||||
@ -6,15 +7,14 @@ easy to use experience.
|
||||
|
||||
For more information about GNOME Shell, including instructions on how
|
||||
to build GNOME Shell from source and how to get involved with the project,
|
||||
see:
|
||||
see the [project wiki][wiki]
|
||||
|
||||
https://wiki.gnome.org/Projects/GnomeShell
|
||||
Bugs should be reported to the GNOME [bug tracking system][bug-tracker].
|
||||
|
||||
Bugs should be reported at http://bugzilla.gnome.org against the 'gnome-shell'
|
||||
product.
|
||||
|
||||
License
|
||||
=======
|
||||
## License
|
||||
GNOME Shell is distributed under the terms of the GNU General Public License,
|
||||
version 2 or later. See the COPYING file for details.
|
||||
version 2 or later. See the [COPYING][license] file for details.
|
||||
|
||||
[project-wiki]: https://wiki.gnome.org/Projects/GnomeShell
|
||||
[bug-tracker]: https://gitlab.gnome.org/GNOME/gnome-shell/issues
|
||||
[license]: COPYING
|
@ -4,14 +4,14 @@ the extensions repository to provide good integration, letting the website
|
||||
know which extensions are enabled and disabled, and allowing the website to
|
||||
enable, disable and install them.
|
||||
|
||||
Bugs should be reported at http://bugzilla.gnome.org against the 'gnome-shell'
|
||||
product.
|
||||
Bugs should be reported to the GNOME [bug tracking system][bug-tracker].
|
||||
|
||||
License
|
||||
=======
|
||||
## License
|
||||
The GNOME Shell Browser Plugin, like GNOME Shell itself is distributed under
|
||||
the GNU General Public License, version 2 or later. The plugin also contains
|
||||
header files from the "NPAPI SDK" project, tri-licensed under MPL 1.1, GPL 2.0
|
||||
and LGPL 2.1. These headers are third-party sources and can be retrieved from:
|
||||
|
||||
http://code.google.com/p/npapi-sdk/
|
||||
|
||||
[bug-tracker]: https://gitlab.gnome.org/GNOME/gnome-shell/issues
|
@ -19,6 +19,12 @@
|
||||
<file>filter-selected-rtl.svg</file>
|
||||
<file>gnome-shell.css</file>
|
||||
<file>gnome-shell-high-contrast.css</file>
|
||||
<file>key-enter.svg</file>
|
||||
<file>key-hide.svg</file>
|
||||
<file>key-layout.svg</file>
|
||||
<file>key-shift.svg</file>
|
||||
<file>key-shift-uppercase.svg</file>
|
||||
<file>key-shift-latched-uppercase.svg</file>
|
||||
<file>logged-in-indicator.svg</file>
|
||||
<file alias="icons/message-indicator-symbolic.svg">message-indicator-symbolic.svg</file>
|
||||
<file>no-events.svg</file>
|
||||
|
@ -1,3 +0,0 @@
|
||||
To generate the css files, from the project directory:
|
||||
|
||||
sass --sourcemap=none --update .
|
@ -1,34 +0,0 @@
|
||||
Summary
|
||||
-------
|
||||
|
||||
* Do not edit the CSS directly, edit the source SCSS files and process them with SASS (running
|
||||
`make` should do that when you have the required software installed, as described below;
|
||||
run `./parse-sass.sh` manually if it doesn't)
|
||||
* Most SASS preprocessors should produce similar results, however the build system
|
||||
integration and 'parse-sass.sh' script use sassc. You should be able to install
|
||||
it with `pkcon install sassc` or your distribution's package manager.
|
||||
|
||||
How to tweak the theme
|
||||
----------------------
|
||||
|
||||
Adwaita is a complex theme, so to keep it maintainable it's written and processed in SASS, the
|
||||
generated CSS is then transformed into a gresource file during gtk build and used at runtime in a
|
||||
non-legible or editable form.
|
||||
|
||||
It is very likely your change will happen in the _common.scss file. That's where all the widget
|
||||
selectors are defined. Here's a rundown of the "supporting" stylesheets, that are unlikely to be the
|
||||
right place for a drive by stylesheet fix:
|
||||
|
||||
_colors.scss - global color definitions. We keep the number of defined colors to a necessary minimum,
|
||||
most colors are derived from a handful of basics. It is an exact copy of the gtk+
|
||||
counterpart. Light theme is used for the classic theme and dark is for GNOME3 shell
|
||||
default.
|
||||
|
||||
_drawing.scss - drawing helper mixings/functions to allow easier definition of widget drawing under
|
||||
specific context. This is why Adwaita isn't 15000 LOC.
|
||||
|
||||
_common.scss - actual definitions of style for each widget. This is where you are likely to add/remove
|
||||
your changes.
|
||||
|
||||
You can read about SASS at http://sass-lang.com/documentation/. Once you make your changes to the
|
||||
_common.scss file, you can either run make or the ./parse-sass.sh script.
|
32
data/theme/README.md
Normal file
32
data/theme/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
## Summary
|
||||
|
||||
Do not edit the CSS directly, edit the source SCSS files and the CSS files
|
||||
will be generated automatically when building with meson + ninja and left
|
||||
inside the build directory to be incorporated into the gresource XML (you'll
|
||||
need to have sassc installed).
|
||||
|
||||
## How to tweak the theme
|
||||
|
||||
Adwaita is a complex theme, so to keep it maintainable it's written and
|
||||
processed in SASS, the generated CSS is then transformed into a gresource
|
||||
file during gtk build and used at runtime in a non-legible or editable form.
|
||||
|
||||
It is very likely your change will happen in the [_common.scss][common] file.
|
||||
That's where all the widget selectors are defined. Here's a rundown of
|
||||
the "supporting" stylesheets, that are unlikely to be the right place
|
||||
for a drive by stylesheet fix:
|
||||
|
||||
| File | Description |
|
||||
| ------------------------ | ----------------- |
|
||||
| [_colors.scss][colors] | global color definitions. We keep the number of defined colors to a necessary minimum, most colors are derived from a handful of basics. It is an exact copy of the gtk+ counterpart. Light theme is used for the classic theme and dark is for GNOME3 shell default. |
|
||||
| [_drawing.scss][drawing] | drawing helper mixings/functions to allow easier definition of widget drawing under specific context. This is why Adwaita isn't 15000 LOC. |
|
||||
| [_common.scss][common] | actual definitions of style for each widget. This is where you are likely to add/remove your changes. |
|
||||
|
||||
You can read about SASS on its [web page][sass-web]. Once you make your
|
||||
changes to the [_common.scss][common] file, you can run ninja to generate the
|
||||
final CSS files.
|
||||
|
||||
[common]: data/theme/gnome-shell-sass/_common.scss
|
||||
[colors]: data/theme/gnome-shell-sass/_colors.scss
|
||||
[drawing]: data/theme/gnome-shell-sass/_drawing.scss
|
||||
[sass-web]: http://sass-lang.com/documentation/
|
File diff suppressed because it is too large
Load Diff
Submodule data/theme/gnome-shell-sass deleted from d509706ff4
339
data/theme/gnome-shell-sass/COPYING
Normal file
339
data/theme/gnome-shell-sass/COPYING
Normal file
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. <http://fsf.org>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
16
data/theme/gnome-shell-sass/README.md
Normal file
16
data/theme/gnome-shell-sass/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# GNOME Shell Sass
|
||||
GNOME Shell Sass is a project intended to allow the sharing of the
|
||||
theme sources in sass between gnome-shell and other projects like
|
||||
gnome-shell-extensions.
|
||||
|
||||
Any changes should be done in the [GNOME Shell subtree][shell-subtree]
|
||||
and not the stand-alone [gnome-shell-sass repository][sass-repo]. They
|
||||
will then be synchronized periodically before releases.
|
||||
|
||||
## License
|
||||
GNOME Shell Sass is distributed under the terms of the GNU General Public
|
||||
License, version 2 or later. See the [COPYING][license] file for details.
|
||||
|
||||
[shell-subtree]: https://gitlab.gnome.org/GNOME/gnome-shell/tree/master/data/theme/gnome-shell-sass
|
||||
[sass-repo]: https://gitlab.gnome.org/GNOME/gnome-shell-sass
|
||||
[license]: COPYING
|
44
data/theme/gnome-shell-sass/_colors.scss
Normal file
44
data/theme/gnome-shell-sass/_colors.scss
Normal file
@ -0,0 +1,44 @@
|
||||
// When color definition differs for dark and light variant,
|
||||
// it gets @if ed depending on $variant
|
||||
|
||||
|
||||
$base_color: if($variant =='light', #ffffff, #292929);
|
||||
$bg_color: if($variant =='light', #ededed, #393f3f);
|
||||
$fg_color: if($variant =='light', #2e3436, #eeeeec);
|
||||
|
||||
$selected_fg_color: #ffffff;
|
||||
$selected_bg_color: if($variant == 'light', #4a90d9, darken(#4a90d9,20%));
|
||||
$selected_borders_color: if($variant=='light', darken($selected_bg_color, 30%),
|
||||
darken($selected_bg_color, 20%));
|
||||
$borders_color: if($variant =='light', darken($bg_color,30%), darken($bg_color,12%));
|
||||
$borders_edge: if($variant =='light', white, transparentize($fg_color, 0.9));
|
||||
$link_color: if($variant == 'light', darken($selected_bg_color,10%),
|
||||
lighten($selected_bg_color,20%));
|
||||
$link_visited_color: if($variant == 'light', darken($selected_bg_color,20%),
|
||||
lighten($selected_bg_color,10%));
|
||||
$top_hilight: $borders_edge;
|
||||
|
||||
$warning_color: #f57900;
|
||||
$error_color: #cc0000;
|
||||
$success_color: if($variant =='light', #73d216, darken(#73d216,10%));
|
||||
$destructive_color: if($variant =='light', #ef2929, darken(#ef2929,10%));
|
||||
|
||||
$osd_fg_color: #eeeeec;
|
||||
$osd_bg_color: #2e3436;
|
||||
$osd_borders_color: transparentize(black, 0.3);
|
||||
$osd_outer_borders_color: transparentize(white, 0.9);
|
||||
|
||||
$tooltip_borders_color: $osd_outer_borders_color;
|
||||
|
||||
//insensitive state derived colors
|
||||
$insensitive_fg_color: mix($fg_color, $bg_color, 50%);
|
||||
$insensitive_bg_color: mix($bg_color, $base_color, 60%);
|
||||
$insensitive_borders_color: $borders_color;
|
||||
|
||||
//colors for the backdrop state, derived from the main colors.
|
||||
$backdrop_base_color: if($variant =='light', darken($base_color,1%), lighten($base_color,1%));
|
||||
$backdrop_bg_color: $bg_color;
|
||||
$backdrop_fg_color: mix($fg_color, $backdrop_bg_color, 80%);
|
||||
$backdrop_insensitive_color: if($variant =='light', darken($backdrop_bg_color,15%), lighten($backdrop_bg_color,15%));
|
||||
$backdrop_borders_color: mix($borders_color, $bg_color, 90%);
|
||||
$backdrop_dark_fill: mix($backdrop_borders_color,$backdrop_bg_color, 35%);
|
2015
data/theme/gnome-shell-sass/_common.scss
Normal file
2015
data/theme/gnome-shell-sass/_common.scss
Normal file
File diff suppressed because it is too large
Load Diff
221
data/theme/gnome-shell-sass/_drawing.scss
Normal file
221
data/theme/gnome-shell-sass/_drawing.scss
Normal file
@ -0,0 +1,221 @@
|
||||
// Drawing mixins
|
||||
|
||||
// generic drawing of more complex things
|
||||
|
||||
@function _widget_edge($c:$borders_edge) {
|
||||
// outer highlight "used" on most widgets
|
||||
@return 0 1px $c;
|
||||
}
|
||||
|
||||
// provide font size in rem, with px fallback
|
||||
@mixin fontsize($size: 24, $base: 16) {
|
||||
font-size: round($size) + pt;
|
||||
//font-size: ($size / $base) * 1rem;
|
||||
}
|
||||
|
||||
@mixin _shadows($shadow1, $shadow2:none, $shadow3:none, $shadow4:none) {
|
||||
//
|
||||
// Helper function to stack up to 4 box-shadows;
|
||||
//
|
||||
@if $shadow4!=none { box-shadow: $shadow1, $shadow2, $shadow3, $shadow4; }
|
||||
@else if $shadow3!=none { box-shadow: $shadow1, $shadow2, $shadow3; }
|
||||
@else if $shadow2!=none { box-shadow: $shadow1, $shadow2; }
|
||||
@else { box-shadow: $shadow1; }
|
||||
}
|
||||
|
||||
// entries
|
||||
|
||||
@mixin entry($t, $fc:$selected_bg_color, $edge: $borders_edge) {
|
||||
//
|
||||
// Entries drawing function
|
||||
//
|
||||
// $t: entry type
|
||||
// $fc: focus color
|
||||
// $edge: set to none to not draw the bottom edge or specify a color to not
|
||||
// use the default one
|
||||
//
|
||||
// possible $t values:
|
||||
// normal, focus, insensitive
|
||||
//
|
||||
$_inner_shadows: inset 0 2px 4px transparentize(black, 0.6);
|
||||
|
||||
@if $t==normal {
|
||||
background-color: $base_color;
|
||||
border-color: $borders_color;
|
||||
@include _shadows($_inner_shadows);
|
||||
|
||||
}
|
||||
@if $t==focus {
|
||||
@include _shadows($_inner_shadows);
|
||||
border-color: if($fc==$selected_bg_color,
|
||||
$selected_borders_color,
|
||||
darken($fc,35%));
|
||||
}
|
||||
@if $t==hover { }
|
||||
@if $t==insensitive {
|
||||
color: $insensitive_fg_color;
|
||||
border-color: $insensitive_bg_color;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
// buttons
|
||||
|
||||
@function _border_color ($c) { @return darken($c,25%); } // colored buttons want
|
||||
// the border form the
|
||||
// base color
|
||||
|
||||
@function _text_shadow_color ($tc:$fg_color, $bg:$bg_color) {
|
||||
//
|
||||
// calculate the color of text shadows
|
||||
//
|
||||
// $tc is the text color
|
||||
// $bg is the background color
|
||||
//
|
||||
$_lbg: lightness($bg)/100%;
|
||||
@if lightness($tc)<50% { @return transparentize(white,1-$_lbg/($_lbg*1.3)); }
|
||||
@else { @return transparentize(black,$_lbg*0.8); }
|
||||
}
|
||||
|
||||
@function _button_hilight_color($c) {
|
||||
//
|
||||
// calculate the right top hilight color for buttons
|
||||
//
|
||||
// $c: base color;
|
||||
//
|
||||
@if lightness($c)>90% { @return white; }
|
||||
@else if lightness($c)>80% { @return transparentize(white, 0.3); }
|
||||
@else if lightness($c)>50% { @return transparentize(white, 0.5); }
|
||||
@else if lightness($c)>40% { @return transparentize(white, 0.7); }
|
||||
@else { @return transparentize(white, 0.9); }
|
||||
}
|
||||
|
||||
@mixin _button_text_shadow ($tc:$fg_color, $bg:$bg_color) {
|
||||
//
|
||||
// helper function for the text emboss effect
|
||||
//
|
||||
// $tc is the optional text color, not the shadow color
|
||||
//
|
||||
// TODO: this functions needs a way to deal with special cases
|
||||
//
|
||||
|
||||
$_shadow: _text_shadow_color($tc, $bg);
|
||||
|
||||
@if lightness($tc)<50% {
|
||||
text-shadow: 0 1px $_shadow;
|
||||
icon-shadow: 0 1px $_shadow;
|
||||
}
|
||||
@else {
|
||||
text-shadow: 0 -1px $_shadow;
|
||||
icon-shadow: 0 -1px $_shadow;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin button($t, $c:$osd_bg_color, $tc:$fg_color, $edge: $borders_edge) {
|
||||
//
|
||||
// Button drawing function
|
||||
//
|
||||
// $t: button type,
|
||||
// $c: base button color for colored* types
|
||||
// $tc: optional text color for colored* types
|
||||
// $edge: set to none to not draw the bottom edge or specify a color to not
|
||||
// use the default one
|
||||
//
|
||||
// possible $t values:
|
||||
// normal, hover, active, insensitive, insensitive-active,
|
||||
// backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active,
|
||||
// osd, osd-hover, osd-active, osd-insensitive, osd-backdrop, undecorated
|
||||
//
|
||||
|
||||
$_hilight_color: _button_hilight_color($c);
|
||||
$_button_edge: if($edge == none, none, _widget_edge($edge));
|
||||
$_blank_edge: if($edge == none, none, _widget_edge(transparentize($edge,1)));
|
||||
|
||||
|
||||
@if $t==normal {
|
||||
//
|
||||
// normal button
|
||||
//
|
||||
$_bg: if($c!=$osd_bg_color, transparentize($c, 0.5),
|
||||
$osd_bg_color);
|
||||
|
||||
color: $osd_fg_color;
|
||||
background-color: $_bg;
|
||||
border-color: $osd_borders_color;
|
||||
box-shadow: inset 0 1px lighten($osd_bg_color,10%);
|
||||
text-shadow: 0 1px black;
|
||||
icon-shadow: 0 1px black;
|
||||
}
|
||||
@if $t==focus {
|
||||
//
|
||||
// focused button
|
||||
//
|
||||
$_bg: if($c!=$osd_bg_color, transparentize($c, 0.5),
|
||||
$osd_bg_color);
|
||||
|
||||
color: $osd_fg_color;
|
||||
text-shadow: 0 1px black;
|
||||
icon-shadow: 0 1px black;
|
||||
box-shadow: inset 0px 0px 0px 1px $selected_bg_color;
|
||||
}
|
||||
|
||||
@else if $t==hover {
|
||||
//
|
||||
// active osd button
|
||||
//
|
||||
$_bg: if($c!=$osd_bg_color, transparentize($c, 0.3),
|
||||
lighten($osd_bg_color,10%));
|
||||
|
||||
color: white;
|
||||
border-color: $osd_borders_color;
|
||||
background-color: $_bg;
|
||||
box-shadow: inset 0 1px lighten($osd_bg_color,20%);
|
||||
text-shadow: 0 1px black;
|
||||
icon-shadow: 0 1px black;
|
||||
|
||||
}
|
||||
@else if $t==active {
|
||||
//
|
||||
// active osd button
|
||||
//
|
||||
$_bg: if($c!=$bg_color, $c, $osd_borders_color);
|
||||
|
||||
color: white;
|
||||
border-color: $osd_borders_color;
|
||||
background-color: darken($_bg,5%);
|
||||
// This should be none, but it's creating some issues with borders, so to
|
||||
// workaround it for now, use inset wich goes through a different code path.
|
||||
// see https://bugzilla.gnome.org/show_bug.cgi?id=752934
|
||||
box-shadow: inset 0 0 black;
|
||||
text-shadow: none;
|
||||
icon-shadow: none;
|
||||
}
|
||||
@else if $t==insensitive {
|
||||
//
|
||||
// insensitive osd button
|
||||
//
|
||||
$_bg: transparentize(mix($insensitive_fg_color,$osd_bg_color,20%),0.3);
|
||||
|
||||
color: $insensitive_fg_color;
|
||||
border-color: $osd_borders_color;
|
||||
background-color: $_bg;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
icon-shadow: none;
|
||||
}
|
||||
@else if $t==undecorated {
|
||||
//
|
||||
// reset
|
||||
//
|
||||
border-color: transparent;
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
|
||||
@include _shadows(inset 0 1px transparentize(white,1),
|
||||
$_blank_edge);
|
||||
|
||||
text-shadow: none;
|
||||
icon-shadow: none;
|
||||
}
|
||||
}
|
||||
|
41
data/theme/gnome-shell-sass/_high-contrast-colors.scss
Normal file
41
data/theme/gnome-shell-sass/_high-contrast-colors.scss
Normal file
@ -0,0 +1,41 @@
|
||||
// When color definition differs for dark and light variant,
|
||||
// it gets @if ed depending on $variant
|
||||
|
||||
|
||||
$base_color: #222;
|
||||
$bg_color: #000;
|
||||
$fg_color: #fff;
|
||||
|
||||
$selected_fg_color: #ffffff;
|
||||
$selected_bg_color: darken(#4a90d9,20%);
|
||||
$selected_borders_color: darken($selected_bg_color, 20%);
|
||||
$borders_color: darken($bg_color,12%);
|
||||
$borders_edge: transparentize($fg_color, 0.9);
|
||||
$link_color: lighten($selected_bg_color,20%);
|
||||
$link_visited_color: lighten($selected_bg_color,10%);
|
||||
$top_hilight: $borders_edge;
|
||||
|
||||
$warning_color: #f57900;
|
||||
$error_color: #cc0000;
|
||||
$success_color: darken(#73d216,10%);
|
||||
$destructive_color: darken(#ef2929,10%);
|
||||
|
||||
$osd_fg_color: #eeeeec;
|
||||
$osd_bg_color: #2e3436;
|
||||
$osd_borders_color: transparentize(black, 0.3);
|
||||
$osd_outer_borders_color: transparentize(white, 0.9);
|
||||
|
||||
$tooltip_borders_color: $osd_outer_borders_color;
|
||||
|
||||
//insensitive state derived colors
|
||||
$insensitive_fg_color: mix($fg_color, $bg_color, 50%);
|
||||
$insensitive_bg_color: mix($bg_color, $base_color, 60%);
|
||||
$insensitive_borders_color: $borders_color;
|
||||
|
||||
//colors for the backdrop state, derived from the main colors.
|
||||
$backdrop_base_color: lighten($base_color,1%);
|
||||
$backdrop_bg_color: $bg_color;
|
||||
$backdrop_fg_color: mix($fg_color, $backdrop_bg_color, 80%);
|
||||
$backdrop_insensitive_color: lighten($backdrop_bg_color,15%);
|
||||
$backdrop_borders_color: mix($borders_color, $bg_color, 90%);
|
||||
$backdrop_dark_fill: mix($backdrop_borders_color,$backdrop_bg_color, 35%);
|
37
data/theme/gnome-shell-sass/gnome-shell-sass.doap
Normal file
37
data/theme/gnome-shell-sass/gnome-shell-sass.doap
Normal file
@ -0,0 +1,37 @@
|
||||
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
|
||||
xmlns:foaf="http://xmlns.com/foaf/0.1/"
|
||||
xmlns:gnome="http://api.gnome.org/doap-extensions#"
|
||||
xmlns="http://usefulinc.com/ns/doap#">
|
||||
|
||||
<name xml:lang="en">GNOME Shell Sass</name>
|
||||
<shortdesc xml:lang="en">Sass sources of GNOME Shell</shortdesc>
|
||||
<description>GNOME Shell Sass is a project intended to allow the sharing of the
|
||||
sass theme sources between gnome-shell and other projects like gnome-shell-extensions.</description>
|
||||
|
||||
<category rdf:resource="http://api.gnome.org/doap-extensions#core" />
|
||||
<programming-language>sass</programming-language>
|
||||
<programming-language>css</programming-language>
|
||||
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Carlos Soriano</foaf:name>
|
||||
<foaf:mbox rdf:resource="mailto:csoriano@gnome.org" />
|
||||
<gnome:userid>csoriano</gnome:userid>
|
||||
</foaf:Person>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Florian Müllner</foaf:name>
|
||||
<foaf:mbox rdf:resource="mailto:fmuellner@gnome.org" />
|
||||
<gnome:userid>fmuellner</gnome:userid>
|
||||
</foaf:Person>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Jakub Steiner</foaf:name>
|
||||
<foaf:mbox rdf:resource="mailto:jimmac@gmail.com" />
|
||||
<gnome:userid>jimmac</gnome:userid>
|
||||
</foaf:Person>
|
||||
</maintainer>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
109
data/theme/key-enter.svg
Normal file
109
data/theme/key-enter.svg
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
viewBox="0 0 32 32"
|
||||
version="1.1"
|
||||
id="svg7384"
|
||||
height="32"
|
||||
sodipodi:docname="key-enter.svg"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1744"
|
||||
inkscape:window-height="866"
|
||||
id="namedview19"
|
||||
showgrid="false"
|
||||
inkscape:zoom="14.75"
|
||||
inkscape:cx="7.9322034"
|
||||
inkscape:cy="14.554666"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="55"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg7384" />
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient19282"
|
||||
gradientTransform="matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)">
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop19284" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer11" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer13" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g4953" />
|
||||
<g
|
||||
transform="matrix(2,0,0,2,-281.56285,-1615.0002)"
|
||||
style="display:inline"
|
||||
id="layer12">
|
||||
<path
|
||||
id="path16589"
|
||||
d="m 148.00015,821.0002 h -1 c -0.26528,0 -0.53057,-0.093 -0.71875,-0.2812 l -3.71875,-3.7188 c 0,0 2.47917,-2.4792 3.71875,-3.7187 0.18817,-0.1882 0.45344,-0.2813 0.71875,-0.2813 h 1 v 1 c 0,0.2653 -0.0931,0.5306 -0.28125,0.7188 l -2.28125,2.2812 2.28125,2.2813 c 0.18811,0.1881 0.28129,0.4534 0.28125,0.7187 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;enable-background:accumulate"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#bebebe;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||
d="m 154.0002,810 v 4.5 c 0,1.3807 -1.11929,2.5 -2.5,2.5 h -6.50005"
|
||||
id="path16591"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
114
data/theme/key-hide.svg
Normal file
114
data/theme/key-hide.svg
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
viewBox="0 0 32 32"
|
||||
version="1.1"
|
||||
id="svg7384"
|
||||
height="32"
|
||||
sodipodi:docname="key-hide.svg"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1919"
|
||||
inkscape:window-height="1011"
|
||||
id="namedview19"
|
||||
showgrid="false"
|
||||
inkscape:zoom="14.75"
|
||||
inkscape:cx="-12.338983"
|
||||
inkscape:cy="14.554666"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="55"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg7384" />
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient19282"
|
||||
gradientTransform="matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)">
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop19284" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer11" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer13" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g4953" />
|
||||
<g
|
||||
style="display:inline"
|
||||
inkscape:label="go-down"
|
||||
id="g11722"
|
||||
transform="matrix(2,0,0,2,-362.0004,-1494)">
|
||||
<rect
|
||||
transform="rotate(90)"
|
||||
style="color:#bebebe;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:1;marker:none;enable-background:new"
|
||||
id="rect11718"
|
||||
y="-197.0002"
|
||||
x="747"
|
||||
height="16"
|
||||
width="16" />
|
||||
<path
|
||||
style="display:inline;fill:#e5e5e5;fill-opacity:1;stroke:none"
|
||||
d="m 189.0002,759.4375 -5.71875,-5.7187 C 183.08558,753.5229 183.0002,753.2556 183.0002,753 v -1 h 1 c 0.25562,0 0.52288,0.085 0.71875,0.2813 l 4.28125,4.2812 4.28125,-4.2812 C 193.47732,752.0854 193.74458,752 194.0002,752 h 1 v 1 c 0,0.2556 -0.0854,0.5229 -0.28125,0.7188 z"
|
||||
id="path11720"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccscsccsscscc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.5 KiB |
114
data/theme/key-layout.svg
Normal file
114
data/theme/key-layout.svg
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
viewBox="0 0 32 32"
|
||||
version="1.1"
|
||||
id="svg7384"
|
||||
height="32"
|
||||
sodipodi:docname="key-layout.svg"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1919"
|
||||
inkscape:window-height="1011"
|
||||
id="namedview19"
|
||||
showgrid="false"
|
||||
inkscape:zoom="14.75"
|
||||
inkscape:cx="1.220339"
|
||||
inkscape:cy="11.842802"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="55"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg7384" />
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient19282"
|
||||
gradientTransform="matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)">
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop19284" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer11" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer13" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g4953" />
|
||||
<g
|
||||
inkscape:label="preferences-desktop-locale"
|
||||
id="g11728"
|
||||
transform="matrix(2,0,0,2,-522.0004,-1086)"
|
||||
style="display:inline;stroke-width:1">
|
||||
<rect
|
||||
style="fill:none;stroke:none;stroke-width:1"
|
||||
id="rect11724"
|
||||
width="16"
|
||||
height="16"
|
||||
x="20"
|
||||
y="326"
|
||||
transform="translate(241.0002,217)" />
|
||||
<path
|
||||
style="fill:#e5e5e5;fill-opacity:1;stroke:none;stroke-width:1"
|
||||
d="m 265.69612,545.23396 c -3.58218,0 -4.66582,1.39975 -4.66582,1.39975 v 10.04946 c 0,0 1.08364,-1.07673 4.66582,-1.07673 2.9161,0 4.47225,1.07673 7.17818,1.07673 2.08923,0 3.19429,-1.39975 3.19429,-1.39975 v -10.04946 c 0,0 -1.14095,1.04084 -3.23018,1.04084 -3.3734,0 -3.97619,-1.04084 -7.14229,-1.04084 z m 2.93145,2.77148 c 1.32876,0 2.375,1.08037 2.375,2.4375 0,1.35713 -1.04624,2.46875 -2.375,2.46875 -1.32876,0 -2.40625,-1.11162 -2.40625,-2.46875 0,-1.35713 1.07749,-2.4375 2.40625,-2.4375 z m -4.5625,0.96875 0.96875,1.03125 -0.9375,-0.0312 0.9375,1 -0.96875,-0.0312 0.96875,1.03125 -1,-0.0312 0.0312,-1 h -0.0312 l 0.0312,-0.9688 h -0.0312 z m 4.5625,0 c -0.794,0 -1.46875,0.6578 -1.46875,1.46875 0,0.81095 0.67475,1.46875 1.46875,1.46875 0.79399,0 1.4375,-0.6578 1.4375,-1.46875 0,-0.81095 -0.64351,-1.46875 -1.4375,-1.46875 z m 4.375,0 v 1 l 0.0312,0.96875 h -0.0312 l 0.0312,1 -1,0.0312 0.96875,-1.03125 -0.96875,0.0312 0.9375,-1 -0.9375,0.0312 z m -7.9375,2.96875 0.96875,1.03125 -1,-0.0312 z m 6.9375,0 0.0312,1 -1,0.0312 z m -5.9375,1 0.96875,1.03125 -1,-0.0312 z m 4.9375,0 0.0312,1 -1,0.0312 z"
|
||||
id="path11726"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sccssccsssssssccccccccccccsssssccccccccccccccccccccccccccc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
109
data/theme/key-shift-latched-uppercase.svg
Normal file
109
data/theme/key-shift-latched-uppercase.svg
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
viewBox="0 0 32 32"
|
||||
version="1.1"
|
||||
id="svg7384"
|
||||
height="32"
|
||||
sodipodi:docname="key-shift-latched-uppercase.svg"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1791"
|
||||
inkscape:window-height="984"
|
||||
id="namedview19"
|
||||
showgrid="false"
|
||||
inkscape:zoom="14.75"
|
||||
inkscape:cx="-0.77966097"
|
||||
inkscape:cy="18.847458"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="55"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg7384" />
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient19282"
|
||||
gradientTransform="matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)">
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop19284" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer11" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer13" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g4953" />
|
||||
<g
|
||||
transform="matrix(2,0,0,2,-282.0004,-1614.2187)"
|
||||
style="display:inline;fill:#006098;fill-opacity:1"
|
||||
id="layer12">
|
||||
<path
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#006098;fill-opacity:1;stroke:none;stroke-width:2;marker:none;enable-background:new"
|
||||
d="m 147,818 v -4 h -3.1248 l 5.125,-5.7813 5.125,5.7813 h -3.1875 v 4 z"
|
||||
id="path16532"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
id="path16534"
|
||||
d="m 147,822 v -2 h 3.9377 v 2 z"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#006098;fill-opacity:1;stroke:none;stroke-width:2;marker:none;enable-background:new"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
104
data/theme/key-shift-uppercase.svg
Normal file
104
data/theme/key-shift-uppercase.svg
Normal file
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
viewBox="0 0 32 32"
|
||||
version="1.1"
|
||||
id="svg7384"
|
||||
height="32"
|
||||
sodipodi:docname="key-shift-uppercase.svg"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2160"
|
||||
inkscape:window-height="1311"
|
||||
id="namedview18"
|
||||
showgrid="false"
|
||||
inkscape:zoom="14.75"
|
||||
inkscape:cx="-27.898305"
|
||||
inkscape:cy="8"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="55"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg7384" />
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient19282"
|
||||
gradientTransform="matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)">
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop19284" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer11" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer13" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-141.0002,-791)"
|
||||
style="display:inline"
|
||||
id="g4953" />
|
||||
<g
|
||||
transform="matrix(2,0,0,2,-282.0008,-1614.2187)"
|
||||
style="display:inline;fill:#006098;fill-opacity:1"
|
||||
id="layer12">
|
||||
<path
|
||||
id="path16548"
|
||||
d="m 147.0002,820 v -4 h -3.1248 l 5.125,-5.7813 5.125,5.7813 h -3.1875 v 4 z"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#006098;fill-opacity:1;stroke:none;stroke-width:2;marker:none;enable-background:new"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
108
data/theme/key-shift.svg
Normal file
108
data/theme/key-shift.svg
Normal file
@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
viewBox="0 0 32 32"
|
||||
version="1.1"
|
||||
id="svg7384"
|
||||
height="32"
|
||||
sodipodi:docname="key-shift.svg"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1400"
|
||||
inkscape:window-height="1034"
|
||||
id="namedview4569"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:zoom="14.75"
|
||||
inkscape:cx="1.5993763"
|
||||
inkscape:cy="5"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="55"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg7384" />
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386">
|
||||
<linearGradient
|
||||
osb:paint="solid"
|
||||
id="linearGradient19282"
|
||||
gradientTransform="matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)">
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop19284" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
style="display:inline"
|
||||
id="layer9" />
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
style="display:inline"
|
||||
id="layer10" />
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
id="layer11" />
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
style="display:inline"
|
||||
id="layer13" />
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
id="layer14" />
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
style="display:inline"
|
||||
id="layer15" />
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
style="display:inline"
|
||||
id="g71291" />
|
||||
<g
|
||||
transform="translate(-143.8754,-788)"
|
||||
style="display:inline"
|
||||
id="g4953" />
|
||||
<g
|
||||
transform="matrix(2,0,0,2,-282.0008,-1614.2187)"
|
||||
style="display:inline"
|
||||
id="layer12">
|
||||
<path
|
||||
id="path16548"
|
||||
d="m 147.0002,820 v -4 h -3.1248 l 5.125,-5.7813 5.125,5.7813 h -3.1875 v 4 z"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;enable-background:new"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
@ -7,15 +7,19 @@ theme_sources = files([
|
||||
'gnome-shell-sass/_high-contrast-colors.scss'
|
||||
])
|
||||
|
||||
styles = [
|
||||
'gnome-shell-high-contrast',
|
||||
'gnome-shell'
|
||||
]
|
||||
|
||||
theme_deps = []
|
||||
|
||||
if sassc.found()
|
||||
parse_sass = files('parse-sass.sh')
|
||||
|
||||
theme_deps += custom_target('update-theme',
|
||||
output: 'theme-update.stamp',
|
||||
depend_files: theme_sources,
|
||||
command: [parse_sass, '@OUTPUT@'],
|
||||
build_by_default: true
|
||||
)
|
||||
endif
|
||||
foreach style: styles
|
||||
theme_deps += custom_target('style-' + style,
|
||||
input: '@0@.scss'.format(style),
|
||||
output: '@0@.css'.format(style),
|
||||
command: [
|
||||
sassc, '-a', '@INPUT@', '@OUTPUT@'
|
||||
],
|
||||
depend_files: theme_sources)
|
||||
endforeach
|
||||
|
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
srcdir=`dirname $0`
|
||||
stamp=${1}
|
||||
for scss in $srcdir/*.scss
|
||||
do
|
||||
sassc -a $scss ${scss%%.scss}.css || exit 1
|
||||
done
|
||||
|
||||
[ "$stamp" ] && touch $stamp
|
@ -34,16 +34,16 @@ function stripPrefix(string, prefix) {
|
||||
|
||||
var Application = new Lang.Class({
|
||||
Name: 'Application',
|
||||
_init: function() {
|
||||
_init() {
|
||||
GLib.set_prgname('gnome-shell-extension-prefs');
|
||||
this.application = new Gtk.Application({
|
||||
application_id: 'org.gnome.shell.ExtensionPrefs',
|
||||
flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE
|
||||
});
|
||||
|
||||
this.application.connect('activate', Lang.bind(this, this._onActivate));
|
||||
this.application.connect('command-line', Lang.bind(this, this._onCommandLine));
|
||||
this.application.connect('startup', Lang.bind(this, this._onStartup));
|
||||
this.application.connect('activate', this._onActivate.bind(this));
|
||||
this.application.connect('command-line', this._onCommandLine.bind(this));
|
||||
this.application.connect('startup', this._onStartup.bind(this));
|
||||
|
||||
this._extensionPrefsModules = {};
|
||||
|
||||
@ -52,7 +52,7 @@ var Application = new Lang.Class({
|
||||
this._skipMainWindow = false;
|
||||
},
|
||||
|
||||
_extensionAvailable: function(uuid) {
|
||||
_extensionAvailable(uuid) {
|
||||
let extension = ExtensionUtils.extensions[uuid];
|
||||
|
||||
if (!extension)
|
||||
@ -64,7 +64,7 @@ var Application = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_getExtensionPrefsModule: function(extension) {
|
||||
_getExtensionPrefsModule(extension) {
|
||||
let uuid = extension.metadata.uuid;
|
||||
|
||||
if (this._extensionPrefsModules.hasOwnProperty(uuid))
|
||||
@ -79,7 +79,7 @@ var Application = new Lang.Class({
|
||||
return prefsModule;
|
||||
},
|
||||
|
||||
_selectExtension: function(uuid) {
|
||||
_selectExtension(uuid) {
|
||||
if (!this._extensionAvailable(uuid))
|
||||
return;
|
||||
|
||||
@ -114,7 +114,7 @@ var Application = new Lang.Class({
|
||||
dialog.show();
|
||||
},
|
||||
|
||||
_buildErrorUI: function(extension, exc) {
|
||||
_buildErrorUI(extension, exc) {
|
||||
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
|
||||
let label = new Gtk.Label({
|
||||
label: _("There was an error loading the preferences dialog for %s:").format(extension.metadata.name)
|
||||
@ -127,9 +127,7 @@ var Application = new Lang.Class({
|
||||
errortext += 'Stack trace:\n';
|
||||
|
||||
// Indent stack trace.
|
||||
errortext += exc.stack.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n');
|
||||
errortext += exc.stack.split('\n').map(line => ' ' + line).join('\n');
|
||||
|
||||
let scroll = new Gtk.ScrolledWindow({ vexpand: true });
|
||||
let buffer = new Gtk.TextBuffer({ text: errortext });
|
||||
@ -142,7 +140,7 @@ var Application = new Lang.Class({
|
||||
return box;
|
||||
},
|
||||
|
||||
_buildUI: function(app) {
|
||||
_buildUI(app) {
|
||||
this._window = new Gtk.ApplicationWindow({ application: app,
|
||||
window_position: Gtk.WindowPosition.CENTER });
|
||||
|
||||
@ -164,28 +162,28 @@ var Application = new Lang.Class({
|
||||
this._window.add(scroll);
|
||||
|
||||
this._extensionSelector = new Gtk.ListBox({ selection_mode: Gtk.SelectionMode.NONE });
|
||||
this._extensionSelector.set_sort_func(Lang.bind(this, this._sortList));
|
||||
this._extensionSelector.set_header_func(Lang.bind(this, this._updateHeader));
|
||||
this._extensionSelector.set_sort_func(this._sortList.bind(this));
|
||||
this._extensionSelector.set_header_func(this._updateHeader.bind(this));
|
||||
|
||||
scroll.add(this._extensionSelector);
|
||||
|
||||
|
||||
this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell');
|
||||
this._shellProxy.connectSignal('ExtensionStatusChanged', Lang.bind(this, function(proxy, senderName, [uuid, state, error]) {
|
||||
this._shellProxy.connectSignal('ExtensionStatusChanged', (proxy, senderName, [uuid, state, error]) => {
|
||||
if (ExtensionUtils.extensions[uuid] !== undefined)
|
||||
this._scanExtensions();
|
||||
}));
|
||||
});
|
||||
|
||||
this._window.show_all();
|
||||
},
|
||||
|
||||
_sortList: function(row1, row2) {
|
||||
_sortList(row1, row2) {
|
||||
let name1 = ExtensionUtils.extensions[row1.uuid].metadata.name;
|
||||
let name2 = ExtensionUtils.extensions[row2.uuid].metadata.name;
|
||||
return name1.localeCompare(name2);
|
||||
},
|
||||
|
||||
_updateHeader: function(row, before) {
|
||||
_updateHeader(row, before) {
|
||||
if (!before || row.get_header())
|
||||
return;
|
||||
|
||||
@ -193,27 +191,26 @@ var Application = new Lang.Class({
|
||||
row.set_header(sep);
|
||||
},
|
||||
|
||||
_scanExtensions: function() {
|
||||
_scanExtensions() {
|
||||
let finder = new ExtensionUtils.ExtensionFinder();
|
||||
finder.connect('extension-found', Lang.bind(this, this._extensionFound));
|
||||
finder.connect('extension-found', this._extensionFound.bind(this));
|
||||
finder.scanExtensions();
|
||||
this._extensionsLoaded();
|
||||
},
|
||||
|
||||
_extensionFound: function(finder, extension) {
|
||||
_extensionFound(finder, extension) {
|
||||
let row = new ExtensionRow(extension.uuid);
|
||||
|
||||
row.prefsButton.visible = this._extensionAvailable(row.uuid);
|
||||
row.prefsButton.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this._selectExtension(row.uuid);
|
||||
}));
|
||||
row.prefsButton.connect('clicked', () => {
|
||||
this._selectExtension(row.uuid);
|
||||
});
|
||||
|
||||
row.show_all();
|
||||
this._extensionSelector.add(row);
|
||||
},
|
||||
|
||||
_extensionsLoaded: function() {
|
||||
_extensionsLoaded() {
|
||||
if (this._startupUuid && this._extensionAvailable(this._startupUuid))
|
||||
this._selectExtension(this._startupUuid);
|
||||
this._startupUuid = null;
|
||||
@ -221,16 +218,16 @@ var Application = new Lang.Class({
|
||||
this._loaded = true;
|
||||
},
|
||||
|
||||
_onActivate: function() {
|
||||
_onActivate() {
|
||||
this._window.present();
|
||||
},
|
||||
|
||||
_onStartup: function(app) {
|
||||
_onStartup(app) {
|
||||
this._buildUI(app);
|
||||
this._scanExtensions();
|
||||
},
|
||||
|
||||
_onCommandLine: function(app, commandLine) {
|
||||
_onCommandLine(app, commandLine) {
|
||||
app.activate();
|
||||
let args = commandLine.get_arguments();
|
||||
|
||||
@ -257,7 +254,7 @@ var DescriptionLabel = new Lang.Class({
|
||||
Name: 'DescriptionLabel',
|
||||
Extends: Gtk.Label,
|
||||
|
||||
vfunc_get_preferred_height_for_width: function(width) {
|
||||
vfunc_get_preferred_height_for_width(width) {
|
||||
// Hack: Request the maximum height allowed by the line limit
|
||||
if (this.lines > 0)
|
||||
return this.parent(0);
|
||||
@ -269,29 +266,28 @@ var ExtensionRow = new Lang.Class({
|
||||
Name: 'ExtensionRow',
|
||||
Extends: Gtk.ListBoxRow,
|
||||
|
||||
_init: function(uuid) {
|
||||
_init(uuid) {
|
||||
this.parent();
|
||||
|
||||
this.uuid = uuid;
|
||||
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
|
||||
this._settings.connect('changed::enabled-extensions', Lang.bind(this,
|
||||
function() {
|
||||
this._switch.state = this._isEnabled();
|
||||
}));
|
||||
this._settings.connect('changed::enabled-extensions', () => {
|
||||
this._switch.state = this._isEnabled();
|
||||
});
|
||||
this._settings.connect('changed::disable-extension-version-validation',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._switch.sensitive = this._canEnable();
|
||||
}));
|
||||
});
|
||||
this._settings.connect('changed::disable-user-extensions',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._switch.sensitive = this._canEnable();
|
||||
}));
|
||||
});
|
||||
|
||||
this._buildUI();
|
||||
},
|
||||
|
||||
_buildUI: function() {
|
||||
_buildUI() {
|
||||
let extension = ExtensionUtils.extensions[this.uuid];
|
||||
|
||||
let hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
|
||||
@ -328,18 +324,17 @@ var ExtensionRow = new Lang.Class({
|
||||
this._switch = new Gtk.Switch({ valign: Gtk.Align.CENTER,
|
||||
sensitive: this._canEnable(),
|
||||
state: this._isEnabled() });
|
||||
this._switch.connect('notify::active', Lang.bind(this,
|
||||
function() {
|
||||
if (this._switch.active)
|
||||
this._enable();
|
||||
else
|
||||
this._disable();
|
||||
}));
|
||||
this._switch.connect('state-set', function() { return true; });
|
||||
this._switch.connect('notify::active', () => {
|
||||
if (this._switch.active)
|
||||
this._enable();
|
||||
else
|
||||
this._disable();
|
||||
});
|
||||
this._switch.connect('state-set', () => true);
|
||||
hbox.add(this._switch);
|
||||
},
|
||||
|
||||
_canEnable: function() {
|
||||
_canEnable() {
|
||||
let extension = ExtensionUtils.extensions[this.uuid];
|
||||
let checkVersion = !this._settings.get_boolean('disable-extension-version-validation');
|
||||
|
||||
@ -347,12 +342,12 @@ var ExtensionRow = new Lang.Class({
|
||||
!(checkVersion && ExtensionUtils.isOutOfDate(extension));
|
||||
},
|
||||
|
||||
_isEnabled: function() {
|
||||
_isEnabled() {
|
||||
let extensions = this._settings.get_strv('enabled-extensions');
|
||||
return extensions.indexOf(this.uuid) != -1;
|
||||
},
|
||||
|
||||
_enable: function() {
|
||||
_enable() {
|
||||
let extensions = this._settings.get_strv('enabled-extensions');
|
||||
if (extensions.indexOf(this.uuid) != -1)
|
||||
return;
|
||||
@ -361,7 +356,7 @@ var ExtensionRow = new Lang.Class({
|
||||
this._settings.set_strv('enabled-extensions', extensions);
|
||||
},
|
||||
|
||||
_disable: function() {
|
||||
_disable() {
|
||||
let extensions = this._settings.get_strv('enabled-extensions');
|
||||
let pos = extensions.indexOf(this.uuid);
|
||||
if (pos == -1)
|
||||
@ -378,11 +373,11 @@ function initEnvironment() {
|
||||
// Monkey-patch in a "global" object that fakes some Shell utilities
|
||||
// that ExtensionUtils depends on.
|
||||
window.global = {
|
||||
log: function() {
|
||||
log() {
|
||||
print([].join.call(arguments, ', '));
|
||||
},
|
||||
|
||||
logError: function(s) {
|
||||
logError(s) {
|
||||
log('ERROR: ' + s);
|
||||
},
|
||||
|
||||
|
@ -41,7 +41,7 @@ var BeginRequestType = {
|
||||
var AuthPrompt = new Lang.Class({
|
||||
Name: 'AuthPrompt',
|
||||
|
||||
_init: function(gdmClient, mode) {
|
||||
_init(gdmClient, mode) {
|
||||
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
||||
|
||||
this._gdmClient = gdmClient;
|
||||
@ -55,35 +55,33 @@ var AuthPrompt = new Lang.Class({
|
||||
|
||||
this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, { reauthenticationOnly: reauthenticationOnly });
|
||||
|
||||
this._userVerifier.connect('ask-question', Lang.bind(this, this._onAskQuestion));
|
||||
this._userVerifier.connect('show-message', Lang.bind(this, this._onShowMessage));
|
||||
this._userVerifier.connect('verification-failed', Lang.bind(this, this._onVerificationFailed));
|
||||
this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete));
|
||||
this._userVerifier.connect('reset', Lang.bind(this, this._onReset));
|
||||
this._userVerifier.connect('smartcard-status-changed', Lang.bind(this, this._onSmartcardStatusChanged));
|
||||
this._userVerifier.connect('ovirt-user-authenticated', Lang.bind(this, this._onOVirtUserAuthenticated));
|
||||
this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this));
|
||||
this._userVerifier.connect('show-message', this._onShowMessage.bind(this));
|
||||
this._userVerifier.connect('verification-failed', this._onVerificationFailed.bind(this));
|
||||
this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
|
||||
this._userVerifier.connect('reset', this._onReset.bind(this));
|
||||
this._userVerifier.connect('smartcard-status-changed', this._onSmartcardStatusChanged.bind(this));
|
||||
this._userVerifier.connect('ovirt-user-authenticated', this._onOVirtUserAuthenticated.bind(this));
|
||||
this.smartcardDetected = this._userVerifier.smartcardDetected;
|
||||
|
||||
this.connect('next', Lang.bind(this, function() {
|
||||
this.updateSensitivity(false);
|
||||
this.startSpinning();
|
||||
if (this._queryingService) {
|
||||
this._userVerifier.answerQuery(this._queryingService, this._entry.text);
|
||||
} else {
|
||||
this._preemptiveAnswer = this._entry.text;
|
||||
}
|
||||
}));
|
||||
this.connect('next', () => {
|
||||
this.updateSensitivity(false);
|
||||
this.startSpinning();
|
||||
if (this._queryingService) {
|
||||
this._userVerifier.answerQuery(this._queryingService, this._entry.text);
|
||||
} else {
|
||||
this._preemptiveAnswer = this._entry.text;
|
||||
}
|
||||
});
|
||||
|
||||
this.actor = new St.BoxLayout({ style_class: 'login-dialog-prompt-layout',
|
||||
vertical: true });
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this.actor.connect('key-press-event',
|
||||
Lang.bind(this, function(actor, event) {
|
||||
if (event.get_key_symbol() == Clutter.KEY_Escape) {
|
||||
this.cancel();
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
this.actor.connect('key-press-event', (actor, event) => {
|
||||
if (event.get_key_symbol() == Clutter.KEY_Escape)
|
||||
this.cancel();
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
||||
this._userWell = new St.Bin({ x_fill: true,
|
||||
x_align: St.Align.START });
|
||||
@ -136,21 +134,18 @@ var AuthPrompt = new Lang.Class({
|
||||
this._defaultButtonWell.add_child(this._spinner.actor);
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this._userVerifier.destroy();
|
||||
this._userVerifier = null;
|
||||
},
|
||||
|
||||
_initButtons: function() {
|
||||
_initButtons() {
|
||||
this.cancelButton = new St.Button({ style_class: 'modal-dialog-button button',
|
||||
button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
|
||||
reactive: true,
|
||||
can_focus: true,
|
||||
label: _("Cancel") });
|
||||
this.cancelButton.connect('clicked',
|
||||
Lang.bind(this, function() {
|
||||
this.cancel();
|
||||
}));
|
||||
this.cancelButton.connect('clicked', () => { this.cancel(); });
|
||||
this._buttonBox.add(this.cancelButton,
|
||||
{ expand: false,
|
||||
x_fill: false,
|
||||
@ -169,10 +164,7 @@ var AuthPrompt = new Lang.Class({
|
||||
reactive: true,
|
||||
can_focus: true,
|
||||
label: _("Next") });
|
||||
this.nextButton.connect('clicked',
|
||||
Lang.bind(this, function() {
|
||||
this.emit('next');
|
||||
}));
|
||||
this.nextButton.connect('clicked', () => { this.emit('next'); });
|
||||
this.nextButton.add_style_pseudo_class('default');
|
||||
this._buttonBox.add(this.nextButton,
|
||||
{ expand: false,
|
||||
@ -183,20 +175,19 @@ var AuthPrompt = new Lang.Class({
|
||||
|
||||
this._updateNextButtonSensitivity(this._entry.text.length > 0);
|
||||
|
||||
this._entry.clutter_text.connect('text-changed',
|
||||
Lang.bind(this, function() {
|
||||
if (!this._userVerifier.hasPendingMessages)
|
||||
this._fadeOutMessage();
|
||||
this._entry.clutter_text.connect('text-changed', () => {
|
||||
if (!this._userVerifier.hasPendingMessages)
|
||||
this._fadeOutMessage();
|
||||
|
||||
this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
|
||||
}));
|
||||
this._entry.clutter_text.connect('activate', Lang.bind(this, function() {
|
||||
this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
|
||||
});
|
||||
this._entry.clutter_text.connect('activate', () => {
|
||||
if (this.nextButton.reactive)
|
||||
this.emit('next');
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onAskQuestion: function(verifier, serviceName, question, passwordChar) {
|
||||
_onAskQuestion(verifier, serviceName, question, passwordChar) {
|
||||
if (this._queryingService)
|
||||
this.clear();
|
||||
|
||||
@ -222,12 +213,12 @@ var AuthPrompt = new Lang.Class({
|
||||
this.emit('prompted');
|
||||
},
|
||||
|
||||
_onOVirtUserAuthenticated: function() {
|
||||
_onOVirtUserAuthenticated() {
|
||||
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
this.reset();
|
||||
},
|
||||
|
||||
_onSmartcardStatusChanged: function() {
|
||||
_onSmartcardStatusChanged() {
|
||||
this.smartcardDetected = this._userVerifier.smartcardDetected;
|
||||
|
||||
// Most of the time we want to reset if the user inserts or removes
|
||||
@ -246,12 +237,12 @@ var AuthPrompt = new Lang.Class({
|
||||
this.reset();
|
||||
},
|
||||
|
||||
_onShowMessage: function(userVerifier, message, type) {
|
||||
_onShowMessage(userVerifier, message, type) {
|
||||
this.setMessage(message, type);
|
||||
this.emit('prompted');
|
||||
},
|
||||
|
||||
_onVerificationFailed: function() {
|
||||
_onVerificationFailed() {
|
||||
this._queryingService = null;
|
||||
this.clear();
|
||||
|
||||
@ -260,22 +251,22 @@ var AuthPrompt = new Lang.Class({
|
||||
this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED;
|
||||
},
|
||||
|
||||
_onVerificationComplete: function() {
|
||||
_onVerificationComplete() {
|
||||
this.setActorInDefaultButtonWell(null);
|
||||
this.verificationStatus = AuthPromptStatus.VERIFICATION_SUCCEEDED;
|
||||
this.cancelButton.reactive = false;
|
||||
},
|
||||
|
||||
_onReset: function() {
|
||||
_onReset() {
|
||||
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
||||
this.reset();
|
||||
},
|
||||
|
||||
addActorToDefaultButtonWell: function(actor) {
|
||||
addActorToDefaultButtonWell(actor) {
|
||||
this._defaultButtonWell.add_child(actor);
|
||||
},
|
||||
|
||||
setActorInDefaultButtonWell: function(actor, animate) {
|
||||
setActorInDefaultButtonWell(actor, animate) {
|
||||
if (!this._defaultButtonWellActor &&
|
||||
!actor)
|
||||
return;
|
||||
@ -312,7 +303,7 @@ var AuthPrompt = new Lang.Class({
|
||||
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
|
||||
transition: 'linear',
|
||||
onCompleteScope: this,
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
if (wasSpinner) {
|
||||
if (this._spinner)
|
||||
this._spinner.stop();
|
||||
@ -339,25 +330,25 @@ var AuthPrompt = new Lang.Class({
|
||||
this._defaultButtonWellActor = actor;
|
||||
},
|
||||
|
||||
startSpinning: function() {
|
||||
startSpinning() {
|
||||
this.setActorInDefaultButtonWell(this._spinner.actor, true);
|
||||
},
|
||||
|
||||
stopSpinning: function() {
|
||||
stopSpinning() {
|
||||
this.setActorInDefaultButtonWell(null, false);
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
clear() {
|
||||
this._entry.text = '';
|
||||
this.stopSpinning();
|
||||
},
|
||||
|
||||
setPasswordChar: function(passwordChar) {
|
||||
setPasswordChar(passwordChar) {
|
||||
this._entry.clutter_text.set_password_char(passwordChar);
|
||||
this._entry.menu.isPassword = passwordChar != '';
|
||||
},
|
||||
|
||||
setQuestion: function(question) {
|
||||
setQuestion(question) {
|
||||
this._label.set_text(question);
|
||||
|
||||
this._label.show();
|
||||
@ -366,7 +357,7 @@ var AuthPrompt = new Lang.Class({
|
||||
this._entry.grab_key_focus();
|
||||
},
|
||||
|
||||
getAnswer: function() {
|
||||
getAnswer() {
|
||||
let text;
|
||||
|
||||
if (this._preemptiveAnswer) {
|
||||
@ -379,7 +370,7 @@ var AuthPrompt = new Lang.Class({
|
||||
return text;
|
||||
},
|
||||
|
||||
_fadeOutMessage: function() {
|
||||
_fadeOutMessage() {
|
||||
if (this._message.opacity == 0)
|
||||
return;
|
||||
Tweener.removeTweens(this._message);
|
||||
@ -390,7 +381,7 @@ var AuthPrompt = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
setMessage: function(message, type) {
|
||||
setMessage(message, type) {
|
||||
if (type == GdmUtil.MessageType.ERROR)
|
||||
this._message.add_style_class_name('login-dialog-message-warning');
|
||||
else
|
||||
@ -410,18 +401,18 @@ var AuthPrompt = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateNextButtonSensitivity: function(sensitive) {
|
||||
_updateNextButtonSensitivity(sensitive) {
|
||||
this.nextButton.reactive = sensitive;
|
||||
this.nextButton.can_focus = sensitive;
|
||||
},
|
||||
|
||||
updateSensitivity: function(sensitive) {
|
||||
updateSensitivity(sensitive) {
|
||||
this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING));
|
||||
this._entry.reactive = sensitive;
|
||||
this._entry.clutter_text.editable = sensitive;
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
hide() {
|
||||
this.setActorInDefaultButtonWell(null, true);
|
||||
this.actor.hide();
|
||||
this._message.opacity = 0;
|
||||
@ -432,7 +423,7 @@ var AuthPrompt = new Lang.Class({
|
||||
this._entry.set_text('');
|
||||
},
|
||||
|
||||
setUser: function(user) {
|
||||
setUser(user) {
|
||||
let oldChild = this._userWell.get_child();
|
||||
if (oldChild)
|
||||
oldChild.destroy();
|
||||
@ -443,7 +434,7 @@ var AuthPrompt = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
reset() {
|
||||
let oldStatus = this.verificationStatus;
|
||||
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
||||
this.cancelButton.reactive = true;
|
||||
@ -480,7 +471,7 @@ var AuthPrompt = new Lang.Class({
|
||||
this.emit('reset', beginRequestType);
|
||||
},
|
||||
|
||||
addCharacter: function(unichar) {
|
||||
addCharacter(unichar) {
|
||||
if (!this._entry.visible)
|
||||
return;
|
||||
|
||||
@ -488,7 +479,7 @@ var AuthPrompt = new Lang.Class({
|
||||
this._entry.clutter_text.insert_unichar(unichar);
|
||||
},
|
||||
|
||||
begin: function(params) {
|
||||
begin(params) {
|
||||
params = Params.parse(params, { userName: null,
|
||||
hold: null });
|
||||
|
||||
@ -502,22 +493,21 @@ var AuthPrompt = new Lang.Class({
|
||||
this.verificationStatus = AuthPromptStatus.VERIFYING;
|
||||
},
|
||||
|
||||
finish: function(onComplete) {
|
||||
finish(onComplete) {
|
||||
if (!this._userVerifier.hasPendingMessages) {
|
||||
this._userVerifier.clear();
|
||||
onComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
let signalId = this._userVerifier.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this._userVerifier.disconnect(signalId);
|
||||
this._userVerifier.clear();
|
||||
onComplete();
|
||||
}));
|
||||
let signalId = this._userVerifier.connect('no-more-messages', () => {
|
||||
this._userVerifier.disconnect(signalId);
|
||||
this._userVerifier.clear();
|
||||
onComplete();
|
||||
});
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
cancel() {
|
||||
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) {
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ const Signals = imports.signals;
|
||||
var Task = new Lang.Class({
|
||||
Name: 'Task',
|
||||
|
||||
_init: function(scope, handler) {
|
||||
_init(scope, handler) {
|
||||
if (scope)
|
||||
this.scope = scope;
|
||||
else
|
||||
@ -59,7 +59,7 @@ var Task = new Lang.Class({
|
||||
this.handler = handler;
|
||||
},
|
||||
|
||||
run: function() {
|
||||
run() {
|
||||
if (this.handler)
|
||||
return this.handler.call(this.scope);
|
||||
|
||||
@ -72,39 +72,37 @@ var Hold = new Lang.Class({
|
||||
Name: 'Hold',
|
||||
Extends: Task,
|
||||
|
||||
_init: function() {
|
||||
this.parent(this, function () {
|
||||
return this;
|
||||
});
|
||||
_init() {
|
||||
this.parent(this, () => this);
|
||||
|
||||
this._acquisitions = 1;
|
||||
},
|
||||
|
||||
acquire: function() {
|
||||
acquire() {
|
||||
if (this._acquisitions <= 0)
|
||||
throw new Error("Cannot acquire hold after it's been released");
|
||||
this._acquisitions++;
|
||||
},
|
||||
|
||||
acquireUntilAfter: function(hold) {
|
||||
acquireUntilAfter(hold) {
|
||||
if (!hold.isAcquired())
|
||||
return;
|
||||
|
||||
this.acquire();
|
||||
let signalId = hold.connect('release', Lang.bind(this, function() {
|
||||
hold.disconnect(signalId);
|
||||
this.release();
|
||||
}));
|
||||
let signalId = hold.connect('release', () => {
|
||||
hold.disconnect(signalId);
|
||||
this.release();
|
||||
});
|
||||
},
|
||||
|
||||
release: function() {
|
||||
release() {
|
||||
this._acquisitions--;
|
||||
|
||||
if (this._acquisitions == 0)
|
||||
this.emit('release');
|
||||
},
|
||||
|
||||
isAcquired: function() {
|
||||
isAcquired() {
|
||||
return this._acquisitions > 0;
|
||||
}
|
||||
});
|
||||
@ -114,7 +112,7 @@ var Batch = new Lang.Class({
|
||||
Name: 'Batch',
|
||||
Extends: Task,
|
||||
|
||||
_init: function(scope, tasks) {
|
||||
_init(scope, tasks) {
|
||||
this.parent();
|
||||
|
||||
this.tasks = [];
|
||||
@ -134,11 +132,11 @@ var Batch = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
process: function() {
|
||||
process() {
|
||||
throw new Error('Not implemented');
|
||||
},
|
||||
|
||||
runTask: function() {
|
||||
runTask() {
|
||||
if (!(this._currentTaskIndex in this.tasks)) {
|
||||
return null;
|
||||
}
|
||||
@ -146,11 +144,11 @@ var Batch = new Lang.Class({
|
||||
return this.tasks[this._currentTaskIndex].run();
|
||||
},
|
||||
|
||||
_finish: function() {
|
||||
_finish() {
|
||||
this.hold.release();
|
||||
},
|
||||
|
||||
nextTask: function() {
|
||||
nextTask() {
|
||||
this._currentTaskIndex++;
|
||||
|
||||
// if the entire batch of tasks is finished, release
|
||||
@ -163,7 +161,7 @@ var Batch = new Lang.Class({
|
||||
this.process();
|
||||
},
|
||||
|
||||
_start: function() {
|
||||
_start() {
|
||||
// acquire a hold to get released when the entire
|
||||
// batch of tasks is finished
|
||||
this.hold = new Hold();
|
||||
@ -171,7 +169,7 @@ var Batch = new Lang.Class({
|
||||
this.process();
|
||||
},
|
||||
|
||||
run: function() {
|
||||
run() {
|
||||
this._start();
|
||||
|
||||
// hold may be destroyed at this point
|
||||
@ -179,7 +177,7 @@ var Batch = new Lang.Class({
|
||||
return this.hold;
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
cancel() {
|
||||
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
|
||||
}
|
||||
});
|
||||
@ -189,7 +187,7 @@ var ConcurrentBatch = new Lang.Class({
|
||||
Name: 'ConcurrentBatch',
|
||||
Extends: Batch,
|
||||
|
||||
process: function() {
|
||||
process() {
|
||||
let hold = this.runTask();
|
||||
|
||||
if (hold) {
|
||||
@ -208,17 +206,16 @@ var ConsecutiveBatch = new Lang.Class({
|
||||
Name: 'ConsecutiveBatch',
|
||||
Extends: Batch,
|
||||
|
||||
process: function() {
|
||||
process() {
|
||||
let hold = this.runTask();
|
||||
|
||||
if (hold && hold.isAcquired()) {
|
||||
// This task is inhibiting the batch. Wait on it
|
||||
// before processing the next one.
|
||||
let signalId = hold.connect('release',
|
||||
Lang.bind(this, function() {
|
||||
hold.disconnect(signalId);
|
||||
this.nextTask();
|
||||
}));
|
||||
let signalId = hold.connect('release', () => {
|
||||
hold.disconnect(signalId);
|
||||
this.nextTask();
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
// This task finished, process the next one
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,28 +29,28 @@ function OVirtCredentials() {
|
||||
|
||||
var OVirtCredentialsManager = new Lang.Class({
|
||||
Name: 'OVirtCredentialsManager',
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._token = null;
|
||||
|
||||
this._credentials = new OVirtCredentials();
|
||||
this._credentials.connectSignal('UserAuthenticated',
|
||||
Lang.bind(this, this._onUserAuthenticated));
|
||||
this._onUserAuthenticated.bind(this));
|
||||
},
|
||||
|
||||
_onUserAuthenticated: function(proxy, sender, [token]) {
|
||||
_onUserAuthenticated(proxy, sender, [token]) {
|
||||
this._token = token;
|
||||
this.emit('user-authenticated', token);
|
||||
},
|
||||
|
||||
hasToken: function() {
|
||||
hasToken() {
|
||||
return this._token != null;
|
||||
},
|
||||
|
||||
getToken: function() {
|
||||
getToken() {
|
||||
return this._token;
|
||||
},
|
||||
|
||||
resetToken: function() {
|
||||
resetToken() {
|
||||
this._token = null;
|
||||
}
|
||||
});
|
||||
|
@ -62,21 +62,21 @@ const Realm = Gio.DBusProxy.makeProxyWrapper(RealmIface);
|
||||
var Manager = new Lang.Class({
|
||||
Name: 'Manager',
|
||||
|
||||
_init: function(parentActor) {
|
||||
_init(parentActor) {
|
||||
this._aggregateProvider = Provider(Gio.DBus.system,
|
||||
'org.freedesktop.realmd',
|
||||
'/org/freedesktop/realmd',
|
||||
Lang.bind(this, this._reloadRealms))
|
||||
this._reloadRealms.bind(this))
|
||||
this._realms = {};
|
||||
|
||||
this._signalId = this._aggregateProvider.connect('g-properties-changed',
|
||||
Lang.bind(this, function(proxy, properties) {
|
||||
if ('Realms' in properties.deep_unpack())
|
||||
this._reloadRealms();
|
||||
}));
|
||||
(proxy, properties) => {
|
||||
if ('Realms' in properties.deep_unpack())
|
||||
this._reloadRealms();
|
||||
});
|
||||
},
|
||||
|
||||
_reloadRealms: function() {
|
||||
_reloadRealms() {
|
||||
let realmPaths = this._aggregateProvider.Realms;
|
||||
|
||||
if (!realmPaths)
|
||||
@ -86,11 +86,11 @@ var Manager = new Lang.Class({
|
||||
let realm = Realm(Gio.DBus.system,
|
||||
'org.freedesktop.realmd',
|
||||
realmPaths[i],
|
||||
Lang.bind(this, this._onRealmLoaded));
|
||||
this._onRealmLoaded.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
_reloadRealm: function(realm) {
|
||||
_reloadRealm(realm) {
|
||||
if (!realm.Configured) {
|
||||
if (this._realms[realm.get_object_path()])
|
||||
delete this._realms[realm.get_object_path()];
|
||||
@ -103,20 +103,19 @@ var Manager = new Lang.Class({
|
||||
this._updateLoginFormat();
|
||||
},
|
||||
|
||||
_onRealmLoaded: function(realm, error) {
|
||||
_onRealmLoaded(realm, error) {
|
||||
if (error)
|
||||
return;
|
||||
|
||||
this._reloadRealm(realm);
|
||||
|
||||
realm.connect('g-properties-changed',
|
||||
Lang.bind(this, function(proxy, properties) {
|
||||
if ('Configured' in properties.deep_unpack())
|
||||
this._reloadRealm(realm);
|
||||
}));
|
||||
realm.connect('g-properties-changed', (proxy, properties) => {
|
||||
if ('Configured' in properties.deep_unpack())
|
||||
this._reloadRealm(realm);
|
||||
});
|
||||
},
|
||||
|
||||
_updateLoginFormat: function() {
|
||||
_updateLoginFormat() {
|
||||
let newLoginFormat;
|
||||
|
||||
for (let realmPath in this._realms) {
|
||||
@ -142,13 +141,11 @@ var Manager = new Lang.Class({
|
||||
return this._loginFormat;
|
||||
},
|
||||
|
||||
release: function() {
|
||||
release() {
|
||||
Service(Gio.DBus.system,
|
||||
'org.freedesktop.realmd',
|
||||
'/org/freedesktop/realmd',
|
||||
function(service) {
|
||||
service.ReleaseRemote();
|
||||
});
|
||||
service => { service.ReleaseRemote(); });
|
||||
this._aggregateProvider.disconnect(this._signalId);
|
||||
this._realms = { };
|
||||
this._updateLoginFormat();
|
||||
|
156
js/gdm/util.js
156
js/gdm/util.js
@ -60,7 +60,7 @@ function fadeInActor(actor) {
|
||||
height: naturalHeight,
|
||||
time: FADE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
this.set_height(-1);
|
||||
hold.release();
|
||||
},
|
||||
@ -82,7 +82,7 @@ function fadeOutActor(actor) {
|
||||
height: 0,
|
||||
time: FADE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
this.hide();
|
||||
this.set_height(-1);
|
||||
hold.release();
|
||||
@ -111,7 +111,7 @@ function cloneAndFadeOutActor(actor) {
|
||||
{ opacity: 0,
|
||||
time: CLONE_FADE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
clone.destroy();
|
||||
hold.release();
|
||||
}
|
||||
@ -122,7 +122,7 @@ function cloneAndFadeOutActor(actor) {
|
||||
var ShellUserVerifier = new Lang.Class({
|
||||
Name: 'ShellUserVerifier',
|
||||
|
||||
_init: function(client, params) {
|
||||
_init(client, params) {
|
||||
params = Params.parse(params, { reauthenticationOnly: false });
|
||||
this._reauthOnly = params.reauthenticationOnly;
|
||||
|
||||
@ -133,7 +133,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
|
||||
this._settings = new Gio.Settings({ schema_id: LOGIN_SCREEN_SCHEMA });
|
||||
this._settings.connect('changed',
|
||||
Lang.bind(this, this._updateDefaultService));
|
||||
this._updateDefaultService.bind(this));
|
||||
this._updateDefaultService();
|
||||
|
||||
this._fprintManager = Fprint.FprintManager();
|
||||
@ -147,9 +147,9 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._checkForSmartcard();
|
||||
|
||||
this._smartcardInsertedId = this._smartcardManager.connect('smartcard-inserted',
|
||||
Lang.bind(this, this._checkForSmartcard));
|
||||
this._checkForSmartcard.bind(this));
|
||||
this._smartcardRemovedId = this._smartcardManager.connect('smartcard-removed',
|
||||
Lang.bind(this, this._checkForSmartcard));
|
||||
this._checkForSmartcard.bind(this));
|
||||
|
||||
this._messageQueue = [];
|
||||
this._messageQueueTimeoutId = 0;
|
||||
@ -164,10 +164,10 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._oVirtUserAuthenticated(this._oVirtCredentialsManager.getToken());
|
||||
|
||||
this._oVirtUserAuthenticatedId = this._oVirtCredentialsManager.connect('user-authenticated',
|
||||
Lang.bind(this, this._oVirtUserAuthenticated));
|
||||
this._oVirtUserAuthenticated.bind(this));
|
||||
},
|
||||
|
||||
begin: function(userName, hold) {
|
||||
begin(userName, hold) {
|
||||
this._cancellable = new Gio.Cancellable();
|
||||
this._hold = hold;
|
||||
this._userName = userName;
|
||||
@ -179,13 +179,13 @@ var ShellUserVerifier = new Lang.Class({
|
||||
// If possible, reauthenticate an already running session,
|
||||
// so any session specific credentials get updated appropriately
|
||||
this._client.open_reauthentication_channel(userName, this._cancellable,
|
||||
Lang.bind(this, this._reauthenticationChannelOpened));
|
||||
this._reauthenticationChannelOpened.bind(this));
|
||||
} else {
|
||||
this._client.get_user_verifier(this._cancellable, Lang.bind(this, this._userVerifierGot));
|
||||
this._client.get_user_verifier(this._cancellable, this._userVerifierGot.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
cancel() {
|
||||
if (this._cancellable)
|
||||
this._cancellable.cancel();
|
||||
|
||||
@ -195,14 +195,14 @@ var ShellUserVerifier = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_clearUserVerifier: function() {
|
||||
_clearUserVerifier() {
|
||||
if (this._userVerifier) {
|
||||
this._userVerifier.run_dispose();
|
||||
this._userVerifier = null;
|
||||
}
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
clear() {
|
||||
if (this._cancellable) {
|
||||
this._cancellable.cancel();
|
||||
this._cancellable = null;
|
||||
@ -212,7 +212,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._clearMessageQueue();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this.clear();
|
||||
|
||||
this._settings.run_dispose();
|
||||
@ -226,24 +226,23 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._oVirtCredentialsManager = null;
|
||||
},
|
||||
|
||||
answerQuery: function(serviceName, answer) {
|
||||
answerQuery(serviceName, answer) {
|
||||
if (!this.hasPendingMessages) {
|
||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
||||
} else {
|
||||
let signalId = this.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
||||
}));
|
||||
let signalId = this.connect('no-more-messages', () => {
|
||||
this.disconnect(signalId);
|
||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_getIntervalForMessage: function(message) {
|
||||
_getIntervalForMessage(message) {
|
||||
// We probably could be smarter here
|
||||
return message.length * USER_READ_TIME;
|
||||
},
|
||||
|
||||
finishMessageQueue: function() {
|
||||
finishMessageQueue() {
|
||||
if (!this.hasPendingMessages)
|
||||
return;
|
||||
|
||||
@ -253,7 +252,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this.emit('no-more-messages');
|
||||
},
|
||||
|
||||
_queueMessageTimeout: function() {
|
||||
_queueMessageTimeout() {
|
||||
if (this._messageQueue.length == 0) {
|
||||
this.finishMessageQueue();
|
||||
return;
|
||||
@ -268,15 +267,15 @@ var ShellUserVerifier = new Lang.Class({
|
||||
|
||||
this._messageQueueTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
message.interval,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._messageQueueTimeoutId = 0;
|
||||
this._queueMessageTimeout();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
|
||||
},
|
||||
|
||||
_queueMessage: function(message, messageType) {
|
||||
_queueMessage(message, messageType) {
|
||||
let interval = this._getIntervalForMessage(message);
|
||||
|
||||
this.hasPendingMessages = true;
|
||||
@ -284,7 +283,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._queueMessageTimeout();
|
||||
},
|
||||
|
||||
_clearMessageQueue: function() {
|
||||
_clearMessageQueue() {
|
||||
this.finishMessageQueue();
|
||||
|
||||
if (this._messageQueueTimeoutId != 0) {
|
||||
@ -294,7 +293,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this.emit('show-message', null, MessageType.NONE);
|
||||
},
|
||||
|
||||
_checkForFingerprintReader: function() {
|
||||
_checkForFingerprintReader() {
|
||||
this._haveFingerprintReader = false;
|
||||
|
||||
if (!this._settings.get_boolean(FINGERPRINT_AUTHENTICATION_KEY) ||
|
||||
@ -303,21 +302,21 @@ var ShellUserVerifier = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable, Lang.bind(this,
|
||||
function(device, error) {
|
||||
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable,
|
||||
(device, error) => {
|
||||
if (!error && device) {
|
||||
this._haveFingerprintReader = true;
|
||||
this._updateDefaultService();
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_oVirtUserAuthenticated: function(token) {
|
||||
_oVirtUserAuthenticated(token) {
|
||||
this._preemptingService = OVIRT_SERVICE_NAME;
|
||||
this.emit('ovirt-user-authenticated');
|
||||
},
|
||||
|
||||
_checkForSmartcard: function() {
|
||||
_checkForSmartcard() {
|
||||
let smartcardDetected;
|
||||
|
||||
if (!this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
|
||||
@ -339,7 +338,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_reportInitError: function(where, error) {
|
||||
_reportInitError(where, error) {
|
||||
logError(error, where);
|
||||
this._hold.release();
|
||||
|
||||
@ -347,7 +346,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._verificationFailed(false);
|
||||
},
|
||||
|
||||
_reauthenticationChannelOpened: function(client, result) {
|
||||
_reauthenticationChannelOpened(client, result) {
|
||||
try {
|
||||
this._clearUserVerifier();
|
||||
this._userVerifier = client.open_reauthentication_channel_finish(result);
|
||||
@ -358,7 +357,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
// Gdm emits org.freedesktop.DBus.Error.AccessDenied when there is
|
||||
// no session to reauthenticate. Fall back to performing verification
|
||||
// from this login session
|
||||
client.get_user_verifier(this._cancellable, Lang.bind(this, this._userVerifierGot));
|
||||
client.get_user_verifier(this._cancellable, this._userVerifierGot.bind(this));
|
||||
return;
|
||||
} catch(e) {
|
||||
this._reportInitError('Failed to open reauthentication channel', e);
|
||||
@ -371,7 +370,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._hold.release();
|
||||
},
|
||||
|
||||
_userVerifierGot: function(client, result) {
|
||||
_userVerifierGot(client, result) {
|
||||
try {
|
||||
this._clearUserVerifier();
|
||||
this._userVerifier = client.get_user_verifier_finish(result);
|
||||
@ -387,47 +386,52 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._hold.release();
|
||||
},
|
||||
|
||||
_connectSignals: function() {
|
||||
this._userVerifier.connect('info', Lang.bind(this, this._onInfo));
|
||||
this._userVerifier.connect('problem', Lang.bind(this, this._onProblem));
|
||||
this._userVerifier.connect('info-query', Lang.bind(this, this._onInfoQuery));
|
||||
this._userVerifier.connect('secret-info-query', Lang.bind(this, this._onSecretInfoQuery));
|
||||
this._userVerifier.connect('conversation-stopped', Lang.bind(this, this._onConversationStopped));
|
||||
this._userVerifier.connect('reset', Lang.bind(this, this._onReset));
|
||||
this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete));
|
||||
_connectSignals() {
|
||||
this._userVerifier.connect('info', this._onInfo.bind(this));
|
||||
this._userVerifier.connect('problem', this._onProblem.bind(this));
|
||||
this._userVerifier.connect('info-query', this._onInfoQuery.bind(this));
|
||||
this._userVerifier.connect('secret-info-query', this._onSecretInfoQuery.bind(this));
|
||||
this._userVerifier.connect('conversation-stopped', this._onConversationStopped.bind(this));
|
||||
this._userVerifier.connect('reset', this._onReset.bind(this));
|
||||
this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
|
||||
},
|
||||
|
||||
_getForegroundService: function() {
|
||||
_getForegroundService() {
|
||||
if (this._preemptingService)
|
||||
return this._preemptingService;
|
||||
|
||||
return this._defaultService;
|
||||
},
|
||||
|
||||
serviceIsForeground: function(serviceName) {
|
||||
serviceIsForeground(serviceName) {
|
||||
return serviceName == this._getForegroundService();
|
||||
},
|
||||
|
||||
serviceIsDefault: function(serviceName) {
|
||||
serviceIsDefault(serviceName) {
|
||||
return serviceName == this._defaultService;
|
||||
},
|
||||
|
||||
_updateDefaultService: function() {
|
||||
_updateDefaultService() {
|
||||
if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY))
|
||||
this._defaultService = PASSWORD_SERVICE_NAME;
|
||||
else if (this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
|
||||
this._defaultService = SMARTCARD_SERVICE_NAME;
|
||||
else if (this._haveFingerprintReader)
|
||||
this._defaultService = FINGERPRINT_SERVICE_NAME;
|
||||
|
||||
if (!this._defaultService) {
|
||||
log("no authentication service is enabled, using password authentication");
|
||||
this._defaultService = PASSWORD_SERVICE_NAME;
|
||||
}
|
||||
},
|
||||
|
||||
_startService: function(serviceName) {
|
||||
_startService(serviceName) {
|
||||
this._hold.acquire();
|
||||
if (this._userName) {
|
||||
this._userVerifier.call_begin_verification_for_user(serviceName,
|
||||
this._userName,
|
||||
this._cancellable,
|
||||
Lang.bind(this, function(obj, result) {
|
||||
(obj, result) => {
|
||||
try {
|
||||
obj.call_begin_verification_for_user_finish(result);
|
||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||
@ -438,11 +442,11 @@ var ShellUserVerifier = new Lang.Class({
|
||||
}
|
||||
|
||||
this._hold.release();
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
this._userVerifier.call_begin_verification(serviceName,
|
||||
this._cancellable,
|
||||
Lang.bind(this, function(obj, result) {
|
||||
(obj, result) => {
|
||||
try {
|
||||
obj.call_begin_verification_finish(result);
|
||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||
@ -453,18 +457,18 @@ var ShellUserVerifier = new Lang.Class({
|
||||
}
|
||||
|
||||
this._hold.release();
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_beginVerification: function() {
|
||||
_beginVerification() {
|
||||
this._startService(this._getForegroundService());
|
||||
|
||||
if (this._userName && this._haveFingerprintReader && !this.serviceIsForeground(FINGERPRINT_SERVICE_NAME))
|
||||
this._startService(FINGERPRINT_SERVICE_NAME);
|
||||
},
|
||||
|
||||
_onInfo: function(client, serviceName, info) {
|
||||
_onInfo(client, serviceName, info) {
|
||||
if (this.serviceIsForeground(serviceName)) {
|
||||
this._queueMessage(info, MessageType.INFO);
|
||||
} else if (serviceName == FINGERPRINT_SERVICE_NAME &&
|
||||
@ -479,21 +483,21 @@ var ShellUserVerifier = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onProblem: function(client, serviceName, problem) {
|
||||
_onProblem(client, serviceName, problem) {
|
||||
if (!this.serviceIsForeground(serviceName))
|
||||
return;
|
||||
|
||||
this._queueMessage(problem, MessageType.ERROR);
|
||||
},
|
||||
|
||||
_onInfoQuery: function(client, serviceName, question) {
|
||||
_onInfoQuery(client, serviceName, question) {
|
||||
if (!this.serviceIsForeground(serviceName))
|
||||
return;
|
||||
|
||||
this.emit('ask-question', serviceName, question, '');
|
||||
},
|
||||
|
||||
_onSecretInfoQuery: function(client, serviceName, secretQuestion) {
|
||||
_onSecretInfoQuery(client, serviceName, secretQuestion) {
|
||||
if (!this.serviceIsForeground(serviceName))
|
||||
return;
|
||||
|
||||
@ -506,7 +510,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this.emit('ask-question', serviceName, secretQuestion, '\u25cf');
|
||||
},
|
||||
|
||||
_onReset: function() {
|
||||
_onReset() {
|
||||
// Clear previous attempts to authenticate
|
||||
this._failCounter = 0;
|
||||
this._updateDefaultService();
|
||||
@ -514,20 +518,20 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this.emit('reset');
|
||||
},
|
||||
|
||||
_onVerificationComplete: function() {
|
||||
_onVerificationComplete() {
|
||||
this.emit('verification-complete');
|
||||
},
|
||||
|
||||
_cancelAndReset: function() {
|
||||
_cancelAndReset() {
|
||||
this.cancel();
|
||||
this._onReset();
|
||||
},
|
||||
|
||||
_retry: function() {
|
||||
_retry() {
|
||||
this.begin(this._userName, new Batch.Hold());
|
||||
},
|
||||
|
||||
_verificationFailed: function(retry) {
|
||||
_verificationFailed(retry) {
|
||||
// For Not Listed / enterprise logins, immediately reset
|
||||
// the dialog
|
||||
// Otherwise, we allow ALLOWED_FAILURES attempts. After that, we
|
||||
@ -541,29 +545,27 @@ var ShellUserVerifier = new Lang.Class({
|
||||
if (!this.hasPendingMessages) {
|
||||
this._retry();
|
||||
} else {
|
||||
let signalId = this.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
if (this._cancellable && !this._cancellable.is_cancelled())
|
||||
this._retry();
|
||||
}));
|
||||
let signalId = this.connect('no-more-messages', () => {
|
||||
this.disconnect(signalId);
|
||||
if (this._cancellable && !this._cancellable.is_cancelled())
|
||||
this._retry();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (!this.hasPendingMessages) {
|
||||
this._cancelAndReset();
|
||||
} else {
|
||||
let signalId = this.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
this._cancelAndReset();
|
||||
}));
|
||||
let signalId = this.connect('no-more-messages', () => {
|
||||
this.disconnect(signalId);
|
||||
this._cancelAndReset();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.emit('verification-failed');
|
||||
},
|
||||
|
||||
_onConversationStopped: function(client, serviceName) {
|
||||
_onConversationStopped(client, serviceName) {
|
||||
// If the login failed with the preauthenticated oVirt credentials
|
||||
// then discard the credentials and revert to default authentication
|
||||
// mechanism.
|
||||
|
@ -161,7 +161,7 @@ function installImporter(extension) {
|
||||
var ExtensionFinder = new Lang.Class({
|
||||
Name: 'ExtensionFinder',
|
||||
|
||||
_loadExtension: function(extensionDir, info, perUserDir) {
|
||||
_loadExtension(extensionDir, info, perUserDir) {
|
||||
let fileType = info.get_file_type();
|
||||
if (fileType != Gio.FileType.DIRECTORY)
|
||||
return;
|
||||
@ -184,9 +184,11 @@ var ExtensionFinder = new Lang.Class({
|
||||
this.emit('extension-found', extension);
|
||||
},
|
||||
|
||||
scanExtensions: function() {
|
||||
scanExtensions() {
|
||||
let perUserDir = Gio.File.new_for_path(global.userdatadir);
|
||||
FileUtils.collectFromDatadirs('extensions', true, Lang.bind(this, this._loadExtension, perUserDir));
|
||||
FileUtils.collectFromDatadirs('extensions', true, (dir, info) => {
|
||||
this._loadExtension(dir, info, perUserDir);
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(ExtensionFinder.prototype);
|
||||
|
@ -10,7 +10,7 @@ var DEFAULT_LIMIT = 512;
|
||||
var HistoryManager = new Lang.Class({
|
||||
Name: 'HistoryManager',
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { gsettingsKey: null,
|
||||
limit: DEFAULT_LIMIT,
|
||||
entry: null });
|
||||
@ -22,7 +22,7 @@ var HistoryManager = new Lang.Class({
|
||||
if (this._key) {
|
||||
this._history = global.settings.get_strv(this._key);
|
||||
global.settings.connect('changed::' + this._key,
|
||||
Lang.bind(this, this._historyChanged));
|
||||
this._historyChanged.bind(this));
|
||||
|
||||
} else {
|
||||
this._history = [];
|
||||
@ -32,16 +32,16 @@ var HistoryManager = new Lang.Class({
|
||||
|
||||
if (this._entry) {
|
||||
this._entry.connect('key-press-event',
|
||||
Lang.bind(this, this._onEntryKeyPress));
|
||||
this._onEntryKeyPress.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
_historyChanged: function() {
|
||||
_historyChanged() {
|
||||
this._history = global.settings.get_strv(this._key);
|
||||
this._historyIndex = this._history.length;
|
||||
},
|
||||
|
||||
_setPrevItem: function(text) {
|
||||
_setPrevItem(text) {
|
||||
if (this._historyIndex <= 0)
|
||||
return false;
|
||||
|
||||
@ -52,7 +52,7 @@ var HistoryManager = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_setNextItem: function(text) {
|
||||
_setNextItem(text) {
|
||||
if (this._historyIndex >= this._history.length)
|
||||
return false;
|
||||
|
||||
@ -63,7 +63,7 @@ var HistoryManager = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
lastItem: function() {
|
||||
lastItem() {
|
||||
if (this._historyIndex != this._history.length) {
|
||||
this._historyIndex = this._history.length;
|
||||
this._indexChanged();
|
||||
@ -72,7 +72,7 @@ var HistoryManager = new Lang.Class({
|
||||
return this._historyIndex ? this._history[this._historyIndex -1] : null;
|
||||
},
|
||||
|
||||
addItem: function(input) {
|
||||
addItem(input) {
|
||||
if (this._history.length == 0 ||
|
||||
this._history[this._history.length - 1] != input) {
|
||||
|
||||
@ -82,7 +82,7 @@ var HistoryManager = new Lang.Class({
|
||||
this._historyIndex = this._history.length;
|
||||
},
|
||||
|
||||
_onEntryKeyPress: function(entry, event) {
|
||||
_onEntryKeyPress(entry, event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
if (symbol == Clutter.KEY_Up) {
|
||||
return this._setPrevItem(entry.get_text());
|
||||
@ -92,7 +92,7 @@ var HistoryManager = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_indexChanged: function() {
|
||||
_indexChanged() {
|
||||
let current = this._history[this._historyIndex] || '';
|
||||
this.emit('changed', current);
|
||||
|
||||
@ -100,7 +100,7 @@ var HistoryManager = new Lang.Class({
|
||||
this._entry.set_text(current);
|
||||
},
|
||||
|
||||
_save: function() {
|
||||
_save() {
|
||||
if (this._history.length > this._limit)
|
||||
this._history.splice(0, this._history.length - this._limit);
|
||||
|
||||
|
@ -40,7 +40,7 @@ var IBusManager = new Lang.Class({
|
||||
_MAX_INPUT_SOURCE_ACTIVATION_TIME: 4000, // ms
|
||||
_PRELOAD_ENGINES_DELAY_TIME: 30, // sec
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
IBus.init();
|
||||
|
||||
this._candidatePopup = new IBusCandidatePopup.CandidatePopup();
|
||||
@ -53,16 +53,16 @@ var IBusManager = new Lang.Class({
|
||||
this._preloadEnginesId = 0;
|
||||
|
||||
this._ibus = IBus.Bus.new_async();
|
||||
this._ibus.connect('connected', Lang.bind(this, this._onConnected));
|
||||
this._ibus.connect('disconnected', Lang.bind(this, this._clear));
|
||||
this._ibus.connect('connected', this._onConnected.bind(this));
|
||||
this._ibus.connect('disconnected', this._clear.bind(this));
|
||||
// Need to set this to get 'global-engine-changed' emitions
|
||||
this._ibus.set_watch_ibus_signal(true);
|
||||
this._ibus.connect('global-engine-changed', Lang.bind(this, this._engineChanged));
|
||||
this._ibus.connect('global-engine-changed', this._engineChanged.bind(this));
|
||||
|
||||
this._spawn();
|
||||
},
|
||||
|
||||
_spawn: function() {
|
||||
_spawn() {
|
||||
try {
|
||||
Gio.Subprocess.new(['ibus-daemon', '--xim', '--panel', 'disable'],
|
||||
Gio.SubprocessFlags.NONE);
|
||||
@ -71,7 +71,7 @@ var IBusManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_clear: function() {
|
||||
_clear() {
|
||||
if (this._panelService)
|
||||
this._panelService.destroy();
|
||||
|
||||
@ -87,15 +87,15 @@ var IBusManager = new Lang.Class({
|
||||
this._spawn();
|
||||
},
|
||||
|
||||
_onConnected: function() {
|
||||
this._ibus.list_engines_async(-1, null, Lang.bind(this, this._initEngines));
|
||||
_onConnected() {
|
||||
this._ibus.list_engines_async(-1, null, this._initEngines.bind(this));
|
||||
this._ibus.request_name_async(IBus.SERVICE_PANEL,
|
||||
IBus.BusNameFlag.REPLACE_EXISTING,
|
||||
-1, null,
|
||||
Lang.bind(this, this._initPanelService));
|
||||
this._initPanelService.bind(this));
|
||||
},
|
||||
|
||||
_initEngines: function(ibus, result) {
|
||||
_initEngines(ibus, result) {
|
||||
let enginesList = this._ibus.list_engines_async_finish(result);
|
||||
if (enginesList) {
|
||||
for (let i = 0; i < enginesList.length; ++i) {
|
||||
@ -108,13 +108,13 @@ var IBusManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_initPanelService: function(ibus, result) {
|
||||
_initPanelService(ibus, result) {
|
||||
let success = this._ibus.request_name_async_finish(result);
|
||||
if (success) {
|
||||
this._panelService = new IBus.PanelService({ connection: this._ibus.get_connection(),
|
||||
object_path: IBus.PATH_PANEL });
|
||||
this._candidatePopup.setPanelService(this._panelService);
|
||||
this._panelService.connect('update-property', Lang.bind(this, this._updateProperty));
|
||||
this._panelService.connect('update-property', this._updateProperty.bind(this));
|
||||
try {
|
||||
// IBus versions older than 1.5.10 have a bug which
|
||||
// causes spurious set-content-type emissions when
|
||||
@ -122,11 +122,11 @@ var IBusManager = new Lang.Class({
|
||||
// and hints defeating its intended semantics and
|
||||
// confusing users. We thus don't use it in that case.
|
||||
_checkIBusVersion(1, 5, 10);
|
||||
this._panelService.connect('set-content-type', Lang.bind(this, this._setContentType));
|
||||
this._panelService.connect('set-content-type', this._setContentType.bind(this));
|
||||
} catch (e) {
|
||||
}
|
||||
// If an engine is already active we need to get its properties
|
||||
this._ibus.get_global_engine_async(-1, null, Lang.bind(this, function(i, result) {
|
||||
this._ibus.get_global_engine_async(-1, null, (i, result) => {
|
||||
let engine;
|
||||
try {
|
||||
engine = this._ibus.get_global_engine_async_finish(result);
|
||||
@ -136,20 +136,20 @@ var IBusManager = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
this._engineChanged(this._ibus, engine.get_name());
|
||||
}));
|
||||
});
|
||||
this._updateReadiness();
|
||||
} else {
|
||||
this._clear();
|
||||
}
|
||||
},
|
||||
|
||||
_updateReadiness: function() {
|
||||
_updateReadiness() {
|
||||
this._ready = (Object.keys(this._engines).length > 0 &&
|
||||
this._panelService != null);
|
||||
this.emit('ready', this._ready);
|
||||
},
|
||||
|
||||
_engineChanged: function(bus, engineName) {
|
||||
_engineChanged(bus, engineName) {
|
||||
if (!this._ready)
|
||||
return;
|
||||
|
||||
@ -159,7 +159,7 @@ var IBusManager = new Lang.Class({
|
||||
return;
|
||||
|
||||
this._registerPropertiesId =
|
||||
this._panelService.connect('register-properties', Lang.bind(this, function(p, props) {
|
||||
this._panelService.connect('register-properties', (p, props) => {
|
||||
if (!props.get(0))
|
||||
return;
|
||||
|
||||
@ -167,29 +167,29 @@ var IBusManager = new Lang.Class({
|
||||
this._registerPropertiesId = 0;
|
||||
|
||||
this.emit('properties-registered', this._currentEngineName, props);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updateProperty: function(panel, prop) {
|
||||
_updateProperty(panel, prop) {
|
||||
this.emit('property-updated', this._currentEngineName, prop);
|
||||
},
|
||||
|
||||
_setContentType: function(panel, purpose, hints) {
|
||||
_setContentType(panel, purpose, hints) {
|
||||
this.emit('set-content-type', purpose, hints);
|
||||
},
|
||||
|
||||
activateProperty: function(key, state) {
|
||||
activateProperty(key, state) {
|
||||
this._panelService.property_activate(key, state);
|
||||
},
|
||||
|
||||
getEngineDesc: function(id) {
|
||||
getEngineDesc(id) {
|
||||
if (!this._ready || !this._engines.hasOwnProperty(id))
|
||||
return null;
|
||||
|
||||
return this._engines[id];
|
||||
},
|
||||
|
||||
setEngine: function(id, callback) {
|
||||
setEngine(id, callback) {
|
||||
// Send id even if id == this._currentEngineName
|
||||
// because 'properties-registered' signal can be emitted
|
||||
// while this._ibusSources == null on a lock screen.
|
||||
@ -203,7 +203,7 @@ var IBusManager = new Lang.Class({
|
||||
null, callback);
|
||||
},
|
||||
|
||||
preloadEngines: function(ids) {
|
||||
preloadEngines(ids) {
|
||||
if (!this._ibus || ids.length == 0)
|
||||
return;
|
||||
|
||||
@ -214,7 +214,7 @@ var IBusManager = new Lang.Class({
|
||||
|
||||
this._preloadEnginesId =
|
||||
Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._ibus.preload_engines_async(
|
||||
ids,
|
||||
-1,
|
||||
@ -222,7 +222,7 @@ var IBusManager = new Lang.Class({
|
||||
null);
|
||||
this._preloadEnginesId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
},
|
||||
});
|
||||
Signals.addSignalMethods(IBusManager.prototype);
|
||||
|
@ -9,20 +9,20 @@ var InputMethod = new Lang.Class({
|
||||
Name: 'InputMethod',
|
||||
Extends: Clutter.InputMethod,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
this._hints = 0;
|
||||
this._purpose = 0;
|
||||
this._enabled = true;
|
||||
this._currentFocus = null;
|
||||
this._ibus = IBus.Bus.new_async();
|
||||
this._ibus.connect('connected', Lang.bind(this, this._onConnected));
|
||||
this._ibus.connect('disconnected', Lang.bind(this, this._clear));
|
||||
this.connect('notify::can-show-preedit', Lang.bind(this, this._updateCapabilities));
|
||||
this._ibus.connect('connected', this._onConnected.bind(this));
|
||||
this._ibus.connect('disconnected', this._clear.bind(this));
|
||||
this.connect('notify::can-show-preedit', this._updateCapabilities.bind(this));
|
||||
|
||||
this._inputSourceManager = Keyboard.getInputSourceManager();
|
||||
this._sourceChangedId = this._inputSourceManager.connect('current-source-changed',
|
||||
Lang.bind(this, this._onSourceChanged));
|
||||
this._onSourceChanged.bind(this));
|
||||
this._currentSource = this._inputSourceManager.currentSource;
|
||||
|
||||
if (this._ibus.is_connected())
|
||||
@ -33,7 +33,7 @@ var InputMethod = new Lang.Class({
|
||||
return this._currentFocus;
|
||||
},
|
||||
|
||||
_updateCapabilities: function() {
|
||||
_updateCapabilities() {
|
||||
let caps = 0;
|
||||
|
||||
if (this.can_show_preedit)
|
||||
@ -48,47 +48,47 @@ var InputMethod = new Lang.Class({
|
||||
this._context.set_capabilities(caps);
|
||||
},
|
||||
|
||||
_onSourceChanged: function() {
|
||||
_onSourceChanged() {
|
||||
this._currentSource = this._inputSourceManager.currentSource;
|
||||
},
|
||||
|
||||
_onConnected: function() {
|
||||
_onConnected() {
|
||||
this._ibus.create_input_context_async ('gnome-shell', -1, null,
|
||||
Lang.bind(this, this._setContext));
|
||||
this._setContext.bind(this));
|
||||
},
|
||||
|
||||
_setContext: function(bus, res) {
|
||||
_setContext(bus, res) {
|
||||
this._context = this._ibus.create_input_context_async_finish(res);
|
||||
this._context.connect('enabled', Lang.bind(this, function () { this._enabled = true }));
|
||||
this._context.connect('disabled', Lang.bind(this, function () { this._enabled = false }));
|
||||
this._context.connect('commit-text', Lang.bind(this, this._onCommitText));
|
||||
this._context.connect('delete-surrounding-text', Lang.bind(this, this._onDeleteSurroundingText));
|
||||
this._context.connect('update-preedit-text', Lang.bind(this, this._onUpdatePreeditText));
|
||||
this._context.connect('enabled', () => { this._enabled = true });
|
||||
this._context.connect('disabled', () => { this._enabled = false });
|
||||
this._context.connect('commit-text', this._onCommitText.bind(this));
|
||||
this._context.connect('delete-surrounding-text', this._onDeleteSurroundingText.bind(this));
|
||||
this._context.connect('update-preedit-text', this._onUpdatePreeditText.bind(this));
|
||||
|
||||
this._updateCapabilities();
|
||||
},
|
||||
|
||||
_clear: function() {
|
||||
_clear() {
|
||||
this._context = null;
|
||||
this._hints = 0;
|
||||
this._purpose = 0;
|
||||
this._enabled = false;
|
||||
},
|
||||
|
||||
_emitRequestSurrounding: function() {
|
||||
_emitRequestSurrounding() {
|
||||
if (this._context.needs_surrounding_text())
|
||||
this.emit('request-surrounding');
|
||||
},
|
||||
|
||||
_onCommitText: function(context, text) {
|
||||
_onCommitText(context, text) {
|
||||
this.commit(text.get_text());
|
||||
},
|
||||
|
||||
_onDeleteSurroundingText: function (context) {
|
||||
_onDeleteSurroundingText(context) {
|
||||
this.delete_surrounding();
|
||||
},
|
||||
|
||||
_onUpdatePreeditText: function (context, text, pos, visible) {
|
||||
_onUpdatePreeditText(context, text, pos, visible) {
|
||||
let str = null;
|
||||
if (visible && text != null)
|
||||
str = text.get_text();
|
||||
@ -96,7 +96,7 @@ var InputMethod = new Lang.Class({
|
||||
this.set_preedit_text(str, pos);
|
||||
},
|
||||
|
||||
vfunc_focus_in: function(focus) {
|
||||
vfunc_focus_in(focus) {
|
||||
this._currentFocus = focus;
|
||||
if (this._context) {
|
||||
this._context.focus_in();
|
||||
@ -105,7 +105,7 @@ var InputMethod = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
vfunc_focus_out: function() {
|
||||
vfunc_focus_out() {
|
||||
this._currentFocus = null;
|
||||
if (this._context) {
|
||||
this._context.focus_out();
|
||||
@ -116,7 +116,7 @@ var InputMethod = new Lang.Class({
|
||||
this.set_preedit_text(null, 0);
|
||||
},
|
||||
|
||||
vfunc_reset: function() {
|
||||
vfunc_reset() {
|
||||
if (this._context) {
|
||||
this._context.reset();
|
||||
this._emitRequestSurrounding();
|
||||
@ -126,7 +126,7 @@ var InputMethod = new Lang.Class({
|
||||
this.set_preedit_text(null, 0);
|
||||
},
|
||||
|
||||
vfunc_set_cursor_location: function(rect) {
|
||||
vfunc_set_cursor_location(rect) {
|
||||
if (this._context) {
|
||||
this._context.set_cursor_location(rect.get_x(), rect.get_y(),
|
||||
rect.get_width(), rect.get_height());
|
||||
@ -134,12 +134,12 @@ var InputMethod = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
vfunc_set_surrounding: function(text, cursor, anchor) {
|
||||
vfunc_set_surrounding(text, cursor, anchor) {
|
||||
if (this._context)
|
||||
this._context.set_surrounding_text(text, cursor, anchor);
|
||||
},
|
||||
|
||||
vfunc_update_content_hints: function(hints) {
|
||||
vfunc_update_content_hints(hints) {
|
||||
let ibusHints = 0;
|
||||
if (hints & Clutter.InputContentHintFlags.COMPLETION)
|
||||
ibusHints |= IBus.InputHints.WORD_COMPLETION;
|
||||
@ -159,7 +159,7 @@ var InputMethod = new Lang.Class({
|
||||
this._context.set_content_type(this._purpose, this._hints);
|
||||
},
|
||||
|
||||
vfunc_update_content_purpose: function(purpose) {
|
||||
vfunc_update_content_purpose(purpose) {
|
||||
let ibusPurpose = 0;
|
||||
if (purpose == Clutter.InputContentPurpose.NORMAL)
|
||||
ibusPurpose = IBus.InputPurpose.FREE_FORM;
|
||||
@ -185,11 +185,10 @@ var InputMethod = new Lang.Class({
|
||||
this._context.set_content_type(this._purpose, this._hints);
|
||||
},
|
||||
|
||||
vfunc_filter_key_event: function(event) {
|
||||
vfunc_filter_key_event(event) {
|
||||
if (!this._context || !this._enabled)
|
||||
return false;
|
||||
if (!this._currentSource ||
|
||||
this._currentSource.type == Keyboard.INPUT_SOURCE_TYPE_XKB)
|
||||
if (!this._currentSource)
|
||||
return false;
|
||||
|
||||
let state = event.get_state();
|
||||
@ -201,14 +200,14 @@ var InputMethod = new Lang.Class({
|
||||
this._context.process_key_event_async(event.get_key_symbol(),
|
||||
event.get_key_code() - 8, // Convert XKB keycodes to evcodes
|
||||
state, -1, null,
|
||||
Lang.bind(this, (context, res) => {
|
||||
(context, res) => {
|
||||
try {
|
||||
let retval = context.process_key_event_async_finish(res);
|
||||
this.notify_key_event(event, retval);
|
||||
} catch (e) {
|
||||
log('Error processing key on IM: ' + e.message);
|
||||
}
|
||||
}));
|
||||
});
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
@ -23,9 +23,9 @@ function getCompletions(text, commandHeader, globalCompletionList) {
|
||||
if (matches) {
|
||||
[expr, base, attrHead] = matches;
|
||||
|
||||
methods = getPropertyNamesFromExpression(base, commandHeader).filter(function(attr) {
|
||||
return attr.slice(0, attrHead.length) == attrHead;
|
||||
});
|
||||
methods = getPropertyNamesFromExpression(base, commandHeader).filter(
|
||||
attr => attr.slice(0, attrHead.length) == attrHead
|
||||
);
|
||||
}
|
||||
|
||||
// Look for the empty expression or partially entered words
|
||||
@ -33,9 +33,9 @@ function getCompletions(text, commandHeader, globalCompletionList) {
|
||||
matches = text.match(/^(\w*)$/);
|
||||
if (text == '' || matches) {
|
||||
[expr, attrHead] = matches;
|
||||
methods = globalCompletionList.filter(function(attr) {
|
||||
return attr.slice(0, attrHead.length) == attrHead;
|
||||
});
|
||||
methods = globalCompletionList.filter(
|
||||
attr => attr.slice(0, attrHead.length) == attrHead
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ function getPropertyNamesFromExpression(expr, commandHeader) {
|
||||
|
||||
// Make sure propsUnique contains one key for every
|
||||
// property so we end up with a unique list of properties
|
||||
allProps.map(function(p){ propsUnique[p] = null; });
|
||||
allProps.map(p => propsUnique[p] = null);
|
||||
}
|
||||
return Object.keys(propsUnique).sort();
|
||||
}
|
||||
@ -233,7 +233,7 @@ function isUnsafeExpression(str) {
|
||||
// Returns a list of global keywords derived from str
|
||||
function getDeclaredConstants(str) {
|
||||
let ret = [];
|
||||
str.split(';').forEach(function(s) {
|
||||
str.split(';').forEach(s => {
|
||||
let base, keyword;
|
||||
let match = s.match(/const\s+(\w+)\s*=/);
|
||||
if (match) {
|
||||
|
@ -47,24 +47,24 @@ var KeyboardManager = new Lang.Class({
|
||||
// even as a Wayland compositor, we can't bump this.
|
||||
MAX_LAYOUTS_PER_GROUP: 4,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._xkbInfo = getXkbInfo();
|
||||
this._current = null;
|
||||
this._localeLayoutInfo = this._getLocaleLayout();
|
||||
this._layoutInfos = {};
|
||||
},
|
||||
|
||||
_applyLayoutGroup: function(group) {
|
||||
_applyLayoutGroup(group) {
|
||||
let options = this._buildOptionsString();
|
||||
let [layouts, variants] = this._buildGroupStrings(group);
|
||||
Meta.get_backend().set_keymap(layouts, variants, options);
|
||||
},
|
||||
|
||||
_applyLayoutGroupIndex: function(idx) {
|
||||
_applyLayoutGroupIndex(idx) {
|
||||
Meta.get_backend().lock_layout_group(idx);
|
||||
},
|
||||
|
||||
apply: function(id) {
|
||||
apply(id) {
|
||||
let info = this._layoutInfos[id];
|
||||
if (!info)
|
||||
return;
|
||||
@ -80,7 +80,7 @@ var KeyboardManager = new Lang.Class({
|
||||
this._current = info;
|
||||
},
|
||||
|
||||
reapply: function() {
|
||||
reapply() {
|
||||
if (!this._current)
|
||||
return;
|
||||
|
||||
@ -88,7 +88,9 @@ var KeyboardManager = new Lang.Class({
|
||||
this._applyLayoutGroupIndex(this._current.groupIndex);
|
||||
},
|
||||
|
||||
setUserLayouts: function(ids) {
|
||||
setUserLayouts(ids) {
|
||||
let currentId = this._current ? this._current.id : null;
|
||||
let currentGroupIndex = this._current ? this._current.groupIndex : null;
|
||||
this._current = null;
|
||||
this._layoutInfos = {};
|
||||
|
||||
@ -115,11 +117,14 @@ var KeyboardManager = new Lang.Class({
|
||||
info.group = group;
|
||||
info.groupIndex = groupIndex;
|
||||
|
||||
if (currentId == id && currentGroupIndex == groupIndex)
|
||||
this._current = info;
|
||||
|
||||
i += 1;
|
||||
}
|
||||
},
|
||||
|
||||
_getLocaleLayout: function() {
|
||||
_getLocaleLayout() {
|
||||
let locale = GLib.get_language_names()[0];
|
||||
if (locale.indexOf('_') == -1)
|
||||
locale = DEFAULT_LOCALE;
|
||||
@ -136,18 +141,18 @@ var KeyboardManager = new Lang.Class({
|
||||
return { layout: DEFAULT_LAYOUT, variant: DEFAULT_VARIANT };
|
||||
},
|
||||
|
||||
_buildGroupStrings: function(_group) {
|
||||
_buildGroupStrings(_group) {
|
||||
let group = _group.concat(this._localeLayoutInfo);
|
||||
let layouts = group.map(function(g) { return g.layout; }).join(',');
|
||||
let variants = group.map(function(g) { return g.variant; }).join(',');
|
||||
let layouts = group.map(g => g.layout).join(',');
|
||||
let variants = group.map(g => g.variant).join(',');
|
||||
return [layouts, variants];
|
||||
},
|
||||
|
||||
setKeyboardOptions: function(options) {
|
||||
setKeyboardOptions(options) {
|
||||
this._xkbOptions = options;
|
||||
},
|
||||
|
||||
_buildOptionsString: function() {
|
||||
_buildOptionsString() {
|
||||
let options = this._xkbOptions.join(',');
|
||||
return options;
|
||||
}
|
||||
|
@ -105,15 +105,15 @@ function getLoginManager() {
|
||||
var LoginManagerSystemd = new Lang.Class({
|
||||
Name: 'LoginManagerSystemd',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._proxy = new SystemdLoginManager(Gio.DBus.system,
|
||||
'org.freedesktop.login1',
|
||||
'/org/freedesktop/login1');
|
||||
this._proxy.connectSignal('PrepareForSleep',
|
||||
Lang.bind(this, this._prepareForSleep));
|
||||
this._prepareForSleep.bind(this));
|
||||
},
|
||||
|
||||
getCurrentSessionProxy: function(callback) {
|
||||
getCurrentSessionProxy(callback) {
|
||||
if (this._currentSession) {
|
||||
callback (this._currentSession);
|
||||
return;
|
||||
@ -125,21 +125,20 @@ var LoginManagerSystemd = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
this._proxy.GetSessionRemote(sessionId, Lang.bind(this,
|
||||
function(result, error) {
|
||||
if (error) {
|
||||
logError(error, 'Could not get a proxy for the current session');
|
||||
} else {
|
||||
this._currentSession = new SystemdLoginSession(Gio.DBus.system,
|
||||
'org.freedesktop.login1',
|
||||
result[0]);
|
||||
callback(this._currentSession);
|
||||
}
|
||||
}));
|
||||
this._proxy.GetSessionRemote(sessionId, (result, error) => {
|
||||
if (error) {
|
||||
logError(error, 'Could not get a proxy for the current session');
|
||||
} else {
|
||||
this._currentSession = new SystemdLoginSession(Gio.DBus.system,
|
||||
'org.freedesktop.login1',
|
||||
result[0]);
|
||||
callback(this._currentSession);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
canSuspend: function(asyncCallback) {
|
||||
this._proxy.CanSuspendRemote(function(result, error) {
|
||||
canSuspend(asyncCallback) {
|
||||
this._proxy.CanSuspendRemote((result, error) => {
|
||||
if (error) {
|
||||
asyncCallback(false, false);
|
||||
} else {
|
||||
@ -150,8 +149,8 @@ var LoginManagerSystemd = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
listSessions: function(asyncCallback) {
|
||||
this._proxy.ListSessionsRemote(function(result, error) {
|
||||
listSessions(asyncCallback) {
|
||||
this._proxy.ListSessionsRemote((result, error) => {
|
||||
if (error)
|
||||
asyncCallback([]);
|
||||
else
|
||||
@ -159,18 +158,18 @@ var LoginManagerSystemd = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
suspend: function() {
|
||||
suspend() {
|
||||
this._proxy.SuspendRemote(true);
|
||||
},
|
||||
|
||||
inhibit: function(reason, callback) {
|
||||
inhibit(reason, callback) {
|
||||
let inVariant = GLib.Variant.new('(ssss)',
|
||||
['sleep',
|
||||
'GNOME Shell',
|
||||
reason,
|
||||
'delay']);
|
||||
this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null,
|
||||
Lang.bind(this, function(proxy, result) {
|
||||
(proxy, result) => {
|
||||
let fd = -1;
|
||||
try {
|
||||
let [outVariant, fdList] = proxy.call_with_unix_fd_list_finish(result);
|
||||
@ -180,10 +179,10 @@ var LoginManagerSystemd = new Lang.Class({
|
||||
logError(e, "Error getting systemd inhibitor");
|
||||
callback(null);
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_prepareForSleep: function(proxy, sender, [aboutToSuspend]) {
|
||||
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
|
||||
this.emit('prepare-for-sleep', aboutToSuspend);
|
||||
}
|
||||
});
|
||||
@ -192,26 +191,26 @@ Signals.addSignalMethods(LoginManagerSystemd.prototype);
|
||||
var LoginManagerDummy = new Lang.Class({
|
||||
Name: 'LoginManagerDummy',
|
||||
|
||||
getCurrentSessionProxy: function(callback) {
|
||||
getCurrentSessionProxy(callback) {
|
||||
// we could return a DummySession object that fakes whatever callers
|
||||
// expect (at the time of writing: connect() and connectSignal()
|
||||
// methods), but just never calling the callback should be safer
|
||||
},
|
||||
|
||||
canSuspend: function(asyncCallback) {
|
||||
canSuspend(asyncCallback) {
|
||||
asyncCallback(false, false);
|
||||
},
|
||||
|
||||
listSessions: function(asyncCallback) {
|
||||
listSessions(asyncCallback) {
|
||||
asyncCallback([]);
|
||||
},
|
||||
|
||||
suspend: function() {
|
||||
suspend() {
|
||||
this.emit('prepare-for-sleep', true);
|
||||
this.emit('prepare-for-sleep', false);
|
||||
},
|
||||
|
||||
inhibit: function(reason, callback) {
|
||||
inhibit(reason, callback) {
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
|
@ -133,22 +133,22 @@ const ModemCdmaProxy = Gio.DBusProxy.makeProxyWrapper(ModemCdmaInterface);
|
||||
var ModemGsm = new Lang.Class({
|
||||
Name: 'ModemGsm',
|
||||
|
||||
_init: function(path) {
|
||||
_init(path) {
|
||||
this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
||||
|
||||
this.signal_quality = 0;
|
||||
this.operator_name = null;
|
||||
|
||||
// Code is duplicated because the function have different signatures
|
||||
this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, [quality]) {
|
||||
this._proxy.connectSignal('SignalQuality', (proxy, sender, [quality]) => {
|
||||
this.signal_quality = quality;
|
||||
this.emit('notify::signal-quality');
|
||||
}));
|
||||
this._proxy.connectSignal('RegistrationInfo', Lang.bind(this, function(proxy, sender, [status, code, name]) {
|
||||
});
|
||||
this._proxy.connectSignal('RegistrationInfo', (proxy, sender, [status, code, name]) => {
|
||||
this.operator_name = _findProviderForMccMnc(name, code);
|
||||
this.emit('notify::operator-name');
|
||||
}));
|
||||
this._proxy.GetRegistrationInfoRemote(Lang.bind(this, function([result], err) {
|
||||
});
|
||||
this._proxy.GetRegistrationInfoRemote(([result], err) => {
|
||||
if (err) {
|
||||
log(err);
|
||||
return;
|
||||
@ -157,8 +157,8 @@ var ModemGsm = new Lang.Class({
|
||||
let [status, code, name] = result;
|
||||
this.operator_name = _findProviderForMccMnc(name, code);
|
||||
this.emit('notify::operator-name');
|
||||
}));
|
||||
this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) {
|
||||
});
|
||||
this._proxy.GetSignalQualityRemote((result, err) => {
|
||||
if (err) {
|
||||
// it will return an error if the device is not connected
|
||||
this.signal_quality = 0;
|
||||
@ -167,7 +167,7 @@ var ModemGsm = new Lang.Class({
|
||||
this.signal_quality = quality;
|
||||
}
|
||||
this.emit('notify::signal-quality');
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(ModemGsm.prototype);
|
||||
@ -175,12 +175,12 @@ Signals.addSignalMethods(ModemGsm.prototype);
|
||||
var ModemCdma = new Lang.Class({
|
||||
Name: 'ModemCdma',
|
||||
|
||||
_init: function(path) {
|
||||
_init(path) {
|
||||
this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
||||
|
||||
this.signal_quality = 0;
|
||||
this.operator_name = null;
|
||||
this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, params) {
|
||||
this._proxy.connectSignal('SignalQuality', (proxy, sender, params) => {
|
||||
this.signal_quality = params[0];
|
||||
this.emit('notify::signal-quality');
|
||||
|
||||
@ -188,8 +188,8 @@ var ModemCdma = new Lang.Class({
|
||||
// and we can finally call GetServingSystem
|
||||
if (this.operator_name == null)
|
||||
this._refreshServingSystem();
|
||||
}));
|
||||
this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) {
|
||||
});
|
||||
this._proxy.GetSignalQualityRemote((result, err) => {
|
||||
if (err) {
|
||||
// it will return an error if the device is not connected
|
||||
this.signal_quality = 0;
|
||||
@ -198,11 +198,11 @@ var ModemCdma = new Lang.Class({
|
||||
this.signal_quality = quality;
|
||||
}
|
||||
this.emit('notify::signal-quality');
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_refreshServingSystem: function() {
|
||||
this._proxy.GetServingSystemRemote(Lang.bind(this, function([result], err) {
|
||||
_refreshServingSystem() {
|
||||
this._proxy.GetServingSystemRemote(([result], err) => {
|
||||
if (err) {
|
||||
// it will return an error if the device is not connected
|
||||
this.operator_name = null;
|
||||
@ -212,7 +212,7 @@ var ModemCdma = new Lang.Class({
|
||||
this.operator_name = _findProviderForSid(sid)
|
||||
}
|
||||
this.emit('notify::operator-name');
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(ModemCdma.prototype);
|
||||
@ -247,40 +247,40 @@ const BroadbandModemCdmaProxy = Gio.DBusProxy.makeProxyWrapper(BroadbandModemCdm
|
||||
var BroadbandModem = new Lang.Class({
|
||||
Name: 'BroadbandModem',
|
||||
|
||||
_init: function(path, capabilities) {
|
||||
_init(path, capabilities) {
|
||||
this._proxy = new BroadbandModemProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||
this._proxy_3gpp = new BroadbandModem3gppProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||
this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||
this._capabilities = capabilities;
|
||||
|
||||
this._proxy.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) {
|
||||
this._proxy.connect('g-properties-changed', (proxy, properties) => {
|
||||
if ('SignalQuality' in properties.deep_unpack())
|
||||
this._reloadSignalQuality();
|
||||
}));
|
||||
});
|
||||
this._reloadSignalQuality();
|
||||
|
||||
this._proxy_3gpp.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) {
|
||||
this._proxy_3gpp.connect('g-properties-changed', (proxy, properties) => {
|
||||
let unpacked = properties.deep_unpack();
|
||||
if ('OperatorName' in unpacked || 'OperatorCode' in unpacked)
|
||||
this._reload3gppOperatorName();
|
||||
}));
|
||||
});
|
||||
this._reload3gppOperatorName();
|
||||
|
||||
this._proxy_cdma.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) {
|
||||
this._proxy_cdma.connect('g-properties-changed', (proxy, properties) => {
|
||||
let unpacked = properties.deep_unpack();
|
||||
if ('Nid' in unpacked || 'Sid' in unpacked)
|
||||
this._reloadCdmaOperatorName();
|
||||
}));
|
||||
});
|
||||
this._reloadCdmaOperatorName();
|
||||
},
|
||||
|
||||
_reloadSignalQuality: function() {
|
||||
_reloadSignalQuality() {
|
||||
let [quality, recent] = this._proxy.SignalQuality;
|
||||
this.signal_quality = quality;
|
||||
this.emit('notify::signal-quality');
|
||||
},
|
||||
|
||||
_reloadOperatorName: function() {
|
||||
_reloadOperatorName() {
|
||||
let new_name = "";
|
||||
if (this.operator_name_3gpp && this.operator_name_3gpp.length > 0)
|
||||
new_name += this.operator_name_3gpp;
|
||||
@ -295,14 +295,14 @@ var BroadbandModem = new Lang.Class({
|
||||
this.emit('notify::operator-name');
|
||||
},
|
||||
|
||||
_reload3gppOperatorName: function() {
|
||||
_reload3gppOperatorName() {
|
||||
let name = this._proxy_3gpp.OperatorName;
|
||||
let code = this._proxy_3gpp.OperatorCode;
|
||||
this.operator_name_3gpp = _findProviderForMccMnc(name, code);
|
||||
this._reloadOperatorName();
|
||||
},
|
||||
|
||||
_reloadCdmaOperatorName: function() {
|
||||
_reloadCdmaOperatorName() {
|
||||
let sid = this._proxy_cdma.Sid;
|
||||
this.operator_name_cdma = _findProviderForSid(sid);
|
||||
this._reloadOperatorName();
|
||||
|
@ -28,7 +28,7 @@ const ObjectManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(ObjectManagerIface);
|
||||
|
||||
var ObjectManager = new Lang.Class({
|
||||
Name: 'ObjectManager',
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { connection: null,
|
||||
name: null,
|
||||
objectPath: null,
|
||||
@ -61,10 +61,10 @@ var ObjectManager = new Lang.Class({
|
||||
this._numLoadInhibitors = 1;
|
||||
this._managerProxy.init_async(GLib.PRIORITY_DEFAULT,
|
||||
this._cancellable,
|
||||
Lang.bind(this, this._onManagerProxyLoaded));
|
||||
this._onManagerProxyLoaded.bind(this));
|
||||
},
|
||||
|
||||
_tryToCompleteLoad: function() {
|
||||
_tryToCompleteLoad() {
|
||||
if (this._numLoadInhibitors == 0)
|
||||
return;
|
||||
|
||||
@ -75,7 +75,7 @@ var ObjectManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_addInterface: function(objectPath, interfaceName, onFinished) {
|
||||
_addInterface(objectPath, interfaceName, onFinished) {
|
||||
let info = this._interfaceInfos[interfaceName];
|
||||
|
||||
if (!info) {
|
||||
@ -93,7 +93,7 @@ var ObjectManager = new Lang.Class({
|
||||
|
||||
proxy.init_async(GLib.PRIORITY_DEFAULT,
|
||||
this._cancellable,
|
||||
Lang.bind(this, function(initable, result) {
|
||||
(initable, result) => {
|
||||
let error = null;
|
||||
try {
|
||||
initable.init_finish(result);
|
||||
@ -127,10 +127,10 @@ var ObjectManager = new Lang.Class({
|
||||
|
||||
if (onFinished)
|
||||
onFinished();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_removeInterface: function(objectPath, interfaceName) {
|
||||
_removeInterface(objectPath, interfaceName) {
|
||||
if (!this._objects[objectPath])
|
||||
return;
|
||||
|
||||
@ -156,7 +156,7 @@ var ObjectManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onManagerProxyLoaded: function(initable, result) {
|
||||
_onManagerProxyLoaded(initable, result) {
|
||||
let error = null;
|
||||
try {
|
||||
initable.init_finish(result);
|
||||
@ -168,35 +168,35 @@ var ObjectManager = new Lang.Class({
|
||||
}
|
||||
|
||||
this._managerProxy.connectSignal('InterfacesAdded',
|
||||
Lang.bind(this, function(objectManager, sender, [objectPath, interfaces]) {
|
||||
(objectManager, sender, [objectPath, interfaces]) => {
|
||||
let interfaceNames = Object.keys(interfaces);
|
||||
for (let i = 0; i < interfaceNames.length; i++)
|
||||
this._addInterface(objectPath, interfaceNames[i]);
|
||||
}));
|
||||
});
|
||||
this._managerProxy.connectSignal('InterfacesRemoved',
|
||||
Lang.bind(this, function(objectManager, sender, [objectPath, interfaceNames]) {
|
||||
(objectManager, sender, [objectPath, interfaceNames]) => {
|
||||
for (let i = 0; i < interfaceNames.length; i++)
|
||||
this._removeInterface(objectPath, interfaceNames[i]);
|
||||
}));
|
||||
});
|
||||
|
||||
if (Object.keys(this._interfaceInfos).length == 0) {
|
||||
this._tryToCompleteLoad();
|
||||
return;
|
||||
}
|
||||
|
||||
this._managerProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
|
||||
this._managerProxy.connect('notify::g-name-owner', () => {
|
||||
if (this._managerProxy.g_name_owner)
|
||||
this._onNameAppeared();
|
||||
else
|
||||
this._onNameVanished();
|
||||
}));
|
||||
});
|
||||
|
||||
if (this._managerProxy.g_name_owner)
|
||||
this._onNameAppeared();
|
||||
},
|
||||
|
||||
_onNameAppeared: function() {
|
||||
this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
|
||||
_onNameAppeared() {
|
||||
this._managerProxy.GetManagedObjectsRemote((result, error) => {
|
||||
if (!result) {
|
||||
if (error) {
|
||||
logError(error, 'could not get remote objects for service ' + this._serviceName + ' path ' + this._managerPath);
|
||||
@ -226,14 +226,14 @@ var ObjectManager = new Lang.Class({
|
||||
this._numLoadInhibitors++;
|
||||
this._addInterface(objectPath,
|
||||
interfaceName,
|
||||
Lang.bind(this, this._tryToCompleteLoad));
|
||||
this._tryToCompleteLoad.bind(this));
|
||||
}
|
||||
}
|
||||
this._tryToCompleteLoad();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onNameVanished: function() {
|
||||
_onNameVanished() {
|
||||
let objectPaths = Object.keys(this._objects);
|
||||
for (let i = 0; i < objectPaths.length; i++) {
|
||||
let object = this._objects[objectPaths];
|
||||
@ -248,14 +248,14 @@ var ObjectManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_registerInterfaces: function(interfaces) {
|
||||
_registerInterfaces(interfaces) {
|
||||
for (let i = 0; i < interfaces.length; i++) {
|
||||
let info = Gio.DBusInterfaceInfo.new_for_xml(interfaces[i]);
|
||||
this._interfaceInfos[info.name] = info;
|
||||
}
|
||||
},
|
||||
|
||||
getProxy: function(objectPath, interfaceName) {
|
||||
getProxy(objectPath, interfaceName) {
|
||||
let object = this._objects[objectPath];
|
||||
|
||||
if (!object)
|
||||
@ -264,7 +264,7 @@ var ObjectManager = new Lang.Class({
|
||||
return object[interfaceName];
|
||||
},
|
||||
|
||||
getProxiesForInterface: function(interfaceName) {
|
||||
getProxiesForInterface(interfaceName) {
|
||||
let proxyList = this._interfaces[interfaceName];
|
||||
|
||||
if (!proxyList)
|
||||
@ -273,7 +273,7 @@ var ObjectManager = new Lang.Class({
|
||||
return proxyList;
|
||||
},
|
||||
|
||||
getAllProxies: function() {
|
||||
getAllProxies() {
|
||||
let proxies = [];
|
||||
|
||||
let objectPaths = Object.keys(this._objects);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// parse:
|
||||
// @params: caller-provided parameter object, or %null
|
||||
// @defaults: function-provided defaults object
|
||||
// @defaults-provided defaults object
|
||||
// @allowExtras: whether or not to allow properties not in @default
|
||||
//
|
||||
// Examines @params and fills in default values from @defaults for
|
||||
|
@ -27,34 +27,34 @@ function getSmartcardManager() {
|
||||
|
||||
var SmartcardManager = new Lang.Class({
|
||||
Name: 'SmartcardManager',
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._objectManager = new ObjectManager.ObjectManager({ connection: Gio.DBus.session,
|
||||
name: "org.gnome.SettingsDaemon.Smartcard",
|
||||
objectPath: '/org/gnome/SettingsDaemon/Smartcard',
|
||||
knownInterfaces: [ SmartcardTokenIface ],
|
||||
onLoaded: Lang.bind(this, this._onLoaded) });
|
||||
onLoaded: this._onLoaded.bind(this) });
|
||||
this._insertedTokens = {};
|
||||
this._loginToken = null;
|
||||
},
|
||||
|
||||
_onLoaded: function() {
|
||||
_onLoaded() {
|
||||
let tokens = this._objectManager.getProxiesForInterface('org.gnome.SettingsDaemon.Smartcard.Token');
|
||||
|
||||
for (let i = 0; i < tokens.length; i++)
|
||||
this._addToken(tokens[i]);
|
||||
|
||||
this._objectManager.connect('interface-added', Lang.bind(this, function(objectManager, interfaceName, proxy) {
|
||||
this._objectManager.connect('interface-added', (objectManager, interfaceName, proxy) => {
|
||||
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
|
||||
this._addToken(proxy);
|
||||
}));
|
||||
});
|
||||
|
||||
this._objectManager.connect('interface-removed', Lang.bind(this, function(objectManager, interfaceName, proxy) {
|
||||
this._objectManager.connect('interface-removed', (objectManager, interfaceName, proxy) => {
|
||||
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
|
||||
this._removeToken(proxy);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updateToken: function(token) {
|
||||
_updateToken(token) {
|
||||
let objectPath = token.get_object_path();
|
||||
|
||||
delete this._insertedTokens[objectPath];
|
||||
@ -66,28 +66,27 @@ var SmartcardManager = new Lang.Class({
|
||||
this._loginToken = token;
|
||||
},
|
||||
|
||||
_addToken: function(token) {
|
||||
_addToken(token) {
|
||||
this._updateToken(token);
|
||||
|
||||
token.connect('g-properties-changed',
|
||||
Lang.bind(this, function(proxy, properties) {
|
||||
if ('IsInserted' in properties.deep_unpack()) {
|
||||
this._updateToken(token);
|
||||
token.connect('g-properties-changed', (proxy, properties) => {
|
||||
if ('IsInserted' in properties.deep_unpack()) {
|
||||
this._updateToken(token);
|
||||
|
||||
if (token.IsInserted) {
|
||||
this.emit('smartcard-inserted', token);
|
||||
} else {
|
||||
this.emit('smartcard-removed', token);
|
||||
}
|
||||
}
|
||||
}));
|
||||
if (token.IsInserted) {
|
||||
this.emit('smartcard-inserted', token);
|
||||
} else {
|
||||
this.emit('smartcard-removed', token);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Emit a smartcard-inserted at startup if it's already plugged in
|
||||
if (token.IsInserted)
|
||||
this.emit('smartcard-inserted', token);
|
||||
},
|
||||
|
||||
_removeToken: function(token) {
|
||||
_removeToken(token) {
|
||||
let objectPath = token.get_object_path();
|
||||
|
||||
if (this._insertedTokens[objectPath] == token) {
|
||||
@ -101,11 +100,11 @@ var SmartcardManager = new Lang.Class({
|
||||
token.disconnectAll();
|
||||
},
|
||||
|
||||
hasInsertedTokens: function() {
|
||||
hasInsertedTokens() {
|
||||
return Object.keys(this._insertedTokens).length > 0;
|
||||
},
|
||||
|
||||
hasInsertedLoginToken: function() {
|
||||
hasInsertedLoginToken() {
|
||||
if (!this._loginToken)
|
||||
return false;
|
||||
|
||||
|
@ -87,7 +87,7 @@ const SystemActions = new Lang.Class({
|
||||
null)
|
||||
},
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
this._canHavePowerOff = true;
|
||||
@ -218,7 +218,7 @@ const SystemActions = new Lang.Class({
|
||||
return this._actions.get(LOCK_ORIENTATION_ACTION_ID).iconName;
|
||||
},
|
||||
|
||||
_sensorProxyAppeared: function() {
|
||||
_sensorProxyAppeared() {
|
||||
this._sensorProxy = new SensorProxy(Gio.DBus.system, SENSOR_BUS_NAME, SENSOR_OBJECT_PATH,
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
@ -231,7 +231,7 @@ const SystemActions = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_updateOrientationLock: function() {
|
||||
_updateOrientationLock() {
|
||||
let available = false;
|
||||
if (this._sensorProxy)
|
||||
available = this._sensorProxy.HasAccelerometer &&
|
||||
@ -242,7 +242,7 @@ const SystemActions = new Lang.Class({
|
||||
this.notify('can-lock-orientation');
|
||||
},
|
||||
|
||||
_updateOrientationLockIcon: function() {
|
||||
_updateOrientationLockIcon() {
|
||||
let locked = this._orientationSettings.get_boolean('orientation-lock');
|
||||
let iconName = locked ? 'rotation-locked-symbolic'
|
||||
: 'rotation-allowed-symbolic';
|
||||
@ -251,14 +251,14 @@ const SystemActions = new Lang.Class({
|
||||
this.notify('orientation-lock-icon');
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
_sessionUpdated() {
|
||||
this._updateLockScreen();
|
||||
this._updatePowerOff();
|
||||
this._updateSuspend();
|
||||
this._updateMultiUser();
|
||||
},
|
||||
|
||||
forceUpdate: function() {
|
||||
forceUpdate() {
|
||||
// Whether those actions are available or not depends on both lockdown
|
||||
// settings and Polkit policy - we don't get change notifications for the
|
||||
// latter, so their value may be outdated; force an update now
|
||||
@ -266,7 +266,7 @@ const SystemActions = new Lang.Class({
|
||||
this._updateHaveSuspend();
|
||||
},
|
||||
|
||||
getMatchingActions: function(terms) {
|
||||
getMatchingActions(terms) {
|
||||
// terms is a list of strings
|
||||
terms = terms.map((term) => { return term.toLowerCase(); });
|
||||
|
||||
@ -279,15 +279,15 @@ const SystemActions = new Lang.Class({
|
||||
return results;
|
||||
},
|
||||
|
||||
getName: function(id) {
|
||||
getName(id) {
|
||||
return this._actions.get(id).name;
|
||||
},
|
||||
|
||||
getIconName: function(id) {
|
||||
getIconName(id) {
|
||||
return this._actions.get(id).iconName;
|
||||
},
|
||||
|
||||
activateAction: function(id) {
|
||||
activateAction(id) {
|
||||
switch (id) {
|
||||
case POWER_OFF_ACTION_ID:
|
||||
this.activatePowerOff();
|
||||
@ -317,7 +317,7 @@ const SystemActions = new Lang.Class({
|
||||
this.notify('can-lock-screen');
|
||||
},
|
||||
|
||||
_updateHaveShutdown: function() {
|
||||
_updateHaveShutdown() {
|
||||
this._session.CanShutdownRemote((result, error) => {
|
||||
if (error)
|
||||
return;
|
||||
@ -327,7 +327,7 @@ const SystemActions = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_updatePowerOff: function() {
|
||||
_updatePowerOff() {
|
||||
let disabled = Main.sessionMode.isLocked ||
|
||||
(Main.sessionMode.isGreeter &&
|
||||
this._loginScreenSettings.get_boolean(DISABLE_RESTART_KEY));
|
||||
@ -335,7 +335,7 @@ const SystemActions = new Lang.Class({
|
||||
this.notify('can-power-off');
|
||||
},
|
||||
|
||||
_updateHaveSuspend: function() {
|
||||
_updateHaveSuspend() {
|
||||
this._loginManager.canSuspend(
|
||||
(canSuspend, needsAuth) => {
|
||||
this._canHaveSuspend = canSuspend;
|
||||
@ -344,7 +344,7 @@ const SystemActions = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_updateSuspend: function() {
|
||||
_updateSuspend() {
|
||||
let disabled = (Main.sessionMode.isLocked &&
|
||||
this._suspendNeedsAuth) ||
|
||||
(Main.sessionMode.isGreeter &&
|
||||
@ -353,12 +353,12 @@ const SystemActions = new Lang.Class({
|
||||
this.notify('can-suspend');
|
||||
},
|
||||
|
||||
_updateMultiUser: function() {
|
||||
_updateMultiUser() {
|
||||
this._updateLogout();
|
||||
this._updateSwitchUser();
|
||||
},
|
||||
|
||||
_updateSwitchUser: function() {
|
||||
_updateSwitchUser() {
|
||||
let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
|
||||
let multiUser = this._userManager.can_switch() && this._userManager.has_multiple_users;
|
||||
let shouldShowInMode = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||
@ -370,7 +370,7 @@ const SystemActions = new Lang.Class({
|
||||
return visible;
|
||||
},
|
||||
|
||||
_updateLogout: function() {
|
||||
_updateLogout() {
|
||||
let user = this._userManager.get_user(GLib.get_user_name());
|
||||
|
||||
let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
|
||||
@ -388,7 +388,7 @@ const SystemActions = new Lang.Class({
|
||||
return visible;
|
||||
},
|
||||
|
||||
activateLockOrientation: function() {
|
||||
activateLockOrientation() {
|
||||
if (!this._actions.get(LOCK_ORIENTATION_ACTION_ID).available)
|
||||
throw new Error('The lock-orientation action is not available!');
|
||||
|
||||
@ -396,27 +396,27 @@ const SystemActions = new Lang.Class({
|
||||
this._orientationSettings.set_boolean('orientation-lock', !locked);
|
||||
},
|
||||
|
||||
activateLockScreen: function() {
|
||||
activateLockScreen() {
|
||||
if (!this._actions.get(LOCK_SCREEN_ACTION_ID).available)
|
||||
throw new Error('The lock-screen action is not available!');
|
||||
|
||||
Main.screenShield.lock(true);
|
||||
},
|
||||
|
||||
activateSwitchUser: function() {
|
||||
activateSwitchUser() {
|
||||
if (!this._actions.get(SWITCH_USER_ACTION_ID).available)
|
||||
throw new Error('The switch-user action is not available!');
|
||||
|
||||
if (Main.screenShield)
|
||||
Main.screenShield.lock(false);
|
||||
|
||||
Clutter.threads_add_repaint_func_full(Clutter.RepaintFlags.POST_PAINT, function() {
|
||||
Clutter.threads_add_repaint_func_full(Clutter.RepaintFlags.POST_PAINT, () => {
|
||||
Gdm.goto_login_session_sync(null);
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
activateLogout: function() {
|
||||
activateLogout() {
|
||||
if (!this._actions.get(LOGOUT_ACTION_ID).available)
|
||||
throw new Error('The logout action is not available!');
|
||||
|
||||
@ -424,14 +424,14 @@ const SystemActions = new Lang.Class({
|
||||
this._session.LogoutRemote(0);
|
||||
},
|
||||
|
||||
activatePowerOff: function() {
|
||||
activatePowerOff() {
|
||||
if (!this._actions.get(POWER_OFF_ACTION_ID).available)
|
||||
throw new Error('The power-off action is not available!');
|
||||
|
||||
this._session.ShutdownRemote(0);
|
||||
},
|
||||
|
||||
activateSuspend: function() {
|
||||
activateSuspend() {
|
||||
if (!this._actions.get(SUSPEND_ACTION_ID).available)
|
||||
throw new Error('The suspend action is not available!');
|
||||
|
||||
|
@ -17,7 +17,7 @@ const Params = imports.misc.params;
|
||||
var SCROLL_TIME = 0.1;
|
||||
|
||||
// http://daringfireball.net/2010/07/improved_regex_for_matching_urls
|
||||
const _balancedParens = '\\((?:[^\\s()<>]+|(?:\\(?:[^\\s()<>]+\\)))*\\)';
|
||||
const _balancedParens = '\\([^\\s()<>]+\\)';
|
||||
const _leadingJunk = '[\\s`(\\[{\'\\"<\u00AB\u201C\u2018]';
|
||||
const _notTrailingJunk = '[^\\s`!()\\[\\]{};:\'\\".,<>?\u00AB\u00BB\u201C\u201D\u2018\u2019]';
|
||||
|
||||
@ -136,7 +136,7 @@ function trySpawn(argv)
|
||||
// Dummy child watch; we don't want to double-fork internally
|
||||
// because then we lose the parent-child relationship, which
|
||||
// can break polkit. See https://bugzilla.redhat.com//show_bug.cgi?id=819275
|
||||
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function () {});
|
||||
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, () => {});
|
||||
}
|
||||
|
||||
// trySpawnCommandLine:
|
||||
@ -291,12 +291,10 @@ function createTimeLabel(date, params) {
|
||||
_desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||
|
||||
let label = new St.Label({ text: formatTime(date, params) });
|
||||
let id = _desktopSettings.connect('changed::clock-format', function() {
|
||||
let id = _desktopSettings.connect('changed::clock-format', () => {
|
||||
label.text = formatTime(date, params);
|
||||
});
|
||||
label.connect('destroy', function() {
|
||||
_desktopSettings.disconnect(id);
|
||||
});
|
||||
label.connect('destroy', () => { _desktopSettings.disconnect(id); });
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -316,7 +314,7 @@ function createTimeLabel(date, params) {
|
||||
|
||||
function lowerBound(array, val, cmp) {
|
||||
let min, max, mid, v;
|
||||
cmp = cmp || function(a, b) { return a - b; };
|
||||
cmp = cmp || ((a, b) => a - b);
|
||||
|
||||
if (array.length == 0)
|
||||
return 0;
|
||||
@ -354,7 +352,7 @@ var CloseButton = new Lang.Class({
|
||||
Name: 'CloseButton',
|
||||
Extends: St.Button,
|
||||
|
||||
_init: function(boxpointer) {
|
||||
_init(boxpointer) {
|
||||
this.parent({ style_class: 'notification-close'});
|
||||
|
||||
// This is a bit tricky. St.Bin has its own x-align/y-align properties
|
||||
@ -371,10 +369,10 @@ var CloseButton = new Lang.Class({
|
||||
|
||||
this._boxPointer = boxpointer;
|
||||
if (boxpointer)
|
||||
this._boxPointer.connect('arrow-side-changed', Lang.bind(this, this._sync));
|
||||
this._boxPointer.connect('arrow-side-changed', this._sync.bind(this));
|
||||
},
|
||||
|
||||
_computeBoxPointerOffset: function() {
|
||||
_computeBoxPointerOffset() {
|
||||
if (!this._boxPointer || !this._boxPointer.actor.get_stage())
|
||||
return 0;
|
||||
|
||||
@ -385,7 +383,7 @@ var CloseButton = new Lang.Class({
|
||||
return 0;
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
let themeNode = this.get_theme_node();
|
||||
|
||||
let offY = this._computeBoxPointerOffset();
|
||||
@ -393,7 +391,7 @@ var CloseButton = new Lang.Class({
|
||||
this.translation_y = themeNode.get_length('-shell-close-overlap-y') + offY;
|
||||
},
|
||||
|
||||
vfunc_style_changed: function() {
|
||||
vfunc_style_changed() {
|
||||
this._sync();
|
||||
this.parent();
|
||||
},
|
||||
@ -442,7 +440,7 @@ function ensureActorVisibleInScrollView(scrollView, actor) {
|
||||
var AppSettingsMonitor = new Lang.Class({
|
||||
Name: 'AppSettingsMonitor',
|
||||
|
||||
_init: function(appId, schemaId) {
|
||||
_init(appId, schemaId) {
|
||||
this._appId = appId;
|
||||
this._schemaId = schemaId;
|
||||
|
||||
@ -454,7 +452,7 @@ var AppSettingsMonitor = new Lang.Class({
|
||||
|
||||
this._appSystem = Shell.AppSystem.get_default();
|
||||
this._appSystem.connect('installed-changed',
|
||||
Lang.bind(this, this._onInstalledChanged));
|
||||
this._onInstalledChanged.bind(this));
|
||||
this._onInstalledChanged();
|
||||
},
|
||||
|
||||
@ -462,19 +460,19 @@ var AppSettingsMonitor = new Lang.Class({
|
||||
return this._app != null && this._settings != null;
|
||||
},
|
||||
|
||||
activateApp: function() {
|
||||
activateApp() {
|
||||
if (this._app)
|
||||
this._app.activate();
|
||||
},
|
||||
|
||||
watchSetting: function(key, callback) {
|
||||
watchSetting(key, callback) {
|
||||
let handler = { id: 0, key: key, callback: callback };
|
||||
this._handlers.push(handler);
|
||||
|
||||
this._connectHandler(handler);
|
||||
},
|
||||
|
||||
_connectHandler: function(handler) {
|
||||
_connectHandler(handler) {
|
||||
if (!this._settings || handler.id > 0)
|
||||
return;
|
||||
|
||||
@ -483,13 +481,13 @@ var AppSettingsMonitor = new Lang.Class({
|
||||
handler.callback(this._settings, handler.key);
|
||||
},
|
||||
|
||||
_disconnectHandler: function(handler) {
|
||||
_disconnectHandler(handler) {
|
||||
if (this._settings && handler.id > 0)
|
||||
this._settings.disconnect(handler.id);
|
||||
handler.id = 0;
|
||||
},
|
||||
|
||||
_onInstalledChanged: function() {
|
||||
_onInstalledChanged() {
|
||||
let hadApp = (this._app != null);
|
||||
this._app = this._appSystem.lookup_app(this._appId);
|
||||
let haveApp = (this._app != null);
|
||||
@ -503,7 +501,7 @@ var AppSettingsMonitor = new Lang.Class({
|
||||
this._setSettings(null);
|
||||
},
|
||||
|
||||
_setSettings: function(settings) {
|
||||
_setSettings(settings) {
|
||||
this._handlers.forEach((handler) => { this._disconnectHandler(handler); });
|
||||
|
||||
let hadSettings = (this._settings != null);
|
||||
@ -516,7 +514,7 @@ var AppSettingsMonitor = new Lang.Class({
|
||||
this.emit('available-changed');
|
||||
},
|
||||
|
||||
_checkSettings: function() {
|
||||
_checkSettings() {
|
||||
let schema = this._schemaSource.lookup(this._schemaId, true);
|
||||
if (schema) {
|
||||
this._setSettings(new Gio.Settings({ settings_schema: schema }));
|
||||
|
@ -16,7 +16,7 @@ var UPDATE_THRESHOLD = 10 * GLib.TIME_SPAN_MINUTE;
|
||||
var WeatherClient = new Lang.Class({
|
||||
Name: 'WeatherClient',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._loading = false;
|
||||
this._locationValid = false;
|
||||
this._lastUpdate = GLib.DateTime.new_from_unix_local(0);
|
||||
@ -46,11 +46,11 @@ var WeatherClient = new Lang.Class({
|
||||
});
|
||||
});
|
||||
this._permStore.connectSignal('Changed',
|
||||
Lang.bind(this, this._onPermStoreChanged));
|
||||
this._onPermStoreChanged.bind(this));
|
||||
|
||||
this._locationSettings = new Gio.Settings({ schema_id: 'org.gnome.system.location' });
|
||||
this._locationSettings.connect('changed::enabled',
|
||||
Lang.bind(this, this._updateAutoLocation));
|
||||
this._updateAutoLocation.bind(this));
|
||||
|
||||
this._world = GWeather.Location.get_world();
|
||||
|
||||
@ -68,9 +68,9 @@ var WeatherClient = new Lang.Class({
|
||||
'org.gnome.Weather.Application');
|
||||
this._weatherAppMon.connect('available-changed', () => { this.emit('changed'); });
|
||||
this._weatherAppMon.watchSetting('automatic-location',
|
||||
Lang.bind(this, this._onAutomaticLocationChanged));
|
||||
this._onAutomaticLocationChanged.bind(this));
|
||||
this._weatherAppMon.watchSetting('locations',
|
||||
Lang.bind(this, this._onLocationsChanged));
|
||||
this._onLocationsChanged.bind(this));
|
||||
},
|
||||
|
||||
get available() {
|
||||
@ -89,11 +89,11 @@ var WeatherClient = new Lang.Class({
|
||||
return this._weatherInfo;
|
||||
},
|
||||
|
||||
activateApp: function() {
|
||||
activateApp() {
|
||||
this._weatherAppMon.activateApp();
|
||||
},
|
||||
|
||||
update: function() {
|
||||
update() {
|
||||
if (!this._locationValid)
|
||||
return;
|
||||
|
||||
@ -112,7 +112,7 @@ var WeatherClient = new Lang.Class({
|
||||
this._weatherAuthorized;
|
||||
},
|
||||
|
||||
_loadInfo: function() {
|
||||
_loadInfo() {
|
||||
let id = this._weatherInfo.connect('updated', () => {
|
||||
this._weatherInfo.disconnect(id);
|
||||
this._loading = false;
|
||||
@ -124,7 +124,7 @@ var WeatherClient = new Lang.Class({
|
||||
this._weatherInfo.update();
|
||||
},
|
||||
|
||||
_locationsEqual: function(loc1, loc2) {
|
||||
_locationsEqual(loc1, loc2) {
|
||||
if (loc1 == loc2)
|
||||
return true;
|
||||
|
||||
@ -134,7 +134,7 @@ var WeatherClient = new Lang.Class({
|
||||
return loc1.equal(loc2);
|
||||
},
|
||||
|
||||
_setLocation: function(location) {
|
||||
_setLocation(location) {
|
||||
if (this._locationsEqual(this._weatherInfo.location, location))
|
||||
return;
|
||||
|
||||
@ -150,14 +150,14 @@ var WeatherClient = new Lang.Class({
|
||||
this.emit('changed');
|
||||
},
|
||||
|
||||
_updateLocationMonitoring: function() {
|
||||
_updateLocationMonitoring() {
|
||||
if (this._useAutoLocation) {
|
||||
if (this._gclueLocationChangedId != 0 || this._gclueService == null)
|
||||
return;
|
||||
|
||||
this._gclueLocationChangedId =
|
||||
this._gclueService.connect('notify::location',
|
||||
Lang.bind(this, this._onGClueLocationChanged));
|
||||
this._onGClueLocationChanged.bind(this));
|
||||
this._onGClueLocationChanged();
|
||||
} else {
|
||||
if (this._gclueLocationChangedId)
|
||||
@ -166,7 +166,7 @@ var WeatherClient = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_startGClueService: function() {
|
||||
_startGClueService() {
|
||||
if (this._gclueStarting)
|
||||
return;
|
||||
|
||||
@ -187,7 +187,7 @@ var WeatherClient = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_onGClueLocationChanged: function() {
|
||||
_onGClueLocationChanged() {
|
||||
let geoLocation = this._gclueService.location;
|
||||
let location = GWeather.Location.new_detached(geoLocation.description,
|
||||
null,
|
||||
@ -196,7 +196,7 @@ var WeatherClient = new Lang.Class({
|
||||
this._setLocation(location);
|
||||
},
|
||||
|
||||
_onAutomaticLocationChanged: function(settings, key) {
|
||||
_onAutomaticLocationChanged(settings, key) {
|
||||
let useAutoLocation = settings.get_boolean(key);
|
||||
if (this._autoLocationRequested == useAutoLocation)
|
||||
return;
|
||||
@ -206,7 +206,7 @@ var WeatherClient = new Lang.Class({
|
||||
this._updateAutoLocation();
|
||||
},
|
||||
|
||||
_updateAutoLocation: function() {
|
||||
_updateAutoLocation() {
|
||||
this._updateLocationMonitoring();
|
||||
|
||||
if (this._useAutoLocation)
|
||||
@ -215,7 +215,7 @@ var WeatherClient = new Lang.Class({
|
||||
this._setLocation(this._mostRecentLocation);
|
||||
},
|
||||
|
||||
_onLocationsChanged: function(settings, key) {
|
||||
_onLocationsChanged(settings, key) {
|
||||
let serialized = settings.get_value(key).deep_unpack().shift();
|
||||
let mostRecentLocation = null;
|
||||
|
||||
@ -231,7 +231,7 @@ var WeatherClient = new Lang.Class({
|
||||
this._setLocation(this._mostRecentLocation);
|
||||
},
|
||||
|
||||
_onPermStoreChanged: function(proxy, sender, params) {
|
||||
_onPermStoreChanged(proxy, sender, params) {
|
||||
let [table, id, deleted, data, perms] = params;
|
||||
|
||||
if (table != 'gnome' || id != 'geolocation')
|
||||
|
@ -75,9 +75,9 @@ function run() {
|
||||
// Enable recording of timestamps for different points in the frame cycle
|
||||
global.frame_timestamps = true;
|
||||
|
||||
Main.overview.connect('shown', function() {
|
||||
Scripting.scriptEvent('overviewShowDone');
|
||||
});
|
||||
Main.overview.connect('shown', () => {
|
||||
Scripting.scriptEvent('overviewShowDone');
|
||||
});
|
||||
|
||||
yield Scripting.sleep(1000);
|
||||
|
||||
|
@ -42,35 +42,29 @@ function waitAndDraw(milliseconds) {
|
||||
let timeline = new Clutter.Timeline({ duration: milliseconds });
|
||||
timeline.start();
|
||||
|
||||
timeline.connect('new-frame',
|
||||
function(timeline, frame) {
|
||||
global.stage.queue_redraw();
|
||||
});
|
||||
timeline.connect('new-frame', (timeline, frame) => {
|
||||
global.stage.queue_redraw();
|
||||
});
|
||||
|
||||
timeline.connect('completed',
|
||||
function() {
|
||||
timeline.stop();
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
timeline.connect('completed', () => {
|
||||
timeline.stop();
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
|
||||
return function(callback) {
|
||||
cb = callback;
|
||||
};
|
||||
return callback => { cb = callback; };
|
||||
}
|
||||
|
||||
function waitSignal(object, signal) {
|
||||
let cb;
|
||||
|
||||
let id = object.connect(signal, function() {
|
||||
let id = object.connect(signal, () => {
|
||||
object.disconnect(id);
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
|
||||
return function(callback) {
|
||||
cb = callback;
|
||||
};
|
||||
return callback => { cb = callback; };
|
||||
}
|
||||
|
||||
function extractBootTimestamp() {
|
||||
@ -142,8 +136,7 @@ function run() {
|
||||
global.frame_finish_timestamp = true;
|
||||
|
||||
for (let k = 0; k < 5; k++)
|
||||
yield Scripting.createTestWindow(640, 480,
|
||||
{ maximized: true });
|
||||
yield Scripting.createTestWindow({ maximized: true });
|
||||
yield Scripting.waitTestWindows();
|
||||
|
||||
yield Scripting.sleep(1000);
|
||||
@ -164,8 +157,7 @@ function run() {
|
||||
yield Scripting.destroyTestWindows();
|
||||
Main.overview.hide();
|
||||
|
||||
yield Scripting.createTestWindow(640, 480,
|
||||
{ maximized: true,
|
||||
yield Scripting.createTestWindow({ maximized: true,
|
||||
redraws: true});
|
||||
yield Scripting.waitTestWindows();
|
||||
|
||||
@ -270,7 +262,7 @@ function script_redrawTestDone(time) {
|
||||
function script_collectTimings(time) {
|
||||
for (let timing in redrawTimes) {
|
||||
let times = redrawTimes[timing];
|
||||
times.sort(function(a, b) { return a - b });
|
||||
times.sort((a, b) => a - b);
|
||||
|
||||
let len = times.length;
|
||||
let median;
|
||||
|
@ -54,7 +54,7 @@ var PortalHeaderBar = new Lang.Class({
|
||||
Name: 'PortalHeaderBar',
|
||||
Extends: Gtk.HeaderBar,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent({ show_close_button: true });
|
||||
|
||||
// See ephy-title-box.c in epiphany for the layout
|
||||
@ -92,11 +92,11 @@ var PortalHeaderBar = new Lang.Class({
|
||||
vbox.show_all();
|
||||
},
|
||||
|
||||
setSubtitle: function(label) {
|
||||
setSubtitle(label) {
|
||||
this.subtitleLabel.set_text(label);
|
||||
},
|
||||
|
||||
setSecurityIcon: function(securityLevel) {
|
||||
setSecurityIcon(securityLevel) {
|
||||
switch (securityLevel) {
|
||||
case PortalHelperSecurityLevel.NOT_YET_DETERMINED:
|
||||
this._lockImage.hide();
|
||||
@ -119,10 +119,10 @@ var PortalWindow = new Lang.Class({
|
||||
Name: 'PortalWindow',
|
||||
Extends: Gtk.ApplicationWindow,
|
||||
|
||||
_init: function(application, url, timestamp, doneCallback) {
|
||||
_init(application, url, timestamp, doneCallback) {
|
||||
this.parent({ application: application });
|
||||
|
||||
this.connect('delete-event', Lang.bind(this, this.destroyWindow));
|
||||
this.connect('delete-event', this.destroyWindow.bind(this));
|
||||
this._headerBar = new PortalHeaderBar();
|
||||
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.NOT_YET_DETERMINED);
|
||||
this.set_titlebar(this._headerBar);
|
||||
@ -146,12 +146,12 @@ var PortalWindow = new Lang.Class({
|
||||
this._webContext.set_network_proxy_settings(WebKit.NetworkProxyMode.NO_PROXY, null);
|
||||
|
||||
this._webView = WebKit.WebView.new_with_context(this._webContext);
|
||||
this._webView.connect('decide-policy', Lang.bind(this, this._onDecidePolicy));
|
||||
this._webView.connect('load-changed', Lang.bind(this, this._onLoadChanged));
|
||||
this._webView.connect('insecure-content-detected', Lang.bind(this, this._onInsecureContentDetected));
|
||||
this._webView.connect('load-failed-with-tls-errors', Lang.bind(this, this._onLoadFailedWithTlsErrors));
|
||||
this._webView.connect('decide-policy', this._onDecidePolicy.bind(this));
|
||||
this._webView.connect('load-changed', this._onLoadChanged.bind(this));
|
||||
this._webView.connect('insecure-content-detected', this._onInsecureContentDetected.bind(this));
|
||||
this._webView.connect('load-failed-with-tls-errors', this._onLoadFailedWithTlsErrors.bind(this));
|
||||
this._webView.load_uri(url);
|
||||
this._webView.connect('notify::uri', Lang.bind(this, this._syncUri));
|
||||
this._webView.connect('notify::uri', this._syncUri.bind(this));
|
||||
this._syncUri();
|
||||
|
||||
this.add(this._webView);
|
||||
@ -163,11 +163,11 @@ var PortalWindow = new Lang.Class({
|
||||
this.application.set_accels_for_action('app.quit', ['<Primary>q', '<Primary>w']);
|
||||
},
|
||||
|
||||
destroyWindow: function() {
|
||||
destroyWindow() {
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
_syncUri: function() {
|
||||
_syncUri() {
|
||||
let uri = this._webView.uri;
|
||||
if (uri)
|
||||
this._headerBar.setSubtitle(GLib.uri_unescape_string(uri, null));
|
||||
@ -175,12 +175,12 @@ var PortalWindow = new Lang.Class({
|
||||
this._headerBar.setSubtitle('');
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
refresh() {
|
||||
this._everSeenRedirect = false;
|
||||
this._webView.load_uri(this._originalUrl);
|
||||
},
|
||||
|
||||
vfunc_delete_event: function(event) {
|
||||
vfunc_delete_event(event) {
|
||||
if (this._recheckAtExit)
|
||||
this._doneCallback(PortalHelperResult.RECHECK);
|
||||
else
|
||||
@ -188,7 +188,7 @@ var PortalWindow = new Lang.Class({
|
||||
return false;
|
||||
},
|
||||
|
||||
_onLoadChanged: function(view, loadEvent) {
|
||||
_onLoadChanged(view, loadEvent) {
|
||||
if (loadEvent == WebKit.LoadEvent.STARTED) {
|
||||
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.NOT_YET_DETERMINED);
|
||||
} else if (loadEvent == WebKit.LoadEvent.COMMITTED) {
|
||||
@ -202,11 +202,11 @@ var PortalWindow = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onInsecureContentDetected: function () {
|
||||
_onInsecureContentDetected() {
|
||||
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.INSECURE);
|
||||
},
|
||||
|
||||
_onLoadFailedWithTlsErrors: function (view, failingURI, certificate, errors) {
|
||||
_onLoadFailedWithTlsErrors(view, failingURI, certificate, errors) {
|
||||
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.INSECURE);
|
||||
let uri = new Soup.URI(failingURI);
|
||||
this._webContext.allow_tls_certificate_for_host(certificate, uri.get_host());
|
||||
@ -214,7 +214,7 @@ var PortalWindow = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_onDecidePolicy: function(view, decision, type) {
|
||||
_onDecidePolicy(view, decision, type) {
|
||||
if (type == WebKit.PolicyDecisionType.NEW_WINDOW_ACTION) {
|
||||
let navigationAction = decision.get_navigation_action();
|
||||
if (navigationAction.is_user_gesture()) {
|
||||
@ -286,7 +286,7 @@ var WebPortalHelper = new Lang.Class({
|
||||
Name: 'WebPortalHelper',
|
||||
Extends: Gtk.Application,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent({ application_id: 'org.gnome.Shell.PortalHelper',
|
||||
flags: Gio.ApplicationFlags.IS_SERVICE,
|
||||
inactivity_timeout: 30000 });
|
||||
@ -299,30 +299,30 @@ var WebPortalHelper = new Lang.Class({
|
||||
this.add_action(action);
|
||||
},
|
||||
|
||||
vfunc_dbus_register: function(connection, path) {
|
||||
vfunc_dbus_register(connection, path) {
|
||||
this._dbusImpl.export(connection, path);
|
||||
this.parent(connection, path);
|
||||
return true;
|
||||
},
|
||||
|
||||
vfunc_dbus_unregister: function(connection, path) {
|
||||
vfunc_dbus_unregister(connection, path) {
|
||||
this._dbusImpl.unexport_from_connection(connection);
|
||||
this.parent(connection, path);
|
||||
},
|
||||
|
||||
vfunc_activate: function() {
|
||||
vfunc_activate() {
|
||||
// If launched manually (for example for testing), force a dummy authentication
|
||||
// session with the default url
|
||||
this.Authenticate('/org/gnome/dummy', '', 0);
|
||||
},
|
||||
|
||||
Authenticate: function(connection, url, timestamp) {
|
||||
Authenticate(connection, url, timestamp) {
|
||||
this._queue.push({ connection: connection, url: url, timestamp: timestamp });
|
||||
|
||||
this._processQueue();
|
||||
},
|
||||
|
||||
Close: function(connection) {
|
||||
Close(connection) {
|
||||
for (let i = 0; i < this._queue.length; i++) {
|
||||
let obj = this._queue[i];
|
||||
|
||||
@ -337,7 +337,7 @@ var WebPortalHelper = new Lang.Class({
|
||||
this._processQueue();
|
||||
},
|
||||
|
||||
Refresh: function(connection) {
|
||||
Refresh(connection) {
|
||||
for (let i = 0; i < this._queue.length; i++) {
|
||||
let obj = this._queue[i];
|
||||
|
||||
@ -349,7 +349,7 @@ var WebPortalHelper = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_processQueue: function() {
|
||||
_processQueue() {
|
||||
if (this._queue.length == 0)
|
||||
return;
|
||||
|
||||
@ -357,9 +357,9 @@ var WebPortalHelper = new Lang.Class({
|
||||
if (top.window != null)
|
||||
return;
|
||||
|
||||
top.window = new PortalWindow(this, top.url, top.timestamp, Lang.bind(this, function(result) {
|
||||
top.window = new PortalWindow(this, top.url, top.timestamp, result => {
|
||||
this._dbusImpl.emit_signal('Done', new GLib.Variant('(ou)', [top.connection, result]));
|
||||
}));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -42,7 +42,7 @@ var AccessDialog = new Lang.Class({
|
||||
Name: 'AccessDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function(invocation, handle, title, subtitle, body, options) {
|
||||
_init(invocation, handle, title, subtitle, body, options) {
|
||||
this.parent({ styleClass: 'access-dialog' });
|
||||
|
||||
this._invocation = invocation;
|
||||
@ -57,7 +57,7 @@ var AccessDialog = new Lang.Class({
|
||||
this._buildLayout(title, subtitle, body, options);
|
||||
},
|
||||
|
||||
_buildLayout: function(title, subtitle, body, options) {
|
||||
_buildLayout(title, subtitle, body, options) {
|
||||
// No support for non-modal system dialogs, so ignore the option
|
||||
//let modal = options['modal'] || true;
|
||||
let denyLabel = options['deny_label'] || _("Deny Access");
|
||||
@ -97,14 +97,14 @@ var AccessDialog = new Lang.Class({
|
||||
}});
|
||||
},
|
||||
|
||||
open: function() {
|
||||
open() {
|
||||
this.parent();
|
||||
|
||||
let connection = this._invocation.get_connection();
|
||||
this._requestExported = this._request.export(connection, this._handle);
|
||||
},
|
||||
|
||||
CloseAsync: function(invocation, params) {
|
||||
CloseAsync(invocation, params) {
|
||||
if (this._invocation.get_sender() != invocation.get_sender()) {
|
||||
invocation.return_error_literal(Gio.DBusError,
|
||||
Gio.DBusError.ACCESS_DENIED,
|
||||
@ -115,7 +115,7 @@ var AccessDialog = new Lang.Class({
|
||||
this._sendResponse(DialogResponse.CLOSED);
|
||||
},
|
||||
|
||||
_sendResponse: function(response) {
|
||||
_sendResponse(response) {
|
||||
if (this._requestExported)
|
||||
this._request.unexport();
|
||||
this._requestExported = false;
|
||||
@ -140,7 +140,7 @@ var AccessDialog = new Lang.Class({
|
||||
var AccessDialogDBus = new Lang.Class({
|
||||
Name: 'AccessDialogDBus',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._accessDialog = null;
|
||||
|
||||
this._windowTracker = Shell.WindowTracker.get_default();
|
||||
@ -151,7 +151,7 @@ var AccessDialogDBus = new Lang.Class({
|
||||
Gio.DBus.session.own_name('org.freedesktop.impl.portal.desktop.gnome', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||
},
|
||||
|
||||
AccessDialogAsync: function(params, invocation) {
|
||||
AccessDialogAsync(params, invocation) {
|
||||
if (this._accessDialog) {
|
||||
invocation.return_error_literal(Gio.DBusError,
|
||||
Gio.DBusError.LIMITS_EXCEEDED,
|
||||
|
176
js/ui/altTab.js
176
js/ui/altTab.js
@ -62,7 +62,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
Name: 'AppSwitcherPopup',
|
||||
Extends: SwitcherPopup.SwitcherPopup,
|
||||
|
||||
_init : function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
this._thumbnails = null;
|
||||
@ -80,7 +80,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
this._items = this._switcherList.icons;
|
||||
},
|
||||
|
||||
_allocate: function (actor, box, flags) {
|
||||
_allocate(actor, box, flags) {
|
||||
this.parent(actor, box, flags);
|
||||
|
||||
// Allocate the thumbnails
|
||||
@ -118,7 +118,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_initialSelection: function(backward, binding) {
|
||||
_initialSelection(backward, binding) {
|
||||
if (binding == 'switch-group') {
|
||||
if (backward) {
|
||||
this._select(0, this._items[0].cachedWindows.length - 1);
|
||||
@ -141,14 +141,14 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_nextWindow : function() {
|
||||
_nextWindow() {
|
||||
// We actually want the second window if we're in the unset state
|
||||
if (this._currentWindow == -1)
|
||||
this._currentWindow = 0;
|
||||
return SwitcherPopup.mod(this._currentWindow + 1,
|
||||
this._items[this._selectedIndex].cachedWindows.length);
|
||||
},
|
||||
_previousWindow : function() {
|
||||
_previousWindow() {
|
||||
// Also assume second window here
|
||||
if (this._currentWindow == -1)
|
||||
this._currentWindow = 1;
|
||||
@ -156,7 +156,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
this._items[this._selectedIndex].cachedWindows.length);
|
||||
},
|
||||
|
||||
_closeAppWindow: function(appIndex, windowIndex) {
|
||||
_closeAppWindow(appIndex, windowIndex) {
|
||||
let appIcon = this._items[appIndex];
|
||||
if (!appIcon)
|
||||
return;
|
||||
@ -168,7 +168,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
window.delete(global.get_current_time());
|
||||
},
|
||||
|
||||
_quitApplication: function(appIndex) {
|
||||
_quitApplication(appIndex) {
|
||||
let appIcon = this._items[appIndex];
|
||||
if (!appIcon)
|
||||
return;
|
||||
@ -176,7 +176,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
appIcon.app.request_quit();
|
||||
},
|
||||
|
||||
_keyPressHandler: function(keysym, action) {
|
||||
_keyPressHandler(keysym, action) {
|
||||
if (action == Meta.KeyBindingAction.SWITCH_GROUP) {
|
||||
if (!this._thumbnailsFocused)
|
||||
this._select(this._selectedIndex, 0);
|
||||
@ -215,7 +215,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_scrollHandler: function(direction) {
|
||||
_scrollHandler(direction) {
|
||||
if (direction == Clutter.ScrollDirection.UP) {
|
||||
if (this._thumbnailsFocused) {
|
||||
if (this._currentWindow == 0 || this._currentWindow == -1)
|
||||
@ -245,7 +245,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_itemActivatedHandler: function(n) {
|
||||
_itemActivatedHandler(n) {
|
||||
// If the user clicks on the selected app, activate the
|
||||
// selected window; otherwise (eg, they click on an app while
|
||||
// !mouseActive) activate the clicked-on app.
|
||||
@ -255,24 +255,24 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
this._select(n);
|
||||
},
|
||||
|
||||
_itemEnteredHandler: function(n) {
|
||||
_itemEnteredHandler(n) {
|
||||
this._select(n);
|
||||
},
|
||||
|
||||
_windowActivated : function(thumbnailList, n) {
|
||||
_windowActivated(thumbnailList, n) {
|
||||
let appIcon = this._items[this._selectedIndex];
|
||||
Main.activateWindow(appIcon.cachedWindows[n]);
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
_windowEntered : function(thumbnailList, n) {
|
||||
_windowEntered(thumbnailList, n) {
|
||||
if (!this.mouseActive)
|
||||
return;
|
||||
|
||||
this._select(this._selectedIndex, n);
|
||||
},
|
||||
|
||||
_windowRemoved : function(thumbnailList, n) {
|
||||
_windowRemoved(thumbnailList, n) {
|
||||
let appIcon = this._items[this._selectedIndex];
|
||||
if (!appIcon)
|
||||
return;
|
||||
@ -283,7 +283,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_finish : function(timestamp) {
|
||||
_finish(timestamp) {
|
||||
let appIcon = this._items[this._selectedIndex];
|
||||
if (this._currentWindow < 0)
|
||||
appIcon.app.activate_window(appIcon.cachedWindows[0], timestamp);
|
||||
@ -293,7 +293,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
this.parent();
|
||||
},
|
||||
|
||||
_onDestroy : function() {
|
||||
_onDestroy() {
|
||||
this.parent();
|
||||
|
||||
if (this._thumbnails)
|
||||
@ -327,7 +327,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
* then @app will be highlighted, and @window outlined, and the
|
||||
* app list will have the keyboard focus.
|
||||
*/
|
||||
_select : function(app, window, forceAppFocus) {
|
||||
_select(app, window, forceAppFocus) {
|
||||
if (app != this._selectedIndex || window == null) {
|
||||
if (this._thumbnails)
|
||||
this._destroyThumbnails();
|
||||
@ -353,12 +353,12 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
!forceAppFocus) {
|
||||
this._thumbnailTimeoutId = Mainloop.timeout_add (
|
||||
THUMBNAIL_POPUP_TIME,
|
||||
Lang.bind(this, this._timeoutPopupThumbnails));
|
||||
this._timeoutPopupThumbnails.bind(this));
|
||||
GLib.Source.set_name_by_id(this._thumbnailTimeoutId, '[gnome-shell] this._timeoutPopupThumbnails');
|
||||
}
|
||||
},
|
||||
|
||||
_timeoutPopupThumbnails: function() {
|
||||
_timeoutPopupThumbnails() {
|
||||
if (!this._thumbnails)
|
||||
this._createThumbnails();
|
||||
this._thumbnailTimeoutId = 0;
|
||||
@ -366,27 +366,27 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
_destroyThumbnails : function() {
|
||||
_destroyThumbnails() {
|
||||
let thumbnailsActor = this._thumbnails.actor;
|
||||
Tweener.addTween(thumbnailsActor,
|
||||
{ opacity: 0,
|
||||
time: THUMBNAIL_FADE_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
thumbnailsActor.destroy();
|
||||
this.thumbnailsVisible = false;
|
||||
})
|
||||
onComplete: () => {
|
||||
thumbnailsActor.destroy();
|
||||
this.thumbnailsVisible = false;
|
||||
}
|
||||
});
|
||||
this._thumbnails = null;
|
||||
if (this._switcherList._items[this._selectedIndex])
|
||||
this._switcherList._items[this._selectedIndex].remove_accessible_state (Atk.StateType.EXPANDED);
|
||||
},
|
||||
|
||||
_createThumbnails : function() {
|
||||
_createThumbnails() {
|
||||
this._thumbnails = new ThumbnailList (this._items[this._selectedIndex].cachedWindows);
|
||||
this._thumbnails.connect('item-activated', Lang.bind(this, this._windowActivated));
|
||||
this._thumbnails.connect('item-entered', Lang.bind(this, this._windowEntered));
|
||||
this._thumbnails.connect('item-removed', Lang.bind(this, this._windowRemoved));
|
||||
this._thumbnails.connect('item-activated', this._windowActivated.bind(this));
|
||||
this._thumbnails.connect('item-entered', this._windowEntered.bind(this));
|
||||
this._thumbnails.connect('item-removed', this._windowRemoved.bind(this));
|
||||
this._thumbnails.actor.connect('destroy', () => {
|
||||
this._thumbnails = null;
|
||||
this._thumbnailsFocused = false;
|
||||
@ -403,7 +403,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
{ opacity: 255,
|
||||
time: THUMBNAIL_FADE_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
|
||||
onComplete: () => { this.thumbnailsVisible = true; }
|
||||
});
|
||||
|
||||
this._switcherList._items[this._selectedIndex].add_accessible_state (Atk.StateType.EXPANDED);
|
||||
@ -413,7 +413,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
var CyclerHighlight = new Lang.Class({
|
||||
Name: 'CyclerHighlight',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._window = null;
|
||||
|
||||
this.actor = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
||||
@ -431,8 +431,8 @@ var CyclerHighlight = new Lang.Class({
|
||||
this.actor.add_constraint(constraint);
|
||||
|
||||
this.actor.connect('notify::allocation',
|
||||
Lang.bind(this, this._onAllocationChanged));
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this._onAllocationChanged.bind(this));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
},
|
||||
|
||||
set window(w) {
|
||||
@ -453,7 +453,7 @@ var CyclerHighlight = new Lang.Class({
|
||||
this._clone.source = windowActor;
|
||||
},
|
||||
|
||||
_onAllocationChanged: function() {
|
||||
_onAllocationChanged() {
|
||||
if (!this._window) {
|
||||
this._highlight.set_size(0, 0);
|
||||
this._highlight.hide();
|
||||
@ -466,7 +466,7 @@ var CyclerHighlight = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this.window = null;
|
||||
}
|
||||
});
|
||||
@ -476,7 +476,7 @@ var CyclerPopup = new Lang.Class({
|
||||
Extends: SwitcherPopup.SwitcherPopup,
|
||||
Abstract: true,
|
||||
|
||||
_init : function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
this._items = this._getWindows();
|
||||
@ -490,16 +490,16 @@ var CyclerPopup = new Lang.Class({
|
||||
// We don't show an actual popup, so just provide what SwitcherPopup
|
||||
// expects instead of inheriting from SwitcherList
|
||||
this._switcherList = { actor: new St.Widget(),
|
||||
highlight: Lang.bind(this, this._highlightItem),
|
||||
connect: function() {} };
|
||||
highlight: this._highlightItem.bind(this),
|
||||
connect() {} };
|
||||
},
|
||||
|
||||
_highlightItem: function(index, justOutline) {
|
||||
_highlightItem(index, justOutline) {
|
||||
this._highlight.window = this._items[index];
|
||||
global.window_group.set_child_above_sibling(this._highlight.actor, null);
|
||||
},
|
||||
|
||||
_finish: function() {
|
||||
_finish() {
|
||||
let window = this._items[this._selectedIndex];
|
||||
let ws = window.get_workspace();
|
||||
let activeWs = global.screen.get_active_workspace();
|
||||
@ -524,7 +524,7 @@ var CyclerPopup = new Lang.Class({
|
||||
this.parent();
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this._highlight.actor.destroy();
|
||||
|
||||
this.parent();
|
||||
@ -536,12 +536,12 @@ var GroupCyclerPopup = new Lang.Class({
|
||||
Name: 'GroupCyclerPopup',
|
||||
Extends: CyclerPopup,
|
||||
|
||||
_getWindows: function() {
|
||||
_getWindows() {
|
||||
let app = Shell.WindowTracker.get_default().focus_app;
|
||||
return app ? app.get_windows() : [];
|
||||
},
|
||||
|
||||
_keyPressHandler: function(keysym, action) {
|
||||
_keyPressHandler(keysym, action) {
|
||||
if (action == Meta.KeyBindingAction.CYCLE_GROUP)
|
||||
this._select(this._next());
|
||||
else if (action == Meta.KeyBindingAction.CYCLE_GROUP_BACKWARD)
|
||||
@ -557,7 +557,7 @@ var WindowSwitcherPopup = new Lang.Class({
|
||||
Name: 'WindowSwitcherPopup',
|
||||
Extends: SwitcherPopup.SwitcherPopup,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
|
||||
|
||||
@ -571,12 +571,12 @@ var WindowSwitcherPopup = new Lang.Class({
|
||||
this._items = this._switcherList.icons;
|
||||
},
|
||||
|
||||
_getWindowList: function() {
|
||||
_getWindowList() {
|
||||
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
||||
return getWindows(workspace);
|
||||
},
|
||||
|
||||
_closeWindow: function(windowIndex) {
|
||||
_closeWindow(windowIndex) {
|
||||
let windowIcon = this._items[windowIndex];
|
||||
if (!windowIcon)
|
||||
return;
|
||||
@ -584,7 +584,7 @@ var WindowSwitcherPopup = new Lang.Class({
|
||||
windowIcon.window.delete(global.get_current_time());
|
||||
},
|
||||
|
||||
_keyPressHandler: function(keysym, action) {
|
||||
_keyPressHandler(keysym, action) {
|
||||
if (action == Meta.KeyBindingAction.SWITCH_WINDOWS) {
|
||||
this._select(this._next());
|
||||
} else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD) {
|
||||
@ -603,7 +603,7 @@ var WindowSwitcherPopup = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_finish: function() {
|
||||
_finish() {
|
||||
Main.activateWindow(this._items[this._selectedIndex].window);
|
||||
|
||||
this.parent();
|
||||
@ -614,17 +614,17 @@ var WindowCyclerPopup = new Lang.Class({
|
||||
Name: 'WindowCyclerPopup',
|
||||
Extends: CyclerPopup,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
|
||||
this.parent();
|
||||
},
|
||||
|
||||
_getWindows: function() {
|
||||
_getWindows() {
|
||||
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
||||
return getWindows(workspace);
|
||||
},
|
||||
|
||||
_keyPressHandler: function(keysym, action) {
|
||||
_keyPressHandler(keysym, action) {
|
||||
if (action == Meta.KeyBindingAction.CYCLE_WINDOWS)
|
||||
this._select(this._next());
|
||||
else if (action == Meta.KeyBindingAction.CYCLE_WINDOWS_BACKWARD)
|
||||
@ -639,7 +639,7 @@ var WindowCyclerPopup = new Lang.Class({
|
||||
var AppIcon = new Lang.Class({
|
||||
Name: 'AppIcon',
|
||||
|
||||
_init: function(app) {
|
||||
_init(app) {
|
||||
this.app = app;
|
||||
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
||||
vertical: true });
|
||||
@ -651,7 +651,7 @@ var AppIcon = new Lang.Class({
|
||||
this.actor.add(this.label, { x_fill: false });
|
||||
},
|
||||
|
||||
set_size: function(size) {
|
||||
set_size(size) {
|
||||
this.icon = this.app.create_icon_texture(size);
|
||||
this._iconBin.child = this.icon;
|
||||
}
|
||||
@ -661,7 +661,7 @@ var AppSwitcher = new Lang.Class({
|
||||
Name: 'AppSwitcher',
|
||||
Extends: SwitcherPopup.SwitcherList,
|
||||
|
||||
_init : function(apps, altTabPopup) {
|
||||
_init(apps, altTabPopup) {
|
||||
this.parent(true);
|
||||
|
||||
this.icons = [];
|
||||
@ -678,9 +678,9 @@ var AppSwitcher = new Lang.Class({
|
||||
let appIcon = new AppIcon(apps[i]);
|
||||
// Cache the window list now; we don't handle dynamic changes here,
|
||||
// and we don't want to be continually retrieving it
|
||||
appIcon.cachedWindows = allWindows.filter(function(w) {
|
||||
return windowTracker.get_window_app (w) == appIcon.app;
|
||||
});
|
||||
appIcon.cachedWindows = allWindows.filter(
|
||||
w => windowTracker.get_window_app (w) == appIcon.app
|
||||
);
|
||||
if (appIcon.cachedWindows.length > 0)
|
||||
this._addIcon(appIcon);
|
||||
}
|
||||
@ -690,10 +690,10 @@ var AppSwitcher = new Lang.Class({
|
||||
this._altTabPopup = altTabPopup;
|
||||
this._mouseTimeOutId = 0;
|
||||
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
if (this._mouseTimeOutId != 0)
|
||||
Mainloop.source_remove(this._mouseTimeOutId);
|
||||
|
||||
@ -702,7 +702,7 @@ var AppSwitcher = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_setIconSize: function() {
|
||||
_setIconSize() {
|
||||
let j = 0;
|
||||
while(this._items.length > 1 && this._items[j].style_class != 'item-box') {
|
||||
j++;
|
||||
@ -721,9 +721,7 @@ var AppSwitcher = new Lang.Class({
|
||||
let availWidth = primary.width - parentPadding - this.actor.get_theme_node().get_horizontal_padding();
|
||||
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let iconSizes = baseIconSizes.map(function(s) {
|
||||
return s * scaleFactor;
|
||||
});
|
||||
let iconSizes = baseIconSizes.map(s => s * scaleFactor);
|
||||
|
||||
if (this._items.length == 1) {
|
||||
this._iconSize = baseIconSizes[0];
|
||||
@ -744,12 +742,12 @@ var AppSwitcher = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getPreferredHeight: function (actor, forWidth, alloc) {
|
||||
_getPreferredHeight(actor, forWidth, alloc) {
|
||||
this._setIconSize();
|
||||
this.parent(actor, forWidth, alloc);
|
||||
},
|
||||
|
||||
_allocate: function (actor, box, flags) {
|
||||
_allocate(actor, box, flags) {
|
||||
// Allocate the main list items
|
||||
this.parent(actor, box, flags);
|
||||
|
||||
@ -770,22 +768,22 @@ var AppSwitcher = new Lang.Class({
|
||||
|
||||
// We override SwitcherList's _onItemEnter method to delay
|
||||
// activation when the thumbnail list is open
|
||||
_onItemEnter: function (index) {
|
||||
_onItemEnter(index) {
|
||||
if (this._mouseTimeOutId != 0)
|
||||
Mainloop.source_remove(this._mouseTimeOutId);
|
||||
if (this._altTabPopup.thumbnailsVisible) {
|
||||
this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT,
|
||||
Lang.bind(this, function () {
|
||||
this._enterItem(index);
|
||||
this._mouseTimeOutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
() => {
|
||||
this._enterItem(index);
|
||||
this._mouseTimeOutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
|
||||
} else
|
||||
this._itemEntered(index);
|
||||
},
|
||||
|
||||
_enterItem: function(index) {
|
||||
_enterItem(index) {
|
||||
let [x, y, mask] = global.get_pointer();
|
||||
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
|
||||
if (this._items[index].contains(pickedActor))
|
||||
@ -799,7 +797,7 @@ var AppSwitcher = new Lang.Class({
|
||||
// in justOutline mode). Apps with multiple windows will normally
|
||||
// show a dim arrow, but show a bright arrow when they are
|
||||
// highlighted.
|
||||
highlight : function(n, justOutline) {
|
||||
highlight(n, justOutline) {
|
||||
if (this.icons[this._curApp]) {
|
||||
if (this.icons[this._curApp].cachedWindows.length == 1)
|
||||
this._arrows[this._curApp].hide();
|
||||
@ -818,7 +816,7 @@ var AppSwitcher = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_addIcon : function(appIcon) {
|
||||
_addIcon(appIcon) {
|
||||
this.icons.push(appIcon);
|
||||
let item = this.addItem(appIcon.actor, appIcon.label);
|
||||
|
||||
@ -829,7 +827,7 @@ var AppSwitcher = new Lang.Class({
|
||||
|
||||
let n = this._arrows.length;
|
||||
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
|
||||
arrow.connect('repaint', function() { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); });
|
||||
arrow.connect('repaint', () => { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); });
|
||||
this._list.add_actor(arrow);
|
||||
this._arrows.push(arrow);
|
||||
|
||||
@ -839,7 +837,7 @@ var AppSwitcher = new Lang.Class({
|
||||
item.add_accessible_state (Atk.StateType.EXPANDABLE);
|
||||
},
|
||||
|
||||
_removeIcon: function(app) {
|
||||
_removeIcon(app) {
|
||||
let index = this.icons.findIndex(icon => {
|
||||
return icon.app == app;
|
||||
});
|
||||
@ -855,7 +853,7 @@ var ThumbnailList = new Lang.Class({
|
||||
Name: 'ThumbnailList',
|
||||
Extends: SwitcherPopup.SwitcherList,
|
||||
|
||||
_init : function(windows) {
|
||||
_init(windows) {
|
||||
this.parent(false);
|
||||
|
||||
this._labels = new Array();
|
||||
@ -891,7 +889,7 @@ var ThumbnailList = new Lang.Class({
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
},
|
||||
|
||||
addClones : function (availHeight) {
|
||||
addClones(availHeight) {
|
||||
if (!this._thumbnailBins.length)
|
||||
return;
|
||||
let totalPadding = this._items[0].get_theme_node().get_horizontal_padding() + this._items[0].get_theme_node().get_vertical_padding();
|
||||
@ -914,7 +912,9 @@ var ThumbnailList = new Lang.Class({
|
||||
this._thumbnailBins[i].set_height(binHeight);
|
||||
this._thumbnailBins[i].add_actor(clone);
|
||||
|
||||
clone._destroyId = mutterWindow.connect('destroy', Lang.bind(this, this._removeThumbnail, clone));
|
||||
clone._destroyId = mutterWindow.connect('destroy', source => {
|
||||
this._removeThumbnail(source, clone);
|
||||
});
|
||||
this._clones.push(clone);
|
||||
}
|
||||
|
||||
@ -922,7 +922,7 @@ var ThumbnailList = new Lang.Class({
|
||||
this._thumbnailBins = new Array();
|
||||
},
|
||||
|
||||
_removeThumbnail: function(source, clone) {
|
||||
_removeThumbnail(source, clone) {
|
||||
let index = this._clones.indexOf(clone);
|
||||
if (index === -1)
|
||||
return;
|
||||
@ -938,7 +938,7 @@ var ThumbnailList = new Lang.Class({
|
||||
this.actor.destroy();
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this._clones.forEach(clone => {
|
||||
if (clone.source)
|
||||
clone.source.disconnect(clone._destroyId);
|
||||
@ -950,7 +950,7 @@ var ThumbnailList = new Lang.Class({
|
||||
var WindowIcon = new Lang.Class({
|
||||
Name: 'WindowIcon',
|
||||
|
||||
_init: function(window, mode) {
|
||||
_init(window, mode) {
|
||||
this.window = window;
|
||||
|
||||
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
||||
@ -993,7 +993,7 @@ var WindowIcon = new Lang.Class({
|
||||
this._icon.set_size(size * scaleFactor, size * scaleFactor);
|
||||
},
|
||||
|
||||
_createAppIcon: function(app, size) {
|
||||
_createAppIcon(app, size) {
|
||||
let appIcon = app ? app.create_icon_texture(size)
|
||||
: new St.Icon({ icon_name: 'icon-missing',
|
||||
icon_size: size });
|
||||
@ -1008,7 +1008,7 @@ var WindowList = new Lang.Class({
|
||||
Name: 'WindowList',
|
||||
Extends: SwitcherPopup.SwitcherList,
|
||||
|
||||
_init : function(windows, mode) {
|
||||
_init(windows, mode) {
|
||||
this.parent(true);
|
||||
|
||||
this._label = new St.Label({ x_align: Clutter.ActorAlign.CENTER,
|
||||
@ -1033,13 +1033,13 @@ var WindowList = new Lang.Class({
|
||||
this.actor.connect('destroy', () => { this._onDestroy(); });
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this.icons.forEach(icon => {
|
||||
icon.window.disconnect(icon._unmanagedSignalId);
|
||||
});
|
||||
},
|
||||
|
||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
||||
_getPreferredHeight(actor, forWidth, alloc) {
|
||||
this.parent(actor, forWidth, alloc);
|
||||
|
||||
let spacing = this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
|
||||
@ -1048,7 +1048,7 @@ var WindowList = new Lang.Class({
|
||||
alloc.natural_size += labelNat + spacing;
|
||||
},
|
||||
|
||||
_allocateTop: function(actor, box, flags) {
|
||||
_allocateTop(actor, box, flags) {
|
||||
let childBox = new Clutter.ActorBox();
|
||||
childBox.x1 = box.x1;
|
||||
childBox.x2 = box.x2;
|
||||
@ -1061,13 +1061,13 @@ var WindowList = new Lang.Class({
|
||||
this.parent(actor, box, flags);
|
||||
},
|
||||
|
||||
highlight: function(index, justOutline) {
|
||||
highlight(index, justOutline) {
|
||||
this.parent(index, justOutline);
|
||||
|
||||
this._label.set_text(index == -1 ? '' : this.icons[index].label.text);
|
||||
},
|
||||
|
||||
_removeWindow: function(window) {
|
||||
_removeWindow(window) {
|
||||
let index = this.icons.findIndex(icon => {
|
||||
return icon.window == window;
|
||||
});
|
||||
|
@ -12,9 +12,9 @@ var ANIMATED_ICON_UPDATE_TIMEOUT = 16;
|
||||
var Animation = new Lang.Class({
|
||||
Name: 'Animation',
|
||||
|
||||
_init: function(file, width, height, speed) {
|
||||
_init(file, width, height, speed) {
|
||||
this.actor = new St.Bin();
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
this._speed = speed;
|
||||
|
||||
this._isLoaded = false;
|
||||
@ -24,23 +24,23 @@ var Animation = new Lang.Class({
|
||||
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
this._animations = St.TextureCache.get_default().load_sliced_image (file, width, height, scaleFactor,
|
||||
Lang.bind(this, this._animationsLoaded));
|
||||
this._animationsLoaded.bind(this));
|
||||
this.actor.set_child(this._animations);
|
||||
},
|
||||
|
||||
play: function() {
|
||||
play() {
|
||||
if (this._isLoaded && this._timeoutId == 0) {
|
||||
if (this._frame == 0)
|
||||
this._showFrame(0);
|
||||
|
||||
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_LOW, this._speed, Lang.bind(this, this._update));
|
||||
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_LOW, this._speed, this._update.bind(this));
|
||||
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._update');
|
||||
}
|
||||
|
||||
this._isPlaying = true;
|
||||
},
|
||||
|
||||
stop: function() {
|
||||
stop() {
|
||||
if (this._timeoutId > 0) {
|
||||
Mainloop.source_remove(this._timeoutId);
|
||||
this._timeoutId = 0;
|
||||
@ -49,7 +49,7 @@ var Animation = new Lang.Class({
|
||||
this._isPlaying = false;
|
||||
},
|
||||
|
||||
_showFrame: function(frame) {
|
||||
_showFrame(frame) {
|
||||
let oldFrameActor = this._animations.get_child_at_index(this._frame);
|
||||
if (oldFrameActor)
|
||||
oldFrameActor.hide();
|
||||
@ -61,19 +61,19 @@ var Animation = new Lang.Class({
|
||||
newFrameActor.show();
|
||||
},
|
||||
|
||||
_update: function() {
|
||||
_update() {
|
||||
this._showFrame(this._frame + 1);
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
},
|
||||
|
||||
_animationsLoaded: function() {
|
||||
_animationsLoaded() {
|
||||
this._isLoaded = this._animations.get_n_children() > 0;
|
||||
|
||||
if (this._isPlaying)
|
||||
this.play();
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this.stop();
|
||||
}
|
||||
});
|
||||
@ -82,7 +82,7 @@ var AnimatedIcon = new Lang.Class({
|
||||
Name: 'AnimatedIcon',
|
||||
Extends: Animation,
|
||||
|
||||
_init: function(file, size) {
|
||||
_init(file, size) {
|
||||
this.parent(file, size, size, ANIMATED_ICON_UPDATE_TIMEOUT);
|
||||
}
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,7 @@ const RENAMED_DESKTOP_IDS = {
|
||||
'dconf-editor.desktop': 'ca.desrt.dconf-editor.desktop',
|
||||
'empathy.desktop': 'org.gnome.Empathy.desktop',
|
||||
'epiphany.desktop': 'org.gnome.Epiphany.desktop',
|
||||
'evolution.desktop': 'org.gnome.Evolution.desktop',
|
||||
'file-roller.desktop': 'org.gnome.FileRoller.desktop',
|
||||
'gcalctool.desktop': 'org.gnome.Calculator.desktop',
|
||||
'geary.desktop': 'org.gnome.Geary.desktop',
|
||||
@ -34,6 +35,7 @@ const RENAMED_DESKTOP_IDS = {
|
||||
'gnome-screenshot.desktop': 'org.gnome.Screenshot.desktop',
|
||||
'gnome-software.desktop': 'org.gnome.Software.desktop',
|
||||
'gnome-terminal.desktop': 'org.gnome.Terminal.desktop',
|
||||
'gnome-tweaks.desktop': 'org.gnome.tweaks.desktop',
|
||||
'gnome-weather.desktop': 'org.gnome.Weather.Application.desktop',
|
||||
'gnomine.desktop': 'gnome-mines.desktop',
|
||||
'gnotravex.desktop': 'gnome-tetravex.desktop',
|
||||
@ -49,24 +51,24 @@ var AppFavorites = new Lang.Class({
|
||||
|
||||
FAVORITE_APPS_KEY: 'favorite-apps',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._favorites = {};
|
||||
global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged));
|
||||
global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, this._onFavsChanged.bind(this));
|
||||
this.reload();
|
||||
},
|
||||
|
||||
_onFavsChanged: function() {
|
||||
_onFavsChanged() {
|
||||
this.reload();
|
||||
this.emit('changed');
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
reload() {
|
||||
let ids = global.settings.get_strv(this.FAVORITE_APPS_KEY);
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
|
||||
// Map old desktop file names to the current ones
|
||||
let updated = false;
|
||||
ids = ids.map(function (id) {
|
||||
ids = ids.map(id => {
|
||||
let newId = RENAMED_DESKTOP_IDS[id];
|
||||
if (newId !== undefined &&
|
||||
appSys.lookup_app(newId) != null) {
|
||||
@ -79,11 +81,8 @@ var AppFavorites = new Lang.Class({
|
||||
if (updated)
|
||||
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
|
||||
|
||||
let apps = ids.map(function (id) {
|
||||
return appSys.lookup_app(id);
|
||||
}).filter(function (app) {
|
||||
return app != null;
|
||||
});
|
||||
let apps = ids.map(id => appSys.lookup_app(id))
|
||||
.filter(app => app != null);
|
||||
this._favorites = {};
|
||||
for (let i = 0; i < apps.length; i++) {
|
||||
let app = apps[i];
|
||||
@ -91,29 +90,29 @@ var AppFavorites = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getIds: function() {
|
||||
_getIds() {
|
||||
let ret = [];
|
||||
for (let id in this._favorites)
|
||||
ret.push(id);
|
||||
return ret;
|
||||
},
|
||||
|
||||
getFavoriteMap: function() {
|
||||
getFavoriteMap() {
|
||||
return this._favorites;
|
||||
},
|
||||
|
||||
getFavorites: function() {
|
||||
getFavorites() {
|
||||
let ret = [];
|
||||
for (let id in this._favorites)
|
||||
ret.push(this._favorites[id]);
|
||||
return ret;
|
||||
},
|
||||
|
||||
isFavorite: function(appId) {
|
||||
isFavorite(appId) {
|
||||
return appId in this._favorites;
|
||||
},
|
||||
|
||||
_addFavorite: function(appId, pos) {
|
||||
_addFavorite(appId, pos) {
|
||||
if (appId in this._favorites)
|
||||
return false;
|
||||
|
||||
@ -132,7 +131,7 @@ var AppFavorites = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
addFavoriteAtPos: function(appId, pos) {
|
||||
addFavoriteAtPos(appId, pos) {
|
||||
if (!this._addFavorite(appId, pos))
|
||||
return;
|
||||
|
||||
@ -140,31 +139,31 @@ var AppFavorites = new Lang.Class({
|
||||
|
||||
Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()),
|
||||
{ forFeedback: true,
|
||||
undoCallback: Lang.bind(this, function () {
|
||||
this._removeFavorite(appId);
|
||||
})
|
||||
undoCallback: () => {
|
||||
this._removeFavorite(appId);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addFavorite: function(appId) {
|
||||
addFavorite(appId) {
|
||||
this.addFavoriteAtPos(appId, -1);
|
||||
},
|
||||
|
||||
moveFavoriteToPos: function(appId, pos) {
|
||||
moveFavoriteToPos(appId, pos) {
|
||||
this._removeFavorite(appId);
|
||||
this._addFavorite(appId, pos);
|
||||
},
|
||||
|
||||
_removeFavorite: function(appId) {
|
||||
_removeFavorite(appId) {
|
||||
if (!appId in this._favorites)
|
||||
return false;
|
||||
|
||||
let ids = this._getIds().filter(function (id) { return id != appId; });
|
||||
let ids = this._getIds().filter(id => id != appId);
|
||||
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
|
||||
return true;
|
||||
},
|
||||
|
||||
removeFavorite: function(appId) {
|
||||
removeFavorite(appId) {
|
||||
let ids = this._getIds();
|
||||
let pos = ids.indexOf(appId);
|
||||
|
||||
@ -174,9 +173,9 @@ var AppFavorites = new Lang.Class({
|
||||
|
||||
Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()),
|
||||
{ forFeedback: true,
|
||||
undoCallback: Lang.bind(this, function () {
|
||||
this._addFavorite(appId, pos);
|
||||
})
|
||||
undoCallback: () => {
|
||||
this._addFavorite(appId, pos);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
Name: 'AudioDeviceSelectionDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function(devices) {
|
||||
_init(devices) {
|
||||
this.parent({ styleClass: 'audio-device-selection-dialog' });
|
||||
|
||||
this._deviceItems = {};
|
||||
@ -50,11 +50,11 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
throw new Error('Too few devices for a selection');
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this.parent();
|
||||
},
|
||||
|
||||
_buildLayout: function(devices) {
|
||||
_buildLayout(devices) {
|
||||
let title = new St.Label({ style_class: 'audio-selection-title',
|
||||
text: _("Select Audio Device"),
|
||||
x_align: Clutter.ActorAlign.CENTER });
|
||||
@ -65,14 +65,14 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
this._selectionBox = new St.BoxLayout({ style_class: 'audio-selection-box' });
|
||||
this.contentLayout.add(this._selectionBox, { expand: true });
|
||||
|
||||
this.addButton({ action: Lang.bind(this, this._openSettings),
|
||||
this.addButton({ action: this._openSettings.bind(this),
|
||||
label: _("Sound Settings") });
|
||||
this.addButton({ action: Lang.bind(this, this.close),
|
||||
this.addButton({ action: this.close.bind(this),
|
||||
label: _("Cancel"),
|
||||
key: Clutter.Escape });
|
||||
},
|
||||
|
||||
_getDeviceLabel: function(device) {
|
||||
_getDeviceLabel(device) {
|
||||
switch(device) {
|
||||
case AudioDevice.HEADPHONES:
|
||||
return _("Headphones");
|
||||
@ -85,7 +85,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getDeviceIcon: function(device) {
|
||||
_getDeviceIcon(device) {
|
||||
switch(device) {
|
||||
case AudioDevice.HEADPHONES:
|
||||
return 'audio-headphones-symbolic';
|
||||
@ -98,16 +98,14 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_addDevice: function(device) {
|
||||
_addDevice(device) {
|
||||
let box = new St.BoxLayout({ style_class: 'audio-selection-device-box',
|
||||
vertical: true });
|
||||
box.connect('notify::height',
|
||||
function() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||
function() {
|
||||
box.width = box.height;
|
||||
});
|
||||
box.connect('notify::height', () => {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
box.width = box.height;
|
||||
});
|
||||
});
|
||||
|
||||
let icon = new St.Icon({ style_class: 'audio-selection-device-icon',
|
||||
icon_name: this._getDeviceIcon(device) });
|
||||
@ -123,15 +121,14 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
child: box });
|
||||
this._selectionBox.add(button);
|
||||
|
||||
button.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this.emit('device-selected', device);
|
||||
this.close();
|
||||
Main.overview.hide();
|
||||
}));
|
||||
button.connect('clicked', () => {
|
||||
this.emit('device-selected', device);
|
||||
this.close();
|
||||
Main.overview.hide();
|
||||
});
|
||||
},
|
||||
|
||||
_openSettings: function() {
|
||||
_openSettings() {
|
||||
let desktopFile = 'gnome-sound-panel.desktop'
|
||||
let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
|
||||
|
||||
@ -149,7 +146,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
var AudioDeviceSelectionDBus = new Lang.Class({
|
||||
Name: 'AudioDeviceSelectionDBus',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._audioSelectionDialog = null;
|
||||
|
||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(AudioDeviceSelectionIface, this);
|
||||
@ -158,17 +155,16 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
||||
Gio.DBus.session.own_name('org.gnome.Shell.AudioDeviceSelection', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||
},
|
||||
|
||||
_onDialogClosed: function() {
|
||||
_onDialogClosed() {
|
||||
this._audioSelectionDialog = null;
|
||||
},
|
||||
|
||||
_onDeviceSelected: function(dialog, device) {
|
||||
_onDeviceSelected(dialog, device) {
|
||||
let connection = this._dbusImpl.get_connection();
|
||||
let info = this._dbusImpl.get_info();
|
||||
let deviceName = Object.keys(AudioDevice).filter(
|
||||
function(dev) {
|
||||
return AudioDevice[dev] == device;
|
||||
})[0].toLowerCase();
|
||||
dev => AudioDevice[dev] == device
|
||||
)[0].toLowerCase();
|
||||
connection.emit_signal(this._audioSelectionDialog._sender,
|
||||
this._dbusImpl.get_object_path(),
|
||||
info ? info.name : null,
|
||||
@ -176,7 +172,7 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
||||
GLib.Variant.new('(s)', [deviceName]));
|
||||
},
|
||||
|
||||
OpenAsync: function(params, invocation) {
|
||||
OpenAsync(params, invocation) {
|
||||
if (this._audioSelectionDialog) {
|
||||
invocation.return_value(null);
|
||||
return;
|
||||
@ -184,9 +180,7 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
||||
|
||||
let [deviceNames] = params;
|
||||
let devices = 0;
|
||||
deviceNames.forEach(function(n) {
|
||||
devices |= AudioDevice[n.toUpperCase()];
|
||||
});
|
||||
deviceNames.forEach(n => { devices |= AudioDevice[n.toUpperCase()]; });
|
||||
|
||||
let dialog;
|
||||
try {
|
||||
@ -197,16 +191,16 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
||||
}
|
||||
dialog._sender = invocation.get_sender();
|
||||
|
||||
dialog.connect('closed', Lang.bind(this, this._onDialogClosed));
|
||||
dialog.connect('closed', this._onDialogClosed.bind(this));
|
||||
dialog.connect('device-selected',
|
||||
Lang.bind(this, this._onDeviceSelected));
|
||||
this._onDeviceSelected.bind(this));
|
||||
dialog.open();
|
||||
|
||||
this._audioSelectionDialog = dialog;
|
||||
invocation.return_value(null);
|
||||
},
|
||||
|
||||
CloseAsync: function(params, invocation) {
|
||||
CloseAsync(params, invocation) {
|
||||
if (this._audioSelectionDialog &&
|
||||
this._audioSelectionDialog._sender == invocation.get_sender())
|
||||
this._audioSelectionDialog.close();
|
||||
|
@ -141,31 +141,31 @@ function _fileEqual0(file1, file2) {
|
||||
var BackgroundCache = new Lang.Class({
|
||||
Name: 'BackgroundCache',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._fileMonitors = {};
|
||||
this._backgroundSources = {};
|
||||
this._animations = {};
|
||||
},
|
||||
|
||||
monitorFile: function(file) {
|
||||
monitorFile(file) {
|
||||
let key = file.hash();
|
||||
if (this._fileMonitors[key])
|
||||
return;
|
||||
|
||||
let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
|
||||
monitor.connect('changed',
|
||||
Lang.bind(this, function(obj, file, otherFile, eventType) {
|
||||
(obj, file, otherFile, eventType) => {
|
||||
// Ignore CHANGED and CREATED events, since in both cases
|
||||
// we'll get a CHANGES_DONE_HINT event when done.
|
||||
if (eventType != Gio.FileMonitorEvent.CHANGED &&
|
||||
eventType != Gio.FileMonitorEvent.CREATED)
|
||||
this.emit('file-changed', file);
|
||||
}));
|
||||
});
|
||||
|
||||
this._fileMonitors[key] = monitor;
|
||||
},
|
||||
|
||||
getAnimation: function(params) {
|
||||
getAnimation(params) {
|
||||
params = Params.parse(params, { file: null,
|
||||
settingsSchema: null,
|
||||
onLoaded: null });
|
||||
@ -173,10 +173,10 @@ var BackgroundCache = new Lang.Class({
|
||||
let animation = this._animations[params.settingsSchema];
|
||||
if (animation && _fileEqual0(animation.file, params.file)) {
|
||||
if (params.onLoaded) {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
params.onLoaded(this._animations[params.settingsSchema]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
|
||||
}
|
||||
return;
|
||||
@ -184,20 +184,20 @@ var BackgroundCache = new Lang.Class({
|
||||
|
||||
animation = new Animation({ file: params.file });
|
||||
|
||||
animation.load(Lang.bind(this, function() {
|
||||
this._animations[params.settingsSchema] = animation;
|
||||
animation.load(() => {
|
||||
this._animations[params.settingsSchema] = animation;
|
||||
|
||||
if (params.onLoaded) {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
|
||||
params.onLoaded(this._animations[params.settingsSchema]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
|
||||
}
|
||||
}));
|
||||
if (params.onLoaded) {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
params.onLoaded(this._animations[params.settingsSchema]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getBackgroundSource: function(layoutManager, settingsSchema) {
|
||||
getBackgroundSource(layoutManager, settingsSchema) {
|
||||
// The layoutManager is always the same one; we pass in it since
|
||||
// Main.layoutManager may not be set yet
|
||||
|
||||
@ -211,7 +211,7 @@ var BackgroundCache = new Lang.Class({
|
||||
return this._backgroundSources[settingsSchema];
|
||||
},
|
||||
|
||||
releaseBackgroundSource: function(settingsSchema) {
|
||||
releaseBackgroundSource(settingsSchema) {
|
||||
if (settingsSchema in this._backgroundSources) {
|
||||
let source = this._backgroundSources[settingsSchema];
|
||||
source._useCount--;
|
||||
@ -233,7 +233,7 @@ function getBackgroundCache() {
|
||||
var Background = new Lang.Class({
|
||||
Name: 'Background',
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { monitorIndex: 0,
|
||||
layoutManager: Main.layoutManager,
|
||||
settings: null,
|
||||
@ -254,10 +254,10 @@ var Background = new Lang.Class({
|
||||
|
||||
this._clock = new GnomeDesktop.WallClock();
|
||||
this._timezoneChangedId = this._clock.connect('notify::timezone',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
if (this._animation)
|
||||
this._loadAnimation(this._animation.file);
|
||||
}));
|
||||
});
|
||||
|
||||
let loginManager = LoginManager.getLoginManager();
|
||||
this._prepareForSleepId = loginManager.connect('prepare-for-sleep',
|
||||
@ -267,14 +267,14 @@ var Background = new Lang.Class({
|
||||
this._refreshAnimation();
|
||||
});
|
||||
|
||||
this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
|
||||
this.emit('changed');
|
||||
}));
|
||||
this._settingsChangedSignalId = this._settings.connect('changed', () => {
|
||||
this.emit('changed');
|
||||
});
|
||||
|
||||
this._load();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._cancellable.cancel();
|
||||
this._removeAnimationTimeout();
|
||||
|
||||
@ -300,12 +300,12 @@ var Background = new Lang.Class({
|
||||
this._settingsChangedSignalId = 0;
|
||||
},
|
||||
|
||||
updateResolution: function() {
|
||||
updateResolution() {
|
||||
if (this._animation)
|
||||
this._refreshAnimation();
|
||||
},
|
||||
|
||||
_refreshAnimation: function() {
|
||||
_refreshAnimation() {
|
||||
if (!this._animation)
|
||||
return;
|
||||
|
||||
@ -313,20 +313,20 @@ var Background = new Lang.Class({
|
||||
this._updateAnimation();
|
||||
},
|
||||
|
||||
_setLoaded: function() {
|
||||
_setLoaded() {
|
||||
if (this.isLoaded)
|
||||
return;
|
||||
|
||||
this.isLoaded = true;
|
||||
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
this.emit('loaded');
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
|
||||
},
|
||||
|
||||
_loadPattern: function() {
|
||||
_loadPattern() {
|
||||
let colorString, res, color, secondColor;
|
||||
|
||||
colorString = this._settings.get_string(PRIMARY_COLOR_KEY);
|
||||
@ -342,37 +342,37 @@ var Background = new Lang.Class({
|
||||
this.background.set_gradient(shadingType, color, secondColor);
|
||||
},
|
||||
|
||||
_watchFile: function(file) {
|
||||
_watchFile(file) {
|
||||
let key = file.hash();
|
||||
if (this._fileWatches[key])
|
||||
return;
|
||||
|
||||
this._cache.monitorFile(file);
|
||||
let signalId = this._cache.connect('file-changed',
|
||||
Lang.bind(this, function(cache, changedFile) {
|
||||
(cache, changedFile) => {
|
||||
if (changedFile.equal(file)) {
|
||||
let imageCache = Meta.BackgroundImageCache.get_default();
|
||||
imageCache.purge(changedFile);
|
||||
this.emit('changed');
|
||||
}
|
||||
}));
|
||||
});
|
||||
this._fileWatches[key] = signalId;
|
||||
},
|
||||
|
||||
_removeAnimationTimeout: function() {
|
||||
_removeAnimationTimeout() {
|
||||
if (this._updateAnimationTimeoutId) {
|
||||
GLib.source_remove(this._updateAnimationTimeoutId);
|
||||
this._updateAnimationTimeoutId = 0;
|
||||
}
|
||||
},
|
||||
|
||||
_updateAnimation: function() {
|
||||
_updateAnimation() {
|
||||
this._updateAnimationTimeoutId = 0;
|
||||
|
||||
this._animation.update(this._layoutManager.monitors[this._monitorIndex]);
|
||||
let files = this._animation.keyFrameFiles;
|
||||
|
||||
let finish = Lang.bind(this, function() {
|
||||
let finish = () => {
|
||||
this._setLoaded();
|
||||
if (files.length > 1) {
|
||||
this.background.set_blend(files[0], files[1],
|
||||
@ -384,7 +384,7 @@ var Background = new Lang.Class({
|
||||
this.background.set_file(null, this._style);
|
||||
}
|
||||
this._queueUpdateAnimation();
|
||||
});
|
||||
};
|
||||
|
||||
let cache = Meta.BackgroundImageCache.get_default();
|
||||
let numPendingImages = files.length;
|
||||
@ -396,18 +396,17 @@ var Background = new Lang.Class({
|
||||
if (numPendingImages == 0)
|
||||
finish();
|
||||
} else {
|
||||
let id = image.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
image.disconnect(id);
|
||||
numPendingImages--;
|
||||
if (numPendingImages == 0)
|
||||
finish();
|
||||
}));
|
||||
let id = image.connect('loaded', () => {
|
||||
image.disconnect(id);
|
||||
numPendingImages--;
|
||||
if (numPendingImages == 0)
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_queueUpdateAnimation: function() {
|
||||
_queueUpdateAnimation() {
|
||||
if (this._updateAnimationTimeoutId != 0)
|
||||
return;
|
||||
|
||||
@ -428,18 +427,18 @@ var Background = new Lang.Class({
|
||||
|
||||
this._updateAnimationTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
interval,
|
||||
Lang.bind(this, function() {
|
||||
this._updateAnimationTimeoutId = 0;
|
||||
this._updateAnimation();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
() => {
|
||||
this._updateAnimationTimeoutId = 0;
|
||||
this._updateAnimation();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
|
||||
},
|
||||
|
||||
_loadAnimation: function(file) {
|
||||
_loadAnimation(file) {
|
||||
this._cache.getAnimation({ file: file,
|
||||
settingsSchema: this._settings.schema_id,
|
||||
onLoaded: Lang.bind(this, function(animation) {
|
||||
onLoaded: animation => {
|
||||
this._animation = animation;
|
||||
|
||||
if (!this._animation || this._cancellable.is_cancelled()) {
|
||||
@ -449,11 +448,11 @@ var Background = new Lang.Class({
|
||||
|
||||
this._updateAnimation();
|
||||
this._watchFile(file);
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_loadImage: function(file) {
|
||||
_loadImage(file) {
|
||||
this.background.set_file(file, this._style);
|
||||
this._watchFile(file);
|
||||
|
||||
@ -462,22 +461,21 @@ var Background = new Lang.Class({
|
||||
if (image.is_loaded())
|
||||
this._setLoaded();
|
||||
else {
|
||||
let id = image.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
this._setLoaded();
|
||||
image.disconnect(id);
|
||||
}));
|
||||
let id = image.connect('loaded', () => {
|
||||
this._setLoaded();
|
||||
image.disconnect(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_loadFile: function(file) {
|
||||
_loadFile(file) {
|
||||
if (file.get_basename().endsWith('.xml'))
|
||||
this._loadAnimation(file);
|
||||
else
|
||||
this._loadImage(file);
|
||||
},
|
||||
|
||||
_load: function () {
|
||||
_load() {
|
||||
this._cache = getBackgroundCache();
|
||||
|
||||
this._loadPattern();
|
||||
@ -497,7 +495,7 @@ let _systemBackground;
|
||||
var SystemBackground = new Lang.Class({
|
||||
Name: 'SystemBackground',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/noise-texture.png');
|
||||
|
||||
if (_systemBackground == null) {
|
||||
@ -514,18 +512,17 @@ var SystemBackground = new Lang.Class({
|
||||
let image = cache.load(file);
|
||||
if (image.is_loaded()) {
|
||||
image = null;
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
this.emit('loaded');
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] SystemBackground.loaded');
|
||||
} else {
|
||||
let id = image.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
this.emit('loaded');
|
||||
image.disconnect(id);
|
||||
image = null;
|
||||
}));
|
||||
let id = image.connect('loaded', () => {
|
||||
this.emit('loaded');
|
||||
image.disconnect(id);
|
||||
image = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -534,7 +531,7 @@ Signals.addSignalMethods(SystemBackground.prototype);
|
||||
var BackgroundSource = new Lang.Class({
|
||||
Name: 'BackgroundSource',
|
||||
|
||||
_init: function(layoutManager, settingsSchema) {
|
||||
_init(layoutManager, settingsSchema) {
|
||||
// Allow override the background image setting for performance testing
|
||||
this._layoutManager = layoutManager;
|
||||
this._overrideImage = GLib.getenv('SHELL_BACKGROUND_IMAGE');
|
||||
@ -542,10 +539,10 @@ var BackgroundSource = new Lang.Class({
|
||||
this._backgrounds = [];
|
||||
|
||||
this._monitorsChangedId = global.screen.connect('monitors-changed',
|
||||
Lang.bind(this, this._onMonitorsChanged));
|
||||
this._onMonitorsChanged.bind(this));
|
||||
},
|
||||
|
||||
_onMonitorsChanged: function() {
|
||||
_onMonitorsChanged() {
|
||||
for (let monitorIndex in this._backgrounds) {
|
||||
let background = this._backgrounds[monitorIndex];
|
||||
|
||||
@ -559,7 +556,7 @@ var BackgroundSource = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
getBackground: function(monitorIndex) {
|
||||
getBackground(monitorIndex) {
|
||||
let file = null;
|
||||
let style;
|
||||
|
||||
@ -594,11 +591,11 @@ var BackgroundSource = new Lang.Class({
|
||||
style: style
|
||||
});
|
||||
|
||||
background._changedId = background.connect('changed', Lang.bind(this, function() {
|
||||
background._changedId = background.connect('changed', () => {
|
||||
background.disconnect(background._changedId);
|
||||
background.destroy();
|
||||
delete this._backgrounds[monitorIndex];
|
||||
}));
|
||||
});
|
||||
|
||||
this._backgrounds[monitorIndex] = background;
|
||||
}
|
||||
@ -606,7 +603,7 @@ var BackgroundSource = new Lang.Class({
|
||||
return this._backgrounds[monitorIndex];
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
global.screen.disconnect(this._monitorsChangedId);
|
||||
|
||||
for (let monitorIndex in this._backgrounds) {
|
||||
@ -622,7 +619,7 @@ var BackgroundSource = new Lang.Class({
|
||||
var Animation = new Lang.Class({
|
||||
Name: 'Animation',
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { file: null });
|
||||
|
||||
this.file = params.file;
|
||||
@ -632,19 +629,17 @@ var Animation = new Lang.Class({
|
||||
this.loaded = false;
|
||||
},
|
||||
|
||||
load: function(callback) {
|
||||
load(callback) {
|
||||
this._show = new GnomeDesktop.BGSlideShow({ filename: this.file.get_path() });
|
||||
|
||||
this._show.load_async(null,
|
||||
Lang.bind(this,
|
||||
function(object, result) {
|
||||
this.loaded = true;
|
||||
if (callback)
|
||||
callback();
|
||||
}));
|
||||
this._show.load_async(null, (object, result) => {
|
||||
this.loaded = true;
|
||||
if (callback)
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
update: function(monitor) {
|
||||
update(monitor) {
|
||||
this.keyFrameFiles = [];
|
||||
|
||||
if (!this._show)
|
||||
@ -670,7 +665,7 @@ Signals.addSignalMethods(Animation.prototype);
|
||||
var BackgroundManager = new Lang.Class({
|
||||
Name: 'BackgroundManager',
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { container: null,
|
||||
layoutManager: Main.layoutManager,
|
||||
monitorIndex: null,
|
||||
@ -692,7 +687,7 @@ var BackgroundManager = new Lang.Class({
|
||||
this._newBackgroundActor = null;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
let cache = getBackgroundCache();
|
||||
cache.releaseBackgroundSource(this._settingsSchema);
|
||||
this._backgroundSource = null;
|
||||
@ -708,7 +703,7 @@ var BackgroundManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_swapBackgroundActor: function() {
|
||||
_swapBackgroundActor() {
|
||||
let oldBackgroundActor = this.backgroundActor;
|
||||
this.backgroundActor = this._newBackgroundActor;
|
||||
this._newBackgroundActor = null;
|
||||
@ -718,14 +713,14 @@ var BackgroundManager = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: FADE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
oldBackgroundActor.background.run_dispose();
|
||||
oldBackgroundActor.destroy();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_updateBackgroundActor: function() {
|
||||
_updateBackgroundActor() {
|
||||
if (this._newBackgroundActor) {
|
||||
/* Skip displaying existing background queued for load */
|
||||
this._newBackgroundActor.destroy();
|
||||
@ -745,17 +740,16 @@ var BackgroundManager = new Lang.Class({
|
||||
this._swapBackgroundActor();
|
||||
} else {
|
||||
newBackgroundActor.loadedSignalId = background.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
background.disconnect(newBackgroundActor.loadedSignalId);
|
||||
newBackgroundActor.loadedSignalId = 0;
|
||||
|
||||
this._swapBackgroundActor();
|
||||
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_createBackgroundActor: function() {
|
||||
_createBackgroundActor() {
|
||||
let background = this._backgroundSource.getBackground(this._monitorIndex);
|
||||
let backgroundActor = new Meta.BackgroundActor({ meta_screen: global.screen,
|
||||
monitor: this._monitorIndex,
|
||||
@ -775,19 +769,19 @@ var BackgroundManager = new Lang.Class({
|
||||
backgroundActor.lower_bottom();
|
||||
}
|
||||
|
||||
let changeSignalId = background.connect('changed', Lang.bind(this, function() {
|
||||
let changeSignalId = background.connect('changed', () => {
|
||||
background.disconnect(changeSignalId);
|
||||
changeSignalId = null;
|
||||
this._updateBackgroundActor();
|
||||
}));
|
||||
});
|
||||
|
||||
backgroundActor.connect('destroy', Lang.bind(this, function() {
|
||||
backgroundActor.connect('destroy', () => {
|
||||
if (changeSignalId)
|
||||
background.disconnect(changeSignalId);
|
||||
|
||||
if (backgroundActor.loadedSignalId)
|
||||
background.disconnect(backgroundActor.loadedSignalId);
|
||||
}));
|
||||
});
|
||||
|
||||
return backgroundActor;
|
||||
},
|
||||
|
@ -13,7 +13,7 @@ var BackgroundMenu = new Lang.Class({
|
||||
Name: 'BackgroundMenu',
|
||||
Extends: PopupMenu.PopupMenu,
|
||||
|
||||
_init: function(layoutManager) {
|
||||
_init(layoutManager) {
|
||||
this.parent(layoutManager.dummyCursor, 0, St.Side.TOP);
|
||||
|
||||
this.addSettingsAction(_("Change Background…"), 'gnome-background-panel.desktop');
|
||||
@ -40,7 +40,7 @@ function addBackgroundMenu(actor, layoutManager) {
|
||||
}
|
||||
|
||||
let clickAction = new Clutter.ClickAction();
|
||||
clickAction.connect('long-press', function(action, actor, state) {
|
||||
clickAction.connect('long-press', (action, actor, state) => {
|
||||
if (state == Clutter.LongPressState.QUERY)
|
||||
return ((action.get_button() == 0 ||
|
||||
action.get_button() == 1) &&
|
||||
@ -52,7 +52,7 @@ function addBackgroundMenu(actor, layoutManager) {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
clickAction.connect('clicked', function(action) {
|
||||
clickAction.connect('clicked', action => {
|
||||
if (action.get_button() == 3) {
|
||||
let [x, y] = action.get_coords();
|
||||
openMenu(x, y);
|
||||
@ -60,11 +60,11 @@ function addBackgroundMenu(actor, layoutManager) {
|
||||
});
|
||||
actor.add_action(clickAction);
|
||||
|
||||
let grabOpBeginId = global.display.connect('grab-op-begin', function () {
|
||||
let grabOpBeginId = global.display.connect('grab-op-begin', () => {
|
||||
clickAction.release();
|
||||
});
|
||||
|
||||
actor.connect('destroy', function() {
|
||||
actor.connect('destroy', () => {
|
||||
actor._backgroundMenu.destroy();
|
||||
actor._backgroundMenu = null;
|
||||
actor._backgroundManager = null;
|
||||
|
@ -35,7 +35,7 @@ var POPUP_ANIMATION_TIME = 0.15;
|
||||
var BoxPointer = new Lang.Class({
|
||||
Name: 'BoxPointer',
|
||||
|
||||
_init: function(arrowSide, binProperties) {
|
||||
_init(arrowSide, binProperties) {
|
||||
this._arrowSide = arrowSide;
|
||||
this._userArrowSide = arrowSide;
|
||||
this._arrowOrigin = 0;
|
||||
@ -44,13 +44,13 @@ var BoxPointer = new Lang.Class({
|
||||
y_fill: true });
|
||||
this._container = new Shell.GenericContainer();
|
||||
this.actor.set_child(this._container);
|
||||
this._container.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||
this._container.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||
this._container.connect('allocate', Lang.bind(this, this._allocate));
|
||||
this._container.connect('get-preferred-width', this._getPreferredWidth.bind(this));
|
||||
this._container.connect('get-preferred-height', this._getPreferredHeight.bind(this));
|
||||
this._container.connect('allocate', this._allocate.bind(this));
|
||||
this.bin = new St.Bin(binProperties);
|
||||
this._container.add_actor(this.bin);
|
||||
this._border = new St.DrawingArea();
|
||||
this._border.connect('repaint', Lang.bind(this, this._drawBorder));
|
||||
this._border.connect('repaint', this._drawBorder.bind(this));
|
||||
this._container.add_actor(this._border);
|
||||
this.bin.raise(this._border);
|
||||
this._xOffset = 0;
|
||||
@ -66,20 +66,20 @@ var BoxPointer = new Lang.Class({
|
||||
return this._arrowSide;
|
||||
},
|
||||
|
||||
_muteInput: function() {
|
||||
_muteInput() {
|
||||
if (this._capturedEventId == 0)
|
||||
this._capturedEventId = this.actor.connect('captured-event',
|
||||
function() { return Clutter.EVENT_STOP; });
|
||||
() => Clutter.EVENT_STOP);
|
||||
},
|
||||
|
||||
_unmuteInput: function() {
|
||||
_unmuteInput() {
|
||||
if (this._capturedEventId != 0) {
|
||||
this.actor.disconnect(this._capturedEventId);
|
||||
this._capturedEventId = 0;
|
||||
}
|
||||
},
|
||||
|
||||
show: function(animate, onComplete) {
|
||||
show(animate, onComplete) {
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
let rise = themeNode.get_length('-arrow-rise');
|
||||
let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
|
||||
@ -112,15 +112,15 @@ var BoxPointer = new Lang.Class({
|
||||
xOffset: 0,
|
||||
yOffset: 0,
|
||||
transition: 'linear',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this._unmuteInput();
|
||||
if (onComplete)
|
||||
onComplete();
|
||||
}),
|
||||
},
|
||||
time: animationTime });
|
||||
},
|
||||
|
||||
hide: function(animate, onComplete) {
|
||||
hide(animate, onComplete) {
|
||||
if (!this.actor.visible)
|
||||
return;
|
||||
|
||||
@ -156,18 +156,18 @@ var BoxPointer = new Lang.Class({
|
||||
yOffset: yOffset,
|
||||
transition: 'linear',
|
||||
time: animationTime,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
this.opacity = 0;
|
||||
this.xOffset = 0;
|
||||
this.yOffset = 0;
|
||||
if (onComplete)
|
||||
onComplete();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_adjustAllocationForArrow: function(isWidth, alloc) {
|
||||
_adjustAllocationForArrow(isWidth, alloc) {
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||
alloc.min_size += borderWidth * 2;
|
||||
@ -180,14 +180,14 @@ var BoxPointer = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
||||
_getPreferredWidth(actor, forHeight, alloc) {
|
||||
let [minInternalSize, natInternalSize] = this.bin.get_preferred_width(forHeight);
|
||||
alloc.min_size = minInternalSize;
|
||||
alloc.natural_size = natInternalSize;
|
||||
this._adjustAllocationForArrow(true, alloc);
|
||||
},
|
||||
|
||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
||||
_getPreferredHeight(actor, forWidth, alloc) {
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||
let [minSize, naturalSize] = this.bin.get_preferred_height(forWidth - 2 * borderWidth);
|
||||
@ -196,7 +196,7 @@ var BoxPointer = new Lang.Class({
|
||||
this._adjustAllocationForArrow(false, alloc);
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
_allocate(actor, box, flags) {
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||
let rise = themeNode.get_length('-arrow-rise');
|
||||
@ -236,7 +236,7 @@ var BoxPointer = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_drawBorder: function(area) {
|
||||
_drawBorder(area) {
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
|
||||
if (this._arrowActor) {
|
||||
@ -418,7 +418,7 @@ var BoxPointer = new Lang.Class({
|
||||
cr.$dispose();
|
||||
},
|
||||
|
||||
setPosition: function(sourceActor, alignment) {
|
||||
setPosition(sourceActor, alignment) {
|
||||
// We need to show it now to force an allocation,
|
||||
// so that we can query the correct size.
|
||||
this.actor.show();
|
||||
@ -430,7 +430,7 @@ var BoxPointer = new Lang.Class({
|
||||
this._updateFlip();
|
||||
},
|
||||
|
||||
setSourceAlignment: function(alignment) {
|
||||
setSourceAlignment(alignment) {
|
||||
this._sourceAlignment = alignment;
|
||||
|
||||
if (!this._sourceActor)
|
||||
@ -439,7 +439,7 @@ var BoxPointer = new Lang.Class({
|
||||
this.setPosition(this._sourceActor, this._arrowAlignment);
|
||||
},
|
||||
|
||||
_reposition: function() {
|
||||
_reposition() {
|
||||
let sourceActor = this._sourceActor;
|
||||
let alignment = this._arrowAlignment;
|
||||
|
||||
@ -556,7 +556,7 @@ var BoxPointer = new Lang.Class({
|
||||
// @origin: Coordinate specifying middle of the arrow, along
|
||||
// the Y axis for St.Side.LEFT, St.Side.RIGHT from the top and X axis from
|
||||
// the left for St.Side.TOP and St.Side.BOTTOM.
|
||||
setArrowOrigin: function(origin) {
|
||||
setArrowOrigin(origin) {
|
||||
if (this._arrowOrigin != origin) {
|
||||
this._arrowOrigin = origin;
|
||||
this._border.queue_repaint();
|
||||
@ -566,14 +566,14 @@ var BoxPointer = new Lang.Class({
|
||||
// @actor: an actor relative to which the arrow is positioned.
|
||||
// Differently from setPosition, this will not move the boxpointer itself,
|
||||
// on the arrow
|
||||
setArrowActor: function(actor) {
|
||||
setArrowActor(actor) {
|
||||
if (this._arrowActor != actor) {
|
||||
this._arrowActor = actor;
|
||||
this._border.queue_repaint();
|
||||
}
|
||||
},
|
||||
|
||||
_shiftActor : function() {
|
||||
_shiftActor() {
|
||||
// Since the position of the BoxPointer depends on the allocated size
|
||||
// of the BoxPointer and the position of the source actor, trying
|
||||
// to position the BoxPointer via the x/y properties will result in
|
||||
@ -584,7 +584,7 @@ var BoxPointer = new Lang.Class({
|
||||
-(this._yPosition + this._yOffset));
|
||||
},
|
||||
|
||||
_calculateArrowSide: function(arrowSide) {
|
||||
_calculateArrowSide(arrowSide) {
|
||||
let sourceAllocation = Shell.util_get_transformed_allocation(this._sourceActor);
|
||||
let [minWidth, minHeight, boxWidth, boxHeight] = this._container.get_preferred_size();
|
||||
let monitorActor = this.sourceActor;
|
||||
@ -618,15 +618,15 @@ var BoxPointer = new Lang.Class({
|
||||
return arrowSide;
|
||||
},
|
||||
|
||||
_updateFlip: function() {
|
||||
_updateFlip() {
|
||||
let arrowSide = this._calculateArrowSide(this._userArrowSide);
|
||||
if (this._arrowSide != arrowSide) {
|
||||
this._arrowSide = arrowSide;
|
||||
this._reposition();
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
this._container.queue_relayout();
|
||||
return false;
|
||||
}));
|
||||
});
|
||||
|
||||
this.emit('arrow-side-changed');
|
||||
}
|
||||
@ -658,18 +658,18 @@ var BoxPointer = new Lang.Class({
|
||||
return this.actor.opacity;
|
||||
},
|
||||
|
||||
updateArrowSide: function(side) {
|
||||
updateArrowSide(side) {
|
||||
this._arrowSide = side;
|
||||
this._border.queue_repaint();
|
||||
|
||||
this.emit('arrow-side-changed');
|
||||
},
|
||||
|
||||
getPadding: function(side) {
|
||||
getPadding(side) {
|
||||
return this.bin.get_theme_node().get_padding(side);
|
||||
},
|
||||
|
||||
getArrowHeight: function() {
|
||||
getArrowHeight() {
|
||||
return this.actor.get_theme_node().get_length('-arrow-rise');
|
||||
}
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ var ELLIPSIS_CHAR = '\u2026';
|
||||
|
||||
var MESSAGE_ICON_SIZE = -1; // pick up from CSS
|
||||
|
||||
var NC_ = function(context, str) { return context + '\u0004' + str; };
|
||||
var NC_ = (context, str) => context + '\u0004' + str;
|
||||
|
||||
function sameYear(dateA, dateB) {
|
||||
return (dateA.getYear() == dateB.getYear());
|
||||
@ -92,7 +92,7 @@ function _getCalendarDayAbbreviation(dayNumber) {
|
||||
var CalendarEvent = new Lang.Class({
|
||||
Name: 'CalendarEvent',
|
||||
|
||||
_init: function(id, date, end, summary, allDay) {
|
||||
_init(id, date, end, summary, allDay) {
|
||||
this.id = id;
|
||||
this.date = date;
|
||||
this.end = end;
|
||||
@ -108,27 +108,27 @@ var CalendarEvent = new Lang.Class({
|
||||
var EmptyEventSource = new Lang.Class({
|
||||
Name: 'EmptyEventSource',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.isLoading = false;
|
||||
this.isDummy = true;
|
||||
this.hasCalendars = false;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
},
|
||||
|
||||
ignoreEvent: function(event) {
|
||||
ignoreEvent(event) {
|
||||
},
|
||||
|
||||
requestRange: function(begin, end) {
|
||||
requestRange(begin, end) {
|
||||
},
|
||||
|
||||
getEvents: function(begin, end) {
|
||||
getEvents(begin, end) {
|
||||
let result = [];
|
||||
return result;
|
||||
},
|
||||
|
||||
hasEvents: function(day) {
|
||||
hasEvents(day) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@ -179,7 +179,7 @@ function _dateIntervalsOverlap(a0, a1, b0, b1)
|
||||
var DBusEventSource = new Lang.Class({
|
||||
Name: 'DBusEventSource',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._resetCache();
|
||||
this.isLoading = false;
|
||||
this.isDummy = false;
|
||||
@ -188,14 +188,13 @@ var DBusEventSource = new Lang.Class({
|
||||
|
||||
let savedState = global.get_persistent_state('as', 'ignored_events');
|
||||
if (savedState)
|
||||
savedState.deep_unpack().forEach(Lang.bind(this,
|
||||
function(eventId) {
|
||||
this._ignoredEvents.set(eventId, true);
|
||||
}));
|
||||
savedState.deep_unpack().forEach(eventId => {
|
||||
this._ignoredEvents.set(eventId, true);
|
||||
});
|
||||
|
||||
this._initialized = false;
|
||||
this._dbusProxy = new CalendarServer();
|
||||
this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(object, result) {
|
||||
this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, (object, result) => {
|
||||
let loaded = false;
|
||||
|
||||
try {
|
||||
@ -216,28 +215,28 @@ var DBusEventSource = new Lang.Class({
|
||||
}
|
||||
}
|
||||
|
||||
this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
|
||||
this._dbusProxy.connectSignal('Changed', this._onChanged.bind(this));
|
||||
|
||||
this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
|
||||
this._dbusProxy.connect('notify::g-name-owner', () => {
|
||||
if (this._dbusProxy.g_name_owner)
|
||||
this._onNameAppeared();
|
||||
else
|
||||
this._onNameVanished();
|
||||
}));
|
||||
});
|
||||
|
||||
this._dbusProxy.connect('g-properties-changed', Lang.bind(this, function() {
|
||||
this._dbusProxy.connect('g-properties-changed', () => {
|
||||
this.emit('notify::has-calendars');
|
||||
}));
|
||||
});
|
||||
|
||||
this._initialized = loaded;
|
||||
if (loaded) {
|
||||
this.emit('notify::has-calendars');
|
||||
this._onNameAppeared();
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._dbusProxy.run_dispose();
|
||||
},
|
||||
|
||||
@ -248,28 +247,28 @@ var DBusEventSource = new Lang.Class({
|
||||
return false;
|
||||
},
|
||||
|
||||
_resetCache: function() {
|
||||
_resetCache() {
|
||||
this._events = [];
|
||||
this._lastRequestBegin = null;
|
||||
this._lastRequestEnd = null;
|
||||
},
|
||||
|
||||
_onNameAppeared: function(owner) {
|
||||
_onNameAppeared(owner) {
|
||||
this._initialized = true;
|
||||
this._resetCache();
|
||||
this._loadEvents(true);
|
||||
},
|
||||
|
||||
_onNameVanished: function(oldOwner) {
|
||||
_onNameVanished(oldOwner) {
|
||||
this._resetCache();
|
||||
this.emit('changed');
|
||||
},
|
||||
|
||||
_onChanged: function() {
|
||||
_onChanged() {
|
||||
this._loadEvents(false);
|
||||
},
|
||||
|
||||
_onEventsReceived: function(results, error) {
|
||||
_onEventsReceived(results, error) {
|
||||
let newEvents = [];
|
||||
let appointments = results ? results[0] : null;
|
||||
if (appointments != null) {
|
||||
@ -283,9 +282,7 @@ var DBusEventSource = new Lang.Class({
|
||||
let event = new CalendarEvent(id, date, end, summary, allDay);
|
||||
newEvents.push(event);
|
||||
}
|
||||
newEvents.sort(function(event1, event2) {
|
||||
return event1.date.getTime() - event2.date.getTime();
|
||||
});
|
||||
newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
|
||||
}
|
||||
|
||||
this._events = newEvents;
|
||||
@ -293,7 +290,7 @@ var DBusEventSource = new Lang.Class({
|
||||
this.emit('changed');
|
||||
},
|
||||
|
||||
_loadEvents: function(forceReload) {
|
||||
_loadEvents(forceReload) {
|
||||
// Ignore while loading
|
||||
if (!this._initialized)
|
||||
return;
|
||||
@ -302,12 +299,12 @@ var DBusEventSource = new Lang.Class({
|
||||
this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
|
||||
this._curRequestEnd.getTime() / 1000,
|
||||
forceReload,
|
||||
Lang.bind(this, this._onEventsReceived),
|
||||
this._onEventsReceived.bind(this),
|
||||
Gio.DBusCallFlags.NONE);
|
||||
}
|
||||
},
|
||||
|
||||
ignoreEvent: function(event) {
|
||||
ignoreEvent(event) {
|
||||
if (this._ignoredEvents.get(event.id))
|
||||
return;
|
||||
|
||||
@ -317,7 +314,7 @@ var DBusEventSource = new Lang.Class({
|
||||
this.emit('changed');
|
||||
},
|
||||
|
||||
requestRange: function(begin, end) {
|
||||
requestRange(begin, end) {
|
||||
if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
|
||||
this.isLoading = true;
|
||||
this._lastRequestBegin = begin;
|
||||
@ -328,7 +325,7 @@ var DBusEventSource = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
getEvents: function(begin, end) {
|
||||
getEvents(begin, end) {
|
||||
let result = [];
|
||||
for(let n = 0; n < this._events.length; n++) {
|
||||
let event = this._events[n];
|
||||
@ -340,7 +337,7 @@ var DBusEventSource = new Lang.Class({
|
||||
result.push(event);
|
||||
}
|
||||
}
|
||||
result.sort(function(event1, event2) {
|
||||
result.sort((event1, event2) => {
|
||||
// sort events by end time on ending day
|
||||
let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
|
||||
let d2 = event2.date < begin && event2.end <= end ? event2.end : event2.date;
|
||||
@ -349,7 +346,7 @@ var DBusEventSource = new Lang.Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
hasEvents: function(day) {
|
||||
hasEvents(day) {
|
||||
let dayBegin = _getBeginningOfDay(day);
|
||||
let dayEnd = _getEndOfDay(day);
|
||||
|
||||
@ -366,11 +363,11 @@ Signals.addSignalMethods(DBusEventSource.prototype);
|
||||
var Calendar = new Lang.Class({
|
||||
Name: 'Calendar',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._weekStart = Shell.util_get_week_start();
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
|
||||
|
||||
this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, Lang.bind(this, this._onSettingsChange));
|
||||
this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, this._onSettingsChange.bind(this));
|
||||
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
|
||||
|
||||
/**
|
||||
@ -401,25 +398,25 @@ var Calendar = new Lang.Class({
|
||||
reactive: true });
|
||||
|
||||
this.actor.connect('scroll-event',
|
||||
Lang.bind(this, this._onScroll));
|
||||
this._onScroll.bind(this));
|
||||
|
||||
this._buildHeader ();
|
||||
},
|
||||
|
||||
// @eventSource: is an object implementing the EventSource API, e.g. the
|
||||
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
|
||||
setEventSource: function(eventSource) {
|
||||
setEventSource(eventSource) {
|
||||
this._eventSource = eventSource;
|
||||
this._eventSource.connect('changed', Lang.bind(this, function() {
|
||||
this._eventSource.connect('changed', () => {
|
||||
this._rebuildCalendar();
|
||||
this._update();
|
||||
}));
|
||||
});
|
||||
this._rebuildCalendar();
|
||||
this._update();
|
||||
},
|
||||
|
||||
// Sets the calendar to show a specific date
|
||||
setDate: function(date) {
|
||||
setDate(date) {
|
||||
if (sameDay(date, this._selectedDate))
|
||||
return;
|
||||
|
||||
@ -428,14 +425,14 @@ var Calendar = new Lang.Class({
|
||||
this.emit('selected-date-changed', new Date(this._selectedDate));
|
||||
},
|
||||
|
||||
updateTimeZone: function() {
|
||||
updateTimeZone() {
|
||||
// The calendar need to be rebuilt after a time zone update because
|
||||
// the date might have changed.
|
||||
this._rebuildCalendar();
|
||||
this._update();
|
||||
},
|
||||
|
||||
_buildHeader: function() {
|
||||
_buildHeader() {
|
||||
let layout = this.actor.layout_manager;
|
||||
let offsetCols = this._useWeekdate ? 1 : 0;
|
||||
this.actor.destroy_all_children();
|
||||
@ -449,7 +446,7 @@ var Calendar = new Lang.Class({
|
||||
accessible_name: _("Previous month"),
|
||||
can_focus: true });
|
||||
this._topBox.add(this._backButton);
|
||||
this._backButton.connect('clicked', Lang.bind(this, this._onPrevMonthButtonClicked));
|
||||
this._backButton.connect('clicked', this._onPrevMonthButtonClicked.bind(this));
|
||||
|
||||
this._monthLabel = new St.Label({style_class: 'calendar-month-label',
|
||||
can_focus: true });
|
||||
@ -459,7 +456,7 @@ var Calendar = new Lang.Class({
|
||||
accessible_name: _("Next month"),
|
||||
can_focus: true });
|
||||
this._topBox.add(this._forwardButton);
|
||||
this._forwardButton.connect('clicked', Lang.bind(this, this._onNextMonthButtonClicked));
|
||||
this._forwardButton.connect('clicked', this._onNextMonthButtonClicked.bind(this));
|
||||
|
||||
// Add weekday labels...
|
||||
//
|
||||
@ -490,7 +487,7 @@ var Calendar = new Lang.Class({
|
||||
this._firstDayIndex = this.actor.get_n_children();
|
||||
},
|
||||
|
||||
_onScroll : function(actor, event) {
|
||||
_onScroll(actor, event) {
|
||||
switch (event.get_scroll_direction()) {
|
||||
case Clutter.ScrollDirection.UP:
|
||||
case Clutter.ScrollDirection.LEFT:
|
||||
@ -504,7 +501,7 @@ var Calendar = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_onPrevMonthButtonClicked: function() {
|
||||
_onPrevMonthButtonClicked() {
|
||||
let newDate = new Date(this._selectedDate);
|
||||
let oldMonth = newDate.getMonth();
|
||||
if (oldMonth == 0) {
|
||||
@ -528,7 +525,7 @@ var Calendar = new Lang.Class({
|
||||
this.setDate(newDate);
|
||||
},
|
||||
|
||||
_onNextMonthButtonClicked: function() {
|
||||
_onNextMonthButtonClicked() {
|
||||
let newDate = new Date(this._selectedDate);
|
||||
let oldMonth = newDate.getMonth();
|
||||
if (oldMonth == 11) {
|
||||
@ -552,14 +549,14 @@ var Calendar = new Lang.Class({
|
||||
this.setDate(newDate);
|
||||
},
|
||||
|
||||
_onSettingsChange: function() {
|
||||
_onSettingsChange() {
|
||||
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
|
||||
this._buildHeader();
|
||||
this._rebuildCalendar();
|
||||
this._update();
|
||||
},
|
||||
|
||||
_rebuildCalendar: function() {
|
||||
_rebuildCalendar() {
|
||||
let now = new Date();
|
||||
|
||||
// Remove everything but the topBox and the weekday labels
|
||||
@ -617,11 +614,11 @@ var Calendar = new Lang.Class({
|
||||
button.reactive = false;
|
||||
|
||||
button._date = new Date(iter);
|
||||
button.connect('clicked', Lang.bind(this, function() {
|
||||
button.connect('clicked', () => {
|
||||
this._shouldDateGrabFocus = true;
|
||||
this.setDate(button._date);
|
||||
this._shouldDateGrabFocus = false;
|
||||
}));
|
||||
});
|
||||
|
||||
let hasEvents = this._eventSource.hasEvents(iter);
|
||||
let styleClass = 'calendar-day-base calendar-day';
|
||||
@ -680,7 +677,7 @@ var Calendar = new Lang.Class({
|
||||
this._eventSource.requestRange(beginDate, iter);
|
||||
},
|
||||
|
||||
_update: function() {
|
||||
_update() {
|
||||
let now = new Date();
|
||||
|
||||
if (sameYear(this._selectedDate, now))
|
||||
@ -691,7 +688,7 @@ var Calendar = new Lang.Class({
|
||||
if (!this._calendarBegin || !sameMonth(this._selectedDate, this._calendarBegin) || !sameDay(now, this._markedAsToday))
|
||||
this._rebuildCalendar();
|
||||
|
||||
this._buttons.forEach(Lang.bind(this, function(button) {
|
||||
this._buttons.forEach(button => {
|
||||
if (sameDay(button._date, this._selectedDate)) {
|
||||
button.add_style_pseudo_class('selected');
|
||||
if (this._shouldDateGrabFocus)
|
||||
@ -699,7 +696,7 @@ var Calendar = new Lang.Class({
|
||||
}
|
||||
else
|
||||
button.remove_style_pseudo_class('selected');
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(Calendar.prototype);
|
||||
@ -708,7 +705,7 @@ var EventMessage = new Lang.Class({
|
||||
Name: 'EventMessage',
|
||||
Extends: MessageList.Message,
|
||||
|
||||
_init: function(event, date) {
|
||||
_init(event, date) {
|
||||
this._event = event;
|
||||
this._date = date;
|
||||
|
||||
@ -723,7 +720,7 @@ var EventMessage = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_formatEventTime: function() {
|
||||
_formatEventTime() {
|
||||
let periodBegin = _getBeginningOfDay(this._date);
|
||||
let periodEnd = _getEndOfDay(this._date);
|
||||
let allDay = (this._event.allDay || (this._event.date <= periodBegin &&
|
||||
@ -756,7 +753,7 @@ var EventMessage = new Lang.Class({
|
||||
return title;
|
||||
},
|
||||
|
||||
canClose: function() {
|
||||
canClose() {
|
||||
return isToday(this._date);
|
||||
}
|
||||
});
|
||||
@ -765,7 +762,7 @@ var NotificationMessage = new Lang.Class({
|
||||
Name: 'NotificationMessage',
|
||||
Extends: MessageList.Message,
|
||||
|
||||
_init: function(notification) {
|
||||
_init(notification) {
|
||||
this.notification = notification;
|
||||
|
||||
this.parent(notification.title, notification.bannerBodyText);
|
||||
@ -773,21 +770,19 @@ var NotificationMessage = new Lang.Class({
|
||||
|
||||
this.setIcon(this._getIcon());
|
||||
|
||||
this.connect('close', Lang.bind(this,
|
||||
function() {
|
||||
this._closed = true;
|
||||
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
|
||||
}));
|
||||
this._destroyId = notification.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
if (!this._closed)
|
||||
this.close();
|
||||
}));
|
||||
this.connect('close', () => {
|
||||
this._closed = true;
|
||||
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
|
||||
});
|
||||
this._destroyId = notification.connect('destroy', () => {
|
||||
if (!this._closed)
|
||||
this.close();
|
||||
});
|
||||
this._updatedId = notification.connect('updated',
|
||||
Lang.bind(this, this._onUpdated));
|
||||
this._onUpdated.bind(this));
|
||||
},
|
||||
|
||||
_getIcon: function() {
|
||||
_getIcon() {
|
||||
if (this.notification.gicon)
|
||||
return new St.Icon({ gicon: this.notification.gicon,
|
||||
icon_size: MESSAGE_ICON_SIZE });
|
||||
@ -795,18 +790,18 @@ var NotificationMessage = new Lang.Class({
|
||||
return this.notification.source.createIcon(MESSAGE_ICON_SIZE);
|
||||
},
|
||||
|
||||
_onUpdated: function(n, clear) {
|
||||
_onUpdated(n, clear) {
|
||||
this.setIcon(this._getIcon());
|
||||
this.setTitle(n.title);
|
||||
this.setBody(n.bannerBodyText);
|
||||
this.setUseBodyMarkup(n.bannerBodyMarkup);
|
||||
},
|
||||
|
||||
_onClicked: function() {
|
||||
_onClicked() {
|
||||
this.notification.activate();
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
if (this._updatedId)
|
||||
this.notification.disconnect(this._updatedId);
|
||||
this._updatedId = 0;
|
||||
@ -821,9 +816,9 @@ var EventsSection = new Lang.Class({
|
||||
Name: 'EventsSection',
|
||||
Extends: MessageList.MessageListSection,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||
this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents));
|
||||
this._desktopSettings.connect('changed', this._reloadEvents.bind(this));
|
||||
this._eventSource = new EmptyEventSource();
|
||||
|
||||
this.parent();
|
||||
@ -834,28 +829,28 @@ var EventsSection = new Lang.Class({
|
||||
can_focus: true });
|
||||
this.actor.insert_child_below(this._title, null);
|
||||
|
||||
this._title.connect('clicked', Lang.bind(this, this._onTitleClicked));
|
||||
this._title.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn));
|
||||
this._title.connect('clicked', this._onTitleClicked.bind(this));
|
||||
this._title.connect('key-focus-in', this._onKeyFocusIn.bind(this));
|
||||
|
||||
Shell.AppSystem.get_default().connect('installed-changed',
|
||||
Lang.bind(this, this._appInstalledChanged));
|
||||
this._appInstalledChanged.bind(this));
|
||||
this._appInstalledChanged();
|
||||
},
|
||||
|
||||
_ignoreEvent: function(event) {
|
||||
_ignoreEvent(event) {
|
||||
this._eventSource.ignoreEvent(event);
|
||||
},
|
||||
|
||||
setEventSource: function(eventSource) {
|
||||
setEventSource(eventSource) {
|
||||
this._eventSource = eventSource;
|
||||
this._eventSource.connect('changed', Lang.bind(this, this._reloadEvents));
|
||||
this._eventSource.connect('changed', this._reloadEvents.bind(this));
|
||||
},
|
||||
|
||||
get allowed() {
|
||||
return Main.sessionMode.showCalendarEvents;
|
||||
},
|
||||
|
||||
_updateTitle: function() {
|
||||
_updateTitle() {
|
||||
this._title.visible = !isToday(this._date);
|
||||
|
||||
if (!this._title.visible)
|
||||
@ -874,7 +869,7 @@ var EventsSection = new Lang.Class({
|
||||
this._title.label = this._date.toLocaleFormat(dayFormat);
|
||||
},
|
||||
|
||||
_reloadEvents: function() {
|
||||
_reloadEvents() {
|
||||
if (this._eventSource.isLoading)
|
||||
return;
|
||||
|
||||
@ -890,9 +885,9 @@ var EventsSection = new Lang.Class({
|
||||
let event = events[i];
|
||||
|
||||
let message = new EventMessage(event, this._date);
|
||||
message.connect('close', Lang.bind(this, function() {
|
||||
message.connect('close', () => {
|
||||
this._ignoreEvent(event);
|
||||
}));
|
||||
});
|
||||
this.addMessage(message, false);
|
||||
}
|
||||
|
||||
@ -900,19 +895,19 @@ var EventsSection = new Lang.Class({
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_appInstalledChanged: function() {
|
||||
_appInstalledChanged() {
|
||||
this._calendarApp = undefined;
|
||||
this._title.reactive = (this._getCalendarApp() != null);
|
||||
},
|
||||
|
||||
_getCalendarApp: function() {
|
||||
_getCalendarApp() {
|
||||
if (this._calendarApp !== undefined)
|
||||
return this._calendarApp;
|
||||
|
||||
let apps = Gio.AppInfo.get_recommended_for_type('text/calendar');
|
||||
if (apps && (apps.length > 0)) {
|
||||
let app = Gio.AppInfo.get_default_for_type('text/calendar', false);
|
||||
let defaultInRecommended = apps.some(function(a) { return a.equal(app); });
|
||||
let defaultInRecommended = apps.some(a => a.equal(app));
|
||||
this._calendarApp = defaultInRecommended ? app : apps[0];
|
||||
} else {
|
||||
this._calendarApp = null;
|
||||
@ -920,7 +915,7 @@ var EventsSection = new Lang.Class({
|
||||
return this._calendarApp;
|
||||
},
|
||||
|
||||
_onTitleClicked: function() {
|
||||
_onTitleClicked() {
|
||||
Main.overview.hide();
|
||||
Main.panel.closeCalendar();
|
||||
|
||||
@ -930,17 +925,17 @@ var EventsSection = new Lang.Class({
|
||||
app.launch([], global.create_app_launch_context(0, -1));
|
||||
},
|
||||
|
||||
setDate: function(date) {
|
||||
setDate(date) {
|
||||
this.parent(date);
|
||||
this._updateTitle();
|
||||
this._reloadEvents();
|
||||
},
|
||||
|
||||
_shouldShow: function() {
|
||||
_shouldShow() {
|
||||
return !this.empty || !isToday(this._date);
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
if (this._reloading)
|
||||
return;
|
||||
|
||||
@ -952,18 +947,18 @@ var NotificationSection = new Lang.Class({
|
||||
Name: 'NotificationSection',
|
||||
Extends: MessageList.MessageListSection,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
this._sources = new Map();
|
||||
this._nUrgent = 0;
|
||||
|
||||
Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
|
||||
Main.messageTray.getSources().forEach(Lang.bind(this, function(source) {
|
||||
Main.messageTray.connect('source-added', this._sourceAdded.bind(this));
|
||||
Main.messageTray.getSources().forEach(source => {
|
||||
this._sourceAdded(Main.messageTray, source);
|
||||
}));
|
||||
});
|
||||
|
||||
this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
|
||||
this.actor.connect('notify::mapped', this._onMapped.bind(this));
|
||||
},
|
||||
|
||||
get allowed() {
|
||||
@ -971,7 +966,7 @@ var NotificationSection = new Lang.Class({
|
||||
!Main.sessionMode.isGreeter;
|
||||
},
|
||||
|
||||
_createTimeLabel: function(datetime) {
|
||||
_createTimeLabel(datetime) {
|
||||
let label = new St.Label({ style_class: 'event-time',
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
y_align: Clutter.ActorAlign.END });
|
||||
@ -982,39 +977,37 @@ var NotificationSection = new Lang.Class({
|
||||
return label;
|
||||
},
|
||||
|
||||
_sourceAdded: function(tray, source) {
|
||||
_sourceAdded(tray, source) {
|
||||
let obj = {
|
||||
destroyId: 0,
|
||||
notificationAddedId: 0,
|
||||
};
|
||||
|
||||
obj.destroyId = source.connect('destroy', Lang.bind(this, function(source) {
|
||||
obj.destroyId = source.connect('destroy', source => {
|
||||
this._onSourceDestroy(source, obj);
|
||||
}));
|
||||
});
|
||||
obj.notificationAddedId = source.connect('notification-added',
|
||||
Lang.bind(this, this._onNotificationAdded));
|
||||
this._onNotificationAdded.bind(this));
|
||||
|
||||
this._sources.set(source, obj);
|
||||
},
|
||||
|
||||
_onNotificationAdded: function(source, notification) {
|
||||
_onNotificationAdded(source, notification) {
|
||||
let message = new NotificationMessage(notification);
|
||||
message.setSecondaryActor(this._createTimeLabel(notification.datetime));
|
||||
|
||||
let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL;
|
||||
|
||||
let updatedId = notification.connect('updated', Lang.bind(this,
|
||||
function() {
|
||||
message.setSecondaryActor(this._createTimeLabel(notification.datetime));
|
||||
this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped);
|
||||
}));
|
||||
let destroyId = notification.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
notification.disconnect(destroyId);
|
||||
notification.disconnect(updatedId);
|
||||
if (isUrgent)
|
||||
this._nUrgent--;
|
||||
}));
|
||||
let updatedId = notification.connect('updated', () => {
|
||||
message.setSecondaryActor(this._createTimeLabel(notification.datetime));
|
||||
this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped);
|
||||
});
|
||||
let destroyId = notification.connect('destroy', () => {
|
||||
notification.disconnect(destroyId);
|
||||
notification.disconnect(updatedId);
|
||||
if (isUrgent)
|
||||
this._nUrgent--;
|
||||
});
|
||||
|
||||
if (isUrgent) {
|
||||
// Keep track of urgent notifications to keep them on top
|
||||
@ -1030,14 +1023,14 @@ var NotificationSection = new Lang.Class({
|
||||
this.addMessageAtIndex(message, index, this.actor.mapped);
|
||||
},
|
||||
|
||||
_onSourceDestroy: function(source, obj) {
|
||||
_onSourceDestroy(source, obj) {
|
||||
source.disconnect(obj.destroyId);
|
||||
source.disconnect(obj.notificationAddedId);
|
||||
|
||||
this._sources.delete(source);
|
||||
},
|
||||
|
||||
_onMapped: function() {
|
||||
_onMapped() {
|
||||
if (!this.actor.mapped)
|
||||
return;
|
||||
|
||||
@ -1046,7 +1039,7 @@ var NotificationSection = new Lang.Class({
|
||||
message.notification.acknowledged = true;
|
||||
},
|
||||
|
||||
_shouldShow: function() {
|
||||
_shouldShow() {
|
||||
return !this.empty && isToday(this._date);
|
||||
}
|
||||
});
|
||||
@ -1054,7 +1047,7 @@ var NotificationSection = new Lang.Class({
|
||||
var Placeholder = new Lang.Class({
|
||||
Name: 'Placeholder',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.BoxLayout({ style_class: 'message-list-placeholder',
|
||||
vertical: true });
|
||||
|
||||
@ -1074,14 +1067,14 @@ var Placeholder = new Lang.Class({
|
||||
this._sync();
|
||||
},
|
||||
|
||||
setDate: function(date) {
|
||||
setDate(date) {
|
||||
if (sameDay(this._date, date))
|
||||
return;
|
||||
this._date = date;
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
let today = isToday(this._date);
|
||||
if (today && this._icon.gicon == this._todayIcon)
|
||||
return;
|
||||
@ -1101,7 +1094,7 @@ var Placeholder = new Lang.Class({
|
||||
var CalendarMessageList = new Lang.Class({
|
||||
Name: 'CalendarMessageList',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.Widget({ style_class: 'message-list',
|
||||
layout_manager: new Clutter.BinLayout(),
|
||||
x_expand: true, y_expand: true });
|
||||
@ -1146,10 +1139,10 @@ var CalendarMessageList = new Lang.Class({
|
||||
this._eventsSection = new EventsSection();
|
||||
this._addSection(this._eventsSection);
|
||||
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sync));
|
||||
Main.sessionMode.connect('updated', this._sync.bind(this));
|
||||
},
|
||||
|
||||
_addSection: function(section) {
|
||||
_addSection(section) {
|
||||
let obj = {
|
||||
destroyId: 0,
|
||||
visibleId: 0,
|
||||
@ -1157,25 +1150,24 @@ var CalendarMessageList = new Lang.Class({
|
||||
canClearChangedId: 0,
|
||||
keyFocusId: 0
|
||||
};
|
||||
obj.destroyId = section.actor.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this._removeSection(section);
|
||||
}));
|
||||
obj.destroyId = section.actor.connect('destroy', () => {
|
||||
this._removeSection(section);
|
||||
});
|
||||
obj.visibleId = section.actor.connect('notify::visible',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync.bind(this));
|
||||
obj.emptyChangedId = section.connect('empty-changed',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync.bind(this));
|
||||
obj.canClearChangedId = section.connect('can-clear-changed',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync.bind(this));
|
||||
obj.keyFocusId = section.connect('key-focus-in',
|
||||
Lang.bind(this, this._onKeyFocusIn));
|
||||
this._onKeyFocusIn.bind(this));
|
||||
|
||||
this._sections.set(section, obj);
|
||||
this._sectionList.add_actor(section.actor);
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_removeSection: function(section) {
|
||||
_removeSection(section) {
|
||||
let obj = this._sections.get(section);
|
||||
section.actor.disconnect(obj.destroyId);
|
||||
section.actor.disconnect(obj.visibleId);
|
||||
@ -1188,36 +1180,30 @@ var CalendarMessageList = new Lang.Class({
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_onKeyFocusIn: function(section, actor) {
|
||||
_onKeyFocusIn(section, actor) {
|
||||
Util.ensureActorVisibleInScrollView(this._scrollView, actor);
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
let sections = [...this._sections.keys()];
|
||||
let visible = sections.some(function(s) {
|
||||
return s.allowed;
|
||||
});
|
||||
let visible = sections.some(s => s.allowed);
|
||||
this.actor.visible = visible;
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
let empty = sections.every(function(s) {
|
||||
return s.empty || !s.actor.visible;
|
||||
});
|
||||
let empty = sections.every(s => s.empty || !s.actor.visible);
|
||||
this._placeholder.actor.visible = empty;
|
||||
this._clearButton.visible = !empty;
|
||||
|
||||
let canClear = sections.some(function(s) {
|
||||
return s.canClear && s.actor.visible;
|
||||
});
|
||||
let canClear = sections.some(s => s.canClear && s.actor.visible);
|
||||
this._clearButton.reactive = canClear;
|
||||
},
|
||||
|
||||
setEventSource: function(eventSource) {
|
||||
setEventSource(eventSource) {
|
||||
this._eventsSection.setEventSource(eventSource);
|
||||
},
|
||||
|
||||
setDate: function(date) {
|
||||
setDate(date) {
|
||||
for (let section of this._sections.keys())
|
||||
section.setDate(date);
|
||||
this._placeholder.setDate(date);
|
||||
|
@ -7,7 +7,7 @@ const Lang = imports.lang;
|
||||
var CheckBox = new Lang.Class({
|
||||
Name: 'CheckBox',
|
||||
|
||||
_init: function(label) {
|
||||
_init(label) {
|
||||
let container = new St.BoxLayout();
|
||||
this.actor = new St.Button({ style_class: 'check-box',
|
||||
child: container,
|
||||
@ -30,11 +30,11 @@ var CheckBox = new Lang.Class({
|
||||
this.setLabel(label);
|
||||
},
|
||||
|
||||
setLabel: function(label) {
|
||||
setLabel(label) {
|
||||
this._label.set_text(label);
|
||||
},
|
||||
|
||||
getLabelActor: function() {
|
||||
getLabelActor() {
|
||||
return this._label;
|
||||
}
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ var CloseDialog = new Lang.Class({
|
||||
'window': GObject.ParamSpec.override('window', Meta.CloseDialog)
|
||||
},
|
||||
|
||||
_init: function (window) {
|
||||
_init(window) {
|
||||
this.parent();
|
||||
this._window = window;
|
||||
this._dialog = null;
|
||||
@ -36,7 +36,7 @@ var CloseDialog = new Lang.Class({
|
||||
this._window = window;
|
||||
},
|
||||
|
||||
_createDialogContent: function () {
|
||||
_createDialogContent() {
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
let windowApp = tracker.get_window_app(this._window);
|
||||
|
||||
@ -48,7 +48,7 @@ var CloseDialog = new Lang.Class({
|
||||
return new Dialog.MessageDialogContent({ icon, title, subtitle });
|
||||
},
|
||||
|
||||
_initDialog: function () {
|
||||
_initDialog() {
|
||||
if (this._dialog)
|
||||
return;
|
||||
|
||||
@ -59,16 +59,16 @@ var CloseDialog = new Lang.Class({
|
||||
|
||||
this._dialog.addContent(this._createDialogContent());
|
||||
this._dialog.addButton({ label: _('Force Quit'),
|
||||
action: Lang.bind(this, this._onClose),
|
||||
action: this._onClose.bind(this),
|
||||
default: true });
|
||||
this._dialog.addButton({ label: _('Wait'),
|
||||
action: Lang.bind(this, this._onWait),
|
||||
action: this._onWait.bind(this),
|
||||
key: Clutter.Escape });
|
||||
|
||||
global.focus_manager.add_group(this._dialog);
|
||||
},
|
||||
|
||||
_addWindowEffect: function () {
|
||||
_addWindowEffect() {
|
||||
// We set the effect on the surface actor, so the dialog itself
|
||||
// (which is a child of the MetaWindowActor) does not get the
|
||||
// effect applied itself.
|
||||
@ -79,21 +79,21 @@ var CloseDialog = new Lang.Class({
|
||||
surfaceActor.add_effect_with_name("gnome-shell-frozen-window", effect);
|
||||
},
|
||||
|
||||
_removeWindowEffect: function () {
|
||||
_removeWindowEffect() {
|
||||
let windowActor = this._window.get_compositor_private();
|
||||
let surfaceActor = windowActor.get_first_child();
|
||||
surfaceActor.remove_effect_by_name("gnome-shell-frozen-window");
|
||||
},
|
||||
|
||||
_onWait: function () {
|
||||
_onWait() {
|
||||
this.response(Meta.CloseDialogResponse.WAIT);
|
||||
},
|
||||
|
||||
_onClose: function () {
|
||||
_onClose() {
|
||||
this.response(Meta.CloseDialogResponse.FORCE_CLOSE);
|
||||
},
|
||||
|
||||
vfunc_show: function () {
|
||||
vfunc_show() {
|
||||
if (this._dialog != null)
|
||||
return;
|
||||
|
||||
@ -107,13 +107,13 @@ var CloseDialog = new Lang.Class({
|
||||
{ scale_y: 1,
|
||||
transition: 'linear',
|
||||
time: DIALOG_TRANSITION_TIME,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
Main.layoutManager.trackChrome(this._dialog, { affectsInputRegion: true });
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
vfunc_hide: function () {
|
||||
vfunc_hide() {
|
||||
if (this._dialog == null)
|
||||
return;
|
||||
|
||||
@ -125,13 +125,13 @@ var CloseDialog = new Lang.Class({
|
||||
{ scale_y: 0,
|
||||
transition: 'linear',
|
||||
time: DIALOG_TRANSITION_TIME,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
dialog.destroy();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
vfunc_focus: function () {
|
||||
vfunc_focus() {
|
||||
if (this._dialog)
|
||||
this._dialog.grab_key_focus();
|
||||
}
|
||||
|
@ -5,38 +5,38 @@ const Main = imports.ui.main;
|
||||
var ComponentManager = new Lang.Class({
|
||||
Name: 'ComponentManager',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._allComponents = {};
|
||||
this._enabledComponents = [];
|
||||
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
||||
this._sessionUpdated();
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
_sessionUpdated() {
|
||||
let newEnabledComponents = Main.sessionMode.components;
|
||||
|
||||
newEnabledComponents.filter(Lang.bind(this, function(name) {
|
||||
return this._enabledComponents.indexOf(name) == -1;
|
||||
})).forEach(Lang.bind(this, function(name) {
|
||||
newEnabledComponents.filter(
|
||||
name => this._enabledComponents.indexOf(name) == -1
|
||||
).forEach(name => {
|
||||
this._enableComponent(name);
|
||||
}));
|
||||
});
|
||||
|
||||
this._enabledComponents.filter(Lang.bind(this, function(name) {
|
||||
return newEnabledComponents.indexOf(name) == -1;
|
||||
})).forEach(Lang.bind(this, function(name) {
|
||||
this._enabledComponents.filter(
|
||||
name => newEnabledComponents.indexOf(name) == -1
|
||||
).forEach(name => {
|
||||
this._disableComponent(name);
|
||||
}));
|
||||
});
|
||||
|
||||
this._enabledComponents = newEnabledComponents;
|
||||
},
|
||||
|
||||
_importComponent: function(name) {
|
||||
_importComponent(name) {
|
||||
let module = imports.ui.components[name];
|
||||
return module.Component;
|
||||
},
|
||||
|
||||
_ensureComponent: function(name) {
|
||||
_ensureComponent(name) {
|
||||
let component = this._allComponents[name];
|
||||
if (component)
|
||||
return component;
|
||||
@ -50,13 +50,13 @@ var ComponentManager = new Lang.Class({
|
||||
return component;
|
||||
},
|
||||
|
||||
_enableComponent: function(name) {
|
||||
_enableComponent(name) {
|
||||
let component = this._ensureComponent(name);
|
||||
if (component)
|
||||
component.enable();
|
||||
},
|
||||
|
||||
_disableComponent: function(name) {
|
||||
_disableComponent(name) {
|
||||
let component = this._allComponents[name];
|
||||
if (component == null)
|
||||
return;
|
||||
|
@ -22,31 +22,31 @@ var AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
|
||||
var AutomountManager = new Lang.Class({
|
||||
Name: 'AutomountManager',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||
this._volumeQueue = [];
|
||||
this._session = new GnomeSession.SessionManager();
|
||||
this._session.connectSignal('InhibitorAdded',
|
||||
Lang.bind(this, this._InhibitorsChanged));
|
||||
this._InhibitorsChanged.bind(this));
|
||||
this._session.connectSignal('InhibitorRemoved',
|
||||
Lang.bind(this, this._InhibitorsChanged));
|
||||
this._InhibitorsChanged.bind(this));
|
||||
this._inhibited = false;
|
||||
|
||||
this._volumeMonitor = Gio.VolumeMonitor.get();
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
this._volumeAddedId = this._volumeMonitor.connect('volume-added', Lang.bind(this, this._onVolumeAdded));
|
||||
this._volumeRemovedId = this._volumeMonitor.connect('volume-removed', Lang.bind(this, this._onVolumeRemoved));
|
||||
this._driveConnectedId = this._volumeMonitor.connect('drive-connected', Lang.bind(this, this._onDriveConnected));
|
||||
this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected', Lang.bind(this, this._onDriveDisconnected));
|
||||
this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', Lang.bind(this, this._onDriveEjectButton));
|
||||
enable() {
|
||||
this._volumeAddedId = this._volumeMonitor.connect('volume-added', this._onVolumeAdded.bind(this));
|
||||
this._volumeRemovedId = this._volumeMonitor.connect('volume-removed', this._onVolumeRemoved.bind(this));
|
||||
this._driveConnectedId = this._volumeMonitor.connect('drive-connected', this._onDriveConnected.bind(this));
|
||||
this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected', this._onDriveDisconnected.bind(this));
|
||||
this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', this._onDriveEjectButton.bind(this));
|
||||
|
||||
this._mountAllId = Mainloop.idle_add(Lang.bind(this, this._startupMountAll));
|
||||
this._mountAllId = Mainloop.idle_add(this._startupMountAll.bind(this));
|
||||
GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
disable() {
|
||||
this._volumeMonitor.disconnect(this._volumeAddedId);
|
||||
this._volumeMonitor.disconnect(this._volumeRemovedId);
|
||||
this._volumeMonitor.disconnect(this._driveConnectedId);
|
||||
@ -59,29 +59,28 @@ var AutomountManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_InhibitorsChanged: function(object, senderName, [inhibtor]) {
|
||||
_InhibitorsChanged(object, senderName, [inhibtor]) {
|
||||
this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
|
||||
Lang.bind(this,
|
||||
function(result, error) {
|
||||
if (!error) {
|
||||
this._inhibited = result[0];
|
||||
}
|
||||
}));
|
||||
(result, error) => {
|
||||
if (!error) {
|
||||
this._inhibited = result[0];
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_startupMountAll: function() {
|
||||
_startupMountAll() {
|
||||
let volumes = this._volumeMonitor.get_volumes();
|
||||
volumes.forEach(Lang.bind(this, function(volume) {
|
||||
volumes.forEach(volume => {
|
||||
this._checkAndMountVolume(volume, { checkSession: false,
|
||||
useMountOp: false,
|
||||
allowAutorun: false });
|
||||
}));
|
||||
});
|
||||
|
||||
this._mountAllId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
_onDriveConnected: function() {
|
||||
_onDriveConnected() {
|
||||
// if we're not in the current ConsoleKit session,
|
||||
// or screensaver is active, don't play sounds
|
||||
if (!this._session.SessionIsActive)
|
||||
@ -92,7 +91,7 @@ var AutomountManager = new Lang.Class({
|
||||
null);
|
||||
},
|
||||
|
||||
_onDriveDisconnected: function() {
|
||||
_onDriveDisconnected() {
|
||||
// if we're not in the current ConsoleKit session,
|
||||
// or screensaver is active, don't play sounds
|
||||
if (!this._session.SessionIsActive)
|
||||
@ -103,7 +102,7 @@ var AutomountManager = new Lang.Class({
|
||||
null);
|
||||
},
|
||||
|
||||
_onDriveEjectButton: function(monitor, drive) {
|
||||
_onDriveEjectButton(monitor, drive) {
|
||||
// TODO: this code path is not tested, as the GVfs volume monitor
|
||||
// doesn't emit this signal just yet.
|
||||
if (!this._session.SessionIsActive)
|
||||
@ -114,31 +113,31 @@ var AutomountManager = new Lang.Class({
|
||||
if (drive.can_stop()) {
|
||||
drive.stop
|
||||
(Gio.MountUnmountFlags.FORCE, null, null,
|
||||
Lang.bind(this, function(drive, res) {
|
||||
(drive, res) => {
|
||||
try {
|
||||
drive.stop_finish(res);
|
||||
} catch (e) {
|
||||
log("Unable to stop the drive after drive-eject-button " + e.toString());
|
||||
}
|
||||
}));
|
||||
});
|
||||
} else if (drive.can_eject()) {
|
||||
drive.eject_with_operation
|
||||
(Gio.MountUnmountFlags.FORCE, null, null,
|
||||
Lang.bind(this, function(drive, res) {
|
||||
(drive, res) => {
|
||||
try {
|
||||
drive.eject_with_operation_finish(res);
|
||||
} catch (e) {
|
||||
log("Unable to eject the drive after drive-eject-button " + e.toString());
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_onVolumeAdded: function(monitor, volume) {
|
||||
_onVolumeAdded(monitor, volume) {
|
||||
this._checkAndMountVolume(volume);
|
||||
},
|
||||
|
||||
_checkAndMountVolume: function(volume, params) {
|
||||
_checkAndMountVolume(volume, params) {
|
||||
params = Params.parse(params, { checkSession: true,
|
||||
useMountOp: true,
|
||||
allowAutorun: true });
|
||||
@ -178,7 +177,7 @@ var AutomountManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_mountVolume: function(volume, operation, allowAutorun) {
|
||||
_mountVolume(volume, operation, allowAutorun) {
|
||||
if (allowAutorun)
|
||||
this._allowAutorun(volume);
|
||||
|
||||
@ -186,10 +185,10 @@ var AutomountManager = new Lang.Class({
|
||||
volume._operation = operation;
|
||||
|
||||
volume.mount(0, mountOp, null,
|
||||
Lang.bind(this, this._onVolumeMounted));
|
||||
this._onVolumeMounted.bind(this));
|
||||
},
|
||||
|
||||
_onVolumeMounted: function(volume, res) {
|
||||
_onVolumeMounted(volume, res) {
|
||||
this._allowAutorunExpire(volume);
|
||||
|
||||
try {
|
||||
@ -210,14 +209,12 @@ var AutomountManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onVolumeRemoved: function(monitor, volume) {
|
||||
_onVolumeRemoved(monitor, volume) {
|
||||
this._volumeQueue =
|
||||
this._volumeQueue.filter(function(element) {
|
||||
return (element != volume);
|
||||
});
|
||||
this._volumeQueue.filter(element => (element != volume));
|
||||
},
|
||||
|
||||
_reaskPassword: function(volume) {
|
||||
_reaskPassword(volume) {
|
||||
let existingDialog = volume._operation ? volume._operation.borrowDialog() : null;
|
||||
let operation =
|
||||
new ShellMountOperation.ShellMountOperation(volume,
|
||||
@ -225,17 +222,17 @@ var AutomountManager = new Lang.Class({
|
||||
this._mountVolume(volume, operation);
|
||||
},
|
||||
|
||||
_closeOperation: function(volume) {
|
||||
_closeOperation(volume) {
|
||||
if (volume._operation)
|
||||
volume._operation.close();
|
||||
},
|
||||
|
||||
_allowAutorun: function(volume) {
|
||||
_allowAutorun(volume) {
|
||||
volume.allowAutorun = true;
|
||||
},
|
||||
|
||||
_allowAutorunExpire: function(volume) {
|
||||
let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, function() {
|
||||
_allowAutorunExpire(volume) {
|
||||
let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
|
||||
volume.allowAutorun = false;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
|
@ -93,26 +93,25 @@ function HotplugSniffer() {
|
||||
var ContentTypeDiscoverer = new Lang.Class({
|
||||
Name: 'ContentTypeDiscoverer',
|
||||
|
||||
_init: function(callback) {
|
||||
_init(callback) {
|
||||
this._callback = callback;
|
||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||
},
|
||||
|
||||
guessContentTypes: function(mount) {
|
||||
guessContentTypes(mount) {
|
||||
let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN);
|
||||
let shouldScan = autorunEnabled && !isMountNonLocal(mount);
|
||||
|
||||
if (shouldScan) {
|
||||
// guess mount's content types using GIO
|
||||
mount.guess_content_type(false, null,
|
||||
Lang.bind(this,
|
||||
this._onContentTypeGuessed));
|
||||
this._onContentTypeGuessed.bind(this));
|
||||
} else {
|
||||
this._emitCallback(mount, []);
|
||||
}
|
||||
},
|
||||
|
||||
_onContentTypeGuessed: function(mount, res) {
|
||||
_onContentTypeGuessed(mount, res) {
|
||||
let contentTypes = [];
|
||||
|
||||
try {
|
||||
@ -129,23 +128,23 @@ var ContentTypeDiscoverer = new Lang.Class({
|
||||
|
||||
let hotplugSniffer = new HotplugSniffer();
|
||||
hotplugSniffer.SniffURIRemote(root.get_uri(),
|
||||
Lang.bind(this, function([contentTypes]) {
|
||||
([contentTypes]) => {
|
||||
this._emitCallback(mount, contentTypes);
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_emitCallback: function(mount, contentTypes) {
|
||||
_emitCallback(mount, contentTypes) {
|
||||
if (!contentTypes)
|
||||
contentTypes = [];
|
||||
|
||||
// we're not interested in win32 software content types here
|
||||
contentTypes = contentTypes.filter(function(type) {
|
||||
return (type != 'x-content/win32-software');
|
||||
});
|
||||
contentTypes = contentTypes.filter(
|
||||
type => (type != 'x-content/win32-software')
|
||||
);
|
||||
|
||||
let apps = [];
|
||||
contentTypes.forEach(function(type) {
|
||||
contentTypes.forEach(type => {
|
||||
let app = Gio.app_info_get_default_for_type(type, false);
|
||||
|
||||
if (app)
|
||||
@ -162,36 +161,36 @@ var ContentTypeDiscoverer = new Lang.Class({
|
||||
var AutorunManager = new Lang.Class({
|
||||
Name: 'AutorunManager',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._session = new GnomeSession.SessionManager();
|
||||
this._volumeMonitor = Gio.VolumeMonitor.get();
|
||||
|
||||
this._dispatcher = new AutorunDispatcher(this);
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
this._mountAddedId = this._volumeMonitor.connect('mount-added', Lang.bind(this, this._onMountAdded));
|
||||
this._mountRemovedId = this._volumeMonitor.connect('mount-removed', Lang.bind(this, this._onMountRemoved));
|
||||
enable() {
|
||||
this._mountAddedId = this._volumeMonitor.connect('mount-added', this._onMountAdded.bind(this));
|
||||
this._mountRemovedId = this._volumeMonitor.connect('mount-removed', this._onMountRemoved.bind(this));
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
disable() {
|
||||
this._volumeMonitor.disconnect(this._mountAddedId);
|
||||
this._volumeMonitor.disconnect(this._mountRemovedId);
|
||||
},
|
||||
|
||||
_onMountAdded: function(monitor, mount) {
|
||||
_onMountAdded(monitor, mount) {
|
||||
// don't do anything if our session is not the currently
|
||||
// active one
|
||||
if (!this._session.SessionIsActive)
|
||||
return;
|
||||
|
||||
let discoverer = new ContentTypeDiscoverer(Lang.bind(this, function(mount, apps, contentTypes) {
|
||||
let discoverer = new ContentTypeDiscoverer((mount, apps, contentTypes) => {
|
||||
this._dispatcher.addMount(mount, apps, contentTypes);
|
||||
}));
|
||||
});
|
||||
discoverer.guessContentTypes(mount);
|
||||
},
|
||||
|
||||
_onMountRemoved: function(monitor, mount) {
|
||||
_onMountRemoved(monitor, mount) {
|
||||
this._dispatcher.removeMount(mount);
|
||||
}
|
||||
});
|
||||
@ -199,13 +198,13 @@ var AutorunManager = new Lang.Class({
|
||||
var AutorunDispatcher = new Lang.Class({
|
||||
Name: 'AutorunDispatcher',
|
||||
|
||||
_init: function(manager) {
|
||||
_init(manager) {
|
||||
this._manager = manager;
|
||||
this._sources = [];
|
||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||
},
|
||||
|
||||
_getAutorunSettingForType: function(contentType) {
|
||||
_getAutorunSettingForType(contentType) {
|
||||
let runApp = this._settings.get_strv(SETTING_START_APP);
|
||||
if (runApp.indexOf(contentType) != -1)
|
||||
return AutorunSetting.RUN;
|
||||
@ -221,11 +220,8 @@ var AutorunDispatcher = new Lang.Class({
|
||||
return AutorunSetting.ASK;
|
||||
},
|
||||
|
||||
_getSourceForMount: function(mount) {
|
||||
let filtered =
|
||||
this._sources.filter(function (source) {
|
||||
return (source.mount == mount);
|
||||
});
|
||||
_getSourceForMount(mount) {
|
||||
let filtered = this._sources.filter(source => (source.mount == mount));
|
||||
|
||||
// we always make sure not to add two sources for the same
|
||||
// mount in addMount(), so it's safe to assume filtered.length
|
||||
@ -236,7 +232,7 @@ var AutorunDispatcher = new Lang.Class({
|
||||
return null;
|
||||
},
|
||||
|
||||
_addSource: function(mount, apps) {
|
||||
_addSource(mount, apps) {
|
||||
// if we already have a source showing for this
|
||||
// mount, return
|
||||
if (this._getSourceForMount(mount))
|
||||
@ -246,7 +242,7 @@ var AutorunDispatcher = new Lang.Class({
|
||||
this._sources.push(new AutorunSource(this._manager, mount, apps));
|
||||
},
|
||||
|
||||
addMount: function(mount, apps, contentTypes) {
|
||||
addMount(mount, apps, contentTypes) {
|
||||
// if autorun is disabled globally, return
|
||||
if (this._settings.get_boolean(SETTING_DISABLE_AUTORUN))
|
||||
return;
|
||||
@ -284,7 +280,7 @@ var AutorunDispatcher = new Lang.Class({
|
||||
this._addSource(mount, apps);
|
||||
},
|
||||
|
||||
removeMount: function(mount) {
|
||||
removeMount(mount) {
|
||||
let source = this._getSourceForMount(mount);
|
||||
|
||||
// if we aren't tracking this mount, don't do anything
|
||||
@ -300,7 +296,7 @@ var AutorunSource = new Lang.Class({
|
||||
Name: 'AutorunSource',
|
||||
Extends: MessageTray.Source,
|
||||
|
||||
_init: function(manager, mount, apps) {
|
||||
_init(manager, mount, apps) {
|
||||
this._manager = manager;
|
||||
this.mount = mount;
|
||||
this.apps = apps;
|
||||
@ -314,11 +310,11 @@ var AutorunSource = new Lang.Class({
|
||||
this.notify(this._notification);
|
||||
},
|
||||
|
||||
getIcon: function() {
|
||||
getIcon() {
|
||||
return this.mount.get_icon();
|
||||
},
|
||||
|
||||
_createPolicy: function() {
|
||||
_createPolicy() {
|
||||
return new MessageTray.NotificationApplicationPolicy('org.gnome.Nautilus');
|
||||
}
|
||||
});
|
||||
@ -327,27 +323,27 @@ var AutorunNotification = new Lang.Class({
|
||||
Name: 'AutorunNotification',
|
||||
Extends: MessageTray.Notification,
|
||||
|
||||
_init: function(manager, source) {
|
||||
_init(manager, source) {
|
||||
this.parent(source, source.title);
|
||||
|
||||
this._manager = manager;
|
||||
this._mount = source.mount;
|
||||
},
|
||||
|
||||
createBanner: function() {
|
||||
createBanner() {
|
||||
let banner = new MessageTray.NotificationBanner(this);
|
||||
|
||||
this.source.apps.forEach(Lang.bind(this, function (app) {
|
||||
this.source.apps.forEach(app => {
|
||||
let actor = this._buttonForApp(app);
|
||||
|
||||
if (actor)
|
||||
banner.addButton(actor);
|
||||
}));
|
||||
});
|
||||
|
||||
return banner;
|
||||
},
|
||||
|
||||
_buttonForApp: function(app) {
|
||||
_buttonForApp(app) {
|
||||
let box = new St.BoxLayout();
|
||||
let icon = new St.Icon({ gicon: app.get_icon(),
|
||||
style_class: 'hotplug-notification-item-icon' });
|
||||
@ -366,15 +362,15 @@ var AutorunNotification = new Lang.Class({
|
||||
button_mask: St.ButtonMask.ONE,
|
||||
style_class: 'hotplug-notification-item button' });
|
||||
|
||||
button.connect('clicked', Lang.bind(this, function() {
|
||||
button.connect('clicked', () => {
|
||||
startAppForMount(app, this._mount);
|
||||
this.destroy();
|
||||
}));
|
||||
});
|
||||
|
||||
return button;
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
activate() {
|
||||
this.parent();
|
||||
|
||||
let app = Gio.app_info_get_default_for_type('inode/directory', false);
|
||||
|
@ -24,13 +24,13 @@ var KeyringDialog = new Lang.Class({
|
||||
Name: 'KeyringDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent({ styleClass: 'prompt-dialog' });
|
||||
|
||||
this.prompt = new Shell.KeyringPrompt();
|
||||
this.prompt.connect('show-password', Lang.bind(this, this._onShowPassword));
|
||||
this.prompt.connect('show-confirm', Lang.bind(this, this._onShowConfirm));
|
||||
this.prompt.connect('prompt-close', Lang.bind(this, this._onHidePrompt));
|
||||
this.prompt.connect('show-password', this._onShowPassword.bind(this));
|
||||
this.prompt.connect('show-confirm', this._onShowConfirm.bind(this));
|
||||
this.prompt.connect('prompt-close', this._onHidePrompt.bind(this));
|
||||
|
||||
let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' });
|
||||
this._content = new Dialog.MessageDialogContent({ icon });
|
||||
@ -55,17 +55,17 @@ var KeyringDialog = new Lang.Class({
|
||||
this._controlTable = null;
|
||||
|
||||
this._cancelButton = this.addButton({ label: '',
|
||||
action: Lang.bind(this, this._onCancelButton),
|
||||
action: this._onCancelButton.bind(this),
|
||||
key: Clutter.Escape });
|
||||
this._continueButton = this.addButton({ label: '',
|
||||
action: Lang.bind(this, this._onContinueButton),
|
||||
action: this._onContinueButton.bind(this),
|
||||
default: true });
|
||||
|
||||
this.prompt.bind_property('cancel-label', this._cancelButton, 'label', GObject.BindingFlags.SYNC_CREATE);
|
||||
this.prompt.bind_property('continue-label', this._continueButton, 'label', GObject.BindingFlags.SYNC_CREATE);
|
||||
},
|
||||
|
||||
_setWorking: function(working) {
|
||||
_setWorking(working) {
|
||||
if (!this._workSpinner)
|
||||
return;
|
||||
|
||||
@ -84,7 +84,7 @@ var KeyringDialog = new Lang.Class({
|
||||
time: WORK_SPINNER_ANIMATION_TIME,
|
||||
transition: 'linear',
|
||||
onCompleteScope: this,
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
if (this._workSpinner)
|
||||
this._workSpinner.stop();
|
||||
}
|
||||
@ -92,7 +92,7 @@ var KeyringDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_buildControlTable: function() {
|
||||
_buildControlTable() {
|
||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||
let table = new St.Widget({ style_class: 'keyring-dialog-control-table',
|
||||
layout_manager: layout });
|
||||
@ -112,7 +112,7 @@ var KeyringDialog = new Lang.Class({
|
||||
x_expand: true });
|
||||
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
|
||||
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
|
||||
this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onPasswordActivate));
|
||||
this._passwordEntry.clutter_text.connect('activate', this._onPasswordActivate.bind(this));
|
||||
|
||||
let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
|
||||
this._workSpinner = new Animation.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE);
|
||||
@ -144,7 +144,7 @@ var KeyringDialog = new Lang.Class({
|
||||
x_expand: true });
|
||||
this._confirmEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
|
||||
ShellEntry.addContextMenu(this._confirmEntry, { isPassword: true });
|
||||
this._confirmEntry.clutter_text.connect('activate', Lang.bind(this, this._onConfirmActivate));
|
||||
this._confirmEntry.clutter_text.connect('activate', this._onConfirmActivate.bind(this));
|
||||
if (rtl) {
|
||||
layout.attach(this._confirmEntry, 0, row, 1, 1);
|
||||
layout.attach(label, 1, row, 1, 1);
|
||||
@ -185,7 +185,7 @@ var KeyringDialog = new Lang.Class({
|
||||
this._content.messageBox.add(table, { x_fill: true, y_fill: true });
|
||||
},
|
||||
|
||||
_updateSensitivity: function(sensitive) {
|
||||
_updateSensitivity(sensitive) {
|
||||
if (this._passwordEntry) {
|
||||
this._passwordEntry.reactive = sensitive;
|
||||
this._passwordEntry.clutter_text.editable = sensitive;
|
||||
@ -201,7 +201,7 @@ var KeyringDialog = new Lang.Class({
|
||||
this._setWorking(!sensitive);
|
||||
},
|
||||
|
||||
_ensureOpen: function() {
|
||||
_ensureOpen() {
|
||||
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
||||
// already open - it just returns true without side-effects
|
||||
if (this.open())
|
||||
@ -219,41 +219,41 @@ var KeyringDialog = new Lang.Class({
|
||||
return false;
|
||||
},
|
||||
|
||||
_onShowPassword: function(prompt) {
|
||||
_onShowPassword(prompt) {
|
||||
this._buildControlTable();
|
||||
this._ensureOpen();
|
||||
this._updateSensitivity(true);
|
||||
this._passwordEntry.grab_key_focus();
|
||||
},
|
||||
|
||||
_onShowConfirm: function(prompt) {
|
||||
_onShowConfirm(prompt) {
|
||||
this._buildControlTable();
|
||||
this._ensureOpen();
|
||||
this._updateSensitivity(true);
|
||||
this._continueButton.grab_key_focus();
|
||||
},
|
||||
|
||||
_onHidePrompt: function(prompt) {
|
||||
_onHidePrompt(prompt) {
|
||||
this.close();
|
||||
},
|
||||
|
||||
_onPasswordActivate: function() {
|
||||
_onPasswordActivate() {
|
||||
if (this.prompt.confirm_visible)
|
||||
this._confirmEntry.grab_key_focus();
|
||||
else
|
||||
this._onContinueButton();
|
||||
},
|
||||
|
||||
_onConfirmActivate: function() {
|
||||
_onConfirmActivate() {
|
||||
this._onContinueButton();
|
||||
},
|
||||
|
||||
_onContinueButton: function() {
|
||||
_onContinueButton() {
|
||||
this._updateSensitivity(false);
|
||||
this.prompt.complete();
|
||||
},
|
||||
|
||||
_onCancelButton: function() {
|
||||
_onCancelButton() {
|
||||
this.prompt.cancel();
|
||||
},
|
||||
});
|
||||
@ -261,15 +261,13 @@ var KeyringDialog = new Lang.Class({
|
||||
var KeyringDummyDialog = new Lang.Class({
|
||||
Name: 'KeyringDummyDialog',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.prompt = new Shell.KeyringPrompt();
|
||||
this.prompt.connect('show-password',
|
||||
Lang.bind(this, this._cancelPrompt));
|
||||
this.prompt.connect('show-confirm', Lang.bind(this,
|
||||
this._cancelPrompt));
|
||||
this.prompt.connect('show-password', this._cancelPrompt.bind(this));
|
||||
this.prompt.connect('show-confirm', this._cancelPrompt.bind(this));
|
||||
},
|
||||
|
||||
_cancelPrompt: function() {
|
||||
_cancelPrompt() {
|
||||
this.prompt.cancel();
|
||||
}
|
||||
});
|
||||
@ -277,22 +275,21 @@ var KeyringDummyDialog = new Lang.Class({
|
||||
var KeyringPrompter = new Lang.Class({
|
||||
Name: 'KeyringPrompter',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._prompter = new Gcr.SystemPrompter();
|
||||
this._prompter.connect('new-prompt', Lang.bind(this,
|
||||
function() {
|
||||
let dialog = this._enabled ? new KeyringDialog()
|
||||
: new KeyringDummyDialog();
|
||||
this._currentPrompt = dialog.prompt;
|
||||
return this._currentPrompt;
|
||||
}));
|
||||
this._prompter.connect('new-prompt', () => {
|
||||
let dialog = this._enabled ? new KeyringDialog()
|
||||
: new KeyringDummyDialog();
|
||||
this._currentPrompt = dialog.prompt;
|
||||
return this._currentPrompt;
|
||||
});
|
||||
this._dbusId = null;
|
||||
this._registered = false;
|
||||
this._enabled = false;
|
||||
this._currentPrompt = null;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
enable() {
|
||||
if (!this._registered) {
|
||||
this._prompter.register(Gio.DBus.session);
|
||||
this._dbusId = Gio.DBus.session.own_name('org.gnome.keyring.SystemPrompter',
|
||||
@ -302,7 +299,7 @@ var KeyringPrompter = new Lang.Class({
|
||||
this._enabled = true;
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
disable() {
|
||||
this._enabled = false;
|
||||
|
||||
if (this._prompter.prompting)
|
||||
|
@ -25,7 +25,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
Name: 'NetworkSecretDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function(agent, requestId, connection, settingName, hints, contentOverride) {
|
||||
_init(agent, requestId, connection, settingName, hints, contentOverride) {
|
||||
this.parent({ styleClass: 'prompt-dialog' });
|
||||
|
||||
this._agent = agent;
|
||||
@ -82,15 +82,15 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
initialFocusSet = true;
|
||||
}
|
||||
|
||||
secret.entry.clutter_text.connect('activate', Lang.bind(this, this._onOk));
|
||||
secret.entry.clutter_text.connect('text-changed', Lang.bind(this, function() {
|
||||
secret.entry.clutter_text.connect('activate', this._onOk.bind(this));
|
||||
secret.entry.clutter_text.connect('text-changed', () => {
|
||||
secret.value = secret.entry.get_text();
|
||||
if (secret.validate)
|
||||
secret.valid = secret.validate(secret);
|
||||
else
|
||||
secret.valid = secret.value.length > 0;
|
||||
this._updateOkButton();
|
||||
}));
|
||||
});
|
||||
} else
|
||||
secret.valid = true;
|
||||
|
||||
@ -110,12 +110,12 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
contentBox.messageBox.add(secretTable);
|
||||
|
||||
this._okButton = { label: _("Connect"),
|
||||
action: Lang.bind(this, this._onOk),
|
||||
action: this._onOk.bind(this),
|
||||
default: true
|
||||
};
|
||||
|
||||
this.setButtons([{ label: _("Cancel"),
|
||||
action: Lang.bind(this, this.cancel),
|
||||
action: this.cancel.bind(this),
|
||||
key: Clutter.KEY_Escape,
|
||||
},
|
||||
this._okButton]);
|
||||
@ -123,7 +123,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
this._updateOkButton();
|
||||
},
|
||||
|
||||
_updateOkButton: function() {
|
||||
_updateOkButton() {
|
||||
let valid = true;
|
||||
for (let i = 0; i < this._content.secrets.length; i++) {
|
||||
let secret = this._content.secrets[i];
|
||||
@ -134,7 +134,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
this._okButton.button.can_focus = valid;
|
||||
},
|
||||
|
||||
_onOk: function() {
|
||||
_onOk() {
|
||||
let valid = true;
|
||||
for (let i = 0; i < this._content.secrets.length; i++) {
|
||||
let secret = this._content.secrets[i];
|
||||
@ -150,12 +150,12 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
// do nothing if not valid
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
cancel() {
|
||||
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||
this.close(global.get_current_time());
|
||||
},
|
||||
|
||||
_validateWpaPsk: function(secret) {
|
||||
_validateWpaPsk(secret) {
|
||||
let value = secret.value;
|
||||
if (value.length == 64) {
|
||||
// must be composed of hexadecimal digits only
|
||||
@ -171,7 +171,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
return (value.length >= 8 && value.length <= 63);
|
||||
},
|
||||
|
||||
_validateStaticWep: function(secret) {
|
||||
_validateStaticWep(secret) {
|
||||
let value = secret.value;
|
||||
if (secret.wep_key_type == NM.WepKeyType.KEY) {
|
||||
if (value.length == 10 || value.length == 26) {
|
||||
@ -196,7 +196,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_getWirelessSecrets: function(secrets, wirelessSetting) {
|
||||
_getWirelessSecrets(secrets, wirelessSetting) {
|
||||
let wirelessSecuritySetting = this._connection.get_setting_wireless_security();
|
||||
switch (wirelessSecuritySetting.key_mgmt) {
|
||||
// First the easy ones
|
||||
@ -227,7 +227,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_get8021xSecrets: function(secrets) {
|
||||
_get8021xSecrets(secrets) {
|
||||
let ieee8021xSetting = this._connection.get_setting_802_1x();
|
||||
let phase2method;
|
||||
|
||||
@ -256,7 +256,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getPPPoESecrets: function(secrets) {
|
||||
_getPPPoESecrets(secrets) {
|
||||
let pppoeSetting = this._connection.get_setting_pppoe();
|
||||
secrets.push({ label: _("Username: "), key: 'username',
|
||||
value: pppoeSetting.username || '', password: false });
|
||||
@ -266,7 +266,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
value: pppoeSetting.password || '', password: true });
|
||||
},
|
||||
|
||||
_getMobileSecrets: function(secrets, connectionType) {
|
||||
_getMobileSecrets(secrets, connectionType) {
|
||||
let setting;
|
||||
if (connectionType == 'bluetooth')
|
||||
setting = this._connection.get_setting_cdma() || this._connection.get_setting_gsm();
|
||||
@ -276,7 +276,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
value: setting.value || '', password: true });
|
||||
},
|
||||
|
||||
_getContent: function() {
|
||||
_getContent() {
|
||||
let connectionSetting = this._connection.get_setting_connection();
|
||||
let connectionType = connectionSetting.get_connection_type();
|
||||
let wirelessSetting;
|
||||
@ -332,7 +332,7 @@ var NetworkSecretDialog = new Lang.Class({
|
||||
var VPNRequestHandler = new Lang.Class({
|
||||
Name: 'VPNRequestHandler',
|
||||
|
||||
_init: function(agent, requestId, authHelper, serviceType, connection, hints, flags) {
|
||||
_init(agent, requestId, authHelper, serviceType, connection, hints, flags) {
|
||||
this._agent = agent;
|
||||
this._requestId = requestId;
|
||||
this._connection = connection;
|
||||
@ -384,7 +384,7 @@ var VPNRequestHandler = new Lang.Class({
|
||||
this._readStdoutOldStyle();
|
||||
|
||||
this._childWatch = GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid,
|
||||
Lang.bind(this, this._vpnChildFinished));
|
||||
this._vpnChildFinished.bind(this));
|
||||
|
||||
this._writeConnection();
|
||||
} catch(e) {
|
||||
@ -394,7 +394,7 @@ var VPNRequestHandler = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function(respond) {
|
||||
cancel(respond) {
|
||||
if (respond)
|
||||
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||
|
||||
@ -410,7 +410,7 @@ var VPNRequestHandler = new Lang.Class({
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
if (this._destroyed)
|
||||
return;
|
||||
|
||||
@ -424,7 +424,7 @@ var VPNRequestHandler = new Lang.Class({
|
||||
this._destroyed = true;
|
||||
},
|
||||
|
||||
_vpnChildFinished: function(pid, status, requestObj) {
|
||||
_vpnChildFinished(pid, status, requestObj) {
|
||||
this._childWatch = 0;
|
||||
if (this._newStylePlugin) {
|
||||
// For new style plugin, all work is done in the async reading functions
|
||||
@ -445,7 +445,7 @@ var VPNRequestHandler = new Lang.Class({
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
_vpnChildProcessLineOldStyle: function(line) {
|
||||
_vpnChildProcessLineOldStyle(line) {
|
||||
if (this._previousLine != undefined) {
|
||||
// Two consecutive newlines mean that the child should be closed
|
||||
// (the actual newlines are eaten by Gio.DataInputStream)
|
||||
@ -463,8 +463,8 @@ var VPNRequestHandler = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_readStdoutOldStyle: function() {
|
||||
this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
||||
_readStdoutOldStyle() {
|
||||
this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, (stream, result) => {
|
||||
let [line, len] = this._dataStdout.read_line_finish_utf8(result);
|
||||
|
||||
if (line == null) {
|
||||
@ -477,11 +477,11 @@ var VPNRequestHandler = new Lang.Class({
|
||||
|
||||
// try to read more!
|
||||
this._readStdoutOldStyle();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_readStdoutNewStyle: function() {
|
||||
this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
||||
_readStdoutNewStyle() {
|
||||
this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, (stream, result) => {
|
||||
let cnt = this._dataStdout.fill_finish(result);
|
||||
|
||||
if (cnt == 0) {
|
||||
@ -495,10 +495,10 @@ var VPNRequestHandler = new Lang.Class({
|
||||
// Try to read more
|
||||
this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size());
|
||||
this._readStdoutNewStyle();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_showNewStyleDialog: function() {
|
||||
_showNewStyleDialog() {
|
||||
let keyfile = new GLib.KeyFile();
|
||||
let data;
|
||||
let contentOverride;
|
||||
@ -558,18 +558,18 @@ var VPNRequestHandler = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_writeConnection: function() {
|
||||
_writeConnection() {
|
||||
let vpnSetting = this._connection.get_setting_vpn();
|
||||
|
||||
try {
|
||||
vpnSetting.foreach_data_item(Lang.bind(this, function(key, value) {
|
||||
vpnSetting.foreach_data_item((key, value) => {
|
||||
this._stdin.write('DATA_KEY=' + key + '\n', null);
|
||||
this._stdin.write('DATA_VAL=' + (value || '') + '\n\n', null);
|
||||
}));
|
||||
vpnSetting.foreach_secret(Lang.bind(this, function(key, value) {
|
||||
});
|
||||
vpnSetting.foreach_secret((key, value) => {
|
||||
this._stdin.write('SECRET_KEY=' + key + '\n', null);
|
||||
this._stdin.write('SECRET_VAL=' + (value || '') + '\n\n', null);
|
||||
}));
|
||||
});
|
||||
this._stdin.write('DONE\n\n', null);
|
||||
} catch(e) {
|
||||
logError(e, 'internal error while writing connection to helper');
|
||||
@ -584,7 +584,7 @@ Signals.addSignalMethods(VPNRequestHandler.prototype);
|
||||
var NetworkAgent = new Lang.Class({
|
||||
Name: 'NetworkAgent',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._native = new Shell.NetworkAgent({ identifier: 'org.gnome.Shell.NetworkAgent',
|
||||
capabilities: NM.SecretAgentCapabilities.VPN_HINTS,
|
||||
auto_register: false
|
||||
@ -602,26 +602,31 @@ var NetworkAgent = new Lang.Class({
|
||||
log('Failed to create monitor for VPN plugin dir: ' + e.message);
|
||||
}
|
||||
|
||||
this._native.connect('new-request', Lang.bind(this, this._newRequest));
|
||||
this._native.connect('cancel-request', Lang.bind(this, this._cancelRequest));
|
||||
try {
|
||||
this._native.init(null);
|
||||
} catch(e) {
|
||||
this._native = null;
|
||||
logError(e, 'error initializing the NetworkManager Agent');
|
||||
}
|
||||
this._native.connect('new-request', this._newRequest.bind(this));
|
||||
this._native.connect('cancel-request', this._cancelRequest.bind(this));
|
||||
|
||||
this._initialized = false;
|
||||
this._native.init_async(GLib.PRIORITY_DEFAULT, null, (o, res) => {
|
||||
try {
|
||||
this._native.init_finish(res);
|
||||
this._initialized = true;
|
||||
} catch(e) {
|
||||
this._native = null;
|
||||
logError(e, 'error initializing the NetworkManager Agent');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
enable() {
|
||||
if (!this._native)
|
||||
return;
|
||||
|
||||
this._native.auto_register = true;
|
||||
if (!this._native.registered)
|
||||
if (this._initialized && !this._native.registered)
|
||||
this._native.register_async(null, null);
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
disable() {
|
||||
let requestId;
|
||||
|
||||
for (requestId in this._dialogs)
|
||||
@ -640,11 +645,11 @@ var NetworkAgent = new Lang.Class({
|
||||
return;
|
||||
|
||||
this._native.auto_register = false;
|
||||
if (this._native.registered)
|
||||
if (this._initialized && this._native.registered)
|
||||
this._native.unregister_async(null, null);
|
||||
},
|
||||
|
||||
_showNotification: function(requestId, connection, settingName, hints, flags) {
|
||||
_showNotification(requestId, connection, settingName, hints, flags) {
|
||||
let source = new MessageTray.Source(_("Network Manager"), 'network-transmit-receive');
|
||||
source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
|
||||
|
||||
@ -655,7 +660,7 @@ var NetworkAgent = new Lang.Class({
|
||||
switch (connectionType) {
|
||||
case '802-11-wireless':
|
||||
let wirelessSetting = connection.get_setting_wireless();
|
||||
let ssid = NM.utils_ssid_to_utf8(wirelessSetting.get_ssid());
|
||||
let ssid = NM.utils_ssid_to_utf8(wirelessSetting.get_ssid().get_data());
|
||||
title = _("Authentication required by wireless network");
|
||||
body = _("Passwords or encryption keys are required to access the wireless network “%s”.").format(ssid);
|
||||
break;
|
||||
@ -688,44 +693,44 @@ var NetworkAgent = new Lang.Class({
|
||||
|
||||
let notification = new MessageTray.Notification(source, title, body);
|
||||
|
||||
notification.connect('activated', Lang.bind(this, function() {
|
||||
notification.connect('activated', () => {
|
||||
notification.answered = true;
|
||||
this._handleRequest(requestId, connection, settingName, hints, flags);
|
||||
}));
|
||||
});
|
||||
|
||||
this._notifications[requestId] = notification;
|
||||
notification.connect('destroy', Lang.bind(this, function() {
|
||||
notification.connect('destroy', () => {
|
||||
if (!notification.answered)
|
||||
this._native.respond(requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||
delete this._notifications[requestId];
|
||||
}));
|
||||
});
|
||||
|
||||
Main.messageTray.add(source);
|
||||
source.notify(notification);
|
||||
},
|
||||
|
||||
_newRequest: function(agent, requestId, connection, settingName, hints, flags) {
|
||||
_newRequest(agent, requestId, connection, settingName, hints, flags) {
|
||||
if (!(flags & NM.SecretAgentGetSecretsFlags.USER_REQUESTED))
|
||||
this._showNotification(requestId, connection, settingName, hints, flags);
|
||||
else
|
||||
this._handleRequest(requestId, connection, settingName, hints, flags);
|
||||
},
|
||||
|
||||
_handleRequest: function(requestId, connection, settingName, hints, flags) {
|
||||
_handleRequest(requestId, connection, settingName, hints, flags) {
|
||||
if (settingName == 'vpn') {
|
||||
this._vpnRequest(requestId, connection, hints, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
let dialog = new NetworkSecretDialog(this._native, requestId, connection, settingName, hints);
|
||||
dialog.connect('destroy', Lang.bind(this, function() {
|
||||
dialog.connect('destroy', () => {
|
||||
delete this._dialogs[requestId];
|
||||
}));
|
||||
});
|
||||
this._dialogs[requestId] = dialog;
|
||||
dialog.open(global.get_current_time());
|
||||
},
|
||||
|
||||
_cancelRequest: function(agent, requestId) {
|
||||
_cancelRequest(agent, requestId) {
|
||||
if (this._dialogs[requestId]) {
|
||||
this._dialogs[requestId].close(global.get_current_time());
|
||||
this._dialogs[requestId].destroy();
|
||||
@ -736,7 +741,7 @@ var NetworkAgent = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_vpnRequest: function(requestId, connection, hints, flags) {
|
||||
_vpnRequest(requestId, connection, hints, flags) {
|
||||
let vpnSetting = connection.get_setting_vpn();
|
||||
let serviceType = vpnSetting.service_type;
|
||||
|
||||
@ -752,70 +757,42 @@ var NetworkAgent = new Lang.Class({
|
||||
}
|
||||
|
||||
let vpnRequest = new VPNRequestHandler(this._native, requestId, binary, serviceType, connection, hints, flags);
|
||||
vpnRequest.connect('destroy', Lang.bind(this, function() {
|
||||
vpnRequest.connect('destroy', () => {
|
||||
delete this._vpnRequests[requestId];
|
||||
}));
|
||||
});
|
||||
this._vpnRequests[requestId] = vpnRequest;
|
||||
},
|
||||
|
||||
_buildVPNServiceCache: function() {
|
||||
_buildVPNServiceCache() {
|
||||
if (this._vpnCacheBuilt)
|
||||
return;
|
||||
|
||||
this._vpnCacheBuilt = true;
|
||||
this._vpnBinaries = { };
|
||||
|
||||
try {
|
||||
let fileEnum = this._pluginDir.enumerate_children('standard::name', Gio.FileQueryInfoFlags.NONE, null);
|
||||
let info;
|
||||
NM.VpnPluginInfo.list_load().forEach(plugin => {
|
||||
let service = plugin.get_service();
|
||||
let fileName = plugin.get_auth_dialog();
|
||||
let supportsHints = plugin.supports_hints();
|
||||
let externalUIMode = false;
|
||||
|
||||
while ((info = fileEnum.next_file(null))) {
|
||||
let name = info.get_name();
|
||||
if (name.substr(-5) != '.name')
|
||||
continue;
|
||||
|
||||
try {
|
||||
let keyfile = new GLib.KeyFile();
|
||||
keyfile.load_from_file(this._pluginDir.get_child(name).get_path(), GLib.KeyFileFlags.NONE);
|
||||
let service = keyfile.get_string('VPN Connection', 'service');
|
||||
let binary = keyfile.get_string('GNOME', 'auth-dialog');
|
||||
let externalUIMode = false;
|
||||
let hints = false;
|
||||
|
||||
try {
|
||||
externalUIMode = keyfile.get_boolean('GNOME', 'supports-external-ui-mode');
|
||||
} catch(e) { } // ignore errors if key does not exist
|
||||
|
||||
try {
|
||||
hints = keyfile.get_boolean('GNOME', 'supports-hints');
|
||||
} catch(e) { } // ignore errors if key does not exist
|
||||
|
||||
let path = binary;
|
||||
if (!GLib.path_is_absolute(path)) {
|
||||
path = GLib.build_filenamev([Config.LIBEXECDIR, path]);
|
||||
}
|
||||
|
||||
if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE)) {
|
||||
this._vpnBinaries[service] = { fileName: path, externalUIMode: externalUIMode, supportsHints: hints };
|
||||
try {
|
||||
let aliases = keyfile.get_string_list('VPN Connection', 'aliases');
|
||||
|
||||
for (let alias of aliases) {
|
||||
this._vpnBinaries[alias] = { fileName: path, externalUIMode: externalUIMode, supportsHints: hints };
|
||||
}
|
||||
} catch(e) { } // ignore errors if key does not exist
|
||||
} else {
|
||||
throw new Error('VPN plugin at %s is not executable'.format(path));
|
||||
}
|
||||
} catch(e) {
|
||||
log('Error \'%s\' while processing VPN keyfile \'%s\''.
|
||||
format(e.message, this._pluginDir.get_child(name).get_path()));
|
||||
continue;
|
||||
}
|
||||
let prop = plugin.lookup_property('GNOME', 'supports-external-ui-mode');
|
||||
if (prop) {
|
||||
prop = prop.trim().toLowerCase();
|
||||
externalUIMode = ['true', 'yes', 'on', '1'].includes(prop);
|
||||
}
|
||||
} catch(e) {
|
||||
logError(e, 'error while enumerating VPN auth helpers');
|
||||
}
|
||||
|
||||
if (GLib.file_test(fileName, GLib.FileTest.IS_EXECUTABLE)) {
|
||||
let binary = { fileName, externalUIMode, supportsHints };
|
||||
this._vpnBinaries[service] = binary;
|
||||
|
||||
plugin.get_aliases().forEach(alias => {
|
||||
this._vpnBinaries[alias] = binary;
|
||||
});
|
||||
} else {
|
||||
log('VPN plugin at %s is not executable'.format(fileName));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
var Component = NetworkAgent;
|
||||
|
@ -16,6 +16,7 @@ const PolkitAgent = imports.gi.PolkitAgent;
|
||||
const Animation = imports.ui.animation;
|
||||
const Components = imports.ui.components;
|
||||
const Dialog = imports.ui.dialog;
|
||||
const Main = imports.ui.main;
|
||||
const ModalDialog = imports.ui.modalDialog;
|
||||
const ShellEntry = imports.ui.shellEntry;
|
||||
const UserWidget = imports.ui.userWidget;
|
||||
@ -31,7 +32,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
Name: 'AuthenticationDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function(actionId, body, cookie, userNames) {
|
||||
_init(actionId, body, cookie, userNames) {
|
||||
this.parent({ styleClass: 'prompt-dialog' });
|
||||
|
||||
this.actionId = actionId;
|
||||
@ -39,6 +40,10 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this.userNames = userNames;
|
||||
this._wasDismissed = false;
|
||||
|
||||
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
|
||||
this._group.visible = !Main.sessionMode.isLocked;
|
||||
});
|
||||
|
||||
let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' });
|
||||
let title = _("Authentication Required");
|
||||
|
||||
@ -60,9 +65,9 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._user = AccountsService.UserManager.get_default().get_user(userName);
|
||||
let userRealName = this._user.get_real_name()
|
||||
this._userLoadedId = this._user.connect('notify::is_loaded',
|
||||
Lang.bind(this, this._onUserChanged));
|
||||
this._onUserChanged.bind(this));
|
||||
this._userChangedId = this._user.connect('changed',
|
||||
Lang.bind(this, this._onUserChanged));
|
||||
this._onUserChanged.bind(this));
|
||||
|
||||
// Special case 'root'
|
||||
let userIsRoot = false;
|
||||
@ -108,7 +113,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
text: "",
|
||||
can_focus: true});
|
||||
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
|
||||
this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivate));
|
||||
this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this));
|
||||
this._passwordBox.add(this._passwordEntry,
|
||||
{ expand: true });
|
||||
|
||||
@ -146,10 +151,10 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._nullMessageLabel.show();
|
||||
|
||||
this._cancelButton = this.addButton({ label: _("Cancel"),
|
||||
action: Lang.bind(this, this.cancel),
|
||||
action: this.cancel.bind(this),
|
||||
key: Clutter.Escape });
|
||||
this._okButton = this.addButton({ label: _("Authenticate"),
|
||||
action: Lang.bind(this, this._onAuthenticateButtonPressed),
|
||||
action: this._onAuthenticateButtonPressed.bind(this),
|
||||
default: true });
|
||||
|
||||
this._doneEmitted = false;
|
||||
@ -158,7 +163,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._cookie = cookie;
|
||||
},
|
||||
|
||||
_setWorking: function(working) {
|
||||
_setWorking(working) {
|
||||
Tweener.removeTweens(this._workSpinner.actor);
|
||||
if (working) {
|
||||
this._workSpinner.play();
|
||||
@ -174,7 +179,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
time: WORK_SPINNER_ANIMATION_TIME,
|
||||
transition: 'linear',
|
||||
onCompleteScope: this,
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
if (this._workSpinner)
|
||||
this._workSpinner.stop();
|
||||
}
|
||||
@ -182,18 +187,26 @@ var AuthenticationDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
performAuthentication: function() {
|
||||
performAuthentication() {
|
||||
this.destroySession();
|
||||
this._session = new PolkitAgent.Session({ identity: this._identityToAuth,
|
||||
cookie: this._cookie });
|
||||
this._session.connect('completed', Lang.bind(this, this._onSessionCompleted));
|
||||
this._session.connect('request', Lang.bind(this, this._onSessionRequest));
|
||||
this._session.connect('show-error', Lang.bind(this, this._onSessionShowError));
|
||||
this._session.connect('show-info', Lang.bind(this, this._onSessionShowInfo));
|
||||
this._session.connect('completed', this._onSessionCompleted.bind(this));
|
||||
this._session.connect('request', this._onSessionRequest.bind(this));
|
||||
this._session.connect('show-error', this._onSessionShowError.bind(this));
|
||||
this._session.connect('show-info', this._onSessionShowInfo.bind(this));
|
||||
this._session.initiate();
|
||||
},
|
||||
|
||||
_ensureOpen: function() {
|
||||
close(timestamp) {
|
||||
this.parent(timestamp);
|
||||
|
||||
if (this._sessionUpdatedId)
|
||||
Main.sessionMode.disconnect(this._sessionUpdatedId);
|
||||
this._sessionUpdatedId = 0;
|
||||
},
|
||||
|
||||
_ensureOpen() {
|
||||
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
||||
// already open - it just returns true without side-effects
|
||||
if (!this.open(global.get_current_time())) {
|
||||
@ -215,14 +228,14 @@ var AuthenticationDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_emitDone: function(dismissed) {
|
||||
_emitDone(dismissed) {
|
||||
if (!this._doneEmitted) {
|
||||
this._doneEmitted = true;
|
||||
this.emit('done', dismissed);
|
||||
}
|
||||
},
|
||||
|
||||
_updateSensitivity: function(sensitive) {
|
||||
_updateSensitivity(sensitive) {
|
||||
this._passwordEntry.reactive = sensitive;
|
||||
this._passwordEntry.clutter_text.editable = sensitive;
|
||||
|
||||
@ -231,7 +244,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._setWorking(!sensitive);
|
||||
},
|
||||
|
||||
_onEntryActivate: function() {
|
||||
_onEntryActivate() {
|
||||
let response = this._passwordEntry.get_text();
|
||||
this._updateSensitivity(false);
|
||||
this._session.response(response);
|
||||
@ -242,11 +255,11 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._nullMessageLabel.show();
|
||||
},
|
||||
|
||||
_onAuthenticateButtonPressed: function() {
|
||||
_onAuthenticateButtonPressed() {
|
||||
this._onEntryActivate();
|
||||
},
|
||||
|
||||
_onSessionCompleted: function(session, gainedAuthorization) {
|
||||
_onSessionCompleted(session, gainedAuthorization) {
|
||||
if (this._completed || this._doneEmitted)
|
||||
return;
|
||||
|
||||
@ -278,7 +291,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onSessionRequest: function(session, request, echo_on) {
|
||||
_onSessionRequest(session, request, echo_on) {
|
||||
// Cheap localization trick
|
||||
if (request == 'Password:' || request == 'Password: ')
|
||||
this._passwordLabel.set_text(_("Password:"));
|
||||
@ -297,7 +310,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._ensureOpen();
|
||||
},
|
||||
|
||||
_onSessionShowError: function(session, text) {
|
||||
_onSessionShowError(session, text) {
|
||||
this._passwordEntry.set_text('');
|
||||
this._errorMessageLabel.set_text(text);
|
||||
this._errorMessageLabel.show();
|
||||
@ -306,7 +319,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._ensureOpen();
|
||||
},
|
||||
|
||||
_onSessionShowInfo: function(session, text) {
|
||||
_onSessionShowInfo(session, text) {
|
||||
this._passwordEntry.set_text('');
|
||||
this._infoMessageLabel.set_text(text);
|
||||
this._infoMessageLabel.show();
|
||||
@ -315,7 +328,7 @@ var AuthenticationDialog = new Lang.Class({
|
||||
this._ensureOpen();
|
||||
},
|
||||
|
||||
destroySession: function() {
|
||||
destroySession() {
|
||||
if (this._session) {
|
||||
if (!this._completed)
|
||||
this._session.cancel();
|
||||
@ -324,14 +337,14 @@ var AuthenticationDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onUserChanged: function() {
|
||||
_onUserChanged() {
|
||||
if (this._user.is_loaded && this._userAvatar) {
|
||||
this._userAvatar.update();
|
||||
this._userAvatar.actor.show();
|
||||
}
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
cancel() {
|
||||
this._wasDismissed = true;
|
||||
this.close(global.get_current_time());
|
||||
this._emitDone(true);
|
||||
@ -342,15 +355,16 @@ Signals.addSignalMethods(AuthenticationDialog.prototype);
|
||||
var AuthenticationAgent = new Lang.Class({
|
||||
Name: 'AuthenticationAgent',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._currentDialog = null;
|
||||
this._handle = null;
|
||||
this._native = new Shell.PolkitAuthenticationAgent();
|
||||
this._native.connect('initiate', Lang.bind(this, this._onInitiate));
|
||||
this._native.connect('cancel', Lang.bind(this, this._onCancel));
|
||||
this._native.connect('initiate', this._onInitiate.bind(this));
|
||||
this._native.connect('cancel', this._onCancel.bind(this));
|
||||
this._sessionUpdatedId = 0;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
enable() {
|
||||
try {
|
||||
this._native.register();
|
||||
} catch(e) {
|
||||
@ -358,7 +372,7 @@ var AuthenticationAgent = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
disable() {
|
||||
try {
|
||||
this._native.unregister();
|
||||
} catch(e) {
|
||||
@ -366,7 +380,18 @@ var AuthenticationAgent = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onInitiate: function(nativeAgent, actionId, message, iconName, cookie, userNames) {
|
||||
_onInitiate(nativeAgent, actionId, message, iconName, cookie, userNames) {
|
||||
// Don't pop up a dialog while locked
|
||||
if (Main.sessionMode.isLocked) {
|
||||
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {
|
||||
Main.sessionMode.disconnect(this._sessionUpdatedId);
|
||||
this._sessionUpdatedId = 0;
|
||||
|
||||
this._onInitiate(nativeAgent, actionId, message, iconName, cookie, userNames);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this._currentDialog = new AuthenticationDialog(actionId, message, cookie, userNames);
|
||||
|
||||
// We actually don't want to open the dialog until we know for
|
||||
@ -379,23 +404,27 @@ var AuthenticationAgent = new Lang.Class({
|
||||
// See https://bugzilla.gnome.org/show_bug.cgi?id=643062 for more
|
||||
// discussion.
|
||||
|
||||
this._currentDialog.connect('done', Lang.bind(this, this._onDialogDone));
|
||||
this._currentDialog.connect('done', this._onDialogDone.bind(this));
|
||||
this._currentDialog.performAuthentication();
|
||||
},
|
||||
|
||||
_onCancel: function(nativeAgent) {
|
||||
_onCancel(nativeAgent) {
|
||||
this._completeRequest(false);
|
||||
},
|
||||
|
||||
_onDialogDone: function(dialog, dismissed) {
|
||||
_onDialogDone(dialog, dismissed) {
|
||||
this._completeRequest(dismissed);
|
||||
},
|
||||
|
||||
_completeRequest: function(dismissed) {
|
||||
_completeRequest(dismissed) {
|
||||
this._currentDialog.close();
|
||||
this._currentDialog.destroySession();
|
||||
this._currentDialog = null;
|
||||
|
||||
if (this._sessionUpdatedId)
|
||||
Main.sessionMode.disconnect(this._sessionUpdatedId);
|
||||
this._sessionUpdatedId = 0;
|
||||
|
||||
this._native.complete(dismissed);
|
||||
},
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ var NotificationDirection = {
|
||||
RECEIVED: 'chat-received'
|
||||
};
|
||||
|
||||
var N_ = function(s) { return s; };
|
||||
var N_ = s => s;
|
||||
|
||||
function makeMessageFromTpMessage(tpMessage, direction) {
|
||||
let [text, flags] = tpMessage.to_text();
|
||||
@ -82,7 +82,7 @@ function makeMessageFromTplEvent(event) {
|
||||
var TelepathyComponent = new Lang.Class({
|
||||
Name: 'TelepathyComponent',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._client = null;
|
||||
|
||||
if (!HAVE_TP)
|
||||
@ -91,7 +91,7 @@ var TelepathyComponent = new Lang.Class({
|
||||
this._client = new TelepathyClient();
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
enable() {
|
||||
if (!this._client)
|
||||
return;
|
||||
|
||||
@ -105,7 +105,7 @@ var TelepathyComponent = new Lang.Class({
|
||||
this._client.account_manager.prepare_async(null, null);
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
disable() {
|
||||
if (!this._client)
|
||||
return;
|
||||
|
||||
@ -117,7 +117,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
||||
Name: 'TelepathyClient',
|
||||
Extends: Tp.BaseClient,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
// channel path -> ChatSource
|
||||
this._chatSources = {};
|
||||
this._chatState = Tp.ChannelChatState.ACTIVE;
|
||||
@ -157,10 +157,10 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
||||
// Allow other clients (such as Empathy) to pre-empt our channels if
|
||||
// needed
|
||||
this.set_delegated_channels_callback(
|
||||
Lang.bind(this, this._delegatedChannelsCb));
|
||||
this._delegatedChannelsCb.bind(this));
|
||||
},
|
||||
|
||||
vfunc_observe_channels: function(account, conn, channels,
|
||||
vfunc_observe_channels(account, conn, channels,
|
||||
dispatchOp, requests, context) {
|
||||
let len = channels.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
@ -181,26 +181,25 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
||||
context.accept();
|
||||
},
|
||||
|
||||
_createChatSource: function(account, conn, channel, contact) {
|
||||
_createChatSource(account, conn, channel, contact) {
|
||||
if (this._chatSources[channel.get_object_path()])
|
||||
return;
|
||||
|
||||
let source = new ChatSource(account, conn, channel, contact, this);
|
||||
|
||||
this._chatSources[channel.get_object_path()] = source;
|
||||
source.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
delete this._chatSources[channel.get_object_path()];
|
||||
}));
|
||||
source.connect('destroy', () => {
|
||||
delete this._chatSources[channel.get_object_path()];
|
||||
});
|
||||
},
|
||||
|
||||
vfunc_handle_channels: function(account, conn, channels, requests,
|
||||
vfunc_handle_channels(account, conn, channels, requests,
|
||||
user_action_time, context) {
|
||||
this._handlingChannels(account, conn, channels, true);
|
||||
context.accept();
|
||||
},
|
||||
|
||||
_handlingChannels: function(account, conn, channels, notify) {
|
||||
_handlingChannels(account, conn, channels, notify) {
|
||||
let len = channels.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
let channel = channels[i];
|
||||
@ -234,7 +233,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
vfunc_add_dispatch_operation: function(account, conn, channels,
|
||||
vfunc_add_dispatch_operation(account, conn, channels,
|
||||
dispatchOp, context) {
|
||||
let channel = channels[0];
|
||||
let chanType = channel.get_channel_type();
|
||||
@ -252,7 +251,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
||||
message: 'Unsupported channel type' }));
|
||||
},
|
||||
|
||||
_approveTextChannel: function(account, conn, channel, dispatchOp, context) {
|
||||
_approveTextChannel(account, conn, channel, dispatchOp, context) {
|
||||
let [targetHandle, targetHandleType] = channel.get_handle();
|
||||
|
||||
if (targetHandleType != Tp.HandleType.CONTACT) {
|
||||
@ -262,19 +261,19 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
||||
}
|
||||
|
||||
// Approve private text channels right away as we are going to handle it
|
||||
dispatchOp.claim_with_async(this, Lang.bind(this, function(dispatchOp, result) {
|
||||
dispatchOp.claim_with_async(this, (dispatchOp, result) => {
|
||||
try {
|
||||
dispatchOp.claim_with_finish(result);
|
||||
this._handlingChannels(account, conn, [channel], false);
|
||||
} catch (err) {
|
||||
log('Failed to Claim channel: ' + err);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
context.accept();
|
||||
},
|
||||
|
||||
_delegatedChannelsCb: function(client, channels) {
|
||||
_delegatedChannelsCb(client, channels) {
|
||||
// Nothing to do as we don't make a distinction between observed and
|
||||
// handled channels.
|
||||
},
|
||||
@ -284,7 +283,7 @@ var ChatSource = new Lang.Class({
|
||||
Name: 'ChatSource',
|
||||
Extends: MessageTray.Source,
|
||||
|
||||
_init: function(account, conn, channel, contact, client) {
|
||||
_init(account, conn, channel, contact, client) {
|
||||
this._account = account;
|
||||
this._contact = contact;
|
||||
this._client = client;
|
||||
@ -296,19 +295,19 @@ var ChatSource = new Lang.Class({
|
||||
|
||||
this._conn = conn;
|
||||
this._channel = channel;
|
||||
this._closedId = this._channel.connect('invalidated', Lang.bind(this, this._channelClosed));
|
||||
this._closedId = this._channel.connect('invalidated', this._channelClosed.bind(this));
|
||||
|
||||
this._notifyTimeoutId = 0;
|
||||
|
||||
this._presence = contact.get_presence_type();
|
||||
|
||||
this._sentId = this._channel.connect('message-sent', Lang.bind(this, this._messageSent));
|
||||
this._receivedId = this._channel.connect('message-received', Lang.bind(this, this._messageReceived));
|
||||
this._pendingId = this._channel.connect('pending-message-removed', Lang.bind(this, this._pendingRemoved));
|
||||
this._sentId = this._channel.connect('message-sent', this._messageSent.bind(this));
|
||||
this._receivedId = this._channel.connect('message-received', this._messageReceived.bind(this));
|
||||
this._pendingId = this._channel.connect('pending-message-removed', this._pendingRemoved.bind(this));
|
||||
|
||||
this._notifyAliasId = this._contact.connect('notify::alias', Lang.bind(this, this._updateAlias));
|
||||
this._notifyAvatarId = this._contact.connect('notify::avatar-file', Lang.bind(this, this._updateAvatarIcon));
|
||||
this._presenceChangedId = this._contact.connect('presence-changed', Lang.bind(this, this._presenceChanged));
|
||||
this._notifyAliasId = this._contact.connect('notify::alias', this._updateAlias.bind(this));
|
||||
this._notifyAvatarId = this._contact.connect('notify::avatar-file', this._updateAvatarIcon.bind(this));
|
||||
this._presenceChangedId = this._contact.connect('presence-changed', this._presenceChanged.bind(this));
|
||||
|
||||
// Add ourselves as a source.
|
||||
Main.messageTray.add(this);
|
||||
@ -316,45 +315,42 @@ var ChatSource = new Lang.Class({
|
||||
this._getLogMessages();
|
||||
},
|
||||
|
||||
_ensureNotification: function() {
|
||||
_ensureNotification() {
|
||||
if (this._notification)
|
||||
return;
|
||||
|
||||
this._notification = new ChatNotification(this);
|
||||
this._notification.connect('activated', Lang.bind(this, this.open));
|
||||
this._notification.connect('updated', Lang.bind(this,
|
||||
function() {
|
||||
if (this._banner && this._banner.expanded)
|
||||
this._ackMessages();
|
||||
}));
|
||||
this._notification.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this._notification = null;
|
||||
}));
|
||||
this._notification.connect('activated', this.open.bind(this));
|
||||
this._notification.connect('updated', () => {
|
||||
if (this._banner && this._banner.expanded)
|
||||
this._ackMessages();
|
||||
});
|
||||
this._notification.connect('destroy', () => {
|
||||
this._notification = null;
|
||||
});
|
||||
this.pushNotification(this._notification);
|
||||
},
|
||||
|
||||
_createPolicy: function() {
|
||||
_createPolicy() {
|
||||
if (this._account.protocol_name == 'irc')
|
||||
return new MessageTray.NotificationApplicationPolicy('org.gnome.Polari');
|
||||
return new MessageTray.NotificationApplicationPolicy('empathy');
|
||||
},
|
||||
|
||||
createBanner: function() {
|
||||
createBanner() {
|
||||
this._banner = new ChatNotificationBanner(this._notification);
|
||||
|
||||
// We ack messages when the user expands the new notification
|
||||
let id = this._banner.connect('expanded', Lang.bind(this, this._ackMessages));
|
||||
this._banner.actor.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this._banner.disconnect(id);
|
||||
this._banner = null;
|
||||
}));
|
||||
let id = this._banner.connect('expanded', this._ackMessages.bind(this));
|
||||
this._banner.actor.connect('destroy', () => {
|
||||
this._banner.disconnect(id);
|
||||
this._banner = null;
|
||||
});
|
||||
|
||||
return this._banner;
|
||||
},
|
||||
|
||||
_updateAlias: function() {
|
||||
_updateAlias() {
|
||||
let oldAlias = this.title;
|
||||
let newAlias = this._contact.get_alias();
|
||||
|
||||
@ -366,7 +362,7 @@ var ChatSource = new Lang.Class({
|
||||
this._notification.appendAliasChange(oldAlias, newAlias);
|
||||
},
|
||||
|
||||
getIcon: function() {
|
||||
getIcon() {
|
||||
let file = this._contact.get_avatar_file();
|
||||
if (file) {
|
||||
return new Gio.FileIcon({ file: file });
|
||||
@ -375,7 +371,7 @@ var ChatSource = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
getSecondaryIcon: function() {
|
||||
getSecondaryIcon() {
|
||||
let iconName;
|
||||
let presenceType = this._contact.get_presence_type();
|
||||
|
||||
@ -404,7 +400,7 @@ var ChatSource = new Lang.Class({
|
||||
return new Gio.ThemedIcon({ name: iconName });
|
||||
},
|
||||
|
||||
_updateAvatarIcon: function() {
|
||||
_updateAvatarIcon() {
|
||||
this.iconUpdated();
|
||||
if (this._notifiction)
|
||||
this._notification.update(this._notification.title,
|
||||
@ -412,7 +408,7 @@ var ChatSource = new Lang.Class({
|
||||
{ gicon: this.getIcon() });
|
||||
},
|
||||
|
||||
open: function() {
|
||||
open() {
|
||||
Main.overview.hide();
|
||||
Main.panel.closeCalendar();
|
||||
|
||||
@ -437,16 +433,16 @@ var ChatSource = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getLogMessages: function() {
|
||||
_getLogMessages() {
|
||||
let logManager = Tpl.LogManager.dup_singleton();
|
||||
let entity = Tpl.Entity.new_from_tp_contact(this._contact, Tpl.EntityType.CONTACT);
|
||||
|
||||
logManager.get_filtered_events_async(this._account, entity,
|
||||
Tpl.EventTypeMask.TEXT, SCROLLBACK_HISTORY_LINES,
|
||||
null, Lang.bind(this, this._displayPendingMessages));
|
||||
null, this._displayPendingMessages.bind(this));
|
||||
},
|
||||
|
||||
_displayPendingMessages: function(logManager, result) {
|
||||
_displayPendingMessages(logManager, result) {
|
||||
let [success, events] = logManager.get_filtered_events_finish(result);
|
||||
|
||||
let logMessages = events.map(makeMessageFromTplEvent);
|
||||
@ -499,12 +495,12 @@ var ChatSource = new Lang.Class({
|
||||
this.notify();
|
||||
},
|
||||
|
||||
destroy: function(reason) {
|
||||
destroy(reason) {
|
||||
if (this._client.is_handling_channel(this._channel)) {
|
||||
this._ackMessages();
|
||||
// The chat box has been destroyed so it can't
|
||||
// handle the channel any more.
|
||||
this._channel.close_async(function(channel, result) {
|
||||
this._channel.close_async((channel, result) => {
|
||||
channel.close_finish(result);
|
||||
});
|
||||
} else {
|
||||
@ -534,7 +530,7 @@ var ChatSource = new Lang.Class({
|
||||
this.parent(reason);
|
||||
},
|
||||
|
||||
_channelClosed: function() {
|
||||
_channelClosed() {
|
||||
this.destroy(MessageTray.NotificationDestroyedReason.SOURCE_CLOSED);
|
||||
},
|
||||
|
||||
@ -551,7 +547,7 @@ var ChatSource = new Lang.Class({
|
||||
return this.count > 0;
|
||||
},
|
||||
|
||||
_messageReceived: function(channel, message) {
|
||||
_messageReceived(channel, message) {
|
||||
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
|
||||
return;
|
||||
|
||||
@ -567,11 +563,11 @@ var ChatSource = new Lang.Class({
|
||||
if (this._notifyTimeoutId != 0)
|
||||
Mainloop.source_remove(this._notifyTimeoutId);
|
||||
this._notifyTimeoutId = Mainloop.timeout_add(500,
|
||||
Lang.bind(this, this._notifyTimeout));
|
||||
this._notifyTimeout.bind(this));
|
||||
GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
|
||||
},
|
||||
|
||||
_notifyTimeout: function() {
|
||||
_notifyTimeout() {
|
||||
if (this._pendingMessages.length != 0)
|
||||
this.notify();
|
||||
|
||||
@ -582,17 +578,17 @@ var ChatSource = new Lang.Class({
|
||||
|
||||
// This is called for both messages we send from
|
||||
// our client and other clients as well.
|
||||
_messageSent: function(channel, message, flags, token) {
|
||||
_messageSent(channel, message, flags, token) {
|
||||
this._ensureNotification();
|
||||
message = makeMessageFromTpMessage(message, NotificationDirection.SENT);
|
||||
this._notification.appendMessage(message);
|
||||
},
|
||||
|
||||
notify: function() {
|
||||
notify() {
|
||||
this.parent(this._notification);
|
||||
},
|
||||
|
||||
respond: function(text) {
|
||||
respond(text) {
|
||||
let type;
|
||||
if (text.slice(0, 4) == '/me ') {
|
||||
type = Tp.ChannelTextMessageType.ACTION;
|
||||
@ -602,12 +598,12 @@ var ChatSource = new Lang.Class({
|
||||
}
|
||||
|
||||
let msg = Tp.ClientMessage.new_text(type, text);
|
||||
this._channel.send_message_async(msg, 0, Lang.bind(this, function (src, result) {
|
||||
this._channel.send_message_async(msg, 0, (src, result) => {
|
||||
this._channel.send_message_finish(result);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
setChatState: function(state) {
|
||||
setChatState(state) {
|
||||
// We don't want to send COMPOSING every time a letter is typed into
|
||||
// the entry. We send the state only when it changes. Telepathy/Empathy
|
||||
// might change it behind our back if the user is using both
|
||||
@ -620,14 +616,14 @@ var ChatSource = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_presenceChanged: function (contact, presence, status, message) {
|
||||
_presenceChanged(contact, presence, status, message) {
|
||||
if (this._notification)
|
||||
this._notification.update(this._notification.title,
|
||||
this._notification.bannerBodyText,
|
||||
{ secondaryGIcon: this.getSecondaryIcon() });
|
||||
},
|
||||
|
||||
_pendingRemoved: function(channel, message) {
|
||||
_pendingRemoved(channel, message) {
|
||||
let idx = this._pendingMessages.indexOf(message);
|
||||
|
||||
if (idx >= 0) {
|
||||
@ -640,7 +636,7 @@ var ChatSource = new Lang.Class({
|
||||
this._banner.hide();
|
||||
},
|
||||
|
||||
_ackMessages: function() {
|
||||
_ackMessages() {
|
||||
// Don't clear our messages here, tp-glib will send a
|
||||
// 'pending-message-removed' for each one.
|
||||
this._channel.ack_all_pending_messages_async(null);
|
||||
@ -651,7 +647,7 @@ var ChatNotification = new Lang.Class({
|
||||
Name: 'ChatNotification',
|
||||
Extends: MessageTray.Notification,
|
||||
|
||||
_init: function(source) {
|
||||
_init(source) {
|
||||
this.parent(source, source.title, null,
|
||||
{ secondaryGIcon: source.getSecondaryIcon() });
|
||||
this.setUrgency(MessageTray.Urgency.HIGH);
|
||||
@ -661,7 +657,7 @@ var ChatNotification = new Lang.Class({
|
||||
this._timestampTimeoutId = 0;
|
||||
},
|
||||
|
||||
destroy: function(reason) {
|
||||
destroy(reason) {
|
||||
if (this._timestampTimeoutId)
|
||||
Mainloop.source_remove(this._timestampTimeoutId);
|
||||
this._timestampTimeoutId = 0;
|
||||
@ -681,7 +677,7 @@ var ChatNotification = new Lang.Class({
|
||||
* will be added, regardless of the difference since the
|
||||
* last timestamp
|
||||
*/
|
||||
appendMessage: function(message, noTimestamp) {
|
||||
appendMessage(message, noTimestamp) {
|
||||
let messageBody = GLib.markup_escape_text(message.text, -1);
|
||||
let styles = [message.direction];
|
||||
|
||||
@ -706,7 +702,7 @@ var ChatNotification = new Lang.Class({
|
||||
noTimestamp: noTimestamp });
|
||||
},
|
||||
|
||||
_filterMessages: function() {
|
||||
_filterMessages() {
|
||||
if (this.messages.length < 1)
|
||||
return;
|
||||
|
||||
@ -722,7 +718,7 @@ var ChatNotification = new Lang.Class({
|
||||
let maxLength = (lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME) ?
|
||||
SCROLLBACK_IDLE_LENGTH : SCROLLBACK_RECENT_LENGTH;
|
||||
|
||||
let filteredHistory = this.messages.filter(function(item) { return item.realMessage });
|
||||
let filteredHistory = this.messages.filter(item => item.realMessage);
|
||||
if (filteredHistory.length > maxLength) {
|
||||
let lastMessageToKeep = filteredHistory[maxLength];
|
||||
let expired = this.messages.splice(this.messages.indexOf(lastMessageToKeep));
|
||||
@ -741,7 +737,7 @@ var ChatNotification = new Lang.Class({
|
||||
* timestamp: The timestamp of the message.
|
||||
* noTimestamp: suppress timestamp signal?
|
||||
*/
|
||||
_append: function(props) {
|
||||
_append(props) {
|
||||
let currentTime = (Date.now() / 1000);
|
||||
props = Params.parse(props, { body: null,
|
||||
group: null,
|
||||
@ -771,7 +767,7 @@ var ChatNotification = new Lang.Class({
|
||||
// from the timestamp of the message.
|
||||
this._timestampTimeoutId = Mainloop.timeout_add_seconds(
|
||||
SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp),
|
||||
Lang.bind(this, this.appendTimestamp));
|
||||
this.appendTimestamp.bind(this));
|
||||
GLib.Source.set_name_by_id(this._timestampTimeoutId, '[gnome-shell] this.appendTimestamp');
|
||||
}
|
||||
}
|
||||
@ -779,7 +775,7 @@ var ChatNotification = new Lang.Class({
|
||||
this._filterMessages();
|
||||
},
|
||||
|
||||
appendTimestamp: function() {
|
||||
appendTimestamp() {
|
||||
this._timestampTimeoutId = 0;
|
||||
|
||||
this.messages[0].showTimestamp = true;
|
||||
@ -790,7 +786,7 @@ var ChatNotification = new Lang.Class({
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
appendAliasChange: function(oldAlias, newAlias) {
|
||||
appendAliasChange(oldAlias, newAlias) {
|
||||
oldAlias = GLib.markup_escape_text(oldAlias, -1);
|
||||
newAlias = GLib.markup_escape_text(newAlias, -1);
|
||||
|
||||
@ -810,7 +806,7 @@ var ChatLineBox = new Lang.Class({
|
||||
Name: 'ChatLineBox',
|
||||
Extends: St.BoxLayout,
|
||||
|
||||
vfunc_get_preferred_height: function(forWidth) {
|
||||
vfunc_get_preferred_height(forWidth) {
|
||||
let [, natHeight] = this.parent(forWidth);
|
||||
return [natHeight, natHeight];
|
||||
}
|
||||
@ -820,23 +816,23 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
Name: 'ChatNotificationBanner',
|
||||
Extends: MessageTray.NotificationBanner,
|
||||
|
||||
_init: function(notification) {
|
||||
_init(notification) {
|
||||
this.parent(notification);
|
||||
|
||||
this._responseEntry = new St.Entry({ style_class: 'chat-response',
|
||||
x_expand: true,
|
||||
can_focus: true });
|
||||
this._responseEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivated));
|
||||
this._responseEntry.clutter_text.connect('text-changed', Lang.bind(this, this._onEntryChanged));
|
||||
this._responseEntry.clutter_text.connect('activate', this._onEntryActivated.bind(this));
|
||||
this._responseEntry.clutter_text.connect('text-changed', this._onEntryChanged.bind(this));
|
||||
this.setActionArea(this._responseEntry);
|
||||
|
||||
this._responseEntry.clutter_text.connect('key-focus-in', Lang.bind(this, function() {
|
||||
this._responseEntry.clutter_text.connect('key-focus-in', () => {
|
||||
this.focused = true;
|
||||
}));
|
||||
this._responseEntry.clutter_text.connect('key-focus-out', Lang.bind(this, function() {
|
||||
});
|
||||
this._responseEntry.clutter_text.connect('key-focus-out', () => {
|
||||
this.focused = false;
|
||||
this.emit('unfocused');
|
||||
}));
|
||||
});
|
||||
|
||||
this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade',
|
||||
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
|
||||
@ -855,11 +851,11 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
// force a scroll to the bottom if things change while we were at the
|
||||
// bottom
|
||||
this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
|
||||
this._scrollArea.vscroll.adjustment.connect('changed', Lang.bind(this, function(adjustment) {
|
||||
this._scrollArea.vscroll.adjustment.connect('changed', adjustment => {
|
||||
if (adjustment.value == this._oldMaxScrollValue)
|
||||
this.scrollTo(St.Side.BOTTOM);
|
||||
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
|
||||
}));
|
||||
});
|
||||
|
||||
this._inputHistory = new History.HistoryManager({ entry: this._responseEntry.clutter_text });
|
||||
|
||||
@ -868,32 +864,32 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
this._messageActors = new Map();
|
||||
|
||||
this._messageAddedId = this.notification.connect('message-added',
|
||||
Lang.bind(this, function(n, message) {
|
||||
(n, message) => {
|
||||
this._addMessage(message);
|
||||
}));
|
||||
});
|
||||
this._messageRemovedId = this.notification.connect('message-removed',
|
||||
Lang.bind(this, function(n, message) {
|
||||
(n, message) => {
|
||||
let actor = this._messageActors.get(message);
|
||||
if (this._messageActors.delete(message))
|
||||
actor.destroy();
|
||||
}));
|
||||
});
|
||||
this._timestampChangedId = this.notification.connect('timestamp-changed',
|
||||
Lang.bind(this, function(n, message) {
|
||||
(n, message) => {
|
||||
this._updateTimestamp(message);
|
||||
}));
|
||||
});
|
||||
|
||||
for (let i = this.notification.messages.length - 1; i >= 0; i--)
|
||||
this._addMessage(this.notification.messages[i]);
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this.parent();
|
||||
this.notification.disconnect(this._messageAddedId);
|
||||
this.notification.disconnect(this._messageRemovedId);
|
||||
this.notification.disconnect(this._timestampChangedId);
|
||||
},
|
||||
|
||||
scrollTo: function(side) {
|
||||
scrollTo(side) {
|
||||
let adjustment = this._scrollArea.vscroll.adjustment;
|
||||
if (side == St.Side.TOP)
|
||||
adjustment.value = adjustment.lower;
|
||||
@ -901,11 +897,11 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
adjustment.value = adjustment.upper;
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
hide() {
|
||||
this.emit('done-displaying');
|
||||
},
|
||||
|
||||
_addMessage: function(message) {
|
||||
_addMessage(message) {
|
||||
let highlighter = new MessageList.URLHighlighter(message.body, true, true);
|
||||
let body = highlighter.actor;
|
||||
|
||||
@ -927,7 +923,7 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
this._updateTimestamp(message);
|
||||
},
|
||||
|
||||
_updateTimestamp: function(message) {
|
||||
_updateTimestamp(message) {
|
||||
let actor = this._messageActors.get(message);
|
||||
if (!actor)
|
||||
return;
|
||||
@ -948,7 +944,7 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onEntryActivated: function() {
|
||||
_onEntryActivated() {
|
||||
let text = this._responseEntry.get_text();
|
||||
if (text == '')
|
||||
return;
|
||||
@ -961,7 +957,7 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
this.notification.source.respond(text);
|
||||
},
|
||||
|
||||
_composingStopTimeout: function() {
|
||||
_composingStopTimeout() {
|
||||
this._composingTimeoutId = 0;
|
||||
|
||||
this.notification.source.setChatState(Tp.ChannelChatState.PAUSED);
|
||||
@ -969,7 +965,7 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
_onEntryChanged: function() {
|
||||
_onEntryChanged() {
|
||||
let text = this._responseEntry.get_text();
|
||||
|
||||
// If we're typing, we want to send COMPOSING.
|
||||
@ -988,7 +984,7 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
|
||||
this._composingTimeoutId = Mainloop.timeout_add_seconds(
|
||||
COMPOSING_STOP_TIMEOUT,
|
||||
Lang.bind(this, this._composingStopTimeout));
|
||||
this._composingStopTimeout.bind(this));
|
||||
GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout');
|
||||
} else {
|
||||
this.notification.source.setChatState(Tp.ChannelChatState.ACTIVE);
|
||||
|
@ -24,14 +24,14 @@ var SortGroup = {
|
||||
var CtrlAltTabManager = new Lang.Class({
|
||||
Name: 'CtrlAltTabManager',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._items = [];
|
||||
this.addGroup(global.window_group, _("Windows"),
|
||||
'focus-windows-symbolic', { sortGroup: SortGroup.TOP,
|
||||
focusCallback: Lang.bind(this, this._focusWindows) });
|
||||
focusCallback: this._focusWindows.bind(this) });
|
||||
},
|
||||
|
||||
addGroup: function(root, name, icon, params) {
|
||||
addGroup(root, name, icon, params) {
|
||||
let item = Params.parse(params, { sortGroup: SortGroup.MIDDLE,
|
||||
proxy: root,
|
||||
focusCallback: null });
|
||||
@ -41,12 +41,12 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
item.iconName = icon;
|
||||
|
||||
this._items.push(item);
|
||||
root.connect('destroy', Lang.bind(this, function() { this.removeGroup(root); }));
|
||||
root.connect('destroy', () => { this.removeGroup(root); });
|
||||
if (root instanceof St.Widget)
|
||||
global.focus_manager.add_group(root);
|
||||
},
|
||||
|
||||
removeGroup: function(root) {
|
||||
removeGroup(root) {
|
||||
if (root instanceof St.Widget)
|
||||
global.focus_manager.remove_group(root);
|
||||
for (let i = 0; i < this._items.length; i++) {
|
||||
@ -57,7 +57,7 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
focusGroup: function(item, timestamp) {
|
||||
focusGroup(item, timestamp) {
|
||||
if (item.focusCallback)
|
||||
item.focusCallback(timestamp);
|
||||
else
|
||||
@ -68,7 +68,7 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
// and everything else in between, sorted by X coordinate, so that
|
||||
// they will have the same left-to-right ordering in the
|
||||
// Ctrl-Alt-Tab dialog as they do onscreen.
|
||||
_sortItems: function(a, b) {
|
||||
_sortItems(a, b) {
|
||||
if (a.sortGroup != b.sortGroup)
|
||||
return a.sortGroup - b.sortGroup;
|
||||
|
||||
@ -79,9 +79,9 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
return ax - bx;
|
||||
},
|
||||
|
||||
popup: function(backward, binding, mask) {
|
||||
popup(backward, binding, mask) {
|
||||
// Start with the set of focus groups that are currently mapped
|
||||
let items = this._items.filter(function (item) { return item.proxy.mapped; });
|
||||
let items = this._items.filter(item => item.proxy.mapped);
|
||||
|
||||
// And add the windows metacity would show in its Ctrl-Alt-Tab list
|
||||
if (Main.sessionMode.hasWindows && !Main.overview.visible) {
|
||||
@ -105,10 +105,9 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
|
||||
items.push({ name: windows[i].title,
|
||||
proxy: windows[i].get_compositor_private(),
|
||||
focusCallback: Lang.bind(windows[i],
|
||||
function(timestamp) {
|
||||
Main.activateWindow(this, timestamp);
|
||||
}),
|
||||
focusCallback: function(timestamp) {
|
||||
Main.activateWindow(this, timestamp);
|
||||
}.bind(windows[i]),
|
||||
iconActor: icon,
|
||||
iconName: iconName,
|
||||
sortGroup: SortGroup.MIDDLE });
|
||||
@ -118,20 +117,20 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
if (!items.length)
|
||||
return;
|
||||
|
||||
items.sort(Lang.bind(this, this._sortItems));
|
||||
items.sort(this._sortItems.bind(this));
|
||||
|
||||
if (!this._popup) {
|
||||
this._popup = new CtrlAltTabPopup(items);
|
||||
this._popup.show(backward, binding, mask);
|
||||
|
||||
this._popup.actor.connect('destroy',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._popup = null;
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_focusWindows: function(timestamp) {
|
||||
_focusWindows(timestamp) {
|
||||
global.screen.focus_default_window(timestamp);
|
||||
}
|
||||
});
|
||||
@ -140,13 +139,13 @@ var CtrlAltTabPopup = new Lang.Class({
|
||||
Name: 'CtrlAltTabPopup',
|
||||
Extends: SwitcherPopup.SwitcherPopup,
|
||||
|
||||
_init: function(items) {
|
||||
_init(items) {
|
||||
this.parent(items);
|
||||
|
||||
this._switcherList = new CtrlAltTabSwitcher(this._items);
|
||||
},
|
||||
|
||||
_keyPressHandler: function(keysym, action) {
|
||||
_keyPressHandler(keysym, action) {
|
||||
if (action == Meta.KeyBindingAction.SWITCH_PANELS)
|
||||
this._select(this._next());
|
||||
else if (action == Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD)
|
||||
@ -161,7 +160,7 @@ var CtrlAltTabPopup = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_finish : function(time) {
|
||||
_finish(time) {
|
||||
this.parent(time);
|
||||
Main.ctrlAltTabManager.focusGroup(this._items[this._selectedIndex], time);
|
||||
},
|
||||
@ -171,14 +170,14 @@ var CtrlAltTabSwitcher = new Lang.Class({
|
||||
Name: 'CtrlAltTabSwitcher',
|
||||
Extends: SwitcherPopup.SwitcherList,
|
||||
|
||||
_init : function(items) {
|
||||
_init(items) {
|
||||
this.parent(true);
|
||||
|
||||
for (let i = 0; i < items.length; i++)
|
||||
this._addIcon(items[i]);
|
||||
},
|
||||
|
||||
_addIcon : function(item) {
|
||||
_addIcon(item) {
|
||||
let box = new St.BoxLayout({ style_class: 'alt-tab-app',
|
||||
vertical: true });
|
||||
|
||||
|
198
js/ui/dash.js
198
js/ui/dash.js
@ -37,7 +37,7 @@ var DashItemContainer = new Lang.Class({
|
||||
Name: 'DashItemContainer',
|
||||
Extends: St.Widget,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent({ style_class: 'dash-item-container' });
|
||||
|
||||
this._labelText = "";
|
||||
@ -56,7 +56,7 @@ var DashItemContainer = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
vfunc_allocate: function(box, flags) {
|
||||
vfunc_allocate(box, flags) {
|
||||
this.set_allocation(box, flags);
|
||||
|
||||
if (this.child == null)
|
||||
@ -80,7 +80,7 @@ var DashItemContainer = new Lang.Class({
|
||||
this.child.allocate(childBox, flags);
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(forWidth) {
|
||||
vfunc_get_preferred_height(forWidth) {
|
||||
let themeNode = this.get_theme_node();
|
||||
|
||||
if (this.child == null)
|
||||
@ -92,7 +92,7 @@ var DashItemContainer = new Lang.Class({
|
||||
natHeight * this.child.scale_y);
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(forHeight) {
|
||||
vfunc_get_preferred_width(forHeight) {
|
||||
let themeNode = this.get_theme_node();
|
||||
|
||||
if (this.child == null)
|
||||
@ -104,7 +104,7 @@ var DashItemContainer = new Lang.Class({
|
||||
natWidth * this.child.scale_y);
|
||||
},
|
||||
|
||||
showLabel: function() {
|
||||
showLabel() {
|
||||
if (!this._labelText)
|
||||
return;
|
||||
|
||||
@ -138,23 +138,23 @@ var DashItemContainer = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
setLabelText: function(text) {
|
||||
setLabelText(text) {
|
||||
this._labelText = text;
|
||||
this.child.accessible_name = text;
|
||||
},
|
||||
|
||||
hideLabel: function () {
|
||||
hideLabel() {
|
||||
Tweener.addTween(this.label,
|
||||
{ opacity: 0,
|
||||
time: DASH_ITEM_LABEL_HIDE_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.label.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setChild: function(actor) {
|
||||
setChild(actor) {
|
||||
if (this.child == actor)
|
||||
return;
|
||||
|
||||
@ -168,7 +168,7 @@ var DashItemContainer = new Lang.Class({
|
||||
this.child.set_opacity(this._childOpacity);
|
||||
},
|
||||
|
||||
show: function(animate) {
|
||||
show(animate) {
|
||||
if (this.child == null)
|
||||
return;
|
||||
|
||||
@ -181,7 +181,7 @@ var DashItemContainer = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
animateOutAndDestroy: function() {
|
||||
animateOutAndDestroy() {
|
||||
this.label.hide();
|
||||
|
||||
if (this.child == null) {
|
||||
@ -195,9 +195,9 @@ var DashItemContainer = new Lang.Class({
|
||||
childOpacity: 0,
|
||||
time: DASH_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.destroy();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -235,7 +235,7 @@ var ShowAppsIcon = new Lang.Class({
|
||||
Name: 'ShowAppsIcon',
|
||||
Extends: DashItemContainer,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
this.toggleButton = new St.Button({ style_class: 'show-apps',
|
||||
@ -246,7 +246,7 @@ var ShowAppsIcon = new Lang.Class({
|
||||
this.icon = new IconGrid.BaseIcon(_("Show Applications"),
|
||||
{ setSizeManually: true,
|
||||
showLabel: false,
|
||||
createIcon: Lang.bind(this, this._createIcon) });
|
||||
createIcon: this._createIcon.bind(this) });
|
||||
this.toggleButton.add_actor(this.icon.actor);
|
||||
this.toggleButton._delegate = this;
|
||||
|
||||
@ -254,7 +254,7 @@ var ShowAppsIcon = new Lang.Class({
|
||||
this.setDragApp(null);
|
||||
},
|
||||
|
||||
_createIcon: function(size) {
|
||||
_createIcon(size) {
|
||||
this._iconActor = new St.Icon({ icon_name: 'view-app-grid-symbolic',
|
||||
icon_size: size,
|
||||
style_class: 'show-apps-icon',
|
||||
@ -262,7 +262,7 @@ var ShowAppsIcon = new Lang.Class({
|
||||
return this._iconActor;
|
||||
},
|
||||
|
||||
_canRemoveApp: function(app) {
|
||||
_canRemoveApp(app) {
|
||||
if (app == null)
|
||||
return false;
|
||||
|
||||
@ -274,7 +274,7 @@ var ShowAppsIcon = new Lang.Class({
|
||||
return isFavorite;
|
||||
},
|
||||
|
||||
setDragApp: function(app) {
|
||||
setDragApp(app) {
|
||||
let canRemove = this._canRemoveApp(app);
|
||||
|
||||
this.toggleButton.set_hover(canRemove);
|
||||
@ -287,25 +287,24 @@ var ShowAppsIcon = new Lang.Class({
|
||||
this.setLabelText(_("Show Applications"));
|
||||
},
|
||||
|
||||
handleDragOver: function(source, actor, x, y, time) {
|
||||
handleDragOver(source, actor, x, y, time) {
|
||||
if (!this._canRemoveApp(getAppFromSource(source)))
|
||||
return DND.DragMotionResult.NO_DROP;
|
||||
|
||||
return DND.DragMotionResult.MOVE_DROP;
|
||||
},
|
||||
|
||||
acceptDrop: function(source, actor, x, y, time) {
|
||||
acceptDrop(source, actor, x, y, time) {
|
||||
let app = getAppFromSource(source);
|
||||
if (!this._canRemoveApp(app))
|
||||
return false;
|
||||
|
||||
let id = app.get_id();
|
||||
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||
function () {
|
||||
AppFavorites.getAppFavorites().removeFavorite(id);
|
||||
return false;
|
||||
}));
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
AppFavorites.getAppFavorites().removeFavorite(id);
|
||||
return false;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -315,7 +314,7 @@ var DragPlaceholderItem = new Lang.Class({
|
||||
Name: 'DragPlaceholderItem',
|
||||
Extends: DashItemContainer,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
this.setChild(new St.Bin({ style_class: 'placeholder' }));
|
||||
}
|
||||
@ -325,7 +324,7 @@ var EmptyDropTargetItem = new Lang.Class({
|
||||
Name: 'EmptyDropTargetItem',
|
||||
Extends: DashItemContainer,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
this.setChild(new St.Bin({ style_class: 'empty-dash-drop-target' }));
|
||||
}
|
||||
@ -335,14 +334,14 @@ var DashActor = new Lang.Class({
|
||||
Name: 'DashActor',
|
||||
Extends: St.Widget,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
let layout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||
this.parent({ name: 'dash',
|
||||
layout_manager: layout,
|
||||
clip_to_allocation: true });
|
||||
},
|
||||
|
||||
vfunc_allocate: function(box, flags) {
|
||||
vfunc_allocate(box, flags) {
|
||||
let contentBox = this.get_theme_node().get_content_box(box);
|
||||
let availWidth = contentBox.x2 - contentBox.x1;
|
||||
|
||||
@ -363,7 +362,7 @@ var DashActor = new Lang.Class({
|
||||
showAppsButton.allocate(childBox, flags);
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(forWidth) {
|
||||
vfunc_get_preferred_height(forWidth) {
|
||||
// We want to request the natural height of all our children
|
||||
// as our natural height, so we chain up to StWidget (which
|
||||
// then calls BoxLayout), but we only request the showApps
|
||||
@ -386,7 +385,7 @@ const baseIconSizes = [ 16, 22, 24, 32, 48, 64 ];
|
||||
var Dash = new Lang.Class({
|
||||
Name: 'Dash',
|
||||
|
||||
_init : function() {
|
||||
_init() {
|
||||
this._maxHeight = -1;
|
||||
this.iconSize = 64;
|
||||
this._shownInitially = false;
|
||||
@ -415,40 +414,39 @@ var Dash = new Lang.Class({
|
||||
this._container.add_actor(this._showAppsIcon);
|
||||
|
||||
this.actor = new St.Bin({ child: this._container });
|
||||
this.actor.connect('notify::height', Lang.bind(this,
|
||||
function() {
|
||||
if (this._maxHeight != this.actor.height)
|
||||
this._queueRedisplay();
|
||||
this._maxHeight = this.actor.height;
|
||||
}));
|
||||
this.actor.connect('notify::height', () => {
|
||||
if (this._maxHeight != this.actor.height)
|
||||
this._queueRedisplay();
|
||||
this._maxHeight = this.actor.height;
|
||||
});
|
||||
|
||||
this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay));
|
||||
this._workId = Main.initializeDeferredWork(this._box, this._redisplay.bind(this));
|
||||
|
||||
this._appSystem = Shell.AppSystem.get_default();
|
||||
|
||||
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
||||
this._appSystem.connect('installed-changed', () => {
|
||||
AppFavorites.getAppFavorites().reload();
|
||||
this._queueRedisplay();
|
||||
}));
|
||||
AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay));
|
||||
this._appSystem.connect('app-state-changed', Lang.bind(this, this._queueRedisplay));
|
||||
});
|
||||
AppFavorites.getAppFavorites().connect('changed', this._queueRedisplay.bind(this));
|
||||
this._appSystem.connect('app-state-changed', this._queueRedisplay.bind(this));
|
||||
|
||||
Main.overview.connect('item-drag-begin',
|
||||
Lang.bind(this, this._onDragBegin));
|
||||
this._onDragBegin.bind(this));
|
||||
Main.overview.connect('item-drag-end',
|
||||
Lang.bind(this, this._onDragEnd));
|
||||
this._onDragEnd.bind(this));
|
||||
Main.overview.connect('item-drag-cancelled',
|
||||
Lang.bind(this, this._onDragCancelled));
|
||||
this._onDragCancelled.bind(this));
|
||||
|
||||
// Translators: this is the name of the dock/favorites area on
|
||||
// the left of the overview
|
||||
Main.ctrlAltTabManager.addGroup(this.actor, _("Dash"), 'user-bookmarks-symbolic');
|
||||
},
|
||||
|
||||
_onDragBegin: function() {
|
||||
_onDragBegin() {
|
||||
this._dragCancelled = false;
|
||||
this._dragMonitor = {
|
||||
dragMotion: Lang.bind(this, this._onDragMotion)
|
||||
dragMotion: this._onDragMotion.bind(this)
|
||||
};
|
||||
DND.addDragMonitor(this._dragMonitor);
|
||||
|
||||
@ -459,26 +457,26 @@ var Dash = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onDragCancelled: function() {
|
||||
_onDragCancelled() {
|
||||
this._dragCancelled = true;
|
||||
this._endDrag();
|
||||
},
|
||||
|
||||
_onDragEnd: function() {
|
||||
_onDragEnd() {
|
||||
if (this._dragCancelled)
|
||||
return;
|
||||
|
||||
this._endDrag();
|
||||
},
|
||||
|
||||
_endDrag: function() {
|
||||
_endDrag() {
|
||||
this._clearDragPlaceholder();
|
||||
this._clearEmptyDropTarget();
|
||||
this._showAppsIcon.setDragApp(null);
|
||||
DND.removeDragMonitor(this._dragMonitor);
|
||||
},
|
||||
|
||||
_onDragMotion: function(dragEvent) {
|
||||
_onDragMotion(dragEvent) {
|
||||
let app = getAppFromSource(dragEvent.source);
|
||||
if (app == null)
|
||||
return DND.DragMotionResult.CONTINUE;
|
||||
@ -497,56 +495,56 @@ var Dash = new Lang.Class({
|
||||
return DND.DragMotionResult.CONTINUE;
|
||||
},
|
||||
|
||||
_appIdListToHash: function(apps) {
|
||||
_appIdListToHash(apps) {
|
||||
let ids = {};
|
||||
for (let i = 0; i < apps.length; i++)
|
||||
ids[apps[i].get_id()] = apps[i];
|
||||
return ids;
|
||||
},
|
||||
|
||||
_queueRedisplay: function () {
|
||||
_queueRedisplay() {
|
||||
Main.queueDeferredWork(this._workId);
|
||||
},
|
||||
|
||||
_hookUpLabel: function(item, appIcon) {
|
||||
item.child.connect('notify::hover', Lang.bind(this, function() {
|
||||
_hookUpLabel(item, appIcon) {
|
||||
item.child.connect('notify::hover', () => {
|
||||
this._syncLabel(item, appIcon);
|
||||
}));
|
||||
});
|
||||
|
||||
let id = Main.overview.connect('hiding', Lang.bind(this, function() {
|
||||
let id = Main.overview.connect('hiding', () => {
|
||||
this._labelShowing = false;
|
||||
item.hideLabel();
|
||||
}));
|
||||
item.child.connect('destroy', function() {
|
||||
});
|
||||
item.child.connect('destroy', () => {
|
||||
Main.overview.disconnect(id);
|
||||
});
|
||||
|
||||
if (appIcon) {
|
||||
appIcon.connect('sync-tooltip', Lang.bind(this, function() {
|
||||
appIcon.connect('sync-tooltip', () => {
|
||||
this._syncLabel(item, appIcon);
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_createAppItem: function(app) {
|
||||
_createAppItem(app) {
|
||||
let appIcon = new AppDisplay.AppIcon(app,
|
||||
{ setSizeManually: true,
|
||||
showLabel: false });
|
||||
if (appIcon._draggable) {
|
||||
appIcon._draggable.connect('drag-begin',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
appIcon.actor.opacity = 50;
|
||||
}));
|
||||
});
|
||||
appIcon._draggable.connect('drag-end',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
appIcon.actor.opacity = 255;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
appIcon.connect('menu-state-changed',
|
||||
Lang.bind(this, function(appIcon, opened) {
|
||||
(appIcon, opened) => {
|
||||
this._itemMenuStateChanged(item, opened);
|
||||
}));
|
||||
});
|
||||
|
||||
let item = new DashItemContainer();
|
||||
item.setChild(appIcon.actor);
|
||||
@ -562,7 +560,7 @@ var Dash = new Lang.Class({
|
||||
return item;
|
||||
},
|
||||
|
||||
_itemMenuStateChanged: function(item, opened) {
|
||||
_itemMenuStateChanged(item, opened) {
|
||||
// When the menu closes, it calls sync_hover, which means
|
||||
// that the notify::hover handler does everything we need to.
|
||||
if (opened) {
|
||||
@ -575,19 +573,19 @@ var Dash = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_syncLabel: function (item, appIcon) {
|
||||
_syncLabel(item, appIcon) {
|
||||
let shouldShow = appIcon ? appIcon.shouldShowTooltip() : item.child.get_hover();
|
||||
|
||||
if (shouldShow) {
|
||||
if (this._showLabelTimeoutId == 0) {
|
||||
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
|
||||
this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._labelShowing = true;
|
||||
item.showLabel();
|
||||
this._showLabelTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
|
||||
if (this._resetHoverTimeoutId > 0) {
|
||||
Mainloop.source_remove(this._resetHoverTimeoutId);
|
||||
@ -601,22 +599,22 @@ var Dash = new Lang.Class({
|
||||
item.hideLabel();
|
||||
if (this._labelShowing) {
|
||||
this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._labelShowing = false;
|
||||
this._resetHoverTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_adjustIconSize: function() {
|
||||
_adjustIconSize() {
|
||||
// For the icon size, we only consider children which are "proper"
|
||||
// icons (i.e. ignoring drag placeholders) and which are not
|
||||
// animating out (which means they will be destroyed at the end of
|
||||
// the animation)
|
||||
let iconChildren = this._box.get_children().filter(function(actor) {
|
||||
let iconChildren = this._box.get_children().filter(actor => {
|
||||
return actor.child &&
|
||||
actor.child._delegate &&
|
||||
actor.child._delegate.icon &&
|
||||
@ -655,9 +653,7 @@ var Dash = new Lang.Class({
|
||||
|
||||
let availSize = availHeight / iconChildren.length;
|
||||
|
||||
let iconSizes = baseIconSizes.map(function(s) {
|
||||
return s * scaleFactor;
|
||||
});
|
||||
let iconSizes = baseIconSizes.map(s => s * scaleFactor);
|
||||
|
||||
let newIconSize = baseIconSizes[0];
|
||||
for (let i = 0; i < iconSizes.length; i++) {
|
||||
@ -703,20 +699,18 @@ var Dash = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_redisplay: function () {
|
||||
_redisplay() {
|
||||
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
|
||||
|
||||
let running = this._appSystem.get_running();
|
||||
|
||||
let children = this._box.get_children().filter(function(actor) {
|
||||
let children = this._box.get_children().filter(actor => {
|
||||
return actor.child &&
|
||||
actor.child._delegate &&
|
||||
actor.child._delegate.app;
|
||||
});
|
||||
// Apps currently in the dash
|
||||
let oldApps = children.map(function(actor) {
|
||||
return actor.child._delegate.app;
|
||||
});
|
||||
let oldApps = children.map(actor => actor.child._delegate.app);
|
||||
// Apps supposed to be in the dash
|
||||
let newApps = [];
|
||||
|
||||
@ -782,7 +776,7 @@ var Dash = new Lang.Class({
|
||||
let nextApp = newApps.length > newIndex + 1 ? newApps[newIndex + 1]
|
||||
: null;
|
||||
let insertHere = nextApp && nextApp == oldApp;
|
||||
let alreadyRemoved = removedActors.reduce(function(result, actor) {
|
||||
let alreadyRemoved = removedActors.reduce((result, actor) => {
|
||||
let removedApp = actor.child._delegate.app;
|
||||
return result || removedApp == newApp;
|
||||
}, false);
|
||||
@ -834,27 +828,26 @@ var Dash = new Lang.Class({
|
||||
this._box.queue_relayout();
|
||||
},
|
||||
|
||||
_clearDragPlaceholder: function() {
|
||||
_clearDragPlaceholder() {
|
||||
if (this._dragPlaceholder) {
|
||||
this._animatingPlaceholdersCount++;
|
||||
this._dragPlaceholder.animateOutAndDestroy();
|
||||
this._dragPlaceholder.connect('destroy',
|
||||
Lang.bind(this, function() {
|
||||
this._animatingPlaceholdersCount--;
|
||||
}));
|
||||
this._dragPlaceholder.connect('destroy', () => {
|
||||
this._animatingPlaceholdersCount--;
|
||||
});
|
||||
this._dragPlaceholder = null;
|
||||
}
|
||||
this._dragPlaceholderPos = -1;
|
||||
},
|
||||
|
||||
_clearEmptyDropTarget: function() {
|
||||
_clearEmptyDropTarget() {
|
||||
if (this._emptyDropTarget) {
|
||||
this._emptyDropTarget.animateOutAndDestroy();
|
||||
this._emptyDropTarget = null;
|
||||
}
|
||||
},
|
||||
|
||||
handleDragOver : function(source, actor, x, y, time) {
|
||||
handleDragOver(source, actor, x, y, time) {
|
||||
let app = getAppFromSource(source);
|
||||
|
||||
// Don't allow favoriting of transient apps
|
||||
@ -932,7 +925,7 @@ var Dash = new Lang.Class({
|
||||
},
|
||||
|
||||
// Draggable target interface
|
||||
acceptDrop : function(source, actor, x, y, time) {
|
||||
acceptDrop(source, actor, x, y, time) {
|
||||
let app = getAppFromSource(source);
|
||||
|
||||
// Don't allow favoriting of transient apps
|
||||
@ -968,15 +961,14 @@ var Dash = new Lang.Class({
|
||||
if (!this._dragPlaceholder)
|
||||
return true;
|
||||
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||
function () {
|
||||
let appFavorites = AppFavorites.getAppFavorites();
|
||||
if (srcIsFavorite)
|
||||
appFavorites.moveFavoriteToPos(id, favPos);
|
||||
else
|
||||
appFavorites.addFavoriteAtPos(id, favPos);
|
||||
return false;
|
||||
}));
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
let appFavorites = AppFavorites.getAppFavorites();
|
||||
if (srcIsFavorite)
|
||||
appFavorites.moveFavoriteToPos(id, favPos);
|
||||
else
|
||||
appFavorites.addFavoriteAtPos(id, favPos);
|
||||
return false;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ function _isToday(date) {
|
||||
var TodayButton = new Lang.Class({
|
||||
Name: 'TodayButton',
|
||||
|
||||
_init: function(calendar) {
|
||||
_init(calendar) {
|
||||
// Having the ability to go to the current date if the user is already
|
||||
// on the current date can be confusing. So don't make the button reactive
|
||||
// until the selected date changes.
|
||||
@ -43,10 +43,9 @@ var TodayButton = new Lang.Class({
|
||||
can_focus: true,
|
||||
reactive: false
|
||||
});
|
||||
this.actor.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this._calendar.setDate(new Date(), false);
|
||||
}));
|
||||
this.actor.connect('clicked', () => {
|
||||
this._calendar.setDate(new Date(), false);
|
||||
});
|
||||
|
||||
let hbox = new St.BoxLayout({ vertical: true });
|
||||
this.actor.add_actor(hbox);
|
||||
@ -59,15 +58,14 @@ var TodayButton = new Lang.Class({
|
||||
hbox.add_actor(this._dateLabel);
|
||||
|
||||
this._calendar = calendar;
|
||||
this._calendar.connect('selected-date-changed', Lang.bind(this,
|
||||
function(calendar, date) {
|
||||
// Make the button reactive only if the selected date is not the
|
||||
// current date.
|
||||
this.actor.reactive = !_isToday(date)
|
||||
}));
|
||||
this._calendar.connect('selected-date-changed', (calendar, date) => {
|
||||
// Make the button reactive only if the selected date is not the
|
||||
// current date.
|
||||
this.actor.reactive = !_isToday(date)
|
||||
});
|
||||
},
|
||||
|
||||
setDate: function(date) {
|
||||
setDate(date) {
|
||||
this._dayLabel.set_text(date.toLocaleFormat('%A'));
|
||||
|
||||
/* Translators: This is the date format to use when the calendar popup is
|
||||
@ -88,7 +86,7 @@ var TodayButton = new Lang.Class({
|
||||
var WorldClocksSection = new Lang.Class({
|
||||
Name: 'WorldClocksSection',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._clock = new GnomeDesktop.WallClock();
|
||||
this._clockNotifyId = 0;
|
||||
|
||||
@ -97,13 +95,12 @@ var WorldClocksSection = new Lang.Class({
|
||||
this.actor = new St.Button({ style_class: 'world-clocks-button',
|
||||
x_fill: true,
|
||||
can_focus: true });
|
||||
this.actor.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this._clockAppMon.activateApp();
|
||||
this.actor.connect('clicked', () => {
|
||||
this._clockAppMon.activateApp();
|
||||
|
||||
Main.overview.hide();
|
||||
Main.panel.closeCalendar();
|
||||
}));
|
||||
Main.overview.hide();
|
||||
Main.panel.closeCalendar();
|
||||
});
|
||||
|
||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||
this._grid = new St.Widget({ style_class: 'world-clocks-grid',
|
||||
@ -115,17 +112,17 @@ var WorldClocksSection = new Lang.Class({
|
||||
this._clockAppMon = new Util.AppSettingsMonitor('org.gnome.clocks.desktop',
|
||||
'org.gnome.clocks');
|
||||
this._clockAppMon.connect('available-changed',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync.bind(this));
|
||||
this._clockAppMon.watchSetting('world-clocks',
|
||||
Lang.bind(this, this._clocksChanged));
|
||||
this._clocksChanged.bind(this));
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
this.actor.visible = this._clockAppMon.available;
|
||||
},
|
||||
|
||||
_clocksChanged: function(settings) {
|
||||
_clocksChanged(settings) {
|
||||
this._grid.destroy_all_children();
|
||||
this._locations = [];
|
||||
|
||||
@ -139,7 +136,7 @@ var WorldClocksSection = new Lang.Class({
|
||||
this._locations.push({ location: l });
|
||||
}
|
||||
|
||||
this._locations.sort(function(a, b) {
|
||||
this._locations.sort((a, b) => {
|
||||
return a.location.get_timezone().get_offset() -
|
||||
b.location.get_timezone().get_offset();
|
||||
});
|
||||
@ -156,8 +153,10 @@ var WorldClocksSection = new Lang.Class({
|
||||
for (let i = 0; i < this._locations.length; i++) {
|
||||
let l = this._locations[i].location;
|
||||
|
||||
let name = l.get_level() == GWeather.LocationLevel.NAMED_TIMEZONE ? l.get_name()
|
||||
: l.get_city_name();
|
||||
let label = new St.Label({ style_class: 'world-clocks-city',
|
||||
text: l.get_city_name(),
|
||||
text: name,
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
x_expand: true });
|
||||
|
||||
@ -179,7 +178,7 @@ var WorldClocksSection = new Lang.Class({
|
||||
if (this._grid.get_n_children() > 1) {
|
||||
if (!this._clockNotifyId)
|
||||
this._clockNotifyId =
|
||||
this._clock.connect('notify::clock', Lang.bind(this, this._updateLabels));
|
||||
this._clock.connect('notify::clock', this._updateLabels.bind(this));
|
||||
this._updateLabels();
|
||||
} else {
|
||||
if (this._clockNotifyId)
|
||||
@ -188,7 +187,7 @@ var WorldClocksSection = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateLabels: function() {
|
||||
_updateLabels() {
|
||||
for (let i = 0; i < this._locations.length; i++) {
|
||||
let l = this._locations[i];
|
||||
let tz = GLib.TimeZone.new(l.location.get_timezone().get_tzid());
|
||||
@ -201,7 +200,7 @@ var WorldClocksSection = new Lang.Class({
|
||||
var WeatherSection = new Lang.Class({
|
||||
Name: 'WeatherSection',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._weatherClient = new Weather.WeatherClient();
|
||||
|
||||
this.actor = new St.Button({ style_class: 'weather-button',
|
||||
@ -233,11 +232,11 @@ var WeatherSection = new Lang.Class({
|
||||
this._conditionsLabel.clutter_text.line_wrap = true;
|
||||
box.add_child(this._conditionsLabel);
|
||||
|
||||
this._weatherClient.connect('changed', Lang.bind(this, this._sync));
|
||||
this._weatherClient.connect('changed', this._sync.bind(this));
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_getSummary: function(info, capitalize=false) {
|
||||
_getSummary(info, capitalize=false) {
|
||||
let options = capitalize ? GWeather.FormatOptions.SENTENCE_CAPITALIZATION
|
||||
: GWeather.FormatOptions.NO_CAPITALIZATION;
|
||||
|
||||
@ -251,7 +250,7 @@ var WeatherSection = new Lang.Class({
|
||||
return GWeather.Sky.to_string_full(sky, options);
|
||||
},
|
||||
|
||||
_sameSummary: function(info1, info2) {
|
||||
_sameSummary(info1, info2) {
|
||||
let [ok1, phenom1, qualifier1] = info1.get_value_conditions();
|
||||
let [ok2, phenom2, qualifier2] = info2.get_value_conditions();
|
||||
if (ok1 || ok2)
|
||||
@ -262,7 +261,7 @@ var WeatherSection = new Lang.Class({
|
||||
return sky1 == sky2;
|
||||
},
|
||||
|
||||
_getSummaryText: function() {
|
||||
_getSummaryText() {
|
||||
let info = this._weatherClient.info;
|
||||
let forecasts = info.get_forecast_list();
|
||||
if (forecasts.length == 0) // No forecasts, just current conditions
|
||||
@ -310,7 +309,7 @@ var WeatherSection = new Lang.Class({
|
||||
return String.prototype.format.apply(fmt, summaries);
|
||||
},
|
||||
|
||||
_getLabelText: function() {
|
||||
_getLabelText() {
|
||||
if (!this._weatherClient.hasLocation)
|
||||
return _("Select a location…");
|
||||
|
||||
@ -329,7 +328,7 @@ var WeatherSection = new Lang.Class({
|
||||
return _("Weather information is currently unavailable");
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
this.actor.visible = this._weatherClient.available;
|
||||
|
||||
if (!this.actor.visible)
|
||||
@ -342,7 +341,7 @@ var WeatherSection = new Lang.Class({
|
||||
var MessagesIndicator = new Lang.Class({
|
||||
Name: 'MessagesIndicator',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.Icon({ icon_name: 'message-indicator-symbolic',
|
||||
icon_size: 16,
|
||||
visible: false, y_expand: true,
|
||||
@ -350,31 +349,28 @@ var MessagesIndicator = new Lang.Class({
|
||||
|
||||
this._sources = [];
|
||||
|
||||
Main.messageTray.connect('source-added', Lang.bind(this, this._onSourceAdded));
|
||||
Main.messageTray.connect('source-removed', Lang.bind(this, this._onSourceRemoved));
|
||||
Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount));
|
||||
Main.messageTray.connect('source-added', this._onSourceAdded.bind(this));
|
||||
Main.messageTray.connect('source-removed', this._onSourceRemoved.bind(this));
|
||||
Main.messageTray.connect('queue-changed', this._updateCount.bind(this));
|
||||
|
||||
let sources = Main.messageTray.getSources();
|
||||
sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); }));
|
||||
sources.forEach(source => { this._onSourceAdded(null, source); });
|
||||
},
|
||||
|
||||
_onSourceAdded: function(tray, source) {
|
||||
source.connect('count-updated', Lang.bind(this, this._updateCount));
|
||||
_onSourceAdded(tray, source) {
|
||||
source.connect('count-updated', this._updateCount.bind(this));
|
||||
this._sources.push(source);
|
||||
this._updateCount();
|
||||
},
|
||||
|
||||
_onSourceRemoved: function(tray, source) {
|
||||
_onSourceRemoved(tray, source) {
|
||||
this._sources.splice(this._sources.indexOf(source), 1);
|
||||
this._updateCount();
|
||||
},
|
||||
|
||||
_updateCount: function() {
|
||||
_updateCount() {
|
||||
let count = 0;
|
||||
this._sources.forEach(Lang.bind(this,
|
||||
function(source) {
|
||||
count += source.unseenCount;
|
||||
}));
|
||||
this._sources.forEach(source => { count += source.unseenCount; });
|
||||
count -= Main.messageTray.queueCount;
|
||||
|
||||
this.actor.visible = (count > 0);
|
||||
@ -385,19 +381,19 @@ var IndicatorPad = new Lang.Class({
|
||||
Name: 'IndicatorPad',
|
||||
Extends: St.Widget,
|
||||
|
||||
_init: function(actor) {
|
||||
_init(actor) {
|
||||
this._source = actor;
|
||||
this._source.connect('notify::visible', () => { this.queue_relayout(); });
|
||||
this.parent();
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(container, forHeight) {
|
||||
vfunc_get_preferred_width(container, forHeight) {
|
||||
if (this._source.visible)
|
||||
return this._source.get_preferred_width(forHeight);
|
||||
return [0, 0];
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(container, forWidth) {
|
||||
vfunc_get_preferred_height(container, forWidth) {
|
||||
if (this._source.visible)
|
||||
return this._source.get_preferred_height(forWidth);
|
||||
return [0, 0];
|
||||
@ -408,7 +404,7 @@ var FreezableBinLayout = new Lang.Class({
|
||||
Name: 'FreezableBinLayout',
|
||||
Extends: Clutter.BinLayout,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
this._frozen = false;
|
||||
@ -425,19 +421,19 @@ var FreezableBinLayout = new Lang.Class({
|
||||
this.layout_changed();
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(container, forHeight) {
|
||||
vfunc_get_preferred_width(container, forHeight) {
|
||||
if (!this._frozen || this._savedWidth.some(isNaN))
|
||||
return this.parent(container, forHeight);
|
||||
return this._savedWidth;
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(container, forWidth) {
|
||||
vfunc_get_preferred_height(container, forWidth) {
|
||||
if (!this._frozen || this._savedHeight.some(isNaN))
|
||||
return this.parent(container, forWidth);
|
||||
return this._savedHeight;
|
||||
},
|
||||
|
||||
vfunc_allocate: function(container, allocation, flags) {
|
||||
vfunc_allocate(container, allocation, flags) {
|
||||
this.parent(container, allocation, flags);
|
||||
|
||||
let [width, height] = allocation.get_size();
|
||||
@ -450,12 +446,12 @@ var CalendarColumnLayout = new Lang.Class({
|
||||
Name: 'CalendarColumnLayout',
|
||||
Extends: Clutter.BoxLayout,
|
||||
|
||||
_init: function(actor) {
|
||||
_init(actor) {
|
||||
this.parent({ orientation: Clutter.Orientation.VERTICAL });
|
||||
this._calActor = actor;
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(container, forHeight) {
|
||||
vfunc_get_preferred_width(container, forHeight) {
|
||||
if (!this._calActor || this._calActor.get_parent() != container)
|
||||
return this.parent(container, forHeight);
|
||||
return this._calActor.get_preferred_width(forHeight);
|
||||
@ -466,7 +462,7 @@ var DateMenuButton = new Lang.Class({
|
||||
Name: 'DateMenuButton',
|
||||
Extends: PanelMenu.Button,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
let item;
|
||||
let hbox;
|
||||
let vbox;
|
||||
@ -500,12 +496,12 @@ var DateMenuButton = new Lang.Class({
|
||||
|
||||
this._calendar = new Calendar.Calendar();
|
||||
this._calendar.connect('selected-date-changed',
|
||||
Lang.bind(this, function(calendar, date) {
|
||||
(calendar, date) => {
|
||||
layout.frozen = !_isToday(date);
|
||||
this._messageList.setDate(date);
|
||||
}));
|
||||
});
|
||||
|
||||
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
|
||||
this.menu.connect('open-state-changed', (menu, isOpen) => {
|
||||
// Whenever the menu is opened, select today
|
||||
if (isOpen) {
|
||||
let now = new Date();
|
||||
@ -513,7 +509,7 @@ var DateMenuButton = new Lang.Class({
|
||||
this._date.setDate(now);
|
||||
this._messageList.setDate(now);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
// Fill up the first column
|
||||
this._messageList = new Calendar.CalendarMessageList();
|
||||
@ -551,17 +547,17 @@ var DateMenuButton = new Lang.Class({
|
||||
|
||||
this._clock = new GnomeDesktop.WallClock();
|
||||
this._clock.bind_property('clock', this._clockDisplay, 'text', GObject.BindingFlags.SYNC_CREATE);
|
||||
this._clock.connect('notify::timezone', Lang.bind(this, this._updateTimeZone));
|
||||
this._clock.connect('notify::timezone', this._updateTimeZone.bind(this));
|
||||
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
||||
this._sessionUpdated();
|
||||
},
|
||||
|
||||
_getEventSource: function() {
|
||||
_getEventSource() {
|
||||
return new Calendar.DBusEventSource();
|
||||
},
|
||||
|
||||
_setEventSource: function(eventSource) {
|
||||
_setEventSource(eventSource) {
|
||||
if (this._eventSource)
|
||||
this._eventSource.destroy();
|
||||
|
||||
@ -571,7 +567,7 @@ var DateMenuButton = new Lang.Class({
|
||||
this._eventSource = eventSource;
|
||||
},
|
||||
|
||||
_updateTimeZone: function() {
|
||||
_updateTimeZone() {
|
||||
// SpiderMonkey caches the time zone so we must explicitly clear it
|
||||
// before we can update the calendar, see
|
||||
// https://bugzilla.gnome.org/show_bug.cgi?id=678507
|
||||
@ -580,7 +576,7 @@ var DateMenuButton = new Lang.Class({
|
||||
this._calendar.updateTimeZone();
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
_sessionUpdated() {
|
||||
let eventSource;
|
||||
let showEvents = Main.sessionMode.showCalendarEvents;
|
||||
if (showEvents) {
|
||||
|
@ -11,9 +11,9 @@ var Dialog = new Lang.Class({
|
||||
Name: 'Dialog',
|
||||
Extends: St.Widget,
|
||||
|
||||
_init: function (parentActor, styleClass) {
|
||||
_init(parentActor, styleClass) {
|
||||
this.parent({ layout_manager: new Clutter.BinLayout() });
|
||||
this.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
|
||||
this._initialKeyFocus = null;
|
||||
this._initialKeyFocusDestroyId = 0;
|
||||
@ -26,11 +26,11 @@ var Dialog = new Lang.Class({
|
||||
this._dialog.add_style_class_name(styleClass);
|
||||
|
||||
this._parentActor = parentActor;
|
||||
this._eventId = this._parentActor.connect('event', Lang.bind(this, this._modalEventHandler));
|
||||
this._eventId = this._parentActor.connect('event', this._modalEventHandler.bind(this));
|
||||
this._parentActor.add_child(this);
|
||||
},
|
||||
|
||||
_createDialog: function () {
|
||||
_createDialog() {
|
||||
this._dialog = new St.BoxLayout({ style_class: 'modal-dialog',
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
@ -56,13 +56,13 @@ var Dialog = new Lang.Class({
|
||||
y_align: St.Align.START });
|
||||
},
|
||||
|
||||
_onDestroy: function () {
|
||||
_onDestroy() {
|
||||
if (this._eventId != 0)
|
||||
this._parentActor.disconnect(this._eventId);
|
||||
this._eventId = 0;
|
||||
},
|
||||
|
||||
_modalEventHandler: function (actor, event) {
|
||||
_modalEventHandler(actor, event) {
|
||||
if (event.type() == Clutter.EventType.KEY_PRESS) {
|
||||
this._pressedKey = event.get_key_symbol();
|
||||
} else if (event.type() == Clutter.EventType.KEY_RELEASE) {
|
||||
@ -88,7 +88,7 @@ var Dialog = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_setInitialKeyFocus: function(actor) {
|
||||
_setInitialKeyFocus(actor) {
|
||||
if (this._initialKeyFocus)
|
||||
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
||||
|
||||
@ -104,11 +104,11 @@ var Dialog = new Lang.Class({
|
||||
return this._initialKeyFocus || this;
|
||||
},
|
||||
|
||||
addContent: function (actor) {
|
||||
addContent(actor) {
|
||||
this.contentLayout.add (actor, { expand: true });
|
||||
},
|
||||
|
||||
addButton: function (buttonInfo) {
|
||||
addButton(buttonInfo) {
|
||||
let { label, action, key } = buttonInfo;
|
||||
let isDefault = buttonInfo['default'];
|
||||
let keys;
|
||||
@ -145,7 +145,7 @@ var Dialog = new Lang.Class({
|
||||
return button;
|
||||
},
|
||||
|
||||
clearButtons: function () {
|
||||
clearButtons() {
|
||||
this.buttonLayout.destroy_all_children();
|
||||
this._buttonKeys = {};
|
||||
},
|
||||
@ -173,7 +173,7 @@ var MessageDialogContent = new Lang.Class({
|
||||
null)
|
||||
},
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
this._icon = new St.Icon({ y_align: Clutter.ActorAlign.START });
|
||||
this._title = new St.Label({ style_class: 'headline' });
|
||||
this._subtitle = new St.Label();
|
||||
@ -243,7 +243,7 @@ var MessageDialogContent = new Lang.Class({
|
||||
this.notify(prop);
|
||||
},
|
||||
|
||||
insertBeforeBody: function(actor) {
|
||||
insertBeforeBody(actor) {
|
||||
this.messageBox.insert_child_below(actor, this._body);
|
||||
}
|
||||
});
|
||||
|
71
js/ui/dnd.js
71
js/ui/dnd.js
@ -49,10 +49,9 @@ function _getEventHandlerActor() {
|
||||
Main.uiGroup.add_actor(eventHandlerActor);
|
||||
// We connect to 'event' rather than 'captured-event' because the capturing phase doesn't happen
|
||||
// when you've grabbed the pointer.
|
||||
eventHandlerActor.connect('event',
|
||||
function(actor, event) {
|
||||
return currentDraggable._onEvent(actor, event);
|
||||
});
|
||||
eventHandlerActor.connect('event', (actor, event) => {
|
||||
return currentDraggable._onEvent(actor, event);
|
||||
});
|
||||
}
|
||||
return eventHandlerActor;
|
||||
}
|
||||
@ -72,7 +71,7 @@ function removeDragMonitor(monitor) {
|
||||
var _Draggable = new Lang.Class({
|
||||
Name: 'Draggable',
|
||||
|
||||
_init : function(actor, params) {
|
||||
_init(actor, params) {
|
||||
params = Params.parse(params, { manualMode: false,
|
||||
restoreOnSuccess: false,
|
||||
dragActorMaxSize: undefined,
|
||||
@ -81,18 +80,18 @@ var _Draggable = new Lang.Class({
|
||||
this.actor = actor;
|
||||
if (!params.manualMode) {
|
||||
this.actor.connect('button-press-event',
|
||||
Lang.bind(this, this._onButtonPress));
|
||||
this._onButtonPress.bind(this));
|
||||
this.actor.connect('touch-event',
|
||||
Lang.bind(this, this._onTouchEvent));
|
||||
this._onTouchEvent.bind(this));
|
||||
}
|
||||
|
||||
this.actor.connect('destroy', Lang.bind(this, function() {
|
||||
this.actor.connect('destroy', () => {
|
||||
this._actorDestroyed = true;
|
||||
|
||||
if (this._dragInProgress && this._dragCancellable)
|
||||
this._cancelDrag(global.get_current_time());
|
||||
this.disconnectAll();
|
||||
}));
|
||||
});
|
||||
this._onEventId = null;
|
||||
this._touchSequence = null;
|
||||
|
||||
@ -108,7 +107,7 @@ var _Draggable = new Lang.Class({
|
||||
this._eventsGrabbed = false;
|
||||
},
|
||||
|
||||
_onButtonPress : function (actor, event) {
|
||||
_onButtonPress(actor, event) {
|
||||
if (event.get_button() != 1)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -125,7 +124,7 @@ var _Draggable = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_onTouchEvent: function (actor, event) {
|
||||
_onTouchEvent(actor, event) {
|
||||
if (event.type() != Clutter.EventType.TOUCH_BEGIN ||
|
||||
!global.display.is_pointer_emulating_sequence(event.get_event_sequence()))
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
@ -145,7 +144,7 @@ var _Draggable = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_grabDevice: function(actor) {
|
||||
_grabDevice(actor) {
|
||||
let manager = Clutter.DeviceManager.get_default();
|
||||
let pointer = manager.get_core_device(Clutter.InputDeviceType.POINTER_DEVICE);
|
||||
|
||||
@ -157,7 +156,7 @@ var _Draggable = new Lang.Class({
|
||||
this._grabbedDevice = pointer;
|
||||
},
|
||||
|
||||
_ungrabDevice: function() {
|
||||
_ungrabDevice() {
|
||||
if (this._touchSequence)
|
||||
this._grabbedDevice.sequence_ungrab (this._touchSequence);
|
||||
else
|
||||
@ -167,13 +166,13 @@ var _Draggable = new Lang.Class({
|
||||
this._grabbedDevice = null;
|
||||
},
|
||||
|
||||
_grabActor: function() {
|
||||
_grabActor() {
|
||||
this._grabDevice(this.actor);
|
||||
this._onEventId = this.actor.connect('event',
|
||||
Lang.bind(this, this._onEvent));
|
||||
this._onEvent.bind(this));
|
||||
},
|
||||
|
||||
_ungrabActor: function() {
|
||||
_ungrabActor() {
|
||||
if (!this._onEventId)
|
||||
return;
|
||||
|
||||
@ -182,7 +181,7 @@ var _Draggable = new Lang.Class({
|
||||
this._onEventId = null;
|
||||
},
|
||||
|
||||
_grabEvents: function() {
|
||||
_grabEvents() {
|
||||
if (!this._eventsGrabbed) {
|
||||
this._eventsGrabbed = Main.pushModal(_getEventHandlerActor());
|
||||
if (this._eventsGrabbed)
|
||||
@ -190,7 +189,7 @@ var _Draggable = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_ungrabEvents: function() {
|
||||
_ungrabEvents() {
|
||||
if (this._eventsGrabbed) {
|
||||
this._ungrabDevice();
|
||||
Main.popModal(_getEventHandlerActor());
|
||||
@ -198,7 +197,7 @@ var _Draggable = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onEvent: function(actor, event) {
|
||||
_onEvent(actor, event) {
|
||||
// We intercept BUTTON_RELEASE event to know that the button was released in case we
|
||||
// didn't start the drag, to drop the draggable in case the drag was in progress, and
|
||||
// to complete the drag and ensure that whatever happens to be under the pointer does
|
||||
@ -249,7 +248,7 @@ var _Draggable = new Lang.Class({
|
||||
* actors for other purposes (for example if you're using
|
||||
* PopupMenu.ignoreRelease())
|
||||
*/
|
||||
fakeRelease: function() {
|
||||
fakeRelease() {
|
||||
this._buttonDown = false;
|
||||
this._ungrabActor();
|
||||
},
|
||||
@ -264,7 +263,7 @@ var _Draggable = new Lang.Class({
|
||||
* This function is useful to call if you've specified manualMode
|
||||
* for the draggable.
|
||||
*/
|
||||
startDrag: function (stageX, stageY, time, sequence) {
|
||||
startDrag(stageX, stageY, time, sequence) {
|
||||
currentDraggable = this;
|
||||
this._dragInProgress = true;
|
||||
|
||||
@ -371,7 +370,7 @@ var _Draggable = new Lang.Class({
|
||||
scale_y: scale * origScale,
|
||||
time: SCALE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onUpdate: function() {
|
||||
onUpdate() {
|
||||
let currentScale = this._dragActor.scale_x / origScale;
|
||||
this._dragOffsetX = currentScale * origDragOffsetX;
|
||||
this._dragOffsetY = currentScale * origDragOffsetY;
|
||||
@ -383,7 +382,7 @@ var _Draggable = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_maybeStartDrag: function(event) {
|
||||
_maybeStartDrag(event) {
|
||||
let [stageX, stageY] = event.get_coords();
|
||||
|
||||
// See if the user has moved the mouse enough to trigger a drag
|
||||
@ -397,7 +396,7 @@ var _Draggable = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_updateDragHover : function () {
|
||||
_updateDragHover() {
|
||||
this._updateHoverId = 0;
|
||||
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
|
||||
this._dragX, this._dragY);
|
||||
@ -441,16 +440,16 @@ var _Draggable = new Lang.Class({
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
_queueUpdateDragHover: function() {
|
||||
_queueUpdateDragHover() {
|
||||
if (this._updateHoverId)
|
||||
return;
|
||||
|
||||
this._updateHoverId = GLib.idle_add(GLib.PRIORITY_DEFAULT,
|
||||
Lang.bind(this, this._updateDragHover));
|
||||
this._updateDragHover.bind(this));
|
||||
GLib.Source.set_name_by_id(this._updateHoverId, '[gnome-shell] this._updateDragHover');
|
||||
},
|
||||
|
||||
_updateDragPosition : function (event) {
|
||||
_updateDragPosition(event) {
|
||||
let [stageX, stageY] = event.get_coords();
|
||||
this._dragX = stageX;
|
||||
this._dragY = stageY;
|
||||
@ -461,7 +460,7 @@ var _Draggable = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_dragActorDropped: function(event) {
|
||||
_dragActorDropped(event) {
|
||||
let [dropX, dropY] = event.get_coords();
|
||||
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
|
||||
dropX, dropY);
|
||||
@ -524,7 +523,7 @@ var _Draggable = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_getRestoreLocation: function() {
|
||||
_getRestoreLocation() {
|
||||
let x, y, scale;
|
||||
|
||||
if (this._dragActorSource && this._dragActorSource.visible) {
|
||||
@ -556,7 +555,7 @@ var _Draggable = new Lang.Class({
|
||||
return [x, y, scale];
|
||||
},
|
||||
|
||||
_cancelDrag: function(eventTime) {
|
||||
_cancelDrag(eventTime) {
|
||||
this.emit('drag-cancelled', eventTime);
|
||||
this._dragInProgress = false;
|
||||
let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation();
|
||||
@ -581,7 +580,7 @@ var _Draggable = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_restoreDragActor: function(eventTime) {
|
||||
_restoreDragActor(eventTime) {
|
||||
this._dragInProgress = false;
|
||||
let [restoreX, restoreY, restoreScale] = this._getRestoreLocation();
|
||||
|
||||
@ -594,14 +593,14 @@ var _Draggable = new Lang.Class({
|
||||
{ time: REVERT_ANIMATION_TIME });
|
||||
},
|
||||
|
||||
_animateDragEnd: function (eventTime, params) {
|
||||
_animateDragEnd(eventTime, params) {
|
||||
this._animationInProgress = true;
|
||||
|
||||
// finish animation if the actor gets destroyed
|
||||
// during it
|
||||
this._dragActorDestroyId =
|
||||
this._dragActor.connect('destroy',
|
||||
Lang.bind(this, this._finishAnimation));
|
||||
this._finishAnimation.bind(this));
|
||||
|
||||
params['opacity'] = this._dragOrigOpacity;
|
||||
params['transition'] = 'easeOutQuad';
|
||||
@ -613,7 +612,7 @@ var _Draggable = new Lang.Class({
|
||||
Tweener.addTween(this._dragActor, params)
|
||||
},
|
||||
|
||||
_finishAnimation : function () {
|
||||
_finishAnimation() {
|
||||
if (!this._animationInProgress)
|
||||
return
|
||||
|
||||
@ -624,7 +623,7 @@ var _Draggable = new Lang.Class({
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
},
|
||||
|
||||
_onAnimationComplete : function (dragActor, eventTime) {
|
||||
_onAnimationComplete(dragActor, eventTime) {
|
||||
dragActor.disconnect(this._dragActorDestroyId);
|
||||
this._dragActorDestroyId = 0;
|
||||
|
||||
@ -641,7 +640,7 @@ var _Draggable = new Lang.Class({
|
||||
this._finishAnimation();
|
||||
},
|
||||
|
||||
_dragComplete: function() {
|
||||
_dragComplete() {
|
||||
if (!this._actorDestroyed)
|
||||
Shell.util_set_hidden_from_pick(this._dragActor, false);
|
||||
|
||||
|
@ -16,25 +16,23 @@ var EdgeDragAction = new Lang.Class({
|
||||
Extends: Clutter.GestureAction,
|
||||
Signals: { 'activated': {} },
|
||||
|
||||
_init : function(side, allowedModes) {
|
||||
_init(side, allowedModes) {
|
||||
this.parent();
|
||||
this._side = side;
|
||||
this._allowedModes = allowedModes;
|
||||
this.set_n_touch_points(1);
|
||||
|
||||
global.display.connect('grab-op-begin', Lang.bind(this, function() {
|
||||
this.cancel();
|
||||
}));
|
||||
global.display.connect('grab-op-begin', () => { this.cancel(); });
|
||||
},
|
||||
|
||||
_getMonitorRect : function (x, y) {
|
||||
_getMonitorRect(x, y) {
|
||||
let rect = new Meta.Rectangle({ x: x - 1, y: y - 1, width: 1, height: 1 });
|
||||
let monitorIndex = global.screen.get_monitor_index_for_rect(rect);
|
||||
|
||||
return global.screen.get_monitor_geometry(monitorIndex);
|
||||
},
|
||||
|
||||
vfunc_gesture_prepare : function(action, actor) {
|
||||
vfunc_gesture_prepare(action, actor) {
|
||||
if (this.get_n_current_points() == 0)
|
||||
return false;
|
||||
|
||||
@ -50,7 +48,7 @@ var EdgeDragAction = new Lang.Class({
|
||||
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD));
|
||||
},
|
||||
|
||||
vfunc_gesture_progress : function (action, actor) {
|
||||
vfunc_gesture_progress(action, actor) {
|
||||
let [startX, startY] = this.get_press_coords(0);
|
||||
let [x, y] = this.get_motion_coords(0);
|
||||
let offsetX = Math.abs (x - startX);
|
||||
@ -70,7 +68,7 @@ var EdgeDragAction = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
vfunc_gesture_end : function (action, actor) {
|
||||
vfunc_gesture_end(action, actor) {
|
||||
let [startX, startY] = this.get_press_coords(0);
|
||||
let [x, y] = this.get_motion_coords(0);
|
||||
let monitorRect = this._getMonitorRect(startX, startY);
|
||||
|
@ -63,12 +63,12 @@ const EndSessionDialogIface = '<node> \
|
||||
const logoutDialogContent = {
|
||||
subjectWithUser: C_("title", "Log Out %s"),
|
||||
subject: C_("title", "Log Out"),
|
||||
descriptionWithUser: function(user, seconds) {
|
||||
descriptionWithUser(user, seconds) {
|
||||
return ngettext("%s will be logged out automatically in %d second.",
|
||||
"%s will be logged out automatically in %d seconds.",
|
||||
seconds).format(user, seconds);
|
||||
},
|
||||
description: function(seconds) {
|
||||
description(seconds) {
|
||||
return ngettext("You will be logged out automatically in %d second.",
|
||||
"You will be logged out automatically in %d seconds.",
|
||||
seconds).format(seconds);
|
||||
@ -83,7 +83,7 @@ const logoutDialogContent = {
|
||||
const shutdownDialogContent = {
|
||||
subject: C_("title", "Power Off"),
|
||||
subjectWithUpdates: C_("title", "Install Updates & Power Off"),
|
||||
description: function(seconds) {
|
||||
description(seconds) {
|
||||
return ngettext("The system will power off automatically in %d second.",
|
||||
"The system will power off automatically in %d seconds.",
|
||||
seconds).format(seconds);
|
||||
@ -101,7 +101,7 @@ const shutdownDialogContent = {
|
||||
|
||||
const restartDialogContent = {
|
||||
subject: C_("title", "Restart"),
|
||||
description: function(seconds) {
|
||||
description(seconds) {
|
||||
return ngettext("The system will restart automatically in %d second.",
|
||||
"The system will restart automatically in %d seconds.",
|
||||
seconds).format(seconds);
|
||||
@ -117,7 +117,7 @@ const restartDialogContent = {
|
||||
const restartUpdateDialogContent = {
|
||||
|
||||
subject: C_("title", "Restart & Install Updates"),
|
||||
description: function(seconds) {
|
||||
description(seconds) {
|
||||
return ngettext("The system will automatically restart and install updates in %d second.",
|
||||
"The system will automatically restart and install updates in %d seconds.",
|
||||
seconds).format(seconds);
|
||||
@ -135,7 +135,7 @@ const restartUpdateDialogContent = {
|
||||
const restartUpgradeDialogContent = {
|
||||
|
||||
subject: C_("title", "Restart & Install Upgrade"),
|
||||
upgradeDescription: function(distroName, distroVersion) {
|
||||
upgradeDescription(distroName, distroVersion) {
|
||||
/* Translators: This is the text displayed for system upgrades in the
|
||||
shut down dialog. First %s gets replaced with the distro name and
|
||||
second %s with the distro version to upgrade to */
|
||||
@ -279,7 +279,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
Name: 'EndSessionDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent({ styleClass: 'end-session-dialog',
|
||||
destroyOnClose: false });
|
||||
|
||||
@ -290,22 +290,22 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._pkOfflineProxy = new PkOfflineProxy(Gio.DBus.system,
|
||||
'org.freedesktop.PackageKit',
|
||||
'/org/freedesktop/PackageKit',
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
}));
|
||||
});
|
||||
this._powerProxy = new UPowerProxy(Gio.DBus.system,
|
||||
'org.freedesktop.UPower',
|
||||
'/org/freedesktop/UPower',
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
}
|
||||
this._powerProxy.connect('g-properties-changed',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync.bind(this));
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
|
||||
this._secondsLeft = 0;
|
||||
this._totalSecondsToStayOpen = 0;
|
||||
@ -313,12 +313,12 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._sessions = [];
|
||||
|
||||
this.connect('destroy',
|
||||
Lang.bind(this, this._onDestroy));
|
||||
this._onDestroy.bind(this));
|
||||
this.connect('opened',
|
||||
Lang.bind(this, this._onOpened));
|
||||
this._onOpened.bind(this));
|
||||
|
||||
this._userLoadedId = this._user.connect('notify::is_loaded', Lang.bind(this, this._sync));
|
||||
this._userChangedId = this._user.connect('changed', Lang.bind(this, this._sync));
|
||||
this._userLoadedId = this._user.connect('notify::is_loaded', this._sync.bind(this));
|
||||
this._userChangedId = this._user.connect('changed', this._sync.bind(this));
|
||||
|
||||
let mainContentLayout = new St.BoxLayout({ vertical: false });
|
||||
this.contentLayout.add(mainContentLayout,
|
||||
@ -354,7 +354,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
y_align: St.Align.START });
|
||||
|
||||
this._checkBox = new CheckBox.CheckBox();
|
||||
this._checkBox.actor.connect('clicked', Lang.bind(this, this._sync));
|
||||
this._checkBox.actor.connect('clicked', this._sync.bind(this));
|
||||
messageLayout.add(this._checkBox.actor);
|
||||
|
||||
this._batteryWarning = new St.Label({ style_class: 'end-session-dialog-warning',
|
||||
@ -398,12 +398,12 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/SessionManager/EndSessionDialog');
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this._user.disconnect(this._userLoadedId);
|
||||
this._user.disconnect(this._userChangedId);
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
let open = (this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED);
|
||||
if (!open)
|
||||
return;
|
||||
@ -476,48 +476,47 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._sessionHeader.visible = hasSessions;
|
||||
},
|
||||
|
||||
_updateButtons: function() {
|
||||
_updateButtons() {
|
||||
let dialogContent = DialogContent[this._type];
|
||||
let buttons = [{ action: Lang.bind(this, this.cancel),
|
||||
let buttons = [{ action: this.cancel.bind(this),
|
||||
label: _("Cancel"),
|
||||
key: Clutter.Escape }];
|
||||
|
||||
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
|
||||
let signal = dialogContent.confirmButtons[i].signal;
|
||||
let label = dialogContent.confirmButtons[i].label;
|
||||
buttons.push({ action: Lang.bind(this, function() {
|
||||
this.close(true);
|
||||
let signalId = this.connect('closed',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
this._confirm(signal);
|
||||
}));
|
||||
}),
|
||||
buttons.push({ action: () => {
|
||||
this.close(true);
|
||||
let signalId = this.connect('closed', () => {
|
||||
this.disconnect(signalId);
|
||||
this._confirm(signal);
|
||||
});
|
||||
},
|
||||
label: label });
|
||||
}
|
||||
|
||||
this.setButtons(buttons);
|
||||
},
|
||||
|
||||
close: function(skipSignal) {
|
||||
close(skipSignal) {
|
||||
this.parent();
|
||||
|
||||
if (!skipSignal)
|
||||
this._dbusImpl.emit_signal('Closed', null);
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
cancel() {
|
||||
this._stopTimer();
|
||||
this._dbusImpl.emit_signal('Canceled', null);
|
||||
this.close();
|
||||
},
|
||||
|
||||
_confirm: function(signal) {
|
||||
let callback = Lang.bind(this, function() {
|
||||
_confirm(signal) {
|
||||
let callback = () => {
|
||||
this._fadeOutDialog();
|
||||
this._stopTimer();
|
||||
this._dbusImpl.emit_signal(signal, null);
|
||||
});
|
||||
};
|
||||
|
||||
// Offline update not available; just emit the signal
|
||||
if (!this._checkBox.actor.visible) {
|
||||
@ -547,13 +546,12 @@ var EndSessionDialog = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onOpened: function() {
|
||||
_onOpened() {
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_triggerOfflineUpdateReboot: function(callback) {
|
||||
this._pkOfflineProxy.TriggerRemote('reboot',
|
||||
function (result, error) {
|
||||
_triggerOfflineUpdateReboot(callback) {
|
||||
this._pkOfflineProxy.TriggerRemote('reboot', (result, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
|
||||
@ -561,9 +559,8 @@ var EndSessionDialog = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_triggerOfflineUpdateShutdown: function(callback) {
|
||||
this._pkOfflineProxy.TriggerRemote('power-off',
|
||||
function (result, error) {
|
||||
_triggerOfflineUpdateShutdown(callback) {
|
||||
this._pkOfflineProxy.TriggerRemote('power-off', (result, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
|
||||
@ -571,8 +568,8 @@ var EndSessionDialog = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_triggerOfflineUpdateCancel: function(callback) {
|
||||
this._pkOfflineProxy.CancelRemote(function (result, error) {
|
||||
_triggerOfflineUpdateCancel(callback) {
|
||||
this._pkOfflineProxy.CancelRemote((result, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
|
||||
@ -580,32 +577,31 @@ var EndSessionDialog = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_startTimer: function() {
|
||||
_startTimer() {
|
||||
let startTime = GLib.get_monotonic_time();
|
||||
this._secondsLeft = this._totalSecondsToStayOpen;
|
||||
|
||||
this._timerId = Mainloop.timeout_add_seconds(1, Lang.bind(this,
|
||||
function() {
|
||||
let currentTime = GLib.get_monotonic_time();
|
||||
let secondsElapsed = ((currentTime - startTime) / 1000000);
|
||||
this._timerId = Mainloop.timeout_add_seconds(1, () => {
|
||||
let currentTime = GLib.get_monotonic_time();
|
||||
let secondsElapsed = ((currentTime - startTime) / 1000000);
|
||||
|
||||
this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
|
||||
if (this._secondsLeft > 0) {
|
||||
this._sync();
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}
|
||||
this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
|
||||
if (this._secondsLeft > 0) {
|
||||
this._sync();
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
let dialogContent = DialogContent[this._type];
|
||||
let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
|
||||
this._confirm(button.signal);
|
||||
this._timerId = 0;
|
||||
let dialogContent = DialogContent[this._type];
|
||||
let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
|
||||
this._confirm(button.signal);
|
||||
this._timerId = 0;
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
|
||||
},
|
||||
|
||||
_stopTimer: function() {
|
||||
_stopTimer() {
|
||||
if (this._timerId > 0) {
|
||||
Mainloop.source_remove(this._timerId);
|
||||
this._timerId = 0;
|
||||
@ -614,7 +610,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._secondsLeft = 0;
|
||||
},
|
||||
|
||||
_constructListItemForApp: function(inhibitor, app) {
|
||||
_constructListItemForApp(inhibitor, app) {
|
||||
let actor = new St.BoxLayout({ style_class: 'end-session-dialog-app-list-item',
|
||||
can_focus: true });
|
||||
actor.add(app.create_icon_texture(_ITEM_ICON_SIZE));
|
||||
@ -639,7 +635,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
return actor;
|
||||
},
|
||||
|
||||
_onInhibitorLoaded: function(inhibitor) {
|
||||
_onInhibitorLoaded(inhibitor) {
|
||||
if (this._applications.indexOf(inhibitor) < 0) {
|
||||
// Stale inhibitor
|
||||
return;
|
||||
@ -658,7 +654,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_constructListItemForSession: function(session) {
|
||||
_constructListItemForSession(session) {
|
||||
let avatar = new UserWidget.Avatar(session.user, { iconSize: _ITEM_ICON_SIZE });
|
||||
avatar.update();
|
||||
|
||||
@ -688,8 +684,8 @@ var EndSessionDialog = new Lang.Class({
|
||||
return actor;
|
||||
},
|
||||
|
||||
_loadSessions: function() {
|
||||
this._loginManager.listSessions(Lang.bind(this, function(result) {
|
||||
_loadSessions() {
|
||||
this._loginManager.listSessions(result => {
|
||||
let n = 0;
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let[id, uid, userName, seat, sessionPath] = result[i];
|
||||
@ -720,10 +716,10 @@ var EndSessionDialog = new Lang.Class({
|
||||
}
|
||||
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
OpenAsync: function(parameters, invocation) {
|
||||
OpenAsync(parameters, invocation) {
|
||||
let [type, timestamp, totalSecondsToStayOpen, inhibitorObjectPaths] = parameters;
|
||||
this._totalSecondsToStayOpen = totalSecondsToStayOpen;
|
||||
this._type = type;
|
||||
@ -750,9 +746,9 @@ var EndSessionDialog = new Lang.Class({
|
||||
let dialogContent = DialogContent[this._type];
|
||||
|
||||
for (let i = 0; i < inhibitorObjectPaths.length; i++) {
|
||||
let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i], Lang.bind(this, function(proxy, error) {
|
||||
let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i], (proxy, error) => {
|
||||
this._onInhibitorLoaded(proxy);
|
||||
}));
|
||||
});
|
||||
|
||||
this._applications.push(inhibitor);
|
||||
}
|
||||
@ -787,14 +783,13 @@ var EndSessionDialog = new Lang.Class({
|
||||
|
||||
this._sync();
|
||||
|
||||
let signalId = this.connect('opened',
|
||||
Lang.bind(this, function() {
|
||||
invocation.return_value(null);
|
||||
this.disconnect(signalId);
|
||||
}));
|
||||
let signalId = this.connect('opened', () => {
|
||||
invocation.return_value(null);
|
||||
this.disconnect(signalId);
|
||||
});
|
||||
},
|
||||
|
||||
Close: function(parameters, invocation) {
|
||||
Close(parameters, invocation) {
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
|
@ -47,14 +47,14 @@ function _patchContainerClass(containerClass) {
|
||||
function _patchLayoutClass(layoutClass, styleProps) {
|
||||
if (styleProps)
|
||||
layoutClass.prototype.hookup_style = function(container) {
|
||||
container.connect('style-changed', Lang.bind(this, function() {
|
||||
container.connect('style-changed', () => {
|
||||
let node = container.get_theme_node();
|
||||
for (let prop in styleProps) {
|
||||
let [found, length] = node.lookup_length(styleProps[prop], false);
|
||||
if (found)
|
||||
this[prop] = length;
|
||||
}
|
||||
}));
|
||||
});
|
||||
};
|
||||
layoutClass.prototype.child_set = function(actor, props) {
|
||||
let meta = this.get_child_meta(actor.get_parent(), actor);
|
||||
@ -88,7 +88,7 @@ function init() {
|
||||
window._ = Gettext.gettext;
|
||||
window.C_ = Gettext.pgettext;
|
||||
window.ngettext = Gettext.ngettext;
|
||||
window.N_ = function(s) { return s; };
|
||||
window.N_ = s => s;
|
||||
|
||||
// Miscellaneous monkeypatching
|
||||
_patchContainerClass(St.BoxLayout);
|
||||
|
@ -30,7 +30,7 @@ function installExtension(uuid, invocation) {
|
||||
|
||||
let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params);
|
||||
|
||||
_httpSession.queue_message(message, function(session, message) {
|
||||
_httpSession.queue_message(message, (session, message) => {
|
||||
if (message.status_code != Soup.KnownStatusCode.OK) {
|
||||
ExtensionSystem.logExtensionError(uuid, 'downloading info: ' + message.status_code);
|
||||
invocation.return_dbus_error('org.gnome.Shell.DownloadInfoError', message.status_code.toString());
|
||||
@ -96,7 +96,7 @@ function gotExtensionZipFile(session, message, uuid, dir, callback, errback) {
|
||||
return;
|
||||
}
|
||||
|
||||
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function(pid, status) {
|
||||
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, (pid, status) => {
|
||||
GLib.spawn_close_pid(pid);
|
||||
|
||||
if (status != 0)
|
||||
@ -119,8 +119,8 @@ function updateExtension(uuid) {
|
||||
let url = REPOSITORY_URL_DOWNLOAD.format(uuid);
|
||||
let message = Soup.form_request_new_from_hash('GET', url, params);
|
||||
|
||||
_httpSession.queue_message(message, Lang.bind(this, function(session, message) {
|
||||
gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, function() {
|
||||
_httpSession.queue_message(message, (session, message) => {
|
||||
gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, () => {
|
||||
let oldExtension = ExtensionUtils.extensions[uuid];
|
||||
let extensionDir = oldExtension.dir;
|
||||
|
||||
@ -151,10 +151,10 @@ function updateExtension(uuid) {
|
||||
}
|
||||
|
||||
FileUtils.recursivelyDeleteDir(oldExtensionTmpDir, true);
|
||||
}, function(code, message) {
|
||||
}, (code, message) => {
|
||||
log('Error while updating extension %s: %s (%s)'.format(uuid, code, message ? message : ''));
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function checkForUpdates() {
|
||||
@ -168,7 +168,7 @@ function checkForUpdates() {
|
||||
|
||||
let url = REPOSITORY_URL_UPDATE;
|
||||
let message = Soup.form_request_new_from_hash('GET', url, params);
|
||||
_httpSession.queue_message(message, function(session, message) {
|
||||
_httpSession.queue_message(message, (session, message) => {
|
||||
if (message.status_code != Soup.KnownStatusCode.OK)
|
||||
return;
|
||||
|
||||
@ -187,7 +187,7 @@ var InstallExtensionDialog = new Lang.Class({
|
||||
Name: 'InstallExtensionDialog',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init: function(uuid, info, invocation) {
|
||||
_init(uuid, info, invocation) {
|
||||
this.parent({ styleClass: 'extension-dialog' });
|
||||
|
||||
this._uuid = uuid;
|
||||
@ -195,11 +195,11 @@ var InstallExtensionDialog = new Lang.Class({
|
||||
this._invocation = invocation;
|
||||
|
||||
this.setButtons([{ label: _("Cancel"),
|
||||
action: Lang.bind(this, this._onCancelButtonPressed),
|
||||
action: this._onCancelButtonPressed.bind(this),
|
||||
key: Clutter.Escape
|
||||
},
|
||||
{ label: _("Install"),
|
||||
action: Lang.bind(this, this._onInstallButtonPressed),
|
||||
action: this._onInstallButtonPressed.bind(this),
|
||||
default: true
|
||||
}]);
|
||||
|
||||
@ -218,12 +218,12 @@ var InstallExtensionDialog = new Lang.Class({
|
||||
box.add(label);
|
||||
},
|
||||
|
||||
_onCancelButtonPressed: function(button, event) {
|
||||
_onCancelButtonPressed(button, event) {
|
||||
this.close();
|
||||
this._invocation.return_value(GLib.Variant.new('(s)', ['cancelled']));
|
||||
},
|
||||
|
||||
_onInstallButtonPressed: function(button, event) {
|
||||
_onInstallButtonPressed(button, event) {
|
||||
let params = { shell_version: Config.PACKAGE_VERSION };
|
||||
|
||||
let url = REPOSITORY_URL_DOWNLOAD.format(this._uuid);
|
||||
@ -258,9 +258,9 @@ var InstallExtensionDialog = new Lang.Class({
|
||||
invocation.return_value(GLib.Variant.new('(s)', ['successful']));
|
||||
}
|
||||
|
||||
_httpSession.queue_message(message, Lang.bind(this, function(session, message) {
|
||||
_httpSession.queue_message(message, (session, message) => {
|
||||
gotExtensionZipFile(session, message, uuid, dir, callback, errback);
|
||||
}));
|
||||
});
|
||||
|
||||
this.close();
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ var extensionOrder = [];
|
||||
var _signals = {};
|
||||
Signals.addSignalMethods(_signals);
|
||||
|
||||
var connect = Lang.bind(_signals, _signals.connect);
|
||||
var disconnect = Lang.bind(_signals, _signals.disconnect);
|
||||
var connect = _signals.connect.bind(_signals);
|
||||
var disconnect = _signals.disconnect.bind(_signals);
|
||||
|
||||
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
|
||||
const DISABLE_USER_EXTENSIONS_KEY = 'disable-user-extensions';
|
||||
@ -273,17 +273,17 @@ function onEnabledExtensionsChanged() {
|
||||
|
||||
// Find and enable all the newly enabled extensions: UUIDs found in the
|
||||
// new setting, but not in the old one.
|
||||
newEnabledExtensions.filter(function(uuid) {
|
||||
return enabledExtensions.indexOf(uuid) == -1;
|
||||
}).forEach(function(uuid) {
|
||||
newEnabledExtensions.filter(
|
||||
uuid => !enabledExtensions.includes(uuid)
|
||||
).forEach(uuid => {
|
||||
enableExtension(uuid);
|
||||
});
|
||||
|
||||
// Find and disable all the newly disabled extensions: UUIDs found in the
|
||||
// old setting, but not in the new one.
|
||||
enabledExtensions.filter(function(item) {
|
||||
return newEnabledExtensions.indexOf(item) == -1;
|
||||
}).forEach(function(uuid) {
|
||||
enabledExtensions.filter(
|
||||
item => !newEnabledExtensions.includes(item)
|
||||
).forEach(uuid => {
|
||||
disableExtension(uuid);
|
||||
});
|
||||
|
||||
@ -300,7 +300,7 @@ function _onVersionValidationChanged() {
|
||||
enabledExtensions = getEnabledExtensions();
|
||||
|
||||
if (Main.sessionMode.allowExtensions) {
|
||||
enabledExtensions.forEach(function(uuid) {
|
||||
enabledExtensions.forEach(uuid => {
|
||||
enableExtension(uuid);
|
||||
});
|
||||
}
|
||||
@ -314,7 +314,7 @@ function _loadExtensions() {
|
||||
enabledExtensions = getEnabledExtensions();
|
||||
|
||||
let finder = new ExtensionUtils.ExtensionFinder();
|
||||
finder.connect('extension-found', function(finder, extension) {
|
||||
finder.connect('extension-found', (finder, extension) => {
|
||||
loadExtension(extension);
|
||||
});
|
||||
finder.scanExtensions();
|
||||
@ -328,7 +328,7 @@ function enableAllExtensions() {
|
||||
_loadExtensions();
|
||||
initted = true;
|
||||
} else {
|
||||
enabledExtensions.forEach(function(uuid) {
|
||||
enabledExtensions.forEach(uuid => {
|
||||
enableExtension(uuid);
|
||||
});
|
||||
}
|
||||
@ -340,7 +340,7 @@ function disableAllExtensions() {
|
||||
return;
|
||||
|
||||
if (initted) {
|
||||
extensionOrder.slice().reverse().forEach(function(uuid) {
|
||||
extensionOrder.slice().reverse().forEach(uuid => {
|
||||
disableExtension(uuid);
|
||||
});
|
||||
}
|
||||
|
@ -31,22 +31,22 @@ const STATECHANGED = 'object:state-changed';
|
||||
var FocusCaretTracker = new Lang.Class({
|
||||
Name: 'FocusCaretTracker',
|
||||
|
||||
_init: function() {
|
||||
this._atspiListener = Atspi.EventListener.new(Lang.bind(this, this._onChanged));
|
||||
_init() {
|
||||
this._atspiListener = Atspi.EventListener.new(this._onChanged.bind(this));
|
||||
|
||||
this._atspiInited = false;
|
||||
this._focusListenerRegistered = false;
|
||||
this._caretListenerRegistered = false;
|
||||
},
|
||||
|
||||
_onChanged: function(event) {
|
||||
_onChanged(event) {
|
||||
if (event.type.indexOf(STATECHANGED) == 0)
|
||||
this.emit('focus-changed', event);
|
||||
else if (event.type == CARETMOVED)
|
||||
this.emit('caret-moved', event);
|
||||
},
|
||||
|
||||
_initAtspi: function() {
|
||||
_initAtspi() {
|
||||
if (!this._atspiInited && Atspi.init() == 0) {
|
||||
Atspi.set_timeout(250, 250);
|
||||
this._atspiInited = true;
|
||||
@ -55,7 +55,7 @@ var FocusCaretTracker = new Lang.Class({
|
||||
return this._atspiInited;
|
||||
},
|
||||
|
||||
registerFocusListener: function() {
|
||||
registerFocusListener() {
|
||||
if (!this._initAtspi() || this._focusListenerRegistered)
|
||||
return;
|
||||
|
||||
@ -64,7 +64,7 @@ var FocusCaretTracker = new Lang.Class({
|
||||
this._focusListenerRegistered = true;
|
||||
},
|
||||
|
||||
registerCaretListener: function() {
|
||||
registerCaretListener() {
|
||||
if (!this._initAtspi() || this._caretListenerRegistered)
|
||||
return;
|
||||
|
||||
@ -72,7 +72,7 @@ var FocusCaretTracker = new Lang.Class({
|
||||
this._caretListenerRegistered = true;
|
||||
},
|
||||
|
||||
deregisterFocusListener: function() {
|
||||
deregisterFocusListener() {
|
||||
if (!this._focusListenerRegistered)
|
||||
return;
|
||||
|
||||
@ -81,7 +81,7 @@ var FocusCaretTracker = new Lang.Class({
|
||||
this._focusListenerRegistered = false;
|
||||
},
|
||||
|
||||
deregisterCaretListener: function() {
|
||||
deregisterCaretListener() {
|
||||
if (!this._caretListenerRegistered)
|
||||
return;
|
||||
|
||||
|
@ -49,7 +49,7 @@ function _popGrabHelper(grabHelper) {
|
||||
var GrabHelper = new Lang.Class({
|
||||
Name: 'GrabHelper',
|
||||
|
||||
_init: function(owner, params) {
|
||||
_init(owner, params) {
|
||||
this._owner = owner;
|
||||
this._modalParams = params;
|
||||
|
||||
@ -66,8 +66,10 @@ var GrabHelper = new Lang.Class({
|
||||
//
|
||||
// Adds @actor to the set of actors that are allowed to process events
|
||||
// during a grab.
|
||||
addActor: function(actor) {
|
||||
actor.__grabHelperDestroyId = actor.connect('destroy', Lang.bind(this, function() { this.removeActor(actor); }));
|
||||
addActor(actor) {
|
||||
actor.__grabHelperDestroyId = actor.connect('destroy', () => {
|
||||
this.removeActor(actor);
|
||||
});
|
||||
this._actors.push(actor);
|
||||
},
|
||||
|
||||
@ -76,7 +78,7 @@ var GrabHelper = new Lang.Class({
|
||||
//
|
||||
// Removes @actor from the set of actors that are allowed to
|
||||
// process events during a grab.
|
||||
removeActor: function(actor) {
|
||||
removeActor(actor) {
|
||||
let index = this._actors.indexOf(actor);
|
||||
if (index != -1)
|
||||
this._actors.splice(index, 1);
|
||||
@ -86,7 +88,7 @@ var GrabHelper = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_isWithinGrabbedActor: function(actor) {
|
||||
_isWithinGrabbedActor(actor) {
|
||||
let currentActor = this.currentGrab.actor;
|
||||
while (actor) {
|
||||
if (this._actors.indexOf(actor) != -1)
|
||||
@ -110,7 +112,7 @@ var GrabHelper = new Lang.Class({
|
||||
return this._grabStack;
|
||||
},
|
||||
|
||||
_findStackIndex: function(actor) {
|
||||
_findStackIndex(actor) {
|
||||
if (!actor)
|
||||
return -1;
|
||||
|
||||
@ -121,7 +123,7 @@ var GrabHelper = new Lang.Class({
|
||||
return -1;
|
||||
},
|
||||
|
||||
_actorInGrabStack: function(actor) {
|
||||
_actorInGrabStack(actor) {
|
||||
while (actor) {
|
||||
let idx = this._findStackIndex(actor);
|
||||
if (idx >= 0)
|
||||
@ -131,7 +133,7 @@ var GrabHelper = new Lang.Class({
|
||||
return -1;
|
||||
},
|
||||
|
||||
isActorGrabbed: function(actor) {
|
||||
isActorGrabbed(actor) {
|
||||
return this._findStackIndex(actor) >= 0;
|
||||
},
|
||||
|
||||
@ -166,7 +168,7 @@ var GrabHelper = new Lang.Class({
|
||||
// to that actor instead of navigating in @params.actor. This is for
|
||||
// use cases like menus, where we want to grab the menu actor, but keep
|
||||
// focus on the clicked on menu item.
|
||||
grab: function(params) {
|
||||
grab(params) {
|
||||
params = Params.parse(params, { actor: null,
|
||||
focus: null,
|
||||
onUngrab: null });
|
||||
@ -195,7 +197,7 @@ var GrabHelper = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_takeModalGrab: function() {
|
||||
_takeModalGrab() {
|
||||
let firstGrab = (this._modalCount == 0);
|
||||
if (firstGrab) {
|
||||
if (!Main.pushModal(this._owner, this._modalParams))
|
||||
@ -208,7 +210,7 @@ var GrabHelper = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_releaseModalGrab: function() {
|
||||
_releaseModalGrab() {
|
||||
this._modalCount--;
|
||||
if (this._modalCount > 0)
|
||||
return;
|
||||
@ -227,7 +229,7 @@ var GrabHelper = new Lang.Class({
|
||||
// capture event handler returns false. This is designed for things
|
||||
// like the ComboBoxMenu that go away on press, but need to eat
|
||||
// the next release event.
|
||||
ignoreRelease: function() {
|
||||
ignoreRelease() {
|
||||
this._ignoreUntilRelease = true;
|
||||
},
|
||||
|
||||
@ -242,7 +244,7 @@ var GrabHelper = new Lang.Class({
|
||||
// popped until the grabbed actor is at the top of the grab stack.
|
||||
// The onUngrab callback for every grab is called for every popped
|
||||
// grab with the parameter %false.
|
||||
ungrab: function(params) {
|
||||
ungrab(params) {
|
||||
params = Params.parse(params, { actor: this.currentGrab.actor,
|
||||
isUser: false });
|
||||
|
||||
@ -274,7 +276,7 @@ var GrabHelper = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
onCapturedEvent: function(event) {
|
||||
onCapturedEvent(event) {
|
||||
let type = event.type();
|
||||
|
||||
if (type == Clutter.EventType.KEY_PRESS &&
|
||||
|
@ -17,7 +17,7 @@ var DEFAULT_INDEX_LABELS = [ '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
var CandidateArea = new Lang.Class({
|
||||
Name: 'CandidateArea',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.BoxLayout({ vertical: true,
|
||||
reactive: true,
|
||||
visible: false });
|
||||
@ -34,13 +34,13 @@ var CandidateArea = new Lang.Class({
|
||||
this.actor.add(box);
|
||||
|
||||
let j = i;
|
||||
box.connect('button-release-event', Lang.bind(this, function(actor, event) {
|
||||
box.connect('button-release-event', (actor, event) => {
|
||||
this.emit('candidate-clicked', j, event.get_button(), event.get_state());
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
this.actor.connect('scroll-event', Lang.bind(this, function(actor, event) {
|
||||
this.actor.connect('scroll-event', (actor, event) => {
|
||||
let direction = event.get_scroll_direction();
|
||||
switch(direction) {
|
||||
case Clutter.ScrollDirection.UP:
|
||||
@ -51,7 +51,7 @@ var CandidateArea = new Lang.Class({
|
||||
break;
|
||||
};
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
|
||||
this._buttonBox = new St.BoxLayout({ style_class: 'candidate-page-button-box' });
|
||||
|
||||
@ -65,18 +65,18 @@ var CandidateArea = new Lang.Class({
|
||||
|
||||
this.actor.add(this._buttonBox);
|
||||
|
||||
this._previousButton.connect('clicked', Lang.bind(this, function() {
|
||||
this._previousButton.connect('clicked', () => {
|
||||
this.emit('previous-page');
|
||||
}));
|
||||
this._nextButton.connect('clicked', Lang.bind(this, function() {
|
||||
});
|
||||
this._nextButton.connect('clicked', () => {
|
||||
this.emit('next-page');
|
||||
}));
|
||||
});
|
||||
|
||||
this._orientation = -1;
|
||||
this._cursorPosition = 0;
|
||||
},
|
||||
|
||||
setOrientation: function(orientation) {
|
||||
setOrientation(orientation) {
|
||||
if (this._orientation == orientation)
|
||||
return;
|
||||
|
||||
@ -97,7 +97,7 @@ var CandidateArea = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
setCandidates: function(indexes, candidates, cursorPosition, cursorVisible) {
|
||||
setCandidates(indexes, candidates, cursorPosition, cursorVisible) {
|
||||
for (let i = 0; i < MAX_CANDIDATES_PER_PAGE; ++i) {
|
||||
let visible = i < candidates.length;
|
||||
let box = this._candidateBoxes[i];
|
||||
@ -116,7 +116,7 @@ var CandidateArea = new Lang.Class({
|
||||
this._candidateBoxes[cursorPosition].add_style_pseudo_class('selected');
|
||||
},
|
||||
|
||||
updateButtons: function(wrapsAround, page, nPages) {
|
||||
updateButtons(wrapsAround, page, nPages) {
|
||||
if (nPages < 2) {
|
||||
this._buttonBox.hide();
|
||||
return;
|
||||
@ -131,7 +131,7 @@ Signals.addSignalMethods(CandidateArea.prototype);
|
||||
var CandidatePopup = new Lang.Class({
|
||||
Name: 'CandidatePopup',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._boxPointer = new BoxPointer.BoxPointer(St.Side.TOP);
|
||||
this._boxPointer.actor.visible = false;
|
||||
this._boxPointer.actor.style_class = 'candidate-popup-boxpointer';
|
||||
@ -152,150 +152,138 @@ var CandidatePopup = new Lang.Class({
|
||||
this._candidateArea = new CandidateArea();
|
||||
box.add(this._candidateArea.actor);
|
||||
|
||||
this._candidateArea.connect('previous-page', Lang.bind(this, function() {
|
||||
this._candidateArea.connect('previous-page', () => {
|
||||
this._panelService.page_up();
|
||||
}));
|
||||
this._candidateArea.connect('next-page', Lang.bind(this, function() {
|
||||
});
|
||||
this._candidateArea.connect('next-page', () => {
|
||||
this._panelService.page_down();
|
||||
}));
|
||||
});
|
||||
|
||||
this._candidateArea.connect('cursor-up', Lang.bind(this, function() {
|
||||
this._candidateArea.connect('cursor-up', () => {
|
||||
this._panelService.cursor_up();
|
||||
}));
|
||||
this._candidateArea.connect('cursor-down', Lang.bind(this, function() {
|
||||
});
|
||||
this._candidateArea.connect('cursor-down', () => {
|
||||
this._panelService.cursor_down();
|
||||
}));
|
||||
});
|
||||
|
||||
this._candidateArea.connect('candidate-clicked', Lang.bind(this, function(ca, index, button, state) {
|
||||
this._candidateArea.connect('candidate-clicked', (area, index, button, state) => {
|
||||
this._panelService.candidate_clicked(index, button, state);
|
||||
}));
|
||||
});
|
||||
|
||||
this._panelService = null;
|
||||
},
|
||||
|
||||
setPanelService: function(panelService) {
|
||||
setPanelService(panelService) {
|
||||
this._panelService = panelService;
|
||||
if (!panelService)
|
||||
return;
|
||||
|
||||
panelService.connect('set-cursor-location',
|
||||
Lang.bind(this, function(ps, x, y, w, h) {
|
||||
this._setDummyCursorGeometry(x, y, w, h);
|
||||
}));
|
||||
panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
||||
this._setDummyCursorGeometry(x, y, w, h);
|
||||
});
|
||||
try {
|
||||
panelService.connect('set-cursor-location-relative',
|
||||
Lang.bind(this, function(ps, x, y, w, h) {
|
||||
if (!global.display.focus_window)
|
||||
return;
|
||||
let window = global.display.focus_window.get_compositor_private();
|
||||
this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
|
||||
}));
|
||||
panelService.connect('set-cursor-location-relative', (ps, x, y, w, h) => {
|
||||
if (!global.display.focus_window)
|
||||
return;
|
||||
let window = global.display.focus_window.get_compositor_private();
|
||||
this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
|
||||
});
|
||||
} catch(e) {
|
||||
// Only recent IBus versions have support for this signal
|
||||
// which is used for wayland clients. In order to work
|
||||
// with older IBus versions we can silently ignore the
|
||||
// signal's absence.
|
||||
}
|
||||
panelService.connect('update-preedit-text',
|
||||
Lang.bind(this, function(ps, text, cursorPosition, visible) {
|
||||
this._preeditText.visible = visible;
|
||||
this._updateVisibility();
|
||||
panelService.connect('update-preedit-text', (ps, text, cursorPosition, visible) => {
|
||||
this._preeditText.visible = visible;
|
||||
this._updateVisibility();
|
||||
|
||||
this._preeditText.text = text.get_text();
|
||||
this._preeditText.text = text.get_text();
|
||||
|
||||
let attrs = text.get_attributes();
|
||||
if (attrs)
|
||||
this._setTextAttributes(this._preeditText.clutter_text,
|
||||
attrs);
|
||||
}));
|
||||
panelService.connect('show-preedit-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._preeditText.show();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('hide-preedit-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._preeditText.hide();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('update-auxiliary-text',
|
||||
Lang.bind(this, function(ps, text, visible) {
|
||||
this._auxText.visible = visible;
|
||||
this._updateVisibility();
|
||||
let attrs = text.get_attributes();
|
||||
if (attrs)
|
||||
this._setTextAttributes(this._preeditText.clutter_text,
|
||||
attrs);
|
||||
});
|
||||
panelService.connect('show-preedit-text', ps => {
|
||||
this._preeditText.show();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('hide-preedit-text', ps => {
|
||||
this._preeditText.hide();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('update-auxiliary-text', (ps, text, visible) => {
|
||||
this._auxText.visible = visible;
|
||||
this._updateVisibility();
|
||||
|
||||
this._auxText.text = text.get_text();
|
||||
}));
|
||||
panelService.connect('show-auxiliary-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._auxText.show();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('hide-auxiliary-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._auxText.hide();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('update-lookup-table',
|
||||
Lang.bind(this, function(ps, lookupTable, visible) {
|
||||
this._candidateArea.actor.visible = visible;
|
||||
this._updateVisibility();
|
||||
this._auxText.text = text.get_text();
|
||||
});
|
||||
panelService.connect('show-auxiliary-text', ps => {
|
||||
this._auxText.show();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('hide-auxiliary-text', ps => {
|
||||
this._auxText.hide();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('update-lookup-table', (ps, lookupTable, visible) => {
|
||||
this._candidateArea.actor.visible = visible;
|
||||
this._updateVisibility();
|
||||
|
||||
let nCandidates = lookupTable.get_number_of_candidates();
|
||||
let cursorPos = lookupTable.get_cursor_pos();
|
||||
let pageSize = lookupTable.get_page_size();
|
||||
let nPages = Math.ceil(nCandidates / pageSize);
|
||||
let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
|
||||
let startIndex = page * pageSize;
|
||||
let endIndex = Math.min((page + 1) * pageSize, nCandidates);
|
||||
let nCandidates = lookupTable.get_number_of_candidates();
|
||||
let cursorPos = lookupTable.get_cursor_pos();
|
||||
let pageSize = lookupTable.get_page_size();
|
||||
let nPages = Math.ceil(nCandidates / pageSize);
|
||||
let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
|
||||
let startIndex = page * pageSize;
|
||||
let endIndex = Math.min((page + 1) * pageSize, nCandidates);
|
||||
|
||||
let indexes = [];
|
||||
let indexLabel;
|
||||
for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
|
||||
indexes.push(indexLabel.get_text());
|
||||
let indexes = [];
|
||||
let indexLabel;
|
||||
for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
|
||||
indexes.push(indexLabel.get_text());
|
||||
|
||||
Main.keyboard.resetSuggestions();
|
||||
Main.keyboard.resetSuggestions();
|
||||
|
||||
let candidates = [];
|
||||
for (let i = startIndex; i < endIndex; ++i) {
|
||||
candidates.push(lookupTable.get_candidate(i).get_text());
|
||||
let candidates = [];
|
||||
for (let i = startIndex; i < endIndex; ++i) {
|
||||
candidates.push(lookupTable.get_candidate(i).get_text());
|
||||
|
||||
Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), Lang.bind(this, function() {
|
||||
let index = i;
|
||||
this._panelService.candidate_clicked(index, 1, 0);
|
||||
}));
|
||||
}
|
||||
Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), () => {
|
||||
let index = i;
|
||||
this._panelService.candidate_clicked(index, 1, 0);
|
||||
});
|
||||
}
|
||||
|
||||
this._candidateArea.setCandidates(indexes,
|
||||
candidates,
|
||||
cursorPos % pageSize,
|
||||
lookupTable.is_cursor_visible());
|
||||
this._candidateArea.setOrientation(lookupTable.get_orientation());
|
||||
this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
|
||||
}));
|
||||
panelService.connect('show-lookup-table',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._candidateArea.actor.show();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('hide-lookup-table',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._candidateArea.actor.hide();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('focus-out',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
|
||||
Main.keyboard.resetSuggestions();
|
||||
}));
|
||||
this._candidateArea.setCandidates(indexes,
|
||||
candidates,
|
||||
cursorPos % pageSize,
|
||||
lookupTable.is_cursor_visible());
|
||||
this._candidateArea.setOrientation(lookupTable.get_orientation());
|
||||
this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
|
||||
});
|
||||
panelService.connect('show-lookup-table', ps => {
|
||||
this._candidateArea.actor.show();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('hide-lookup-table', ps => {
|
||||
this._candidateArea.actor.hide();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('focus-out', ps => {
|
||||
this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
|
||||
Main.keyboard.resetSuggestions();
|
||||
});
|
||||
},
|
||||
|
||||
_setDummyCursorGeometry: function(x, y, w, h) {
|
||||
_setDummyCursorGeometry(x, y, w, h) {
|
||||
Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
|
||||
if (this._boxPointer.actor.visible)
|
||||
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
|
||||
},
|
||||
|
||||
_updateVisibility: function() {
|
||||
_updateVisibility() {
|
||||
let isVisible = (!Main.keyboard.visible &&
|
||||
(this._preeditText.visible ||
|
||||
this._auxText.visible ||
|
||||
@ -310,7 +298,7 @@ var CandidatePopup = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_setTextAttributes: function(clutterText, ibusAttrList) {
|
||||
_setTextAttributes(clutterText, ibusAttrList) {
|
||||
let attr;
|
||||
for (let i = 0; attr = ibusAttrList.get(i); ++i)
|
||||
if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
|
||||
|
@ -37,7 +37,7 @@ var APPICON_ANIMATION_OUT_TIME = 0.25;
|
||||
var BaseIcon = new Lang.Class({
|
||||
Name: 'BaseIcon',
|
||||
|
||||
_init : function(label, params) {
|
||||
_init(label, params) {
|
||||
params = Params.parse(params, { createIcon: null,
|
||||
setSizeManually: false,
|
||||
showLabel: true });
|
||||
@ -50,19 +50,17 @@ var BaseIcon = new Lang.Class({
|
||||
x_fill: true,
|
||||
y_fill: true });
|
||||
this.actor._delegate = this;
|
||||
this.actor.connect('style-changed',
|
||||
Lang.bind(this, this._onStyleChanged));
|
||||
this.actor.connect('destroy',
|
||||
Lang.bind(this, this._onDestroy));
|
||||
this.actor.connect('style-changed', this._onStyleChanged.bind(this));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
|
||||
this._spacing = 0;
|
||||
|
||||
let box = new Shell.GenericContainer();
|
||||
box.connect('allocate', Lang.bind(this, this._allocate));
|
||||
box.connect('allocate', this._allocate.bind(this));
|
||||
box.connect('get-preferred-width',
|
||||
Lang.bind(this, this._getPreferredWidth));
|
||||
this._getPreferredWidth.bind(this));
|
||||
box.connect('get-preferred-height',
|
||||
Lang.bind(this, this._getPreferredHeight));
|
||||
this._getPreferredHeight.bind(this));
|
||||
this.actor.set_child(box);
|
||||
|
||||
this.iconSize = ICON_SIZE;
|
||||
@ -85,10 +83,10 @@ var BaseIcon = new Lang.Class({
|
||||
this.icon = null;
|
||||
|
||||
let cache = St.TextureCache.get_default();
|
||||
this._iconThemeChangedId = cache.connect('icon-theme-changed', Lang.bind(this, this._onIconThemeChanged));
|
||||
this._iconThemeChangedId = cache.connect('icon-theme-changed', this._onIconThemeChanged.bind(this));
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
_allocate(actor, box, flags) {
|
||||
let availWidth = box.x2 - box.x1;
|
||||
let availHeight = box.y2 - box.y1;
|
||||
|
||||
@ -122,11 +120,11 @@ var BaseIcon = new Lang.Class({
|
||||
this._iconBin.allocate(childBox, flags);
|
||||
},
|
||||
|
||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
||||
_getPreferredWidth(actor, forHeight, alloc) {
|
||||
this._getPreferredHeight(actor, -1, alloc);
|
||||
},
|
||||
|
||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
||||
_getPreferredHeight(actor, forWidth, alloc) {
|
||||
let [iconMinHeight, iconNatHeight] = this._iconBin.get_preferred_height(forWidth);
|
||||
alloc.min_size = iconMinHeight;
|
||||
alloc.natural_size = iconNatHeight;
|
||||
@ -140,11 +138,11 @@ var BaseIcon = new Lang.Class({
|
||||
|
||||
// This can be overridden by a subclass, or by the createIcon
|
||||
// parameter to _init()
|
||||
createIcon: function(size) {
|
||||
createIcon(size) {
|
||||
throw new Error('no implementation of createIcon in ' + this);
|
||||
},
|
||||
|
||||
setIconSize: function(size) {
|
||||
setIconSize(size) {
|
||||
if (!this._setSizeManually)
|
||||
throw new Error('setSizeManually has to be set to use setIconsize');
|
||||
|
||||
@ -154,7 +152,7 @@ var BaseIcon = new Lang.Class({
|
||||
this._createIconTexture(size);
|
||||
},
|
||||
|
||||
_createIconTexture: function(size) {
|
||||
_createIconTexture(size) {
|
||||
if (this.icon)
|
||||
this.icon.destroy();
|
||||
this.iconSize = size;
|
||||
@ -163,7 +161,7 @@ var BaseIcon = new Lang.Class({
|
||||
this._iconBin.child = this.icon;
|
||||
},
|
||||
|
||||
_onStyleChanged: function() {
|
||||
_onStyleChanged() {
|
||||
let node = this.actor.get_theme_node();
|
||||
this._spacing = node.get_length('spacing');
|
||||
|
||||
@ -181,7 +179,7 @@ var BaseIcon = new Lang.Class({
|
||||
this._createIconTexture(size);
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
if (this._iconThemeChangedId > 0) {
|
||||
let cache = St.TextureCache.get_default();
|
||||
cache.disconnect(this._iconThemeChangedId);
|
||||
@ -189,11 +187,11 @@ var BaseIcon = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onIconThemeChanged: function() {
|
||||
_onIconThemeChanged() {
|
||||
this._createIconTexture(this.iconSize);
|
||||
},
|
||||
|
||||
animateZoomOut: function() {
|
||||
animateZoomOut() {
|
||||
// Animate only the child instead of the entire actor, so the
|
||||
// styles like hover and running are not applied while
|
||||
// animating.
|
||||
@ -234,7 +232,7 @@ function zoomOutActor(actor) {
|
||||
translation_y: containedY - scaledY,
|
||||
opacity: 0,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
actorClone.destroy();
|
||||
}
|
||||
});
|
||||
@ -243,7 +241,7 @@ function zoomOutActor(actor) {
|
||||
var IconGrid = new Lang.Class({
|
||||
Name: 'IconGrid',
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { rowLimit: null,
|
||||
columnLimit: null,
|
||||
minRows: 1,
|
||||
@ -274,7 +272,7 @@ var IconGrid = new Lang.Class({
|
||||
this._fixedHItemSize = this._fixedVItemSize = undefined;
|
||||
this._grid = new Shell.GenericContainer();
|
||||
this.actor.add(this._grid, { expand: true, y_align: St.Align.START });
|
||||
this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged));
|
||||
this.actor.connect('style-changed', this._onStyleChanged.bind(this));
|
||||
|
||||
// Cancel animations when hiding the overview, to avoid icons
|
||||
// swarming into the void ...
|
||||
@ -283,26 +281,26 @@ var IconGrid = new Lang.Class({
|
||||
this._cancelAnimation();
|
||||
});
|
||||
|
||||
this._grid.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||
this._grid.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||
this._grid.connect('allocate', Lang.bind(this, this._allocate));
|
||||
this._grid.connect('actor-added', Lang.bind(this, this._childAdded));
|
||||
this._grid.connect('actor-removed', Lang.bind(this, this._childRemoved));
|
||||
this._grid.connect('get-preferred-width', this._getPreferredWidth.bind(this));
|
||||
this._grid.connect('get-preferred-height', this._getPreferredHeight.bind(this));
|
||||
this._grid.connect('allocate', this._allocate.bind(this));
|
||||
this._grid.connect('actor-added', this._childAdded.bind(this));
|
||||
this._grid.connect('actor-removed', this._childRemoved.bind(this));
|
||||
},
|
||||
|
||||
_keyFocusIn: function(actor) {
|
||||
_keyFocusIn(actor) {
|
||||
this.emit('key-focus-in', actor);
|
||||
},
|
||||
|
||||
_childAdded: function(grid, child) {
|
||||
child._iconGridKeyFocusInId = child.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
|
||||
_childAdded(grid, child) {
|
||||
child._iconGridKeyFocusInId = child.connect('key-focus-in', this._keyFocusIn.bind(this));
|
||||
},
|
||||
|
||||
_childRemoved: function(grid, child) {
|
||||
_childRemoved(grid, child) {
|
||||
child.disconnect(child._iconGridKeyFocusInId);
|
||||
},
|
||||
|
||||
_getPreferredWidth: function (grid, forHeight, alloc) {
|
||||
_getPreferredWidth(grid, forHeight, alloc) {
|
||||
if (this._fillParent)
|
||||
// Ignore all size requests of children and request a size of 0;
|
||||
// later we'll allocate as many children as fit the parent
|
||||
@ -320,15 +318,11 @@ var IconGrid = new Lang.Class({
|
||||
alloc.natural_size = nColumns * this._getHItemSize() + totalSpacing + this.leftPadding + this.rightPadding;
|
||||
},
|
||||
|
||||
_getVisibleChildren: function() {
|
||||
let children = this._grid.get_children();
|
||||
children = children.filter(function(actor) {
|
||||
return actor.visible;
|
||||
});
|
||||
return children;
|
||||
_getVisibleChildren() {
|
||||
return this._grid.get_children().filter(actor => actor.visible);
|
||||
},
|
||||
|
||||
_getPreferredHeight: function (grid, forWidth, alloc) {
|
||||
_getPreferredHeight(grid, forWidth, alloc) {
|
||||
if (this._fillParent)
|
||||
// Ignore all size requests of children and request a size of 0;
|
||||
// later we'll allocate as many children as fit the parent
|
||||
@ -354,7 +348,7 @@ var IconGrid = new Lang.Class({
|
||||
alloc.natural_size = height;
|
||||
},
|
||||
|
||||
_allocate: function (grid, box, flags) {
|
||||
_allocate(grid, box, flags) {
|
||||
if (this._fillParent) {
|
||||
// Reset the passed in box to fill the parent
|
||||
let parentBox = this.actor.get_parent().allocation;
|
||||
@ -414,21 +408,21 @@ var IconGrid = new Lang.Class({
|
||||
* Intended to be override by subclasses if they need a different
|
||||
* set of items to be animated.
|
||||
*/
|
||||
_getChildrenToAnimate: function() {
|
||||
_getChildrenToAnimate() {
|
||||
return this._getVisibleChildren();
|
||||
},
|
||||
|
||||
_cancelAnimation: function() {
|
||||
_cancelAnimation() {
|
||||
this._clonesAnimating.forEach(clone => { clone.destroy(); });
|
||||
this._clonesAnimating = [];
|
||||
},
|
||||
|
||||
_animationDone: function() {
|
||||
_animationDone() {
|
||||
this._clonesAnimating = [];
|
||||
this.emit('animation-done');
|
||||
},
|
||||
|
||||
animatePulse: function(animationDirection) {
|
||||
animatePulse(animationDirection) {
|
||||
if (animationDirection != AnimationDirection.IN)
|
||||
throw new Error("Pulse animation only implements 'in' animation direction");
|
||||
|
||||
@ -462,24 +456,24 @@ var IconGrid = new Lang.Class({
|
||||
delay: delay,
|
||||
scale_x: ANIMATION_BOUNCE_ICON_SCALE,
|
||||
scale_y: ANIMATION_BOUNCE_ICON_SCALE,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
Tweener.addTween(actor,
|
||||
{ time: ANIMATION_TIME_IN - bounceUpTime,
|
||||
transition: 'easeInOutQuad',
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
if (isLastItem)
|
||||
this._animationDone();
|
||||
actor.reactive = true;
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
animateSpring: function(animationDirection, sourceActor) {
|
||||
animateSpring(animationDirection, sourceActor) {
|
||||
this._cancelAnimation();
|
||||
|
||||
let actors = this._getChildrenToAnimate();
|
||||
@ -495,15 +489,15 @@ var IconGrid = new Lang.Class({
|
||||
// Design decision, 1/2 of the source actor size.
|
||||
let [sourceScaledWidth, sourceScaledHeight] = [sourceWidth / 2, sourceHeight / 2];
|
||||
|
||||
actors.forEach(function(actor) {
|
||||
actors.forEach(actor => {
|
||||
let [actorX, actorY] = actor._transformedPosition = actor.get_transformed_position();
|
||||
let [x, y] = [actorX - sourceX, actorY - sourceY];
|
||||
actor._distance = Math.sqrt(x * x + y * y);
|
||||
});
|
||||
let maxDist = actors.reduce(function(prev, cur) {
|
||||
let maxDist = actors.reduce((prev, cur) => {
|
||||
return Math.max(prev, cur._distance);
|
||||
}, 0);
|
||||
let minDist = actors.reduce(function(prev, cur) {
|
||||
let minDist = actors.reduce((prev, cur) => {
|
||||
return Math.min(prev, cur._distance);
|
||||
}, Infinity);
|
||||
let normalization = maxDist - minDist;
|
||||
@ -541,14 +535,14 @@ var IconGrid = new Lang.Class({
|
||||
y: finalY,
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
if (isLastItem)
|
||||
this._animationDone();
|
||||
|
||||
actor.opacity = 255;
|
||||
actor.reactive = true;
|
||||
actorClone.destroy();
|
||||
})};
|
||||
}};
|
||||
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
|
||||
transition: 'easeInOutQuad',
|
||||
delay: delay,
|
||||
@ -567,14 +561,14 @@ var IconGrid = new Lang.Class({
|
||||
y: adjustedSourcePositionY,
|
||||
scale_x: scaleX,
|
||||
scale_y: scaleY,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
if (isLastItem) {
|
||||
this._animationDone();
|
||||
this._restoreItemsOpacity();
|
||||
}
|
||||
actor.reactive = true;
|
||||
actorClone.destroy();
|
||||
})};
|
||||
}};
|
||||
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
|
||||
transition: 'easeInOutQuad',
|
||||
delay: ANIMATION_TIME_OUT + delay - ANIMATION_FADE_IN_TIME_FOR_ITEM,
|
||||
@ -587,13 +581,13 @@ var IconGrid = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_restoreItemsOpacity: function() {
|
||||
_restoreItemsOpacity() {
|
||||
for (let index = 0; index < this._items.length; index++) {
|
||||
this._items[index].actor.opacity = 255;
|
||||
}
|
||||
},
|
||||
|
||||
_getAllocatedChildSizeAndSpacing: function(child) {
|
||||
_getAllocatedChildSizeAndSpacing(child) {
|
||||
let [,, natWidth, natHeight] = child.get_preferred_size();
|
||||
let width = Math.min(this._getHItemSize(), natWidth);
|
||||
let xSpacing = Math.max(0, width - natWidth) / 2;
|
||||
@ -602,7 +596,7 @@ var IconGrid = new Lang.Class({
|
||||
return [width, height, xSpacing, ySpacing];
|
||||
},
|
||||
|
||||
_calculateChildBox: function(child, x, y, box) {
|
||||
_calculateChildBox(child, x, y, box) {
|
||||
/* Center the item in its allocation horizontally */
|
||||
let [width, height, childXSpacing, childYSpacing] =
|
||||
this._getAllocatedChildSizeAndSpacing(child);
|
||||
@ -620,15 +614,15 @@ var IconGrid = new Lang.Class({
|
||||
return childBox;
|
||||
},
|
||||
|
||||
columnsForWidth: function(rowWidth) {
|
||||
columnsForWidth(rowWidth) {
|
||||
return this._computeLayout(rowWidth)[0];
|
||||
},
|
||||
|
||||
getRowLimit: function() {
|
||||
getRowLimit() {
|
||||
return this._rowLimit;
|
||||
},
|
||||
|
||||
_computeLayout: function (forWidth) {
|
||||
_computeLayout(forWidth) {
|
||||
let nColumns = 0;
|
||||
let usedWidth = this.leftPadding + this.rightPadding;
|
||||
let spacing = this._getSpacing();
|
||||
@ -645,7 +639,7 @@ var IconGrid = new Lang.Class({
|
||||
return [nColumns, usedWidth];
|
||||
},
|
||||
|
||||
_onStyleChanged: function() {
|
||||
_onStyleChanged() {
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
this._spacing = themeNode.get_length('spacing');
|
||||
this._hItemSize = themeNode.get_length('-shell-grid-horizontal-item-size') || ICON_SIZE;
|
||||
@ -653,7 +647,7 @@ var IconGrid = new Lang.Class({
|
||||
this._grid.queue_relayout();
|
||||
},
|
||||
|
||||
nRows: function(forWidth) {
|
||||
nRows(forWidth) {
|
||||
let children = this._getVisibleChildren();
|
||||
let nColumns = (forWidth < 0) ? children.length : this._computeLayout(forWidth)[0];
|
||||
let nRows = (nColumns > 0) ? Math.ceil(children.length / nColumns) : 0;
|
||||
@ -662,35 +656,35 @@ var IconGrid = new Lang.Class({
|
||||
return nRows;
|
||||
},
|
||||
|
||||
rowsForHeight: function(forHeight) {
|
||||
rowsForHeight(forHeight) {
|
||||
return Math.floor((forHeight - (this.topPadding + this.bottomPadding) + this._getSpacing()) / (this._getVItemSize() + this._getSpacing()));
|
||||
},
|
||||
|
||||
usedHeightForNRows: function(nRows) {
|
||||
usedHeightForNRows(nRows) {
|
||||
return (this._getVItemSize() + this._getSpacing()) * nRows - this._getSpacing() + this.topPadding + this.bottomPadding;
|
||||
},
|
||||
|
||||
usedWidth: function(forWidth) {
|
||||
usedWidth(forWidth) {
|
||||
return this.usedWidthForNColumns(this.columnsForWidth(forWidth));
|
||||
},
|
||||
|
||||
usedWidthForNColumns: function(columns) {
|
||||
usedWidthForNColumns(columns) {
|
||||
let usedWidth = columns * (this._getHItemSize() + this._getSpacing());
|
||||
usedWidth -= this._getSpacing();
|
||||
return usedWidth + this.leftPadding + this.rightPadding;
|
||||
},
|
||||
|
||||
removeAll: function() {
|
||||
removeAll() {
|
||||
this._items = [];
|
||||
this._grid.remove_all_children();
|
||||
},
|
||||
|
||||
destroyAll: function() {
|
||||
destroyAll() {
|
||||
this._items = [];
|
||||
this._grid.destroy_all_children();
|
||||
},
|
||||
|
||||
addItem: function(item, index) {
|
||||
addItem(item, index) {
|
||||
if (!item.icon instanceof BaseIcon)
|
||||
throw new Error('Only items with a BaseIcon icon property can be added to IconGrid');
|
||||
|
||||
@ -701,35 +695,35 @@ var IconGrid = new Lang.Class({
|
||||
this._grid.add_actor(item.actor);
|
||||
},
|
||||
|
||||
removeItem: function(item) {
|
||||
removeItem(item) {
|
||||
this._grid.remove_child(item.actor);
|
||||
},
|
||||
|
||||
getItemAtIndex: function(index) {
|
||||
getItemAtIndex(index) {
|
||||
return this._grid.get_child_at_index(index);
|
||||
},
|
||||
|
||||
visibleItemsCount: function() {
|
||||
visibleItemsCount() {
|
||||
return this._grid.get_n_children() - this._grid.get_n_skip_paint();
|
||||
},
|
||||
|
||||
setSpacing: function(spacing) {
|
||||
setSpacing(spacing) {
|
||||
this._fixedSpacing = spacing;
|
||||
},
|
||||
|
||||
_getSpacing: function() {
|
||||
_getSpacing() {
|
||||
return this._fixedSpacing ? this._fixedSpacing : this._spacing;
|
||||
},
|
||||
|
||||
_getHItemSize: function() {
|
||||
_getHItemSize() {
|
||||
return this._fixedHItemSize ? this._fixedHItemSize : this._hItemSize;
|
||||
},
|
||||
|
||||
_getVItemSize: function() {
|
||||
_getVItemSize() {
|
||||
return this._fixedVItemSize ? this._fixedVItemSize : this._vItemSize;
|
||||
},
|
||||
|
||||
_updateSpacingForSize: function(availWidth, availHeight) {
|
||||
_updateSpacingForSize(availWidth, availHeight) {
|
||||
let maxEmptyVArea = availHeight - this._minRows * this._getVItemSize();
|
||||
let maxEmptyHArea = availWidth - this._minColumns * this._getHItemSize();
|
||||
let maxHSpacing, maxVSpacing;
|
||||
@ -766,7 +760,7 @@ var IconGrid = new Lang.Class({
|
||||
* This function must to be called before iconGrid allocation,
|
||||
* to know how much spacing can the grid has
|
||||
*/
|
||||
adaptToSize: function(availWidth, availHeight) {
|
||||
adaptToSize(availWidth, availHeight) {
|
||||
this._fixedHItemSize = this._hItemSize;
|
||||
this._fixedVItemSize = this._vItemSize;
|
||||
this._updateSpacingForSize(availWidth, availHeight);
|
||||
@ -784,11 +778,11 @@ var IconGrid = new Lang.Class({
|
||||
this._updateSpacingForSize(availWidth, availHeight);
|
||||
}
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||
Lang.bind(this, this._updateIconSizes));
|
||||
this._updateIconSizes.bind(this));
|
||||
},
|
||||
|
||||
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
|
||||
_updateIconSizes: function() {
|
||||
_updateIconSizes() {
|
||||
let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
|
||||
let newIconSize = Math.floor(ICON_SIZE * scale);
|
||||
for (let i in this._items) {
|
||||
@ -802,7 +796,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
Name: 'PaginatedIconGrid',
|
||||
Extends: IconGrid,
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
this.parent(params);
|
||||
this._nPages = 0;
|
||||
this.currentPage = 0;
|
||||
@ -811,12 +805,12 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
this._childrenPerPage = 0;
|
||||
},
|
||||
|
||||
_getPreferredHeight: function (grid, forWidth, alloc) {
|
||||
_getPreferredHeight(grid, forWidth, alloc) {
|
||||
alloc.min_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
||||
alloc.natural_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
||||
},
|
||||
|
||||
_allocate: function (grid, box, flags) {
|
||||
_allocate(grid, box, flags) {
|
||||
if (this._childrenPerPage == 0)
|
||||
log('computePages() must be called before allocate(); pagination will not work.');
|
||||
|
||||
@ -870,7 +864,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
},
|
||||
|
||||
// Overriden from IconGrid
|
||||
_getChildrenToAnimate: function() {
|
||||
_getChildrenToAnimate() {
|
||||
let children = this._getVisibleChildren();
|
||||
let firstIndex = this._childrenPerPage * this.currentPage;
|
||||
let lastIndex = firstIndex + this._childrenPerPage;
|
||||
@ -878,7 +872,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
return children.slice(firstIndex, lastIndex);
|
||||
},
|
||||
|
||||
_computePages: function (availWidthPerPage, availHeightPerPage) {
|
||||
_computePages(availWidthPerPage, availHeightPerPage) {
|
||||
let [nColumns, usedWidth] = this._computeLayout(availWidthPerPage);
|
||||
let nRows;
|
||||
let children = this._getVisibleChildren();
|
||||
@ -897,24 +891,24 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
this._childrenPerPage = nColumns * this._rowsPerPage;
|
||||
},
|
||||
|
||||
adaptToSize: function(availWidth, availHeight) {
|
||||
adaptToSize(availWidth, availHeight) {
|
||||
this.parent(availWidth, availHeight);
|
||||
this._computePages(availWidth, availHeight);
|
||||
},
|
||||
|
||||
_availableHeightPerPageForItems: function() {
|
||||
_availableHeightPerPageForItems() {
|
||||
return this.usedHeightForNRows(this._rowsPerPage) - (this.topPadding + this.bottomPadding);
|
||||
},
|
||||
|
||||
nPages: function() {
|
||||
nPages() {
|
||||
return this._nPages;
|
||||
},
|
||||
|
||||
getPageHeight: function() {
|
||||
getPageHeight() {
|
||||
return this._availableHeightPerPageForItems();
|
||||
},
|
||||
|
||||
getPageY: function(pageNumber) {
|
||||
getPageY(pageNumber) {
|
||||
if (!this._nPages)
|
||||
return 0;
|
||||
|
||||
@ -923,7 +917,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
return childBox.y1 - this.topPadding;
|
||||
},
|
||||
|
||||
getItemPage: function(item) {
|
||||
getItemPage(item) {
|
||||
let children = this._getVisibleChildren();
|
||||
let index = children.indexOf(item);
|
||||
if (index == -1) {
|
||||
@ -941,7 +935,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
*
|
||||
* Pan view to create extra space for @nRows above or below @sourceItem.
|
||||
*/
|
||||
openExtraSpace: function(sourceItem, side, nRows) {
|
||||
openExtraSpace(sourceItem, side, nRows) {
|
||||
let children = this._getVisibleChildren();
|
||||
let index = children.indexOf(sourceItem.actor);
|
||||
if (index == -1) {
|
||||
@ -985,7 +979,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_translateChildren: function(children, direction, nRows) {
|
||||
_translateChildren(children, direction, nRows) {
|
||||
let translationY = nRows * (this._getVItemSize() + this._getSpacing());
|
||||
if (translationY == 0)
|
||||
return;
|
||||
@ -1000,15 +994,12 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
transition: 'easeInOutQuad'
|
||||
};
|
||||
if (i == (children.length - 1))
|
||||
params.onComplete = Lang.bind(this,
|
||||
function() {
|
||||
this.emit('space-opened');
|
||||
});
|
||||
params.onComplete = () => { this.emit('space-opened'); };
|
||||
Tweener.addTween(children[i], params);
|
||||
}
|
||||
},
|
||||
|
||||
closeExtraSpace: function() {
|
||||
closeExtraSpace() {
|
||||
if (!this._translatedChildren || !this._translatedChildren.length) {
|
||||
this.emit('space-closed');
|
||||
return;
|
||||
@ -1021,10 +1012,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
{ translation_y: 0,
|
||||
time: EXTRA_SPACE_ANIMATION_TIME,
|
||||
transition: 'easeInOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this.emit('space-closed');
|
||||
})
|
||||
onComplete: () => { this.emit('space-closed'); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ var InhibitShortcutsDialog = new Lang.Class({
|
||||
'window': GObject.ParamSpec.override('window', Meta.InhibitShortcutsDialog)
|
||||
},
|
||||
|
||||
_init: function(window) {
|
||||
_init(window) {
|
||||
this.parent();
|
||||
this._window = window;
|
||||
|
||||
@ -45,14 +45,14 @@ var InhibitShortcutsDialog = new Lang.Class({
|
||||
return windowTracker.get_window_app(this._window);
|
||||
},
|
||||
|
||||
_getRestoreAccel: function() {
|
||||
_getRestoreAccel() {
|
||||
let settings = new Gio.Settings({ schema_id: WAYLAND_KEYBINDINGS_SCHEMA });
|
||||
let accel = settings.get_strv('restore-shortcuts')[0] || '';
|
||||
return Gtk.accelerator_get_label.apply(null,
|
||||
Gtk.accelerator_parse(accel));
|
||||
},
|
||||
|
||||
_buildLayout: function() {
|
||||
_buildLayout() {
|
||||
let name = this._app ? this._app.get_name() : this._window.title;
|
||||
|
||||
/* Translators: %s is an application name like "Settings" */
|
||||
@ -84,19 +84,19 @@ var InhibitShortcutsDialog = new Lang.Class({
|
||||
default: true });
|
||||
},
|
||||
|
||||
_emitResponse: function(response) {
|
||||
_emitResponse(response) {
|
||||
this.emit('response', response);
|
||||
this._dialog.close();
|
||||
},
|
||||
|
||||
vfunc_show: function() {
|
||||
vfunc_show() {
|
||||
if (this._app && APP_WHITELIST.indexOf(this._app.get_id()) != -1)
|
||||
this._emitResponse(DialogResponse.ALLOW);
|
||||
else
|
||||
this._dialog.open();
|
||||
},
|
||||
|
||||
vfunc_hide: function() {
|
||||
vfunc_hide() {
|
||||
this._dialog.close();
|
||||
}
|
||||
});
|
||||
|
@ -13,15 +13,15 @@ var KbdA11yDialog = new Lang.Class({
|
||||
Name: 'KbdA11yDialog',
|
||||
Extends: GObject.Object,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._a11ySettings = new Gio.Settings({ schema_id: KEYBOARD_A11Y_SCHEMA });
|
||||
|
||||
let deviceManager = Clutter.DeviceManager.get_default();
|
||||
deviceManager.connect('kbd-a11y-flags-changed',
|
||||
Lang.bind(this, this._showKbdA11yDialog));
|
||||
this._showKbdA11yDialog.bind(this));
|
||||
},
|
||||
|
||||
_showKbdA11yDialog: function(deviceManager, newFlags, whatChanged) {
|
||||
_showKbdA11yDialog(deviceManager, newFlags, whatChanged) {
|
||||
let dialog = new ModalDialog.ModalDialog();
|
||||
let title, body;
|
||||
let key, enabled;
|
||||
|
File diff suppressed because it is too large
Load Diff
267
js/ui/layout.js
267
js/ui/layout.js
@ -52,7 +52,7 @@ var MonitorConstraint = new Lang.Class({
|
||||
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
|
||||
false)},
|
||||
|
||||
_init: function(props) {
|
||||
_init(props) {
|
||||
this._primary = false;
|
||||
this._index = -1;
|
||||
this._workArea = false;
|
||||
@ -98,19 +98,21 @@ var MonitorConstraint = new Lang.Class({
|
||||
this.notify('work-area');
|
||||
},
|
||||
|
||||
vfunc_set_actor: function(actor) {
|
||||
vfunc_set_actor(actor) {
|
||||
if (actor) {
|
||||
if (!this._monitorsChangedId) {
|
||||
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() {
|
||||
this.actor.queue_relayout();
|
||||
}));
|
||||
this._monitorsChangedId =
|
||||
Main.layoutManager.connect('monitors-changed', () => {
|
||||
this.actor.queue_relayout();
|
||||
});
|
||||
}
|
||||
|
||||
if (!this._workareasChangedId) {
|
||||
this._workareasChangedId = global.screen.connect('workareas-changed', Lang.bind(this, function() {
|
||||
if (this._workArea)
|
||||
this.actor.queue_relayout();
|
||||
}));
|
||||
this._workareasChangedId =
|
||||
global.screen.connect('workareas-changed', () => {
|
||||
if (this._workArea)
|
||||
this.actor.queue_relayout();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (this._monitorsChangedId)
|
||||
@ -125,7 +127,7 @@ var MonitorConstraint = new Lang.Class({
|
||||
this.parent(actor);
|
||||
},
|
||||
|
||||
vfunc_update_allocation: function(actor, actorBox) {
|
||||
vfunc_update_allocation(actor, actorBox) {
|
||||
if (!this._primary && this._index < 0)
|
||||
return;
|
||||
|
||||
@ -153,7 +155,7 @@ var MonitorConstraint = new Lang.Class({
|
||||
var Monitor = new Lang.Class({
|
||||
Name: 'Monitor',
|
||||
|
||||
_init: function(index, geometry) {
|
||||
_init(index, geometry) {
|
||||
this.index = index;
|
||||
this.x = geometry.x;
|
||||
this.y = geometry.y;
|
||||
@ -175,7 +177,7 @@ const defaultParams = {
|
||||
var LayoutManager = new Lang.Class({
|
||||
Name: 'LayoutManager',
|
||||
|
||||
_init: function () {
|
||||
_init() {
|
||||
this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||
this.monitors = [];
|
||||
this.primaryMonitor = null;
|
||||
@ -201,22 +203,19 @@ var LayoutManager = new Lang.Class({
|
||||
|
||||
// Set up stage hierarchy to group all UI actors under one container.
|
||||
this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
|
||||
this.uiGroup.connect('allocate',
|
||||
function (actor, box, flags) {
|
||||
let children = actor.get_children();
|
||||
for (let i = 0; i < children.length; i++)
|
||||
children[i].allocate_preferred_size(flags);
|
||||
});
|
||||
this.uiGroup.connect('get-preferred-width',
|
||||
function(actor, forHeight, alloc) {
|
||||
let width = global.stage.width;
|
||||
[alloc.min_size, alloc.natural_size] = [width, width];
|
||||
});
|
||||
this.uiGroup.connect('get-preferred-height',
|
||||
function(actor, forWidth, alloc) {
|
||||
let height = global.stage.height;
|
||||
[alloc.min_size, alloc.natural_size] = [height, height];
|
||||
});
|
||||
this.uiGroup.connect('allocate', (actor, box, flags) => {
|
||||
let children = actor.get_children();
|
||||
for (let i = 0; i < children.length; i++)
|
||||
children[i].allocate_preferred_size(flags);
|
||||
});
|
||||
this.uiGroup.connect('get-preferred-width', (actor, forHeight, alloc) => {
|
||||
let width = global.stage.width;
|
||||
[alloc.min_size, alloc.natural_size] = [width, width];
|
||||
});
|
||||
this.uiGroup.connect('get-preferred-height', (actor, forWidth, alloc) => {
|
||||
let height = global.stage.height;
|
||||
[alloc.min_size, alloc.natural_size] = [height, height];
|
||||
});
|
||||
|
||||
global.stage.remove_actor(global.window_group);
|
||||
this.uiGroup.add_actor(global.window_group);
|
||||
@ -240,7 +239,7 @@ var LayoutManager = new Lang.Class({
|
||||
this.addChrome(this.panelBox, { affectsStruts: true,
|
||||
trackFullscreen: true });
|
||||
this.panelBox.connect('allocation-changed',
|
||||
Lang.bind(this, this._panelBoxChanged));
|
||||
this._panelBoxChanged.bind(this));
|
||||
|
||||
this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup',
|
||||
layout_manager: new Clutter.BinLayout() });
|
||||
@ -271,13 +270,13 @@ var LayoutManager = new Lang.Class({
|
||||
|
||||
// Need to update struts on new workspaces when they are added
|
||||
global.screen.connect('notify::n-workspaces',
|
||||
Lang.bind(this, this._queueUpdateRegions));
|
||||
this._queueUpdateRegions.bind(this));
|
||||
global.screen.connect('restacked',
|
||||
Lang.bind(this, this._windowsRestacked));
|
||||
this._windowsRestacked.bind(this));
|
||||
global.screen.connect('monitors-changed',
|
||||
Lang.bind(this, this._monitorsChanged));
|
||||
this._monitorsChanged.bind(this));
|
||||
global.screen.connect('in-fullscreen-changed',
|
||||
Lang.bind(this, this._updateFullscreen));
|
||||
this._updateFullscreen.bind(this));
|
||||
this._monitorsChanged();
|
||||
|
||||
// NVIDIA drivers don't preserve FBO contents across
|
||||
@ -285,41 +284,41 @@ var LayoutManager = new Lang.Class({
|
||||
// https://bugzilla.gnome.org/show_bug.cgi?id=739178
|
||||
if (Shell.util_need_background_refresh()) {
|
||||
LoginManager.getLoginManager().connect('prepare-for-sleep',
|
||||
function(lm, suspending) {
|
||||
if (suspending)
|
||||
return;
|
||||
Meta.Background.refresh_all();
|
||||
});
|
||||
(lm, suspending) => {
|
||||
if (suspending)
|
||||
return;
|
||||
Meta.Background.refresh_all();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// This is called by Main after everything else is constructed
|
||||
init: function() {
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||
init() {
|
||||
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
||||
|
||||
this._loadBackground();
|
||||
},
|
||||
|
||||
showOverview: function() {
|
||||
showOverview() {
|
||||
this.overviewGroup.show();
|
||||
|
||||
this._inOverview = true;
|
||||
this._updateVisibility();
|
||||
},
|
||||
|
||||
hideOverview: function() {
|
||||
hideOverview() {
|
||||
this.overviewGroup.hide();
|
||||
|
||||
this._inOverview = false;
|
||||
this._updateVisibility();
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
_sessionUpdated() {
|
||||
this._updateVisibility();
|
||||
this._queueUpdateRegions();
|
||||
},
|
||||
|
||||
_updateMonitors: function() {
|
||||
_updateMonitors() {
|
||||
let screen = global.screen;
|
||||
|
||||
this.monitors = [];
|
||||
@ -357,9 +356,9 @@ var LayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateHotCorners: function() {
|
||||
_updateHotCorners() {
|
||||
// destroy old hot corners
|
||||
this.hotCorners.forEach(function(corner) {
|
||||
this.hotCorners.forEach(corner => {
|
||||
if (corner)
|
||||
corner.destroy();
|
||||
});
|
||||
@ -416,22 +415,22 @@ var LayoutManager = new Lang.Class({
|
||||
this.emit('hot-corners-changed');
|
||||
},
|
||||
|
||||
_addBackgroundMenu: function(bgManager) {
|
||||
_addBackgroundMenu(bgManager) {
|
||||
BackgroundMenu.addBackgroundMenu(bgManager.backgroundActor, this);
|
||||
},
|
||||
|
||||
_createBackgroundManager: function(monitorIndex) {
|
||||
_createBackgroundManager(monitorIndex) {
|
||||
let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup,
|
||||
layoutManager: this,
|
||||
monitorIndex: monitorIndex });
|
||||
|
||||
bgManager.connect('changed', Lang.bind(this, this._addBackgroundMenu));
|
||||
bgManager.connect('changed', this._addBackgroundMenu.bind(this));
|
||||
this._addBackgroundMenu(bgManager);
|
||||
|
||||
return bgManager;
|
||||
},
|
||||
|
||||
_showSecondaryBackgrounds: function() {
|
||||
_showSecondaryBackgrounds() {
|
||||
for (let i = 0; i < this.monitors.length; i++) {
|
||||
if (i != this.primaryIndex) {
|
||||
let backgroundActor = this._bgManagers[i].backgroundActor;
|
||||
@ -445,7 +444,7 @@ var LayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateBackgrounds: function() {
|
||||
_updateBackgrounds() {
|
||||
let i;
|
||||
for (i = 0; i < this._bgManagers.length; i++)
|
||||
this._bgManagers[i].destroy();
|
||||
@ -464,13 +463,13 @@ var LayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateKeyboardBox: function() {
|
||||
_updateKeyboardBox() {
|
||||
this.keyboardBox.set_position(this.keyboardMonitor.x,
|
||||
this.keyboardMonitor.y + this.keyboardMonitor.height);
|
||||
this.keyboardBox.set_size(this.keyboardMonitor.width, -1);
|
||||
},
|
||||
|
||||
_updateBoxes: function() {
|
||||
_updateBoxes() {
|
||||
this.screenShieldGroup.set_position(0, 0);
|
||||
this.screenShieldGroup.set_size(global.screen_width, global.screen_height);
|
||||
|
||||
@ -483,17 +482,17 @@ var LayoutManager = new Lang.Class({
|
||||
this.keyboardIndex = this.primaryIndex;
|
||||
},
|
||||
|
||||
_panelBoxChanged: function() {
|
||||
_panelBoxChanged() {
|
||||
this._updatePanelBarrier();
|
||||
|
||||
let size = this.panelBox.height;
|
||||
this.hotCorners.forEach(function(corner) {
|
||||
this.hotCorners.forEach(corner => {
|
||||
if (corner)
|
||||
corner.setBarrierSize(size);
|
||||
});
|
||||
},
|
||||
|
||||
_updatePanelBarrier: function() {
|
||||
_updatePanelBarrier() {
|
||||
if (this._rightPanelBarrier) {
|
||||
this._rightPanelBarrier.destroy();
|
||||
this._rightPanelBarrier = null;
|
||||
@ -512,7 +511,7 @@ var LayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_monitorsChanged: function() {
|
||||
_monitorsChanged() {
|
||||
this._updateMonitors();
|
||||
this._updateBoxes();
|
||||
this._updateHotCorners();
|
||||
@ -524,7 +523,7 @@ var LayoutManager = new Lang.Class({
|
||||
this.emit('monitors-changed');
|
||||
},
|
||||
|
||||
_isAboveOrBelowPrimary: function(monitor) {
|
||||
_isAboveOrBelowPrimary(monitor) {
|
||||
let primary = this.monitors[this.primaryIndex];
|
||||
let monitorLeft = monitor.x, monitorRight = monitor.x + monitor.width;
|
||||
let primaryLeft = primary.x, primaryRight = primary.x + primary.width;
|
||||
@ -570,7 +569,7 @@ var LayoutManager = new Lang.Class({
|
||||
return this._keyboardIndex;
|
||||
},
|
||||
|
||||
_loadBackground: function() {
|
||||
_loadBackground() {
|
||||
if (!this.primaryMonitor) {
|
||||
this._pendingLoadBackground = true;
|
||||
return;
|
||||
@ -584,13 +583,13 @@ var LayoutManager = new Lang.Class({
|
||||
coordinate: Clutter.BindCoordinate.ALL });
|
||||
this._systemBackground.actor.add_constraint(constraint);
|
||||
|
||||
let signalId = this._systemBackground.connect('loaded', Lang.bind(this, function() {
|
||||
let signalId = this._systemBackground.connect('loaded', () => {
|
||||
this._systemBackground.disconnect(signalId);
|
||||
this._systemBackground.actor.show();
|
||||
global.stage.show();
|
||||
|
||||
this._prepareStartupAnimation();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
// Startup Animations
|
||||
@ -608,7 +607,7 @@ var LayoutManager = new Lang.Class({
|
||||
// When starting a normal user session, we want to grow it out of the middle
|
||||
// of the screen.
|
||||
|
||||
_prepareStartupAnimation: function() {
|
||||
_prepareStartupAnimation() {
|
||||
// During the initial transition, add a simple actor to block all events,
|
||||
// so they don't get delivered to X11 windows that have been transformed.
|
||||
this._coverPane = new Clutter.Actor({ opacity: 0,
|
||||
@ -652,14 +651,14 @@ var LayoutManager = new Lang.Class({
|
||||
// until the event loop is uncontended and idle.
|
||||
// This helps to prevent us from running the animation
|
||||
// when the system is bogged down
|
||||
let id = GLib.idle_add(GLib.PRIORITY_LOW, Lang.bind(this, function() {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_LOW, () => {
|
||||
this._startupAnimation();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
|
||||
},
|
||||
|
||||
_startupAnimation: function() {
|
||||
_startupAnimation() {
|
||||
if (Meta.is_restart())
|
||||
this._startupAnimationComplete();
|
||||
else if (Main.sessionMode.isGreeter)
|
||||
@ -668,7 +667,7 @@ var LayoutManager = new Lang.Class({
|
||||
this._startupAnimationSession();
|
||||
},
|
||||
|
||||
_startupAnimationGreeter: function() {
|
||||
_startupAnimationGreeter() {
|
||||
Tweener.addTween(this.panelBox,
|
||||
{ translation_y: 0,
|
||||
time: STARTUP_ANIMATION_TIME,
|
||||
@ -677,7 +676,7 @@ var LayoutManager = new Lang.Class({
|
||||
onCompleteScope: this });
|
||||
},
|
||||
|
||||
_startupAnimationSession: function() {
|
||||
_startupAnimationSession() {
|
||||
Tweener.addTween(this.uiGroup,
|
||||
{ scale_x: 1,
|
||||
scale_y: 1,
|
||||
@ -688,7 +687,7 @@ var LayoutManager = new Lang.Class({
|
||||
onCompleteScope: this });
|
||||
},
|
||||
|
||||
_startupAnimationComplete: function() {
|
||||
_startupAnimationComplete() {
|
||||
this._coverPane.destroy();
|
||||
this._coverPane = null;
|
||||
|
||||
@ -709,7 +708,7 @@ var LayoutManager = new Lang.Class({
|
||||
this.emit('startup-complete');
|
||||
},
|
||||
|
||||
showKeyboard: function () {
|
||||
showKeyboard() {
|
||||
this.keyboardBox.show();
|
||||
Tweener.addTween(this.keyboardBox,
|
||||
{ anchor_y: this.keyboardBox.height,
|
||||
@ -722,17 +721,17 @@ var LayoutManager = new Lang.Class({
|
||||
this.emit('keyboard-visible-changed', true);
|
||||
},
|
||||
|
||||
_showKeyboardComplete: function() {
|
||||
_showKeyboardComplete() {
|
||||
// Poke Chrome to update the input shape; it doesn't notice
|
||||
// anchor point changes
|
||||
this._updateRegions();
|
||||
|
||||
this._keyboardHeightNotifyId = this.keyboardBox.connect('notify::height', Lang.bind(this, function () {
|
||||
this._keyboardHeightNotifyId = this.keyboardBox.connect('notify::height', () => {
|
||||
this.keyboardBox.anchor_y = this.keyboardBox.height;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
hideKeyboard: function (immediate) {
|
||||
hideKeyboard(immediate) {
|
||||
if (this._keyboardHeightNotifyId) {
|
||||
this.keyboardBox.disconnect(this._keyboardHeightNotifyId);
|
||||
this._keyboardHeightNotifyId = 0;
|
||||
@ -749,7 +748,7 @@ var LayoutManager = new Lang.Class({
|
||||
this.emit('keyboard-visible-changed', false);
|
||||
},
|
||||
|
||||
_hideKeyboardComplete: function() {
|
||||
_hideKeyboardComplete() {
|
||||
this.keyboardBox.hide();
|
||||
this._updateRegions();
|
||||
},
|
||||
@ -764,7 +763,7 @@ var LayoutManager = new Lang.Class({
|
||||
// the actual mouse pointer as it moves, you need to call this
|
||||
// function before you show the menu to ensure it is at the right
|
||||
// position and has the right size.
|
||||
setDummyCursorGeometry: function(x, y, w, h) {
|
||||
setDummyCursorGeometry(x, y, w, h) {
|
||||
this.dummyCursor.set_position(Math.round(x), Math.round(y));
|
||||
this.dummyCursor.set_size(Math.round(w), Math.round(h));
|
||||
},
|
||||
@ -788,7 +787,7 @@ var LayoutManager = new Lang.Class({
|
||||
// will be bound to the presence of fullscreen windows on the same
|
||||
// monitor (it will be hidden whenever a fullscreen window is visible,
|
||||
// and shown otherwise)
|
||||
addChrome: function(actor, params) {
|
||||
addChrome(actor, params) {
|
||||
this.uiGroup.add_actor(actor);
|
||||
if (this.uiGroup.contains(global.top_window_group))
|
||||
this.uiGroup.set_child_below_sibling(actor, global.top_window_group);
|
||||
@ -805,7 +804,7 @@ var LayoutManager = new Lang.Class({
|
||||
// @params can have any of the same values as in addChrome(),
|
||||
// though some possibilities don't make sense. By default, @actor has
|
||||
// the same params as its chrome ancestor.
|
||||
trackChrome: function(actor, params) {
|
||||
trackChrome(actor, params) {
|
||||
let ancestor = actor.get_parent();
|
||||
let index = this._findActor(ancestor);
|
||||
while (ancestor && index == -1) {
|
||||
@ -831,7 +830,7 @@ var LayoutManager = new Lang.Class({
|
||||
// @actor: an actor previously tracked via trackChrome()
|
||||
//
|
||||
// Undoes the effect of trackChrome()
|
||||
untrackChrome: function(actor) {
|
||||
untrackChrome(actor) {
|
||||
this._untrackActor(actor);
|
||||
},
|
||||
|
||||
@ -839,12 +838,12 @@ var LayoutManager = new Lang.Class({
|
||||
// @actor: a chrome actor
|
||||
//
|
||||
// Removes @actor from the chrome
|
||||
removeChrome: function(actor) {
|
||||
removeChrome(actor) {
|
||||
this.uiGroup.remove_actor(actor);
|
||||
this._untrackActor(actor);
|
||||
},
|
||||
|
||||
_findActor: function(actor) {
|
||||
_findActor(actor) {
|
||||
for (let i = 0; i < this._trackedActors.length; i++) {
|
||||
let actorData = this._trackedActors[i];
|
||||
if (actorData.actor == actor)
|
||||
@ -853,18 +852,18 @@ var LayoutManager = new Lang.Class({
|
||||
return -1;
|
||||
},
|
||||
|
||||
_trackActor: function(actor, params) {
|
||||
_trackActor(actor, params) {
|
||||
if (this._findActor(actor) != -1)
|
||||
throw new Error('trying to re-track existing chrome actor');
|
||||
|
||||
let actorData = Params.parse(params, defaultParams);
|
||||
actorData.actor = actor;
|
||||
actorData.visibleId = actor.connect('notify::visible',
|
||||
Lang.bind(this, this._queueUpdateRegions));
|
||||
this._queueUpdateRegions.bind(this));
|
||||
actorData.allocationId = actor.connect('notify::allocation',
|
||||
Lang.bind(this, this._queueUpdateRegions));
|
||||
this._queueUpdateRegions.bind(this));
|
||||
actorData.destroyId = actor.connect('destroy',
|
||||
Lang.bind(this, this._untrackActor));
|
||||
this._untrackActor.bind(this));
|
||||
// Note that destroying actor will unset its parent, so we don't
|
||||
// need to connect to 'destroy' too.
|
||||
|
||||
@ -873,7 +872,7 @@ var LayoutManager = new Lang.Class({
|
||||
this._queueUpdateRegions();
|
||||
},
|
||||
|
||||
_untrackActor: function(actor) {
|
||||
_untrackActor(actor) {
|
||||
let i = this._findActor(actor);
|
||||
|
||||
if (i == -1)
|
||||
@ -888,7 +887,7 @@ var LayoutManager = new Lang.Class({
|
||||
this._queueUpdateRegions();
|
||||
},
|
||||
|
||||
_updateActorVisibility: function(actorData) {
|
||||
_updateActorVisibility(actorData) {
|
||||
if (!actorData.trackFullscreen)
|
||||
return;
|
||||
|
||||
@ -898,16 +897,16 @@ var LayoutManager = new Lang.Class({
|
||||
monitor.inFullscreen);
|
||||
},
|
||||
|
||||
_updateVisibility: function() {
|
||||
_updateVisibility() {
|
||||
let windowsVisible = Main.sessionMode.hasWindows && !this._inOverview;
|
||||
|
||||
global.window_group.visible = windowsVisible;
|
||||
global.top_window_group.visible = windowsVisible;
|
||||
|
||||
this._trackedActors.forEach(Lang.bind(this, this._updateActorVisibility));
|
||||
this._trackedActors.forEach(this._updateActorVisibility.bind(this));
|
||||
},
|
||||
|
||||
getWorkAreaForMonitor: function(monitorIndex) {
|
||||
getWorkAreaForMonitor(monitorIndex) {
|
||||
// Assume that all workspaces will have the same
|
||||
// struts and pick the first one.
|
||||
let ws = global.screen.get_workspace_by_index(0);
|
||||
@ -916,42 +915,42 @@ var LayoutManager = new Lang.Class({
|
||||
|
||||
// This call guarantees that we return some monitor to simplify usage of it
|
||||
// In practice all tracked actors should be visible on some monitor anyway
|
||||
findIndexForActor: function(actor) {
|
||||
findIndexForActor(actor) {
|
||||
let [x, y] = actor.get_transformed_position();
|
||||
let [w, h] = actor.get_transformed_size();
|
||||
let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h });
|
||||
return global.screen.get_monitor_index_for_rect(rect);
|
||||
},
|
||||
|
||||
findMonitorForActor: function(actor) {
|
||||
findMonitorForActor(actor) {
|
||||
let index = this.findIndexForActor(actor);
|
||||
if (index >= 0 && index < this.monitors.length)
|
||||
return this.monitors[index];
|
||||
return null;
|
||||
},
|
||||
|
||||
_queueUpdateRegions: function() {
|
||||
_queueUpdateRegions() {
|
||||
if (this._startingUp)
|
||||
return;
|
||||
|
||||
if (!this._updateRegionIdle)
|
||||
this._updateRegionIdle = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||
Lang.bind(this, this._updateRegions));
|
||||
this._updateRegions.bind(this));
|
||||
},
|
||||
|
||||
_getWindowActorsForWorkspace: function(workspace) {
|
||||
return global.get_window_actors().filter(function (actor) {
|
||||
_getWindowActorsForWorkspace(workspace) {
|
||||
return global.get_window_actors().filter(actor => {
|
||||
let win = actor.meta_window;
|
||||
return win.located_on_workspace(workspace);
|
||||
});
|
||||
},
|
||||
|
||||
_updateFullscreen: function() {
|
||||
_updateFullscreen() {
|
||||
this._updateVisibility();
|
||||
this._queueUpdateRegions();
|
||||
},
|
||||
|
||||
_windowsRestacked: function() {
|
||||
_windowsRestacked() {
|
||||
let changed = false;
|
||||
|
||||
if (this._isPopupWindowVisible != global.top_window_group.get_children().some(isPopupMetaWindow))
|
||||
@ -963,7 +962,7 @@ var LayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateRegions: function() {
|
||||
_updateRegions() {
|
||||
if (this._updateRegionIdle) {
|
||||
Meta.later_remove(this._updateRegionIdle);
|
||||
delete this._updateRegionIdle;
|
||||
@ -1062,7 +1061,7 @@ var LayoutManager = new Lang.Class({
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
modalEnded: function() {
|
||||
modalEnded() {
|
||||
// We don't update the stage input region while in a modal,
|
||||
// so queue an update now.
|
||||
this._queueUpdateRegions();
|
||||
@ -1078,7 +1077,7 @@ Signals.addSignalMethods(LayoutManager.prototype);
|
||||
var HotCorner = new Lang.Class({
|
||||
Name: 'HotCorner',
|
||||
|
||||
_init : function(layoutManager, monitor, x, y) {
|
||||
_init(layoutManager, monitor, x, y) {
|
||||
// We use this flag to mark the case where the user has entered the
|
||||
// hot corner and has not left both the hot corner and a surrounding
|
||||
// guard area (the "environs"). This avoids triggering the hot corner
|
||||
@ -1096,7 +1095,7 @@ var HotCorner = new Lang.Class({
|
||||
HOT_CORNER_PRESSURE_TIMEOUT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW);
|
||||
this._pressureBarrier.connect('trigger', Lang.bind(this, this._toggleOverview));
|
||||
this._pressureBarrier.connect('trigger', this._toggleOverview.bind(this));
|
||||
|
||||
// Cache the three ripples instead of dynamically creating and destroying them.
|
||||
this._ripple1 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0, visible: false });
|
||||
@ -1108,7 +1107,7 @@ var HotCorner = new Lang.Class({
|
||||
layoutManager.uiGroup.add_actor(this._ripple3);
|
||||
},
|
||||
|
||||
setBarrierSize: function(size) {
|
||||
setBarrierSize(size) {
|
||||
if (this._verticalBarrier) {
|
||||
this._pressureBarrier.removeBarrier(this._verticalBarrier);
|
||||
this._verticalBarrier.destroy();
|
||||
@ -1143,7 +1142,7 @@ var HotCorner = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_setupFallbackCornerIfNeeded: function(layoutManager) {
|
||||
_setupFallbackCornerIfNeeded(layoutManager) {
|
||||
if (!global.display.supports_extended_barriers()) {
|
||||
this.actor = new Clutter.Actor({ name: 'hot-corner-environs',
|
||||
x: this._x, y: this._y,
|
||||
@ -1169,16 +1168,16 @@ var HotCorner = new Lang.Class({
|
||||
}
|
||||
|
||||
this.actor.connect('leave-event',
|
||||
Lang.bind(this, this._onEnvironsLeft));
|
||||
this._onEnvironsLeft.bind(this));
|
||||
|
||||
this._corner.connect('enter-event',
|
||||
Lang.bind(this, this._onCornerEntered));
|
||||
this._onCornerEntered.bind(this));
|
||||
this._corner.connect('leave-event',
|
||||
Lang.bind(this, this._onCornerLeft));
|
||||
this._onCornerLeft.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this.setBarrierSize(0);
|
||||
this._pressureBarrier.destroy();
|
||||
this._pressureBarrier = null;
|
||||
@ -1187,7 +1186,7 @@ var HotCorner = new Lang.Class({
|
||||
this.actor.destroy();
|
||||
},
|
||||
|
||||
_animRipple : function(ripple, delay, time, startScale, startOpacity, finalScale) {
|
||||
_animRipple(ripple, delay, time, startScale, startOpacity, finalScale) {
|
||||
// We draw a ripple by using a source image and animating it scaling
|
||||
// outwards and fading away. We want the ripples to move linearly
|
||||
// or it looks unrealistic, but if the opacity of the ripple goes
|
||||
@ -1213,11 +1212,11 @@ var HotCorner = new Lang.Class({
|
||||
delay: delay,
|
||||
time: time,
|
||||
transition: 'linear',
|
||||
onUpdate: function() { ripple.opacity = 255 * Math.sqrt(ripple._opacity); },
|
||||
onComplete: function() { ripple.visible = false; } });
|
||||
onUpdate() { ripple.opacity = 255 * Math.sqrt(ripple._opacity); },
|
||||
onComplete() { ripple.visible = false; } });
|
||||
},
|
||||
|
||||
_rippleAnimation: function() {
|
||||
_rippleAnimation() {
|
||||
// Show three concentric ripples expanding outwards; the exact
|
||||
// parameters were found by trial and error, so don't look
|
||||
// for them to make perfect sense mathematically
|
||||
@ -1228,7 +1227,7 @@ var HotCorner = new Lang.Class({
|
||||
this._animRipple(this._ripple3, 0.35, 1.0, 0.0, 0.3, 1);
|
||||
},
|
||||
|
||||
_toggleOverview: function() {
|
||||
_toggleOverview() {
|
||||
if (this._monitor.inFullscreen)
|
||||
return;
|
||||
|
||||
@ -1238,7 +1237,7 @@ var HotCorner = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
handleDragOver: function(source, actor, x, y, time) {
|
||||
handleDragOver(source, actor, x, y, time) {
|
||||
if (source != Main.xdndHandler)
|
||||
return DND.DragMotionResult.CONTINUE;
|
||||
|
||||
@ -1247,7 +1246,7 @@ var HotCorner = new Lang.Class({
|
||||
return DND.DragMotionResult.CONTINUE;
|
||||
},
|
||||
|
||||
_onCornerEntered : function() {
|
||||
_onCornerEntered() {
|
||||
if (!this._entered) {
|
||||
this._entered = true;
|
||||
this._toggleOverview();
|
||||
@ -1255,14 +1254,14 @@ var HotCorner = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_onCornerLeft : function(actor, event) {
|
||||
_onCornerLeft(actor, event) {
|
||||
if (event.get_related() != this.actor)
|
||||
this._entered = false;
|
||||
// Consume event, otherwise this will confuse onEnvironsLeft
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_onEnvironsLeft : function(actor, event) {
|
||||
_onEnvironsLeft(actor, event) {
|
||||
if (event.get_related() != this._corner)
|
||||
this._entered = false;
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
@ -1272,7 +1271,7 @@ var HotCorner = new Lang.Class({
|
||||
var PressureBarrier = new Lang.Class({
|
||||
Name: 'PressureBarrier',
|
||||
|
||||
_init: function(threshold, timeout, actionMode) {
|
||||
_init(threshold, timeout, actionMode) {
|
||||
this._threshold = threshold;
|
||||
this._timeout = timeout;
|
||||
this._actionMode = actionMode;
|
||||
@ -1283,57 +1282,57 @@ var PressureBarrier = new Lang.Class({
|
||||
this._reset();
|
||||
},
|
||||
|
||||
addBarrier: function(barrier) {
|
||||
barrier._pressureHitId = barrier.connect('hit', Lang.bind(this, this._onBarrierHit));
|
||||
barrier._pressureLeftId = barrier.connect('left', Lang.bind(this, this._onBarrierLeft));
|
||||
addBarrier(barrier) {
|
||||
barrier._pressureHitId = barrier.connect('hit', this._onBarrierHit.bind(this));
|
||||
barrier._pressureLeftId = barrier.connect('left', this._onBarrierLeft.bind(this));
|
||||
|
||||
this._barriers.push(barrier);
|
||||
},
|
||||
|
||||
_disconnectBarrier: function(barrier) {
|
||||
_disconnectBarrier(barrier) {
|
||||
barrier.disconnect(barrier._pressureHitId);
|
||||
barrier.disconnect(barrier._pressureLeftId);
|
||||
},
|
||||
|
||||
removeBarrier: function(barrier) {
|
||||
removeBarrier(barrier) {
|
||||
this._disconnectBarrier(barrier);
|
||||
this._barriers.splice(this._barriers.indexOf(barrier), 1);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this._barriers.forEach(Lang.bind(this, this._disconnectBarrier));
|
||||
destroy() {
|
||||
this._barriers.forEach(this._disconnectBarrier.bind(this));
|
||||
this._barriers = [];
|
||||
},
|
||||
|
||||
setEventFilter: function(filter) {
|
||||
setEventFilter(filter) {
|
||||
this._eventFilter = filter;
|
||||
},
|
||||
|
||||
_reset: function() {
|
||||
_reset() {
|
||||
this._barrierEvents = [];
|
||||
this._currentPressure = 0;
|
||||
this._lastTime = 0;
|
||||
},
|
||||
|
||||
_isHorizontal: function(barrier) {
|
||||
_isHorizontal(barrier) {
|
||||
return barrier.y1 == barrier.y2;
|
||||
},
|
||||
|
||||
_getDistanceAcrossBarrier: function(barrier, event) {
|
||||
_getDistanceAcrossBarrier(barrier, event) {
|
||||
if (this._isHorizontal(barrier))
|
||||
return Math.abs(event.dy);
|
||||
else
|
||||
return Math.abs(event.dx);
|
||||
},
|
||||
|
||||
_getDistanceAlongBarrier: function(barrier, event) {
|
||||
_getDistanceAlongBarrier(barrier, event) {
|
||||
if (this._isHorizontal(barrier))
|
||||
return Math.abs(event.dx);
|
||||
else
|
||||
return Math.abs(event.dy);
|
||||
},
|
||||
|
||||
_trimBarrierEvents: function() {
|
||||
_trimBarrierEvents() {
|
||||
// Events are guaranteed to be sorted in time order from
|
||||
// oldest to newest, so just look for the first old event,
|
||||
// and then chop events after that off.
|
||||
@ -1357,21 +1356,21 @@ var PressureBarrier = new Lang.Class({
|
||||
this._barrierEvents = this._barrierEvents.slice(firstNewEvent);
|
||||
},
|
||||
|
||||
_onBarrierLeft: function(barrier, event) {
|
||||
_onBarrierLeft(barrier, event) {
|
||||
barrier._isHit = false;
|
||||
if (this._barriers.every(function(b) { return !b._isHit; })) {
|
||||
if (this._barriers.every(b => !b._isHit)) {
|
||||
this._reset();
|
||||
this._isTriggered = false;
|
||||
}
|
||||
},
|
||||
|
||||
_trigger: function() {
|
||||
_trigger() {
|
||||
this._isTriggered = true;
|
||||
this.emit('trigger');
|
||||
this._reset();
|
||||
},
|
||||
|
||||
_onBarrierHit: function(barrier, event) {
|
||||
_onBarrierHit(barrier, event) {
|
||||
barrier._isHit = true;
|
||||
|
||||
// If we've triggered the barrier, wait until the pointer has the
|
||||
|
@ -31,7 +31,7 @@ var RadialShaderQuad = new Lang.Class({
|
||||
Name: 'RadialShaderQuad',
|
||||
Extends: Shell.GLSLQuad,
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
this.parent(params);
|
||||
|
||||
this._brightnessLocation = this.get_uniform_location('brightness');
|
||||
@ -41,7 +41,7 @@ var RadialShaderQuad = new Lang.Class({
|
||||
this.vignetteSharpness = 0.0;
|
||||
},
|
||||
|
||||
vfunc_build_pipeline: function() {
|
||||
vfunc_build_pipeline() {
|
||||
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT,
|
||||
VIGNETTE_DECLARATIONS, VIGNETTE_CODE, true);
|
||||
},
|
||||
@ -94,7 +94,7 @@ var RadialShaderQuad = new Lang.Class({
|
||||
var Lightbox = new Lang.Class({
|
||||
Name: 'Lightbox',
|
||||
|
||||
_init : function(container, params) {
|
||||
_init(container, params) {
|
||||
params = Params.parse(params, { inhibitEvents: false,
|
||||
width: null,
|
||||
height: null,
|
||||
@ -122,7 +122,7 @@ var Lightbox = new Lang.Class({
|
||||
this.actor.hide();
|
||||
this.shown = false;
|
||||
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
|
||||
if (params.width && params.height) {
|
||||
this.actor.width = params.width;
|
||||
@ -133,13 +133,13 @@ var Lightbox = new Lang.Class({
|
||||
this.actor.add_constraint(constraint);
|
||||
}
|
||||
|
||||
this._actorAddedSignalId = container.connect('actor-added', Lang.bind(this, this._actorAdded));
|
||||
this._actorRemovedSignalId = container.connect('actor-removed', Lang.bind(this, this._actorRemoved));
|
||||
this._actorAddedSignalId = container.connect('actor-added', this._actorAdded.bind(this));
|
||||
this._actorRemovedSignalId = container.connect('actor-removed', this._actorRemoved.bind(this));
|
||||
|
||||
this._highlighted = null;
|
||||
},
|
||||
|
||||
_actorAdded : function(container, newChild) {
|
||||
_actorAdded(container, newChild) {
|
||||
let children = this._container.get_children();
|
||||
let myIndex = children.indexOf(this.actor);
|
||||
let newChildIndex = children.indexOf(newChild);
|
||||
@ -161,7 +161,7 @@ var Lightbox = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
show: function(fadeInTime) {
|
||||
show(fadeInTime) {
|
||||
fadeInTime = fadeInTime || 0;
|
||||
|
||||
Tweener.removeTweens(this.actor);
|
||||
@ -171,27 +171,27 @@ var Lightbox = new Lang.Class({
|
||||
vignetteSharpness: VIGNETTE_SHARPNESS,
|
||||
time: fadeInTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.shown = true;
|
||||
this.emit('shown');
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Tweener.addTween(this.actor,
|
||||
{ opacity: 255 * this._fadeFactor,
|
||||
time: fadeInTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.shown = true;
|
||||
this.emit('shown');
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.actor.show();
|
||||
},
|
||||
|
||||
hide: function(fadeOutTime) {
|
||||
hide(fadeOutTime) {
|
||||
fadeOutTime = fadeOutTime || 0;
|
||||
|
||||
this.shown = false;
|
||||
@ -203,23 +203,23 @@ var Lightbox = new Lang.Class({
|
||||
opacity: 0,
|
||||
time: fadeOutTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Tweener.addTween(this.actor,
|
||||
{ opacity: 0,
|
||||
time: fadeOutTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_actorRemoved : function(container, child) {
|
||||
_actorRemoved(container, child) {
|
||||
let index = this._children.indexOf(child);
|
||||
if (index != -1) // paranoia
|
||||
this._children.splice(index, 1);
|
||||
@ -236,7 +236,7 @@ var Lightbox = new Lang.Class({
|
||||
* currently-highlighted actor. With no arguments or a false/null
|
||||
* argument, all actors will be unhighlighted.
|
||||
*/
|
||||
highlight : function(window) {
|
||||
highlight(window) {
|
||||
if (this._highlighted == window)
|
||||
return;
|
||||
|
||||
@ -264,7 +264,7 @@ var Lightbox = new Lang.Class({
|
||||
*
|
||||
* Destroys the lightbox.
|
||||
*/
|
||||
destroy : function() {
|
||||
destroy() {
|
||||
this.actor.destroy();
|
||||
},
|
||||
|
||||
@ -274,7 +274,7 @@ var Lightbox = new Lang.Class({
|
||||
* This is called when the lightbox' actor is destroyed, either
|
||||
* by destroying its container or by explicitly calling this.destroy().
|
||||
*/
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this._container.disconnect(this._actorAddedSignalId);
|
||||
this._container.disconnect(this._actorRemovedSignalId);
|
||||
|
||||
|
@ -40,9 +40,9 @@ var commandHeader = 'const Clutter = imports.gi.Clutter; ' +
|
||||
* in the shell core code too. */
|
||||
'const stage = global.stage; ' +
|
||||
/* Special lookingGlass functions */
|
||||
'const inspect = Lang.bind(Main.lookingGlass, Main.lookingGlass.inspect); ' +
|
||||
'const inspect = Main.lookingGlass.inspect.bind(Main.lookingGlass); ' +
|
||||
'const it = Main.lookingGlass.getIt(); ' +
|
||||
'const r = Lang.bind(Main.lookingGlass, Main.lookingGlass.getResult); ';
|
||||
'const r = Main.lookingGlass.getResult.bind(Main.lookingGlass); ';
|
||||
|
||||
const HISTORY_KEY = 'looking-glass-history';
|
||||
// Time between tabs for them to count as a double-tab event
|
||||
@ -53,7 +53,9 @@ var AUTO_COMPLETE_GLOBAL_KEYWORDS = _getAutoCompleteGlobalKeywords();
|
||||
function _getAutoCompleteGlobalKeywords() {
|
||||
const keywords = ['true', 'false', 'null', 'new'];
|
||||
// Don't add the private properties of window (i.e., ones starting with '_')
|
||||
const windowProperties = Object.getOwnPropertyNames(window).filter(function(a){ return a.charAt(0) != '_' });
|
||||
const windowProperties = Object.getOwnPropertyNames(window).filter(
|
||||
a => a.charAt(0) != '_'
|
||||
);
|
||||
const headerProperties = JsParse.getDeclaredConstants(commandHeader);
|
||||
|
||||
return keywords.concat(windowProperties).concat(headerProperties);
|
||||
@ -62,13 +64,13 @@ function _getAutoCompleteGlobalKeywords() {
|
||||
var AutoComplete = new Lang.Class({
|
||||
Name: 'AutoComplete',
|
||||
|
||||
_init: function(entry) {
|
||||
_init(entry) {
|
||||
this._entry = entry;
|
||||
this._entry.connect('key-press-event', Lang.bind(this, this._entryKeyPressEvent));
|
||||
this._entry.connect('key-press-event', this._entryKeyPressEvent.bind(this));
|
||||
this._lastTabTime = global.get_current_time();
|
||||
},
|
||||
|
||||
_processCompletionRequest: function(event) {
|
||||
_processCompletionRequest(event) {
|
||||
if (event.completions.length == 0) {
|
||||
return;
|
||||
}
|
||||
@ -90,7 +92,7 @@ var AutoComplete = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_entryKeyPressEvent: function(actor, event) {
|
||||
_entryKeyPressEvent(actor, event) {
|
||||
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
||||
let text = this._entry.get_text();
|
||||
if (cursorPos != -1) {
|
||||
@ -115,7 +117,7 @@ var AutoComplete = new Lang.Class({
|
||||
|
||||
// Insert characters of text not already included in head at cursor position. i.e., if text="abc" and head="a",
|
||||
// the string "bc" will be appended to this._entry
|
||||
additionalCompletionText: function(text, head) {
|
||||
additionalCompletionText(text, head) {
|
||||
let additionalCompletionText = text.slice(head.length);
|
||||
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
||||
|
||||
@ -128,7 +130,7 @@ Signals.addSignalMethods(AutoComplete.prototype);
|
||||
var Notebook = new Lang.Class({
|
||||
Name: 'Notebook',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.BoxLayout({ vertical: true });
|
||||
|
||||
this.tabControls = new St.BoxLayout({ style_class: 'labels' });
|
||||
@ -137,15 +139,15 @@ var Notebook = new Lang.Class({
|
||||
this._tabs = [];
|
||||
},
|
||||
|
||||
appendPage: function(name, child) {
|
||||
appendPage(name, child) {
|
||||
let labelBox = new St.BoxLayout({ style_class: 'notebook-tab',
|
||||
reactive: true,
|
||||
track_hover: true });
|
||||
let label = new St.Button({ label: name });
|
||||
label.connect('clicked', Lang.bind(this, function () {
|
||||
label.connect('clicked', () => {
|
||||
this.selectChild(child);
|
||||
return true;
|
||||
}));
|
||||
});
|
||||
labelBox.add(label, { expand: true });
|
||||
this.tabControls.add(labelBox);
|
||||
|
||||
@ -163,14 +165,14 @@ var Notebook = new Lang.Class({
|
||||
this.actor.add(scrollview, { expand: true });
|
||||
|
||||
let vAdjust = scrollview.vscroll.adjustment;
|
||||
vAdjust.connect('changed', Lang.bind(this, function () { this._onAdjustScopeChanged(tabData); }));
|
||||
vAdjust.connect('notify::value', Lang.bind(this, function() { this._onAdjustValueChanged(tabData); }));
|
||||
vAdjust.connect('changed', () => { this._onAdjustScopeChanged(tabData); });
|
||||
vAdjust.connect('notify::value', () => { this._onAdjustValueChanged(tabData); });
|
||||
|
||||
if (this._selectedIndex == -1)
|
||||
this.selectIndex(0);
|
||||
},
|
||||
|
||||
_unselect: function() {
|
||||
_unselect() {
|
||||
if (this._selectedIndex < 0)
|
||||
return;
|
||||
let tabData = this._tabs[this._selectedIndex];
|
||||
@ -179,7 +181,7 @@ var Notebook = new Lang.Class({
|
||||
this._selectedIndex = -1;
|
||||
},
|
||||
|
||||
selectIndex: function(index) {
|
||||
selectIndex(index) {
|
||||
if (index == this._selectedIndex)
|
||||
return;
|
||||
if (index < 0) {
|
||||
@ -201,7 +203,7 @@ var Notebook = new Lang.Class({
|
||||
this.emit('selection', tabData.child);
|
||||
},
|
||||
|
||||
selectChild: function(child) {
|
||||
selectChild(child) {
|
||||
if (child == null)
|
||||
this.selectIndex(-1);
|
||||
else {
|
||||
@ -215,26 +217,26 @@ var Notebook = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
scrollToBottom: function(index) {
|
||||
scrollToBottom(index) {
|
||||
let tabData = this._tabs[index];
|
||||
tabData._scrollToBottom = true;
|
||||
|
||||
},
|
||||
|
||||
_onAdjustValueChanged: function (tabData) {
|
||||
_onAdjustValueChanged(tabData) {
|
||||
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
||||
if (vAdjust.value < (vAdjust.upper - vAdjust.lower - 0.5))
|
||||
tabData._scrolltoBottom = false;
|
||||
},
|
||||
|
||||
_onAdjustScopeChanged: function (tabData) {
|
||||
_onAdjustScopeChanged(tabData) {
|
||||
if (!tabData._scrollToBottom)
|
||||
return;
|
||||
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
||||
vAdjust.value = vAdjust.upper - vAdjust.page_size;
|
||||
},
|
||||
|
||||
nextTab: function() {
|
||||
nextTab() {
|
||||
let nextIndex = this._selectedIndex;
|
||||
if (nextIndex < this._tabs.length - 1) {
|
||||
++nextIndex;
|
||||
@ -243,7 +245,7 @@ var Notebook = new Lang.Class({
|
||||
this.selectIndex(nextIndex);
|
||||
},
|
||||
|
||||
prevTab: function() {
|
||||
prevTab() {
|
||||
let prevIndex = this._selectedIndex;
|
||||
if (prevIndex > 0) {
|
||||
--prevIndex;
|
||||
@ -266,7 +268,7 @@ function objectToString(o) {
|
||||
var ObjLink = new Lang.Class({
|
||||
Name: 'ObjLink',
|
||||
|
||||
_init: function(lookingGlass, o, title) {
|
||||
_init(lookingGlass, o, title) {
|
||||
let text;
|
||||
if (title)
|
||||
text = title;
|
||||
@ -280,12 +282,12 @@ var ObjLink = new Lang.Class({
|
||||
style_class: 'shell-link',
|
||||
label: text });
|
||||
this.actor.get_child().single_line_mode = true;
|
||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||
this.actor.connect('clicked', this._onClicked.bind(this));
|
||||
|
||||
this._lookingGlass = lookingGlass;
|
||||
},
|
||||
|
||||
_onClicked: function (link) {
|
||||
_onClicked(link) {
|
||||
this._lookingGlass.inspectObject(this._obj, this.actor);
|
||||
}
|
||||
});
|
||||
@ -293,7 +295,7 @@ var ObjLink = new Lang.Class({
|
||||
var Result = new Lang.Class({
|
||||
Name: 'Result',
|
||||
|
||||
_init: function(lookingGlass, command, o, index) {
|
||||
_init(lookingGlass, command, o, index) {
|
||||
this.index = index;
|
||||
this.o = o;
|
||||
|
||||
@ -316,17 +318,17 @@ var Result = new Lang.Class({
|
||||
var WindowList = new Lang.Class({
|
||||
Name: 'WindowList',
|
||||
|
||||
_init: function(lookingGlass) {
|
||||
_init(lookingGlass) {
|
||||
this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
this._updateId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._updateWindowList));
|
||||
global.display.connect('window-created', Lang.bind(this, this._updateWindowList));
|
||||
tracker.connect('tracked-windows-changed', Lang.bind(this, this._updateWindowList));
|
||||
this._updateId = Main.initializeDeferredWork(this.actor, this._updateWindowList.bind(this));
|
||||
global.display.connect('window-created', this._updateWindowList.bind(this));
|
||||
tracker.connect('tracked-windows-changed', this._updateWindowList.bind(this));
|
||||
|
||||
this._lookingGlass = lookingGlass;
|
||||
},
|
||||
|
||||
_updateWindowList: function() {
|
||||
_updateWindowList() {
|
||||
this.actor.destroy_all_children();
|
||||
let windows = global.get_window_actors();
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
@ -334,7 +336,7 @@ var WindowList = new Lang.Class({
|
||||
let metaWindow = windows[i].metaWindow;
|
||||
// Avoid multiple connections
|
||||
if (!metaWindow._lookingGlassManaged) {
|
||||
metaWindow.connect('unmanaged', Lang.bind(this, this._updateWindowList));
|
||||
metaWindow.connect('unmanaged', this._updateWindowList.bind(this));
|
||||
metaWindow._lookingGlassManaged = true;
|
||||
}
|
||||
let box = new St.BoxLayout({ vertical: true });
|
||||
@ -364,7 +366,7 @@ Signals.addSignalMethods(WindowList.prototype);
|
||||
var ObjInspector = new Lang.Class({
|
||||
Name: 'ObjInspector',
|
||||
|
||||
_init: function(lookingGlass) {
|
||||
_init(lookingGlass) {
|
||||
this._obj = null;
|
||||
this._previousObj = null;
|
||||
|
||||
@ -381,7 +383,7 @@ var ObjInspector = new Lang.Class({
|
||||
this._lookingGlass = lookingGlass;
|
||||
},
|
||||
|
||||
selectObject: function(obj, skipPrevious) {
|
||||
selectObject(obj, skipPrevious) {
|
||||
if (!skipPrevious)
|
||||
this._previousObj = this._obj;
|
||||
else
|
||||
@ -397,17 +399,17 @@ var ObjInspector = new Lang.Class({
|
||||
label.single_line_mode = true;
|
||||
hbox.add(label, { expand: true, y_fill: false });
|
||||
let button = new St.Button({ label: 'Insert', style_class: 'lg-obj-inspector-button' });
|
||||
button.connect('clicked', Lang.bind(this, this._onInsert));
|
||||
button.connect('clicked', this._onInsert.bind(this));
|
||||
hbox.add(button);
|
||||
|
||||
if (this._previousObj != null) {
|
||||
button = new St.Button({ label: 'Back', style_class: 'lg-obj-inspector-button' });
|
||||
button.connect('clicked', Lang.bind(this, this._onBack));
|
||||
button.connect('clicked', this._onBack.bind(this));
|
||||
hbox.add(button);
|
||||
}
|
||||
|
||||
button = new St.Button({ style_class: 'window-close' });
|
||||
button.connect('clicked', Lang.bind(this, this.close));
|
||||
button.connect('clicked', this.close.bind(this));
|
||||
hbox.add(button);
|
||||
if (typeof(obj) == typeof({})) {
|
||||
let properties = [];
|
||||
@ -435,7 +437,7 @@ var ObjInspector = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
open: function(sourceActor) {
|
||||
open(sourceActor) {
|
||||
if (this._open)
|
||||
return;
|
||||
this._previousObj = null;
|
||||
@ -451,7 +453,7 @@ var ObjInspector = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
close: function() {
|
||||
close() {
|
||||
if (!this._open)
|
||||
return;
|
||||
this._open = false;
|
||||
@ -460,13 +462,13 @@ var ObjInspector = new Lang.Class({
|
||||
this._obj = null;
|
||||
},
|
||||
|
||||
_onInsert: function() {
|
||||
_onInsert() {
|
||||
let obj = this._obj;
|
||||
this.close();
|
||||
this._lookingGlass.insertObject(obj);
|
||||
},
|
||||
|
||||
_onBack: function() {
|
||||
_onBack() {
|
||||
this.selectObject(this._previousObj, true);
|
||||
}
|
||||
});
|
||||
@ -475,7 +477,7 @@ var RedBorderEffect = new Lang.Class({
|
||||
Name: 'RedBorderEffect',
|
||||
Extends: Clutter.Effect,
|
||||
|
||||
vfunc_paint: function() {
|
||||
vfunc_paint() {
|
||||
let actor = this.get_actor();
|
||||
actor.continue_paint();
|
||||
|
||||
@ -500,10 +502,10 @@ var RedBorderEffect = new Lang.Class({
|
||||
var Inspector = new Lang.Class({
|
||||
Name: 'Inspector',
|
||||
|
||||
_init: function(lookingGlass) {
|
||||
_init(lookingGlass) {
|
||||
let container = new Shell.GenericContainer({ width: 0,
|
||||
height: 0 });
|
||||
container.connect('allocate', Lang.bind(this, this._allocate));
|
||||
container.connect('allocate', this._allocate.bind(this));
|
||||
Main.uiGroup.add_actor(container);
|
||||
|
||||
let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog',
|
||||
@ -514,10 +516,10 @@ var Inspector = new Lang.Class({
|
||||
this._displayText = new St.Label();
|
||||
eventHandler.add(this._displayText, { expand: true });
|
||||
|
||||
eventHandler.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
|
||||
eventHandler.connect('button-press-event', Lang.bind(this, this._onButtonPressEvent));
|
||||
eventHandler.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
||||
eventHandler.connect('motion-event', Lang.bind(this, this._onMotionEvent));
|
||||
eventHandler.connect('key-press-event', this._onKeyPressEvent.bind(this));
|
||||
eventHandler.connect('button-press-event', this._onButtonPressEvent.bind(this));
|
||||
eventHandler.connect('scroll-event', this._onScrollEvent.bind(this));
|
||||
eventHandler.connect('motion-event', this._onMotionEvent.bind(this));
|
||||
Clutter.grab_pointer(eventHandler);
|
||||
Clutter.grab_keyboard(eventHandler);
|
||||
|
||||
@ -532,7 +534,7 @@ var Inspector = new Lang.Class({
|
||||
this._lookingGlass = lookingGlass;
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
_allocate(actor, box, flags) {
|
||||
if (!this._eventHandler)
|
||||
return;
|
||||
|
||||
@ -549,7 +551,7 @@ var Inspector = new Lang.Class({
|
||||
this._eventHandler.allocate(childBox, flags);
|
||||
},
|
||||
|
||||
_close: function() {
|
||||
_close() {
|
||||
Clutter.ungrab_pointer();
|
||||
Clutter.ungrab_keyboard();
|
||||
this._eventHandler.destroy();
|
||||
@ -557,13 +559,13 @@ var Inspector = new Lang.Class({
|
||||
this.emit('closed');
|
||||
},
|
||||
|
||||
_onKeyPressEvent: function (actor, event) {
|
||||
_onKeyPressEvent(actor, event) {
|
||||
if (event.get_key_symbol() == Clutter.Escape)
|
||||
this._close();
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_onButtonPressEvent: function (actor, event) {
|
||||
_onButtonPressEvent(actor, event) {
|
||||
if (this._target) {
|
||||
let [stageX, stageY] = event.get_coords();
|
||||
this.emit('target', this._target, stageX, stageY);
|
||||
@ -572,7 +574,7 @@ var Inspector = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_onScrollEvent: function (actor, event) {
|
||||
_onScrollEvent(actor, event) {
|
||||
switch (event.get_scroll_direction()) {
|
||||
case Clutter.ScrollDirection.UP:
|
||||
// select parent
|
||||
@ -606,12 +608,12 @@ var Inspector = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_onMotionEvent: function (actor, event) {
|
||||
_onMotionEvent(actor, event) {
|
||||
this._update(event);
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_update: function(event) {
|
||||
_update(event) {
|
||||
let [stageX, stageY] = event.get_coords();
|
||||
let target = global.stage.get_actor_at_pos(Clutter.PickMode.ALL,
|
||||
stageX,
|
||||
@ -634,7 +636,7 @@ Signals.addSignalMethods(Inspector.prototype);
|
||||
var Extensions = new Lang.Class({
|
||||
Name: 'Extensions',
|
||||
|
||||
_init: function(lookingGlass) {
|
||||
_init(lookingGlass) {
|
||||
this._lookingGlass = lookingGlass;
|
||||
this.actor = new St.BoxLayout({ vertical: true,
|
||||
name: 'lookingGlassExtensions' });
|
||||
@ -650,10 +652,10 @@ var Extensions = new Lang.Class({
|
||||
this._loadExtension(null, uuid);
|
||||
|
||||
ExtensionSystem.connect('extension-loaded',
|
||||
Lang.bind(this, this._loadExtension));
|
||||
this._loadExtension.bind(this));
|
||||
},
|
||||
|
||||
_loadExtension: function(o, uuid) {
|
||||
_loadExtension(o, uuid) {
|
||||
let extension = ExtensionUtils.extensions[uuid];
|
||||
// There can be cases where we create dummy extension metadata
|
||||
// that's not really a proper extension. Don't bother with these.
|
||||
@ -668,20 +670,20 @@ var Extensions = new Lang.Class({
|
||||
this._extensionsList.add(extensionDisplay);
|
||||
},
|
||||
|
||||
_onViewSource: function (actor) {
|
||||
_onViewSource(actor) {
|
||||
let extension = actor._extension;
|
||||
let uri = extension.dir.get_uri();
|
||||
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context(0, -1));
|
||||
this._lookingGlass.close();
|
||||
},
|
||||
|
||||
_onWebPage: function (actor) {
|
||||
_onWebPage(actor) {
|
||||
let extension = actor._extension;
|
||||
Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context(0, -1));
|
||||
this._lookingGlass.close();
|
||||
},
|
||||
|
||||
_onViewErrors: function (actor) {
|
||||
_onViewErrors(actor) {
|
||||
let extension = actor._extension;
|
||||
let shouldShow = !actor._isShowing;
|
||||
|
||||
@ -709,7 +711,7 @@ var Extensions = new Lang.Class({
|
||||
actor._isShowing = shouldShow;
|
||||
},
|
||||
|
||||
_stateToString: function(extensionState) {
|
||||
_stateToString(extensionState) {
|
||||
switch (extensionState) {
|
||||
case ExtensionSystem.ExtensionState.ENABLED:
|
||||
return _("Enabled");
|
||||
@ -726,7 +728,7 @@ var Extensions = new Lang.Class({
|
||||
return 'Unknown'; // Not translated, shouldn't appear
|
||||
},
|
||||
|
||||
_createExtensionDisplay: function(extension) {
|
||||
_createExtensionDisplay(extension) {
|
||||
let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true });
|
||||
let name = new St.Label({ style_class: 'lg-extension-name',
|
||||
text: extension.metadata.name });
|
||||
@ -747,7 +749,7 @@ var Extensions = new Lang.Class({
|
||||
style_class: 'shell-link',
|
||||
label: _("View Source") });
|
||||
viewsource._extension = extension;
|
||||
viewsource.connect('clicked', Lang.bind(this, this._onViewSource));
|
||||
viewsource.connect('clicked', this._onViewSource.bind(this));
|
||||
metaBox.add(viewsource);
|
||||
|
||||
if (extension.metadata.url) {
|
||||
@ -756,7 +758,7 @@ var Extensions = new Lang.Class({
|
||||
style_class: 'shell-link',
|
||||
label: _("Web Page") });
|
||||
webpage._extension = extension;
|
||||
webpage.connect('clicked', Lang.bind(this, this._onWebPage));
|
||||
webpage.connect('clicked', this._onWebPage.bind(this));
|
||||
metaBox.add(webpage);
|
||||
}
|
||||
|
||||
@ -767,7 +769,7 @@ var Extensions = new Lang.Class({
|
||||
viewerrors._extension = extension;
|
||||
viewerrors._parentBox = box;
|
||||
viewerrors._isShowing = false;
|
||||
viewerrors.connect('clicked', Lang.bind(this, this._onViewErrors));
|
||||
viewerrors.connect('clicked', this._onViewErrors.bind(this));
|
||||
metaBox.add(viewerrors);
|
||||
|
||||
return box;
|
||||
@ -777,7 +779,7 @@ var Extensions = new Lang.Class({
|
||||
var LookingGlass = new Lang.Class({
|
||||
Name: 'LookingGlass',
|
||||
|
||||
_init : function() {
|
||||
_init() {
|
||||
this._borderPaintTarget = null;
|
||||
this._redBorderEffect = new RedBorderEffect();
|
||||
|
||||
@ -795,11 +797,11 @@ var LookingGlass = new Lang.Class({
|
||||
vertical: true,
|
||||
visible: false,
|
||||
reactive: true });
|
||||
this.actor.connect('key-press-event', Lang.bind(this, this._globalKeyPressEvent));
|
||||
this.actor.connect('key-press-event', this._globalKeyPressEvent.bind(this));
|
||||
|
||||
this._interfaceSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||
this._interfaceSettings.connect('changed::monospace-font-name',
|
||||
Lang.bind(this, this._updateFont));
|
||||
this._updateFont.bind(this));
|
||||
this._updateFont();
|
||||
|
||||
// We want it to appear to slide out from underneath the panel
|
||||
@ -807,9 +809,9 @@ var LookingGlass = new Lang.Class({
|
||||
Main.uiGroup.set_child_below_sibling(this.actor,
|
||||
Main.layoutManager.panelBox);
|
||||
Main.layoutManager.panelBox.connect('allocation-changed',
|
||||
Lang.bind(this, this._queueResize));
|
||||
this._queueResize.bind(this));
|
||||
Main.layoutManager.keyboardBox.connect('allocation-changed',
|
||||
Lang.bind(this, this._queueResize));
|
||||
this._queueResize.bind(this));
|
||||
|
||||
this._objInspector = new ObjInspector(this);
|
||||
Main.uiGroup.add_actor(this._objInspector.actor);
|
||||
@ -821,34 +823,34 @@ var LookingGlass = new Lang.Class({
|
||||
icon_size: 24 });
|
||||
toolbar.add_actor(inspectIcon);
|
||||
inspectIcon.reactive = true;
|
||||
inspectIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||
inspectIcon.connect('button-press-event', () => {
|
||||
let inspector = new Inspector(this);
|
||||
inspector.connect('target', Lang.bind(this, function(i, target, stageX, stageY) {
|
||||
inspector.connect('target', (i, target, stageX, stageY) => {
|
||||
this._pushResult('inspect(' + Math.round(stageX) + ', ' + Math.round(stageY) + ')', target);
|
||||
}));
|
||||
inspector.connect('closed', Lang.bind(this, function() {
|
||||
});
|
||||
inspector.connect('closed', () => {
|
||||
this.actor.show();
|
||||
global.stage.set_key_focus(this._entry);
|
||||
}));
|
||||
});
|
||||
this.actor.hide();
|
||||
return Clutter.EVENT_STOP;
|
||||
}));
|
||||
});
|
||||
|
||||
let gcIcon = new St.Icon({ icon_name: 'user-trash-full',
|
||||
icon_size: 24 });
|
||||
toolbar.add_actor(gcIcon);
|
||||
gcIcon.reactive = true;
|
||||
gcIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||
gcIcon.connect('button-press-event', () => {
|
||||
gcIcon.icon_name = 'user-trash';
|
||||
System.gc();
|
||||
this._timeoutId = Mainloop.timeout_add(500, Lang.bind(this, function () {
|
||||
this._timeoutId = Mainloop.timeout_add(500, () => {
|
||||
gcIcon.icon_name = 'user-trash-full';
|
||||
this._timeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] gcIcon.icon_name = \'user-trash-full\'');
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
|
||||
let notebook = new Notebook();
|
||||
this._notebook = notebook;
|
||||
@ -880,7 +882,7 @@ var LookingGlass = new Lang.Class({
|
||||
this._extensions = new Extensions(this);
|
||||
notebook.appendPage('Extensions', this._extensions.actor);
|
||||
|
||||
this._entry.clutter_text.connect('activate', Lang.bind(this, function (o, e) {
|
||||
this._entry.clutter_text.connect('activate', (o, e) => {
|
||||
// Hide any completions we are currently showing
|
||||
this._hideCompletions();
|
||||
|
||||
@ -894,26 +896,26 @@ var LookingGlass = new Lang.Class({
|
||||
return true;
|
||||
this._evaluate(text);
|
||||
return true;
|
||||
}));
|
||||
});
|
||||
|
||||
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
|
||||
entry: this._entry.clutter_text });
|
||||
|
||||
this._autoComplete = new AutoComplete(this._entry);
|
||||
this._autoComplete.connect('suggest', Lang.bind(this, function(a,e) {
|
||||
this._autoComplete.connect('suggest', (a, e) => {
|
||||
this._showCompletions(e.completions);
|
||||
}));
|
||||
});
|
||||
// If a completion is completed unambiguously, the currently-displayed completion
|
||||
// suggestions become irrelevant.
|
||||
this._autoComplete.connect('completion', Lang.bind(this, function(a,e) {
|
||||
this._autoComplete.connect('completion', (a, e) => {
|
||||
if (e.type == 'whole-word')
|
||||
this._hideCompletions();
|
||||
}));
|
||||
});
|
||||
|
||||
this._resize();
|
||||
},
|
||||
|
||||
_updateFont: function() {
|
||||
_updateFont() {
|
||||
let fontName = this._interfaceSettings.get_string('monospace-font-name');
|
||||
let fontDesc = Pango.FontDescription.from_string(fontName);
|
||||
// We ignore everything but size and style; you'd be crazy to set your system-wide
|
||||
@ -923,7 +925,7 @@ var LookingGlass = new Lang.Class({
|
||||
+ 'font-family: "' + fontDesc.get_family() + '";';
|
||||
},
|
||||
|
||||
setBorderPaintTarget: function(obj) {
|
||||
setBorderPaintTarget(obj) {
|
||||
if (this._borderPaintTarget != null)
|
||||
this._borderPaintTarget.remove_effect(this._redBorderEffect);
|
||||
this._borderPaintTarget = obj;
|
||||
@ -931,7 +933,7 @@ var LookingGlass = new Lang.Class({
|
||||
this._borderPaintTarget.add_effect(this._redBorderEffect);
|
||||
},
|
||||
|
||||
_pushResult: function(command, obj) {
|
||||
_pushResult(command, obj) {
|
||||
let index = this._results.length + this._offset;
|
||||
let result = new Result(this, CHEVRON + command, obj, index);
|
||||
this._results.push(result);
|
||||
@ -951,7 +953,7 @@ var LookingGlass = new Lang.Class({
|
||||
this._notebook.scrollToBottom(0);
|
||||
},
|
||||
|
||||
_showCompletions: function(completions) {
|
||||
_showCompletions(completions) {
|
||||
if (!this._completionActor) {
|
||||
this._completionActor = new St.Label({ name: 'LookingGlassAutoCompletionText', style_class: 'lg-completions-text' });
|
||||
this._completionActor.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||
@ -980,21 +982,21 @@ var LookingGlass = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_hideCompletions: function() {
|
||||
_hideCompletions() {
|
||||
if (this._completionActor) {
|
||||
Tweener.removeTweens(this._completionActor);
|
||||
Tweener.addTween(this._completionActor, { time: AUTO_COMPLETE_SHOW_COMPLETION_ANIMATION_DURATION / St.get_slow_down_factor(),
|
||||
transition: 'easeOutQuad',
|
||||
height: 0,
|
||||
opacity: 0,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
this._completionActor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_evaluate : function(command) {
|
||||
_evaluate(command) {
|
||||
this._history.addItem(command);
|
||||
|
||||
let fullCmd = commandHeader + command;
|
||||
@ -1010,31 +1012,30 @@ var LookingGlass = new Lang.Class({
|
||||
this._entry.text = '';
|
||||
},
|
||||
|
||||
inspect: function(x, y) {
|
||||
inspect(x, y) {
|
||||
return global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
|
||||
},
|
||||
|
||||
getIt: function () {
|
||||
getIt() {
|
||||
return this._it;
|
||||
},
|
||||
|
||||
getResult: function(idx) {
|
||||
getResult(idx) {
|
||||
return this._results[idx - this._offset].o;
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
toggle() {
|
||||
if (this._open)
|
||||
this.close();
|
||||
else
|
||||
this.open();
|
||||
},
|
||||
|
||||
_queueResize: function() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||
Lang.bind(this, function () { this._resize(); }));
|
||||
_queueResize() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { this._resize(); });
|
||||
},
|
||||
|
||||
_resize: function() {
|
||||
_resize() {
|
||||
let primary = Main.layoutManager.primaryMonitor;
|
||||
let myWidth = primary.width * 0.7;
|
||||
let availableHeight = primary.height - Main.layoutManager.keyboardBox.height;
|
||||
@ -1050,17 +1051,17 @@ var LookingGlass = new Lang.Class({
|
||||
this._targetY + Math.floor(myHeight * 0.1));
|
||||
},
|
||||
|
||||
insertObject: function(obj) {
|
||||
insertObject(obj) {
|
||||
this._pushResult('<insert>', obj);
|
||||
},
|
||||
|
||||
inspectObject: function(obj, sourceActor) {
|
||||
inspectObject(obj, sourceActor) {
|
||||
this._objInspector.open(sourceActor);
|
||||
this._objInspector.selectObject(obj);
|
||||
},
|
||||
|
||||
// Handle key events which are relevant for all tabs of the LookingGlass
|
||||
_globalKeyPressEvent : function(actor, event) {
|
||||
_globalKeyPressEvent(actor, event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
let modifierState = event.get_state();
|
||||
if (symbol == Clutter.Escape) {
|
||||
@ -1082,7 +1083,7 @@ var LookingGlass = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
open : function() {
|
||||
open() {
|
||||
if (this._open)
|
||||
return;
|
||||
|
||||
@ -1104,7 +1105,7 @@ var LookingGlass = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
close : function() {
|
||||
close() {
|
||||
if (!this._open)
|
||||
return;
|
||||
|
||||
@ -1120,9 +1121,9 @@ var LookingGlass = new Lang.Class({
|
||||
Tweener.addTween(this.actor, { time: Math.min(0.5 / St.get_slow_down_factor(), 0.5),
|
||||
transition: 'easeOutQuad',
|
||||
y: this._hiddenY,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -101,7 +101,7 @@ let _zoomRegionInstanceCount = 0;
|
||||
var ShellMagnifier = new Lang.Class({
|
||||
Name: 'ShellMagnifier',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._zoomers = {};
|
||||
|
||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(MagnifierIface, this);
|
||||
@ -112,7 +112,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* setActive:
|
||||
* @activate: Boolean to activate or de-activate the magnifier.
|
||||
*/
|
||||
setActive: function(activate) {
|
||||
setActive(activate) {
|
||||
Main.magnifier.setActive(activate);
|
||||
},
|
||||
|
||||
@ -120,7 +120,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* isActive:
|
||||
* @return Whether the magnifier is active (boolean).
|
||||
*/
|
||||
isActive: function() {
|
||||
isActive() {
|
||||
return Main.magnifier.isActive();
|
||||
},
|
||||
|
||||
@ -128,7 +128,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* showCursor:
|
||||
* Show the system mouse pointer.
|
||||
*/
|
||||
showCursor: function() {
|
||||
showCursor() {
|
||||
Main.magnifier.showSystemCursor();
|
||||
},
|
||||
|
||||
@ -136,7 +136,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* hideCursor:
|
||||
* Hide the system mouse pointer.
|
||||
*/
|
||||
hideCursor: function() {
|
||||
hideCursor() {
|
||||
Main.magnifier.hideSystemCursor();
|
||||
},
|
||||
|
||||
@ -160,7 +160,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
*
|
||||
* @return The newly created ZoomRegion.
|
||||
*/
|
||||
createZoomRegion: function(xMagFactor, yMagFactor, roi, viewPort) {
|
||||
createZoomRegion(xMagFactor, yMagFactor, roi, viewPort) {
|
||||
let ROI = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
|
||||
let viewBox = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
||||
let realZoomRegion = Main.magnifier.createZoomRegion(xMagFactor, yMagFactor, ROI, viewBox);
|
||||
@ -180,7 +180,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Append the given ZoomRegion to the magnifier's list of ZoomRegions.
|
||||
* @zoomerObjectPath: The object path for the zoom region proxy.
|
||||
*/
|
||||
addZoomRegion: function(zoomerObjectPath) {
|
||||
addZoomRegion(zoomerObjectPath) {
|
||||
let proxyAndZoomRegion = this._zoomers[zoomerObjectPath];
|
||||
if (proxyAndZoomRegion && proxyAndZoomRegion.zoomRegion) {
|
||||
Main.magnifier.addZoomRegion(proxyAndZoomRegion.zoomRegion);
|
||||
@ -196,14 +196,14 @@ var ShellMagnifier = new Lang.Class({
|
||||
* @return: The Magnifier's zoom region list as an array of DBus object
|
||||
* paths.
|
||||
*/
|
||||
getZoomRegions: function() {
|
||||
getZoomRegions() {
|
||||
// There may be more ZoomRegions in the magnifier itself than have
|
||||
// been added through dbus. Make sure all of them are associated with
|
||||
// an object path and proxy.
|
||||
let zoomRegions = Main.magnifier.getZoomRegions();
|
||||
let objectPaths = [];
|
||||
let thoseZoomers = this._zoomers;
|
||||
zoomRegions.forEach (function(aZoomRegion, index, array) {
|
||||
zoomRegions.forEach ((aZoomRegion, index, array) => {
|
||||
let found = false;
|
||||
for (let objectPath in thoseZoomers) {
|
||||
let proxyAndZoomRegion = thoseZoomers[objectPath];
|
||||
@ -232,7 +232,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* clearAllZoomRegions:
|
||||
* Remove all the zoom regions from this Magnfier's ZoomRegion list.
|
||||
*/
|
||||
clearAllZoomRegions: function() {
|
||||
clearAllZoomRegions() {
|
||||
Main.magnifier.clearAllZoomRegions();
|
||||
for (let objectPath in this._zoomers) {
|
||||
let proxyAndZoomer = this._zoomers[objectPath];
|
||||
@ -249,7 +249,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Consult if the Magnifier can magnify in full-screen mode.
|
||||
* @return Always return true.
|
||||
*/
|
||||
fullScreenCapable: function() {
|
||||
fullScreenCapable() {
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -258,7 +258,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Set the crosswire size of all ZoomRegions.
|
||||
* @size: The thickness of each line in the cross wire.
|
||||
*/
|
||||
setCrosswireSize: function(size) {
|
||||
setCrosswireSize(size) {
|
||||
Main.magnifier.setCrosshairsThickness(size);
|
||||
},
|
||||
|
||||
@ -267,7 +267,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Get the crosswire size of all ZoomRegions.
|
||||
* @return: The thickness of each line in the cross wire.
|
||||
*/
|
||||
getCrosswireSize: function() {
|
||||
getCrosswireSize() {
|
||||
return Main.magnifier.getCrosshairsThickness();
|
||||
},
|
||||
|
||||
@ -276,7 +276,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Set the crosswire length of all zoom-regions..
|
||||
* @size: The length of each line in the cross wire.
|
||||
*/
|
||||
setCrosswireLength: function(length) {
|
||||
setCrosswireLength(length) {
|
||||
Main.magnifier.setCrosshairsLength(length);
|
||||
},
|
||||
|
||||
@ -285,7 +285,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Set the crosswire size of all zoom-regions.
|
||||
* @size: The thickness of each line in the cross wire.
|
||||
*/
|
||||
getCrosswireLength: function() {
|
||||
getCrosswireLength() {
|
||||
return Main.magnifier.getCrosshairsLength();
|
||||
},
|
||||
|
||||
@ -294,7 +294,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Set if the crosswire will be clipped by the cursor image..
|
||||
* @clip: Flag to indicate whether to clip the crosswire.
|
||||
*/
|
||||
setCrosswireClip: function(clip) {
|
||||
setCrosswireClip(clip) {
|
||||
Main.magnifier.setCrosshairsClip(clip);
|
||||
},
|
||||
|
||||
@ -303,7 +303,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Get the crosswire clip value.
|
||||
* @return: Whether the crosswire is clipped by the cursor image.
|
||||
*/
|
||||
getCrosswireClip: function() {
|
||||
getCrosswireClip() {
|
||||
return Main.magnifier.getCrosshairsClip();
|
||||
},
|
||||
|
||||
@ -312,7 +312,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Set the crosswire color of all ZoomRegions.
|
||||
* @color: Unsigned int of the form rrggbbaa.
|
||||
*/
|
||||
setCrosswireColor: function(color) {
|
||||
setCrosswireColor(color) {
|
||||
Main.magnifier.setCrosshairsColor('#%08x'.format(color));
|
||||
},
|
||||
|
||||
@ -321,7 +321,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
* Get the crosswire color of all ZoomRegions.
|
||||
* @return: The crosswire color as an unsigned int in the form rrggbbaa.
|
||||
*/
|
||||
getCrosswireColor: function() {
|
||||
getCrosswireColor() {
|
||||
let colorString = Main.magnifier.getCrosshairsColor();
|
||||
// Drop the leading '#'.
|
||||
return parseInt(colorString.slice(1), 16);
|
||||
@ -337,7 +337,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
var ShellMagnifierZoomRegion = new Lang.Class({
|
||||
Name: 'ShellMagnifierZoomRegion',
|
||||
|
||||
_init: function(zoomerObjectPath, zoomRegion) {
|
||||
_init(zoomerObjectPath, zoomRegion) {
|
||||
this._zoomRegion = zoomRegion;
|
||||
|
||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ZoomRegionIface, this);
|
||||
@ -352,7 +352,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
||||
* @yMagFactor: The power to set the vertical magnification factor to
|
||||
* of the magnified view.
|
||||
*/
|
||||
setMagFactor: function(xMagFactor, yMagFactor) {
|
||||
setMagFactor(xMagFactor, yMagFactor) {
|
||||
this._zoomRegion.setMagFactor(xMagFactor, yMagFactor);
|
||||
},
|
||||
|
||||
@ -363,7 +363,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
||||
* magnification. A value of 2.0 means the contents are doubled
|
||||
* in size, and so on.
|
||||
*/
|
||||
getMagFactor: function() {
|
||||
getMagFactor() {
|
||||
return this._zoomRegion.getMagFactor();
|
||||
},
|
||||
|
||||
@ -374,7 +374,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
||||
* screen to magnify. The values are in screen (unmagnified)
|
||||
* coordinate space.
|
||||
*/
|
||||
setRoi: function(roi) {
|
||||
setRoi(roi) {
|
||||
let roiObject = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
|
||||
this._zoomRegion.setROI(roiObject);
|
||||
},
|
||||
@ -387,7 +387,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
||||
* @return an array, [left, top, right, bottom], representing the bounding
|
||||
* rectangle of what is shown in the magnified view.
|
||||
*/
|
||||
getRoi: function() {
|
||||
getRoi() {
|
||||
let roi = this._zoomRegion.getROI();
|
||||
roi[2] += roi[0];
|
||||
roi[3] += roi[1];
|
||||
@ -402,7 +402,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
||||
* @return Whether the shift was successful (for GS-mag, this is always
|
||||
* true).
|
||||
*/
|
||||
shiftContentsTo: function(x, y) {
|
||||
shiftContentsTo(x, y) {
|
||||
this._zoomRegion.scrollContentsTo(x, y);
|
||||
return true;
|
||||
},
|
||||
@ -413,12 +413,12 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
||||
* @viewPort Array, [left, top, right, bottom], defining the position and
|
||||
* size on screen to place the zoom region.
|
||||
*/
|
||||
moveResize: function(viewPort) {
|
||||
moveResize(viewPort) {
|
||||
let viewRect = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
||||
this._zoomRegion.setViewPort(viewRect);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._dbusImpl.unexport();
|
||||
}
|
||||
});
|
||||
|
@ -96,7 +96,7 @@ function _sessionUpdated() {
|
||||
wm.setCustomKeybindingHandler('panel-main-menu',
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null);
|
||||
sessionMode.hasOverview ? overview.toggle.bind(overview) : null);
|
||||
wm.allowKeybinding('overlay-key', Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW);
|
||||
|
||||
@ -119,7 +119,9 @@ function start() {
|
||||
global.log = window.log;
|
||||
|
||||
// Chain up async errors reported from C
|
||||
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });
|
||||
global.connect('notify-error', (global, msg, detail) => {
|
||||
notifyError(msg, detail);
|
||||
});
|
||||
|
||||
Gio.DesktopAppInfo.set_desktop_env('GNOME');
|
||||
|
||||
@ -190,17 +192,17 @@ function _initializeUI() {
|
||||
|
||||
_a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
|
||||
|
||||
global.display.connect('overlay-key', Lang.bind(overview, function () {
|
||||
global.display.connect('overlay-key', () => {
|
||||
if (!_a11ySettings.get_boolean (STICKY_KEYS_ENABLE))
|
||||
overview.toggle();
|
||||
}));
|
||||
});
|
||||
|
||||
global.display.connect('show-restart-message', function(display, message) {
|
||||
global.display.connect('show-restart-message', (display, message) => {
|
||||
showRestartMessage(message);
|
||||
return true;
|
||||
});
|
||||
|
||||
global.display.connect('restart', function() {
|
||||
global.display.connect('restart', () => {
|
||||
global.reexec_self();
|
||||
return true;
|
||||
});
|
||||
@ -227,12 +229,12 @@ function _initializeUI() {
|
||||
ExtensionSystem.init();
|
||||
|
||||
if (sessionMode.isGreeter && screenShield) {
|
||||
layoutManager.connect('startup-prepared', function() {
|
||||
layoutManager.connect('startup-prepared', () => {
|
||||
screenShield.showDialog();
|
||||
});
|
||||
}
|
||||
|
||||
layoutManager.connect('startup-complete', function() {
|
||||
layoutManager.connect('startup-complete', () => {
|
||||
if (actionMode == Shell.ActionMode.NONE) {
|
||||
actionMode = Shell.ActionMode.NORMAL;
|
||||
}
|
||||
@ -254,6 +256,14 @@ function _getStylesheet(name) {
|
||||
if (stylesheet.query_exists(null))
|
||||
return stylesheet;
|
||||
|
||||
let dataDirs = GLib.get_system_data_dirs();
|
||||
for (let i = 0; i < dataDirs.length; i++) {
|
||||
let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'theme', name]);
|
||||
let stylesheet = Gio.file_new_for_path(path);
|
||||
if (stylesheet.query_exists(null))
|
||||
return stylesheet;
|
||||
}
|
||||
|
||||
stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name);
|
||||
if (stylesheet.query_exists(null))
|
||||
return stylesheet;
|
||||
@ -423,7 +433,7 @@ function pushModal(actor, params) {
|
||||
}
|
||||
|
||||
modalCount += 1;
|
||||
let actorDestroyId = actor.connect('destroy', function() {
|
||||
let actorDestroyId = actor.connect('destroy', () => {
|
||||
let index = _findModal(actor);
|
||||
if (index >= 0)
|
||||
popModal(actor);
|
||||
@ -432,7 +442,7 @@ function pushModal(actor, params) {
|
||||
let prevFocus = global.stage.get_key_focus();
|
||||
let prevFocusDestroyId;
|
||||
if (prevFocus != null) {
|
||||
prevFocusDestroyId = prevFocus.connect('destroy', function() {
|
||||
prevFocusDestroyId = prevFocus.connect('destroy', () => {
|
||||
let index = _findModal(actor);
|
||||
if (index >= 0)
|
||||
modalActorFocusStack[index].prevFocus = null;
|
||||
@ -606,7 +616,7 @@ function _runBeforeRedrawQueue() {
|
||||
function _queueBeforeRedraw(workId) {
|
||||
_beforeRedrawQueue.push(workId);
|
||||
if (_beforeRedrawQueue.length == 1) {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, function () {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
_runBeforeRedrawQueue();
|
||||
return false;
|
||||
});
|
||||
@ -636,12 +646,12 @@ function initializeDeferredWork(actor, callback, props) {
|
||||
let workId = '' + (++_deferredWorkSequence);
|
||||
_deferredWorkData[workId] = { 'actor': actor,
|
||||
'callback': callback };
|
||||
actor.connect('notify::mapped', function () {
|
||||
actor.connect('notify::mapped', () => {
|
||||
if (!(actor.mapped && _deferredWorkQueue.indexOf(workId) >= 0))
|
||||
return;
|
||||
_queueBeforeRedraw(workId);
|
||||
});
|
||||
actor.connect('destroy', function() {
|
||||
actor.connect('destroy', () => {
|
||||
let index = _deferredWorkQueue.indexOf(workId);
|
||||
if (index >= 0)
|
||||
_deferredWorkQueue.splice(index, 1);
|
||||
@ -673,7 +683,7 @@ function queueDeferredWork(workId) {
|
||||
_queueBeforeRedraw(workId);
|
||||
return;
|
||||
} else if (_deferredTimeoutId == 0) {
|
||||
_deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, function () {
|
||||
_deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, () => {
|
||||
_runAllDeferredWork();
|
||||
_deferredTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
@ -686,7 +696,7 @@ var RestartMessage = new Lang.Class({
|
||||
Name: 'RestartMessage',
|
||||
Extends: ModalDialog.ModalDialog,
|
||||
|
||||
_init : function(message) {
|
||||
_init(message) {
|
||||
this.parent({ shellReactive: true,
|
||||
styleClass: 'restart-message headline',
|
||||
shouldFadeIn: false,
|
||||
|
@ -27,6 +27,7 @@ function _fixMarkup(text, allowMarkup) {
|
||||
|
||||
// Support <b>, <i>, and <u>, escape anything else
|
||||
// so it displays as raw markup.
|
||||
// Ref: https://developer.gnome.org/notification-spec/#markup
|
||||
_text = _text.replace(/<(?!\/?[biu]>)/g, '<');
|
||||
|
||||
try {
|
||||
@ -42,13 +43,13 @@ function _fixMarkup(text, allowMarkup) {
|
||||
var URLHighlighter = new Lang.Class({
|
||||
Name: 'URLHighlighter',
|
||||
|
||||
_init: function(text, lineWrap, allowMarkup) {
|
||||
_init(text, lineWrap, allowMarkup) {
|
||||
if (!text)
|
||||
text = '';
|
||||
this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter',
|
||||
x_expand: true, x_align: Clutter.ActorAlign.START });
|
||||
this._linkColor = '#ccccff';
|
||||
this.actor.connect('style-changed', Lang.bind(this, function() {
|
||||
this.actor.connect('style-changed', () => {
|
||||
let [hasColor, color] = this.actor.get_theme_node().lookup_color('link-color', false);
|
||||
if (hasColor) {
|
||||
let linkColor = color.to_string().substr(0, 7);
|
||||
@ -57,12 +58,12 @@ var URLHighlighter = new Lang.Class({
|
||||
this._highlightUrls();
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
this.actor.clutter_text.line_wrap = lineWrap;
|
||||
this.actor.clutter_text.line_wrap_mode = Pango.WrapMode.WORD_CHAR;
|
||||
|
||||
this.setMarkup(text, allowMarkup);
|
||||
this.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
|
||||
this.actor.connect('button-press-event', (actor, event) => {
|
||||
// Don't try to URL highlight when invisible.
|
||||
// The MessageTray doesn't actually hide us, so
|
||||
// we need to check for paint opacities as well.
|
||||
@ -73,8 +74,8 @@ var URLHighlighter = new Lang.Class({
|
||||
// a pointer grab, which would block our button-release-event
|
||||
// handler, if an URL is clicked
|
||||
return this._findUrlAtPos(event) != -1;
|
||||
}));
|
||||
this.actor.connect('button-release-event', Lang.bind(this, function (actor, event) {
|
||||
});
|
||||
this.actor.connect('button-release-event', (actor, event) => {
|
||||
if (!actor.visible || actor.get_paint_opacity() == 0)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -88,8 +89,8 @@ var URLHighlighter = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
this.actor.connect('motion-event', Lang.bind(this, function(actor, event) {
|
||||
});
|
||||
this.actor.connect('motion-event', (actor, event) => {
|
||||
if (!actor.visible || actor.get_paint_opacity() == 0)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -102,8 +103,8 @@ var URLHighlighter = new Lang.Class({
|
||||
this._cursorChanged = false;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
this.actor.connect('leave-event', Lang.bind(this, function() {
|
||||
});
|
||||
this.actor.connect('leave-event', () => {
|
||||
if (!this.actor.visible || this.actor.get_paint_opacity() == 0)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -112,10 +113,10 @@ var URLHighlighter = new Lang.Class({
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
setMarkup: function(text, allowMarkup) {
|
||||
setMarkup(text, allowMarkup) {
|
||||
text = text ? _fixMarkup(text, allowMarkup) : '';
|
||||
this._text = text;
|
||||
|
||||
@ -125,7 +126,7 @@ var URLHighlighter = new Lang.Class({
|
||||
this._highlightUrls();
|
||||
},
|
||||
|
||||
_highlightUrls: function() {
|
||||
_highlightUrls() {
|
||||
// text here contain markup
|
||||
let urls = Util.findUrls(this._text);
|
||||
let markup = '';
|
||||
@ -140,7 +141,7 @@ var URLHighlighter = new Lang.Class({
|
||||
this.actor.clutter_text.set_markup(markup);
|
||||
},
|
||||
|
||||
_findUrlAtPos: function(event) {
|
||||
_findUrlAtPos(event) {
|
||||
let success;
|
||||
let [x, y] = event.get_coords();
|
||||
[success, x, y] = this.actor.transform_stage_point(x, y);
|
||||
@ -165,12 +166,12 @@ var ScaleLayout = new Lang.Class({
|
||||
Name: 'ScaleLayout',
|
||||
Extends: Clutter.BinLayout,
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
this._container = null;
|
||||
this.parent(params);
|
||||
},
|
||||
|
||||
_connectContainer: function(container) {
|
||||
_connectContainer(container) {
|
||||
if (this._container == container)
|
||||
return;
|
||||
|
||||
@ -183,15 +184,14 @@ var ScaleLayout = new Lang.Class({
|
||||
|
||||
if (this._container)
|
||||
for (let signal of ['notify::scale-x', 'notify::scale-y']) {
|
||||
let id = this._container.connect(signal, Lang.bind(this,
|
||||
function() {
|
||||
this.layout_changed();
|
||||
}));
|
||||
let id = this._container.connect(signal, () => {
|
||||
this.layout_changed();
|
||||
});
|
||||
this._signals.push(id);
|
||||
}
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(container, forHeight) {
|
||||
vfunc_get_preferred_width(container, forHeight) {
|
||||
this._connectContainer(container);
|
||||
|
||||
let [min, nat] = this.parent(container, forHeight);
|
||||
@ -199,7 +199,7 @@ var ScaleLayout = new Lang.Class({
|
||||
Math.floor(nat * container.scale_x)];
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(container, forWidth) {
|
||||
vfunc_get_preferred_height(container, forWidth) {
|
||||
this._connectContainer(container);
|
||||
|
||||
let [min, nat] = this.parent(container, forWidth);
|
||||
@ -218,7 +218,7 @@ var LabelExpanderLayout = new Lang.Class({
|
||||
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
|
||||
0, 1, 0)},
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
this._expansion = 0;
|
||||
this._expandLines = DEFAULT_EXPAND_LINES;
|
||||
|
||||
@ -250,11 +250,11 @@ var LabelExpanderLayout = new Lang.Class({
|
||||
this.layout_changed();
|
||||
},
|
||||
|
||||
vfunc_set_container: function(container) {
|
||||
vfunc_set_container(container) {
|
||||
this._container = container;
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(container, forHeight) {
|
||||
vfunc_get_preferred_width(container, forHeight) {
|
||||
let [min, nat] = [0, 0];
|
||||
|
||||
for (let i = 0; i < container.get_n_children(); i++) {
|
||||
@ -269,7 +269,7 @@ var LabelExpanderLayout = new Lang.Class({
|
||||
return [min, nat];
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(container, forWidth) {
|
||||
vfunc_get_preferred_height(container, forWidth) {
|
||||
let [min, nat] = [0, 0];
|
||||
|
||||
let children = container.get_children();
|
||||
@ -287,7 +287,7 @@ var LabelExpanderLayout = new Lang.Class({
|
||||
return [min, nat];
|
||||
},
|
||||
|
||||
vfunc_allocate: function(container, box, flags) {
|
||||
vfunc_allocate(container, box, flags) {
|
||||
for (let i = 0; i < container.get_n_children(); i++) {
|
||||
let child = container.get_child_at_index(i);
|
||||
|
||||
@ -301,7 +301,7 @@ var LabelExpanderLayout = new Lang.Class({
|
||||
var Message = new Lang.Class({
|
||||
Name: 'Message',
|
||||
|
||||
_init: function(title, body) {
|
||||
_init(title, body) {
|
||||
this.expanded = false;
|
||||
|
||||
this._useBodyMarkup = false;
|
||||
@ -311,7 +311,7 @@ var Message = new Lang.Class({
|
||||
can_focus: true,
|
||||
x_expand: true, x_fill: true });
|
||||
this.actor.connect('key-press-event',
|
||||
Lang.bind(this, this._onKeyPressed));
|
||||
this._onKeyPressed.bind(this));
|
||||
|
||||
let vbox = new St.BoxLayout({ vertical: true });
|
||||
this.actor.set_child(vbox);
|
||||
@ -362,32 +362,32 @@ var Message = new Lang.Class({
|
||||
this._bodyStack.add_actor(this.bodyLabel.actor);
|
||||
this.setBody(body);
|
||||
|
||||
this._closeButton.connect('clicked', Lang.bind(this, this.close));
|
||||
this.actor.connect('notify::hover', Lang.bind(this, this._sync));
|
||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this._closeButton.connect('clicked', this.close.bind(this));
|
||||
this.actor.connect('notify::hover', this._sync.bind(this));
|
||||
this.actor.connect('clicked', this._onClicked.bind(this));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
this._sync();
|
||||
},
|
||||
|
||||
close: function() {
|
||||
close() {
|
||||
this.emit('close');
|
||||
},
|
||||
|
||||
setIcon: function(actor) {
|
||||
setIcon(actor) {
|
||||
this._iconBin.child = actor;
|
||||
this._iconBin.visible = (actor != null);
|
||||
},
|
||||
|
||||
setSecondaryActor: function(actor) {
|
||||
setSecondaryActor(actor) {
|
||||
this._secondaryBin.child = actor;
|
||||
},
|
||||
|
||||
setTitle: function(text) {
|
||||
setTitle(text) {
|
||||
let title = text ? _fixMarkup(text.replace(/\n/g, ' '), false) : '';
|
||||
this.titleLabel.clutter_text.set_markup(title);
|
||||
},
|
||||
|
||||
setBody: function(text) {
|
||||
setBody(text) {
|
||||
this._bodyText = text;
|
||||
this.bodyLabel.setMarkup(text ? text.replace(/\n/g, ' ') : '',
|
||||
this._useBodyMarkup);
|
||||
@ -395,7 +395,7 @@ var Message = new Lang.Class({
|
||||
this._expandedLabel.setMarkup(text, this._useBodyMarkup);
|
||||
},
|
||||
|
||||
setUseBodyMarkup: function(enable) {
|
||||
setUseBodyMarkup(enable) {
|
||||
if (this._useBodyMarkup === enable)
|
||||
return;
|
||||
this._useBodyMarkup = enable;
|
||||
@ -403,7 +403,7 @@ var Message = new Lang.Class({
|
||||
this.setBody(this._bodyText);
|
||||
},
|
||||
|
||||
setActionArea: function(actor) {
|
||||
setActionArea(actor) {
|
||||
if (actor == null) {
|
||||
if (this._actionBin.get_n_children() > 0)
|
||||
this._actionBin.get_child_at_index(0).destroy();
|
||||
@ -417,7 +417,7 @@ var Message = new Lang.Class({
|
||||
this._actionBin.visible = this.expanded;
|
||||
},
|
||||
|
||||
addMediaControl: function(iconName, callback) {
|
||||
addMediaControl(iconName, callback) {
|
||||
let icon = new St.Icon({ icon_name: iconName, icon_size: 16 });
|
||||
let button = new St.Button({ style_class: 'message-media-control',
|
||||
child: icon });
|
||||
@ -426,7 +426,7 @@ var Message = new Lang.Class({
|
||||
return button;
|
||||
},
|
||||
|
||||
setExpandedBody: function(actor) {
|
||||
setExpandedBody(actor) {
|
||||
if (actor == null) {
|
||||
if (this._bodyStack.get_n_children() > 1)
|
||||
this._bodyStack.get_child_at_index(1).destroy();
|
||||
@ -439,11 +439,11 @@ var Message = new Lang.Class({
|
||||
this._bodyStack.insert_child_at_index(actor, 1);
|
||||
},
|
||||
|
||||
setExpandedLines: function(nLines) {
|
||||
setExpandedLines(nLines) {
|
||||
this._bodyStack.layout_manager.expandLines = nLines;
|
||||
},
|
||||
|
||||
expand: function(animate) {
|
||||
expand(animate) {
|
||||
this.expanded = true;
|
||||
|
||||
this._actionBin.visible = (this._actionBin.get_n_children() > 0);
|
||||
@ -472,7 +472,7 @@ var Message = new Lang.Class({
|
||||
this.emit('expanded');
|
||||
},
|
||||
|
||||
unexpand: function(animate) {
|
||||
unexpand(animate) {
|
||||
if (animate) {
|
||||
Tweener.addTween(this._bodyStack.layout_manager,
|
||||
{ expansion: 0,
|
||||
@ -483,7 +483,7 @@ var Message = new Lang.Class({
|
||||
time: MessageTray.ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onCompleteScope: this,
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
this._actionBin.hide();
|
||||
this.expanded = false;
|
||||
}});
|
||||
@ -496,22 +496,23 @@ var Message = new Lang.Class({
|
||||
this.emit('unexpanded');
|
||||
},
|
||||
|
||||
canClose: function() {
|
||||
canClose() {
|
||||
return this._mediaControls.get_n_children() == 0;
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
let visible = this.actor.hover && this.canClose();
|
||||
this._closeButton.opacity = visible ? 255 : 0;
|
||||
this._closeButton.reactive = visible;
|
||||
},
|
||||
|
||||
_onClicked: function() {
|
||||
_onClicked() {
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
},
|
||||
|
||||
_onKeyPressed: function(a, event) {
|
||||
_onKeyPressed(a, event) {
|
||||
let keysym = event.get_key_symbol();
|
||||
|
||||
if (keysym == Clutter.KEY_Delete ||
|
||||
@ -527,7 +528,7 @@ Signals.addSignalMethods(Message.prototype);
|
||||
var MessageListSection = new Lang.Class({
|
||||
Name: 'MessageListSection',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.actor = new St.BoxLayout({ style_class: 'message-list-section',
|
||||
clip_to_allocation: true,
|
||||
x_expand: true, vertical: true });
|
||||
@ -536,12 +537,12 @@ var MessageListSection = new Lang.Class({
|
||||
vertical: true });
|
||||
this.actor.add_actor(this._list);
|
||||
|
||||
this._list.connect('actor-added', Lang.bind(this, this._sync));
|
||||
this._list.connect('actor-removed', Lang.bind(this, this._sync));
|
||||
this._list.connect('actor-added', this._sync.bind(this));
|
||||
this._list.connect('actor-removed', this._sync.bind(this));
|
||||
|
||||
let id = Main.sessionMode.connect('updated',
|
||||
Lang.bind(this, this._sync));
|
||||
this.actor.connect('destroy', function() {
|
||||
this._sync.bind(this));
|
||||
this.actor.connect('destroy', () => {
|
||||
Main.sessionMode.disconnect(id);
|
||||
});
|
||||
|
||||
@ -552,7 +553,7 @@ var MessageListSection = new Lang.Class({
|
||||
this._sync();
|
||||
},
|
||||
|
||||
_onKeyFocusIn: function(actor) {
|
||||
_onKeyFocusIn(actor) {
|
||||
this.emit('key-focus-in', actor);
|
||||
},
|
||||
|
||||
@ -560,18 +561,18 @@ var MessageListSection = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
setDate: function(date) {
|
||||
setDate(date) {
|
||||
if (Calendar.sameDay(date, this._date))
|
||||
return;
|
||||
this._date = date;
|
||||
this._sync();
|
||||
},
|
||||
|
||||
addMessage: function(message, animate) {
|
||||
addMessage(message, animate) {
|
||||
this.addMessageAtIndex(message, -1, animate);
|
||||
},
|
||||
|
||||
addMessageAtIndex: function(message, index, animate) {
|
||||
addMessageAtIndex(message, index, animate) {
|
||||
let obj = {
|
||||
container: null,
|
||||
destroyId: 0,
|
||||
@ -584,15 +585,13 @@ var MessageListSection = new Lang.Class({
|
||||
pivot_point: pivot,
|
||||
scale_x: scale, scale_y: scale });
|
||||
obj.keyFocusId = message.actor.connect('key-focus-in',
|
||||
Lang.bind(this, this._onKeyFocusIn));
|
||||
obj.destroyId = message.actor.connect('destroy',
|
||||
Lang.bind(this, function() {
|
||||
this.removeMessage(message, false);
|
||||
}));
|
||||
obj.closeId = message.connect('close',
|
||||
Lang.bind(this, function() {
|
||||
this.removeMessage(message, true);
|
||||
}));
|
||||
this._onKeyFocusIn.bind(this));
|
||||
obj.destroyId = message.actor.connect('destroy', () => {
|
||||
this.removeMessage(message, false);
|
||||
});
|
||||
obj.closeId = message.connect('close', () => {
|
||||
this.removeMessage(message, true);
|
||||
});
|
||||
|
||||
this._messages.set(message, obj);
|
||||
obj.container.add_actor(message.actor);
|
||||
@ -606,7 +605,7 @@ var MessageListSection = new Lang.Class({
|
||||
transition: 'easeOutQuad' });
|
||||
},
|
||||
|
||||
moveMessage: function(message, index, animate) {
|
||||
moveMessage(message, index, animate) {
|
||||
let obj = this._messages.get(message);
|
||||
|
||||
if (!animate) {
|
||||
@ -614,13 +613,13 @@ var MessageListSection = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
let onComplete = Lang.bind(this, function() {
|
||||
let onComplete = () => {
|
||||
this._list.set_child_at_index(obj.container, index);
|
||||
Tweener.addTween(obj.container, { scale_x: 1,
|
||||
scale_y: 1,
|
||||
time: MESSAGE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad' });
|
||||
});
|
||||
};
|
||||
Tweener.addTween(obj.container, { scale_x: 0,
|
||||
scale_y: 0,
|
||||
time: MESSAGE_ANIMATION_TIME,
|
||||
@ -628,7 +627,7 @@ var MessageListSection = new Lang.Class({
|
||||
onComplete: onComplete });
|
||||
},
|
||||
|
||||
removeMessage: function(message, animate) {
|
||||
removeMessage(message, animate) {
|
||||
let obj = this._messages.get(message);
|
||||
|
||||
message.actor.disconnect(obj.destroyId);
|
||||
@ -641,7 +640,7 @@ var MessageListSection = new Lang.Class({
|
||||
Tweener.addTween(obj.container, { scale_x: 0, scale_y: 0,
|
||||
time: MESSAGE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
obj.container.destroy();
|
||||
global.sync_pointer();
|
||||
}});
|
||||
@ -651,14 +650,12 @@ var MessageListSection = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
let messages = [...this._messages.keys()].filter(function(message) {
|
||||
return message.canClose();
|
||||
});
|
||||
clear() {
|
||||
let messages = [...this._messages.keys()].filter(msg => msg.canClose());
|
||||
|
||||
// If there are few messages, letting them all zoom out looks OK
|
||||
if (messages.length < 2) {
|
||||
messages.forEach(function(message) {
|
||||
messages.forEach(message => {
|
||||
message.close();
|
||||
});
|
||||
} else {
|
||||
@ -674,25 +671,25 @@ var MessageListSection = new Lang.Class({
|
||||
time: MESSAGE_ANIMATION_TIME,
|
||||
delay: i * delay,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
message.close();
|
||||
}});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_canClear: function() {
|
||||
_canClear() {
|
||||
for (let message of this._messages.keys())
|
||||
if (message.canClose())
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
_shouldShow: function() {
|
||||
_shouldShow() {
|
||||
return !this.empty;
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
let empty = this._list.get_n_children() == 0;
|
||||
let changed = this.empty !== empty;
|
||||
this.empty = empty;
|
||||
|
@ -72,20 +72,20 @@ var Urgency = {
|
||||
var FocusGrabber = new Lang.Class({
|
||||
Name: 'FocusGrabber',
|
||||
|
||||
_init: function(actor) {
|
||||
_init(actor) {
|
||||
this._actor = actor;
|
||||
this._prevKeyFocusActor = null;
|
||||
this._focusActorChangedId = 0;
|
||||
this._focused = false;
|
||||
},
|
||||
|
||||
grabFocus: function() {
|
||||
grabFocus() {
|
||||
if (this._focused)
|
||||
return;
|
||||
|
||||
this._prevKeyFocusActor = global.stage.get_key_focus();
|
||||
|
||||
this._focusActorChangedId = global.stage.connect('notify::key-focus', Lang.bind(this, this._focusActorChanged));
|
||||
this._focusActorChangedId = global.stage.connect('notify::key-focus', this._focusActorChanged.bind(this));
|
||||
|
||||
if (!this._actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false))
|
||||
this._actor.grab_key_focus();
|
||||
@ -93,7 +93,7 @@ var FocusGrabber = new Lang.Class({
|
||||
this._focused = true;
|
||||
},
|
||||
|
||||
_focusUngrabbed: function() {
|
||||
_focusUngrabbed() {
|
||||
if (!this._focused)
|
||||
return false;
|
||||
|
||||
@ -106,13 +106,13 @@ var FocusGrabber = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_focusActorChanged: function() {
|
||||
_focusActorChanged() {
|
||||
let focusedActor = global.stage.get_key_focus();
|
||||
if (!focusedActor || !this._actor.contains(focusedActor))
|
||||
this._focusUngrabbed();
|
||||
},
|
||||
|
||||
ungrabFocus: function() {
|
||||
ungrabFocus() {
|
||||
if (!this._focusUngrabbed())
|
||||
return;
|
||||
|
||||
@ -135,7 +135,7 @@ var FocusGrabber = new Lang.Class({
|
||||
var NotificationPolicy = new Lang.Class({
|
||||
Name: 'NotificationPolicy',
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { enable: true,
|
||||
enableSound: true,
|
||||
showBanners: true,
|
||||
@ -148,8 +148,8 @@ var NotificationPolicy = new Lang.Class({
|
||||
|
||||
// Do nothing for the default policy. These methods are only useful for the
|
||||
// GSettings policy.
|
||||
store: function() { },
|
||||
destroy: function() { }
|
||||
store() { },
|
||||
destroy() { }
|
||||
});
|
||||
Signals.addSignalMethods(NotificationPolicy.prototype);
|
||||
|
||||
@ -157,23 +157,23 @@ var NotificationGenericPolicy = new Lang.Class({
|
||||
Name: 'NotificationGenericPolicy',
|
||||
Extends: NotificationPolicy,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
// Don't chain to parent, it would try setting
|
||||
// our properties to the defaults
|
||||
|
||||
this.id = 'generic';
|
||||
|
||||
this._masterSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications' });
|
||||
this._masterSettings.connect('changed', Lang.bind(this, this._changed));
|
||||
this._masterSettings.connect('changed', this._changed.bind(this));
|
||||
},
|
||||
|
||||
store: function() { },
|
||||
store() { },
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._masterSettings.run_dispose();
|
||||
},
|
||||
|
||||
_changed: function(settings, key) {
|
||||
_changed(settings, key) {
|
||||
this.emit('policy-changed', key);
|
||||
},
|
||||
|
||||
@ -206,7 +206,7 @@ var NotificationApplicationPolicy = new Lang.Class({
|
||||
Name: 'NotificationApplicationPolicy',
|
||||
Extends: NotificationPolicy,
|
||||
|
||||
_init: function(id) {
|
||||
_init(id) {
|
||||
// Don't chain to parent, it would try setting
|
||||
// our properties to the defaults
|
||||
|
||||
@ -217,11 +217,11 @@ var NotificationApplicationPolicy = new Lang.Class({
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications.application',
|
||||
path: '/org/gnome/desktop/notifications/application/' + this._canonicalId + '/' });
|
||||
|
||||
this._masterSettings.connect('changed', Lang.bind(this, this._changed));
|
||||
this._settings.connect('changed', Lang.bind(this, this._changed));
|
||||
this._masterSettings.connect('changed', this._changed.bind(this));
|
||||
this._settings.connect('changed', this._changed.bind(this));
|
||||
},
|
||||
|
||||
store: function() {
|
||||
store() {
|
||||
this._settings.set_string('application-id', this.id + '.desktop');
|
||||
|
||||
let apps = this._masterSettings.get_strv('application-children');
|
||||
@ -231,18 +231,18 @@ var NotificationApplicationPolicy = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._masterSettings.run_dispose();
|
||||
this._settings.run_dispose();
|
||||
},
|
||||
|
||||
_changed: function(settings, key) {
|
||||
_changed(settings, key) {
|
||||
this.emit('policy-changed', key);
|
||||
if (key == 'enable')
|
||||
this.emit('enable-changed');
|
||||
},
|
||||
|
||||
_canonicalizeId: function(id) {
|
||||
_canonicalizeId(id) {
|
||||
// Keys are restricted to lowercase alphanumeric characters and dash,
|
||||
// and two dashes cannot be in succession
|
||||
return id.toLowerCase().replace(/[^a-z0-9\-]/g, '-').replace(/--+/g, '-');
|
||||
@ -315,10 +315,10 @@ var NotificationApplicationPolicy = new Lang.Class({
|
||||
// You can add a secondary icon to the banner with 'secondaryGIcon'. There
|
||||
// is no fallback for this icon.
|
||||
//
|
||||
// If @params contains 'bannerMarkup', with the value %true, then
|
||||
// the corresponding element is assumed to use pango markup. If the
|
||||
// parameter is not present for an element, then anything that looks
|
||||
// like markup in that element will appear literally in the output.
|
||||
// If @params contains 'bannerMarkup', with the value %true, a subset (<b>,
|
||||
// <i> and <u>) of the markup in [1] will be interpreted within @banner. If
|
||||
// the parameter is not present, then anything that looks like markup
|
||||
// in @banner will appear literally in the output.
|
||||
//
|
||||
// If @params contains a 'clear' parameter with the value %true, then
|
||||
// the content and the action area of the notification will be cleared.
|
||||
@ -328,10 +328,12 @@ var NotificationApplicationPolicy = new Lang.Class({
|
||||
// If @params contains 'soundName' or 'soundFile', the corresponding
|
||||
// event sound is played when the notification is shown (if the policy for
|
||||
// @source allows playing sounds).
|
||||
//
|
||||
// [1] https://developer.gnome.org/notification-spec/#markup
|
||||
var Notification = new Lang.Class({
|
||||
Name: 'Notification',
|
||||
|
||||
_init: function(source, title, banner, params) {
|
||||
_init(source, title, banner, params) {
|
||||
this.source = source;
|
||||
this.title = title;
|
||||
this.urgency = Urgency.NORMAL;
|
||||
@ -363,7 +365,7 @@ var Notification = new Lang.Class({
|
||||
// Updates the notification by regenerating its icon and updating
|
||||
// the title/banner. If @params.clear is %true, it will also
|
||||
// remove any additional actors/action buttons previously added.
|
||||
update: function(title, banner, params) {
|
||||
update(title, banner, params) {
|
||||
params = Params.parse(params, { gicon: null,
|
||||
secondaryGIcon: null,
|
||||
bannerMarkup: false,
|
||||
@ -403,7 +405,7 @@ var Notification = new Lang.Class({
|
||||
// addAction:
|
||||
// @label: the label for the action's button
|
||||
// @callback: the callback for the action
|
||||
addAction: function(label, callback) {
|
||||
addAction(label, callback) {
|
||||
this.actions.push({ label: label, callback: callback });
|
||||
},
|
||||
|
||||
@ -418,23 +420,23 @@ var Notification = new Lang.Class({
|
||||
this.emit('acknowledged-changed');
|
||||
},
|
||||
|
||||
setUrgency: function(urgency) {
|
||||
setUrgency(urgency) {
|
||||
this.urgency = urgency;
|
||||
},
|
||||
|
||||
setResident: function(resident) {
|
||||
setResident(resident) {
|
||||
this.resident = resident;
|
||||
},
|
||||
|
||||
setTransient: function(isTransient) {
|
||||
setTransient(isTransient) {
|
||||
this.isTransient = isTransient;
|
||||
},
|
||||
|
||||
setForFeedback: function(forFeedback) {
|
||||
setForFeedback(forFeedback) {
|
||||
this.forFeedback = forFeedback;
|
||||
},
|
||||
|
||||
playSound: function() {
|
||||
playSound() {
|
||||
if (this._soundPlayed)
|
||||
return;
|
||||
|
||||
@ -471,17 +473,17 @@ var Notification = new Lang.Class({
|
||||
// the source (which will create a NotificationBanner),
|
||||
// so customization can be done by subclassing either
|
||||
// Notification or Source
|
||||
createBanner: function() {
|
||||
createBanner() {
|
||||
return this.source.createBanner(this);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
activate() {
|
||||
this.emit('activated');
|
||||
if (!this.resident)
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
destroy: function(reason) {
|
||||
destroy(reason) {
|
||||
if (!reason)
|
||||
reason = NotificationDestroyedReason.DISMISSED;
|
||||
this.emit('destroy', reason);
|
||||
@ -493,7 +495,7 @@ var NotificationBanner = new Lang.Class({
|
||||
Name: 'NotificationBanner',
|
||||
Extends: Calendar.NotificationMessage,
|
||||
|
||||
_init: function(notification) {
|
||||
_init(notification) {
|
||||
this.parent(notification);
|
||||
|
||||
this.actor.can_focus = false;
|
||||
@ -504,22 +506,21 @@ var NotificationBanner = new Lang.Class({
|
||||
this._addActions();
|
||||
this._addSecondaryIcon();
|
||||
|
||||
this._activatedId = this.notification.connect('activated',
|
||||
Lang.bind(this, function() {
|
||||
// We hide all types of notifications once the user clicks on
|
||||
// them because the common outcome of clicking should be the
|
||||
// relevant window being brought forward and the user's
|
||||
// attention switching to the window.
|
||||
this.emit('done-displaying');
|
||||
}));
|
||||
this._activatedId = this.notification.connect('activated', () => {
|
||||
// We hide all types of notifications once the user clicks on
|
||||
// them because the common outcome of clicking should be the
|
||||
// relevant window being brought forward and the user's
|
||||
// attention switching to the window.
|
||||
this.emit('done-displaying');
|
||||
});
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
this.parent();
|
||||
this.notification.disconnect(this._activatedId);
|
||||
},
|
||||
|
||||
_onUpdated: function(n, clear) {
|
||||
_onUpdated(n, clear) {
|
||||
this.parent(n, clear);
|
||||
|
||||
if (clear) {
|
||||
@ -532,14 +533,13 @@ var NotificationBanner = new Lang.Class({
|
||||
this._addSecondaryIcon();
|
||||
},
|
||||
|
||||
_addActions: function() {
|
||||
this.notification.actions.forEach(Lang.bind(this,
|
||||
function(action) {
|
||||
this.addAction(action.label, action.callback);
|
||||
}));
|
||||
_addActions() {
|
||||
this.notification.actions.forEach(action => {
|
||||
this.addAction(action.label, action.callback);
|
||||
});
|
||||
},
|
||||
|
||||
_addSecondaryIcon: function() {
|
||||
_addSecondaryIcon() {
|
||||
if (this.notification.secondaryGIcon) {
|
||||
let icon = new St.Icon({ gicon: this.notification.secondaryGIcon,
|
||||
x_align: Clutter.ActorAlign.END });
|
||||
@ -547,7 +547,7 @@ var NotificationBanner = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
addButton: function(button, callback) {
|
||||
addButton(button, callback) {
|
||||
if (!this._buttonBox) {
|
||||
this._buttonBox = new St.BoxLayout({ style_class: 'notification-actions',
|
||||
x_expand: true });
|
||||
@ -559,7 +559,7 @@ var NotificationBanner = new Lang.Class({
|
||||
return null;
|
||||
|
||||
this._buttonBox.add(button);
|
||||
button.connect('clicked', Lang.bind(this, function() {
|
||||
button.connect('clicked', () => {
|
||||
callback();
|
||||
|
||||
if (!this.notification.resident) {
|
||||
@ -570,12 +570,12 @@ var NotificationBanner = new Lang.Class({
|
||||
this.emit('done-displaying');
|
||||
this.notification.destroy();
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
return button;
|
||||
},
|
||||
|
||||
addAction: function(label, callback) {
|
||||
addAction(label, callback) {
|
||||
let button = new St.Button({ style_class: 'notification-button',
|
||||
label: label,
|
||||
x_expand: true,
|
||||
@ -588,18 +588,18 @@ var NotificationBanner = new Lang.Class({
|
||||
var SourceActor = new Lang.Class({
|
||||
Name: 'SourceActor',
|
||||
|
||||
_init: function(source, size) {
|
||||
_init(source, size) {
|
||||
this._source = source;
|
||||
this._size = size;
|
||||
|
||||
this.actor = new Shell.GenericContainer();
|
||||
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
||||
this.actor.connect('destroy', Lang.bind(this, function() {
|
||||
this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this));
|
||||
this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this));
|
||||
this.actor.connect('allocate', this._allocate.bind(this));
|
||||
this.actor.connect('destroy', () => {
|
||||
this._source.disconnect(this._iconUpdatedId);
|
||||
this._actorDestroyed = true;
|
||||
}));
|
||||
});
|
||||
this._actorDestroyed = false;
|
||||
|
||||
let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
@ -609,31 +609,31 @@ var SourceActor = new Lang.Class({
|
||||
|
||||
this.actor.add_actor(this._iconBin);
|
||||
|
||||
this._iconUpdatedId = this._source.connect('icon-updated', Lang.bind(this, this._updateIcon));
|
||||
this._iconUpdatedId = this._source.connect('icon-updated', this._updateIcon.bind(this));
|
||||
this._updateIcon();
|
||||
},
|
||||
|
||||
setIcon: function(icon) {
|
||||
setIcon(icon) {
|
||||
this._iconBin.child = icon;
|
||||
this._iconSet = true;
|
||||
},
|
||||
|
||||
_getPreferredWidth: function (actor, forHeight, alloc) {
|
||||
_getPreferredWidth(actor, forHeight, alloc) {
|
||||
let [min, nat] = this._iconBin.get_preferred_width(forHeight);
|
||||
alloc.min_size = min; alloc.nat_size = nat;
|
||||
},
|
||||
|
||||
_getPreferredHeight: function (actor, forWidth, alloc) {
|
||||
_getPreferredHeight(actor, forWidth, alloc) {
|
||||
let [min, nat] = this._iconBin.get_preferred_height(forWidth);
|
||||
alloc.min_size = min; alloc.nat_size = nat;
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
_allocate(actor, box, flags) {
|
||||
// the iconBin should fill our entire box
|
||||
this._iconBin.allocate(box, flags);
|
||||
},
|
||||
|
||||
_updateIcon: function() {
|
||||
_updateIcon() {
|
||||
if (this._actorDestroyed)
|
||||
return;
|
||||
|
||||
@ -646,7 +646,7 @@ var SourceActorWithLabel = new Lang.Class({
|
||||
Name: 'SourceActorWithLabel',
|
||||
Extends: SourceActor,
|
||||
|
||||
_init: function(source, size) {
|
||||
_init(source, size) {
|
||||
this.parent(source, size);
|
||||
|
||||
this._counterLabel = new St.Label({ x_align: Clutter.ActorAlign.CENTER,
|
||||
@ -659,23 +659,23 @@ var SourceActorWithLabel = new Lang.Class({
|
||||
layout_manager: new Clutter.BinLayout() });
|
||||
this._counterBin.hide();
|
||||
|
||||
this._counterBin.connect('style-changed', Lang.bind(this, function() {
|
||||
this._counterBin.connect('style-changed', () => {
|
||||
let themeNode = this._counterBin.get_theme_node();
|
||||
this._counterBin.translation_x = themeNode.get_length('-shell-counter-overlap-x');
|
||||
this._counterBin.translation_y = themeNode.get_length('-shell-counter-overlap-y');
|
||||
}));
|
||||
});
|
||||
|
||||
this.actor.add_actor(this._counterBin);
|
||||
|
||||
this._countUpdatedId = this._source.connect('count-updated', Lang.bind(this, this._updateCount));
|
||||
this._countUpdatedId = this._source.connect('count-updated', this._updateCount.bind(this));
|
||||
this._updateCount();
|
||||
|
||||
this.actor.connect('destroy', function() {
|
||||
this.actor.connect('destroy', () => {
|
||||
this._source.disconnect(this._countUpdatedId);
|
||||
});
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
_allocate(actor, box, flags) {
|
||||
this.parent(actor, box, flags);
|
||||
|
||||
let childBox = new Clutter.ActorBox();
|
||||
@ -699,7 +699,7 @@ var SourceActorWithLabel = new Lang.Class({
|
||||
this._counterBin.allocate(childBox, flags);
|
||||
},
|
||||
|
||||
_updateCount: function() {
|
||||
_updateCount() {
|
||||
if (this._actorDestroyed)
|
||||
return;
|
||||
|
||||
@ -720,7 +720,7 @@ var Source = new Lang.Class({
|
||||
|
||||
SOURCE_ICON_SIZE: 48,
|
||||
|
||||
_init: function(title, iconName) {
|
||||
_init(title, iconName) {
|
||||
this.title = title;
|
||||
this.iconName = iconName;
|
||||
|
||||
@ -736,43 +736,43 @@ var Source = new Lang.Class({
|
||||
},
|
||||
|
||||
get unseenCount() {
|
||||
return this.notifications.filter(function(n) { return !n.acknowledged; }).length;
|
||||
return this.notifications.filter(n => !n.acknowledged).length;
|
||||
},
|
||||
|
||||
get countVisible() {
|
||||
return this.count > 1;
|
||||
},
|
||||
|
||||
countUpdated: function() {
|
||||
countUpdated() {
|
||||
this.emit('count-updated');
|
||||
},
|
||||
|
||||
_createPolicy: function() {
|
||||
_createPolicy() {
|
||||
return new NotificationPolicy();
|
||||
},
|
||||
|
||||
setTitle: function(newTitle) {
|
||||
setTitle(newTitle) {
|
||||
this.title = newTitle;
|
||||
this.emit('title-changed');
|
||||
},
|
||||
|
||||
createBanner: function(notification) {
|
||||
createBanner(notification) {
|
||||
return new NotificationBanner(notification);
|
||||
},
|
||||
|
||||
// Called to create a new icon actor.
|
||||
// Provides a sane default implementation, override if you need
|
||||
// something more fancy.
|
||||
createIcon: function(size) {
|
||||
createIcon(size) {
|
||||
return new St.Icon({ gicon: this.getIcon(),
|
||||
icon_size: size });
|
||||
},
|
||||
|
||||
getIcon: function() {
|
||||
getIcon() {
|
||||
return new Gio.ThemedIcon({ name: this.iconName });
|
||||
},
|
||||
|
||||
_onNotificationDestroy: function(notification) {
|
||||
_onNotificationDestroy(notification) {
|
||||
let index = this.notifications.indexOf(notification);
|
||||
if (index < 0)
|
||||
return;
|
||||
@ -784,22 +784,22 @@ var Source = new Lang.Class({
|
||||
this.countUpdated();
|
||||
},
|
||||
|
||||
pushNotification: function(notification) {
|
||||
pushNotification(notification) {
|
||||
if (this.notifications.indexOf(notification) >= 0)
|
||||
return;
|
||||
|
||||
while (this.notifications.length >= MAX_NOTIFICATIONS_PER_SOURCE)
|
||||
this.notifications.shift().destroy(NotificationDestroyedReason.EXPIRED);
|
||||
|
||||
notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy));
|
||||
notification.connect('acknowledged-changed', Lang.bind(this, this.countUpdated));
|
||||
notification.connect('destroy', this._onNotificationDestroy.bind(this));
|
||||
notification.connect('acknowledged-changed', this.countUpdated.bind(this));
|
||||
this.notifications.push(notification);
|
||||
this.emit('notification-added', notification);
|
||||
|
||||
this.countUpdated();
|
||||
},
|
||||
|
||||
notify: function(notification) {
|
||||
notify(notification) {
|
||||
notification.acknowledged = false;
|
||||
this.pushNotification(notification);
|
||||
|
||||
@ -810,7 +810,7 @@ var Source = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function(reason) {
|
||||
destroy(reason) {
|
||||
this.policy.destroy();
|
||||
|
||||
let notifications = this.notifications;
|
||||
@ -822,15 +822,15 @@ var Source = new Lang.Class({
|
||||
this.emit('destroy', reason);
|
||||
},
|
||||
|
||||
iconUpdated: function() {
|
||||
iconUpdated() {
|
||||
this.emit('icon-updated');
|
||||
},
|
||||
|
||||
// To be overridden by subclasses
|
||||
open: function() {
|
||||
open() {
|
||||
},
|
||||
|
||||
destroyNonResidentNotifications: function() {
|
||||
destroyNonResidentNotifications() {
|
||||
for (let i = this.notifications.length - 1; i >= 0; i--)
|
||||
if (!this.notifications[i].resident)
|
||||
this.notifications[i].destroy();
|
||||
@ -843,27 +843,26 @@ Signals.addSignalMethods(Source.prototype);
|
||||
var MessageTray = new Lang.Class({
|
||||
Name: 'MessageTray',
|
||||
|
||||
_init: function() {
|
||||
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
|
||||
_init() {
|
||||
this._presence = new GnomeSession.Presence((proxy, error) => {
|
||||
this._onStatusChanged(proxy.status);
|
||||
}));
|
||||
});
|
||||
this._busy = false;
|
||||
this._bannerBlocked = false;
|
||||
this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) {
|
||||
this._presence.connectSignal('StatusChanged', (proxy, senderName, [status]) => {
|
||||
this._onStatusChanged(status);
|
||||
}));
|
||||
});
|
||||
|
||||
global.stage.connect('enter-event', Lang.bind(this,
|
||||
function(a, ev) {
|
||||
// HACK: St uses ClutterInputDevice for hover tracking, which
|
||||
// misses relevant X11 events when untracked actors are
|
||||
// involved (read: the notification banner in normal mode),
|
||||
// so fix up Clutter's view of the pointer position in
|
||||
// that case.
|
||||
let related = ev.get_related();
|
||||
if (!related || this.actor.contains(related))
|
||||
global.sync_pointer();
|
||||
}));
|
||||
global.stage.connect('enter-event', (a, ev) => {
|
||||
// HACK: St uses ClutterInputDevice for hover tracking, which
|
||||
// misses relevant X11 events when untracked actors are
|
||||
// involved (read: the notification banner in normal mode),
|
||||
// so fix up Clutter's view of the pointer position in
|
||||
// that case.
|
||||
let related = ev.get_related();
|
||||
if (!related || this.actor.contains(related))
|
||||
global.sync_pointer();
|
||||
});
|
||||
|
||||
this.actor = new St.Widget({ visible: false,
|
||||
clip_to_allocation: true,
|
||||
@ -883,9 +882,9 @@ var MessageTray = new Lang.Class({
|
||||
x_expand: true,
|
||||
layout_manager: new Clutter.BinLayout() });
|
||||
this._bannerBin.connect('key-release-event',
|
||||
Lang.bind(this, this._onNotificationKeyRelease));
|
||||
this._onNotificationKeyRelease.bind(this));
|
||||
this._bannerBin.connect('notify::hover',
|
||||
Lang.bind(this, this._onNotificationHoverChanged));
|
||||
this._onNotificationHoverChanged.bind(this));
|
||||
this.actor.add_actor(this._bannerBin);
|
||||
|
||||
this._notificationFocusGrabber = new FocusGrabber(this._bannerBin);
|
||||
@ -918,50 +917,50 @@ var MessageTray = new Lang.Class({
|
||||
Main.layoutManager.addChrome(this.actor, { affectsInputRegion: false });
|
||||
Main.layoutManager.trackChrome(this._bannerBin, { affectsInputRegion: true });
|
||||
|
||||
global.screen.connect('in-fullscreen-changed', Lang.bind(this, this._updateState));
|
||||
global.screen.connect('in-fullscreen-changed', this._updateState.bind(this));
|
||||
|
||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
||||
|
||||
Main.overview.connect('window-drag-begin',
|
||||
Lang.bind(this, this._onDragBegin));
|
||||
this._onDragBegin.bind(this));
|
||||
Main.overview.connect('window-drag-cancelled',
|
||||
Lang.bind(this, this._onDragEnd));
|
||||
this._onDragEnd.bind(this));
|
||||
Main.overview.connect('window-drag-end',
|
||||
Lang.bind(this, this._onDragEnd));
|
||||
this._onDragEnd.bind(this));
|
||||
|
||||
Main.overview.connect('item-drag-begin',
|
||||
Lang.bind(this, this._onDragBegin));
|
||||
this._onDragBegin.bind(this));
|
||||
Main.overview.connect('item-drag-cancelled',
|
||||
Lang.bind(this, this._onDragEnd));
|
||||
this._onDragEnd.bind(this));
|
||||
Main.overview.connect('item-drag-end',
|
||||
Lang.bind(this, this._onDragEnd));
|
||||
this._onDragEnd.bind(this));
|
||||
|
||||
Main.xdndHandler.connect('drag-begin',
|
||||
Lang.bind(this, this._onDragBegin));
|
||||
this._onDragBegin.bind(this));
|
||||
Main.xdndHandler.connect('drag-end',
|
||||
Lang.bind(this, this._onDragEnd));
|
||||
this._onDragEnd.bind(this));
|
||||
|
||||
Main.wm.addKeybinding('focus-active-notification',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.NONE,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
Lang.bind(this, this._expandActiveNotification));
|
||||
this._expandActiveNotification.bind(this));
|
||||
|
||||
this._sources = new Map();
|
||||
|
||||
this._sessionUpdated();
|
||||
},
|
||||
|
||||
_sessionUpdated: function() {
|
||||
_sessionUpdated() {
|
||||
this._updateState();
|
||||
},
|
||||
|
||||
_onDragBegin: function() {
|
||||
_onDragBegin() {
|
||||
Shell.util_set_hidden_from_pick(this.actor, true);
|
||||
},
|
||||
|
||||
_onDragEnd: function() {
|
||||
_onDragEnd() {
|
||||
Shell.util_set_hidden_from_pick(this.actor, false);
|
||||
},
|
||||
|
||||
@ -973,7 +972,7 @@ var MessageTray = new Lang.Class({
|
||||
this._bannerBin.set_x_align(align);
|
||||
},
|
||||
|
||||
_onNotificationKeyRelease: function(actor, event) {
|
||||
_onNotificationKeyRelease(actor, event) {
|
||||
if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) {
|
||||
this._expireNotification();
|
||||
return Clutter.EVENT_STOP;
|
||||
@ -982,7 +981,7 @@ var MessageTray = new Lang.Class({
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
|
||||
_expireNotification: function() {
|
||||
_expireNotification() {
|
||||
this._notificationExpired = true;
|
||||
this._updateState();
|
||||
},
|
||||
@ -998,11 +997,11 @@ var MessageTray = new Lang.Class({
|
||||
this._updateState();
|
||||
},
|
||||
|
||||
contains: function(source) {
|
||||
contains(source) {
|
||||
return this._sources.has(source);
|
||||
},
|
||||
|
||||
add: function(source) {
|
||||
add(source) {
|
||||
if (this.contains(source)) {
|
||||
log('Trying to re-add source ' + source.title);
|
||||
return;
|
||||
@ -1011,12 +1010,14 @@ var MessageTray = new Lang.Class({
|
||||
// Register that we got a notification for this source
|
||||
source.policy.store();
|
||||
|
||||
source.policy.connect('enable-changed', Lang.bind(this, this._onSourceEnableChanged, source));
|
||||
source.policy.connect('policy-changed', Lang.bind(this, this._updateState));
|
||||
source.policy.connect('enable-changed', () => {
|
||||
this._onSourceEnableChanged(source.policy, source);
|
||||
});
|
||||
source.policy.connect('policy-changed', this._updateState.bind(this));
|
||||
this._onSourceEnableChanged(source.policy, source);
|
||||
},
|
||||
|
||||
_addSource: function(source) {
|
||||
_addSource(source) {
|
||||
let obj = {
|
||||
source: source,
|
||||
notifyId: 0,
|
||||
@ -1025,13 +1026,13 @@ var MessageTray = new Lang.Class({
|
||||
|
||||
this._sources.set(source, obj);
|
||||
|
||||
obj.notifyId = source.connect('notify', Lang.bind(this, this._onNotify));
|
||||
obj.destroyId = source.connect('destroy', Lang.bind(this, this._onSourceDestroy));
|
||||
obj.notifyId = source.connect('notify', this._onNotify.bind(this));
|
||||
obj.destroyId = source.connect('destroy', this._onSourceDestroy.bind(this));
|
||||
|
||||
this.emit('source-added', source);
|
||||
},
|
||||
|
||||
_removeSource: function(source) {
|
||||
_removeSource(source) {
|
||||
let obj = this._sources.get(source);
|
||||
this._sources.delete(source);
|
||||
|
||||
@ -1041,11 +1042,11 @@ var MessageTray = new Lang.Class({
|
||||
this.emit('source-removed', source);
|
||||
},
|
||||
|
||||
getSources: function() {
|
||||
getSources() {
|
||||
return [...this._sources.keys()];
|
||||
},
|
||||
|
||||
_onSourceEnableChanged: function(policy, source) {
|
||||
_onSourceEnableChanged(policy, source) {
|
||||
let wasEnabled = this.contains(source);
|
||||
let shouldBeEnabled = policy.enable;
|
||||
|
||||
@ -1057,11 +1058,11 @@ var MessageTray = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onSourceDestroy: function(source) {
|
||||
_onSourceDestroy(source) {
|
||||
this._removeSource(source);
|
||||
},
|
||||
|
||||
_onNotificationDestroy: function(notification) {
|
||||
_onNotificationDestroy(notification) {
|
||||
if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) {
|
||||
this._updateNotificationTimeout(0);
|
||||
this._notificationRemoved = true;
|
||||
@ -1076,7 +1077,7 @@ var MessageTray = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onNotify: function(source, notification) {
|
||||
_onNotify(source, notification) {
|
||||
if (this._notification == notification) {
|
||||
// If a notification that is being shown is updated, we update
|
||||
// how it is shown and extend the time until it auto-hides.
|
||||
@ -1091,18 +1092,18 @@ var MessageTray = new Lang.Class({
|
||||
let full = (this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE);
|
||||
if (!full || notification.urgency == Urgency.CRITICAL) {
|
||||
notification.connect('destroy',
|
||||
Lang.bind(this, this._onNotificationDestroy));
|
||||
this._onNotificationDestroy.bind(this));
|
||||
this._notificationQueue.push(notification);
|
||||
this._notificationQueue.sort(function(notification1, notification2) {
|
||||
return (notification2.urgency - notification1.urgency);
|
||||
});
|
||||
this._notificationQueue.sort(
|
||||
(n1, n2) => n2.urgency - n1.urgency
|
||||
);
|
||||
this.emit('queue-changed');
|
||||
}
|
||||
}
|
||||
this._updateState();
|
||||
},
|
||||
|
||||
_resetNotificationLeftTimeout: function() {
|
||||
_resetNotificationLeftTimeout() {
|
||||
this._useLongerNotificationLeftTimeout = false;
|
||||
if (this._notificationLeftTimeoutId) {
|
||||
Mainloop.source_remove(this._notificationLeftTimeoutId);
|
||||
@ -1112,7 +1113,7 @@ var MessageTray = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onNotificationHoverChanged: function() {
|
||||
_onNotificationHoverChanged() {
|
||||
if (this._bannerBin.hover == this._notificationHovered)
|
||||
return;
|
||||
|
||||
@ -1151,12 +1152,12 @@ var MessageTray = new Lang.Class({
|
||||
// We wait for a longer period if the notification popped up where the mouse pointer was already positioned.
|
||||
// That gives the user more time to mouse away from the notification and mouse back in in order to expand it.
|
||||
let timeout = this._useLongerNotificationLeftTimeout ? LONGER_HIDE_TIMEOUT * 1000 : HIDE_TIMEOUT * 1000;
|
||||
this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout, Lang.bind(this, this._onNotificationLeftTimeout));
|
||||
this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout, this._onNotificationLeftTimeout.bind(this));
|
||||
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout');
|
||||
}
|
||||
},
|
||||
|
||||
_onStatusChanged: function(status) {
|
||||
_onStatusChanged(status) {
|
||||
if (status == GnomeSession.PresenceStatus.BUSY) {
|
||||
// remove notification and allow the summary to be closed now
|
||||
this._updateNotificationTimeout(0);
|
||||
@ -1171,7 +1172,7 @@ var MessageTray = new Lang.Class({
|
||||
this._updateState();
|
||||
},
|
||||
|
||||
_onNotificationLeftTimeout: function() {
|
||||
_onNotificationLeftTimeout() {
|
||||
let [x, y, mods] = global.get_pointer();
|
||||
// We extend the timeout once if the mouse moved no further than MOUSE_LEFT_ACTOR_THRESHOLD to either side.
|
||||
if (this._notificationLeftMouseX > -1 &&
|
||||
@ -1181,7 +1182,7 @@ var MessageTray = new Lang.Class({
|
||||
x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) {
|
||||
this._notificationLeftMouseX = -1;
|
||||
this._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT * 1000,
|
||||
Lang.bind(this, this._onNotificationLeftTimeout));
|
||||
this._onNotificationLeftTimeout.bind(this));
|
||||
GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout');
|
||||
} else {
|
||||
this._notificationLeftTimeoutId = 0;
|
||||
@ -1193,7 +1194,7 @@ var MessageTray = new Lang.Class({
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
_escapeTray: function() {
|
||||
_escapeTray() {
|
||||
this._pointerInNotification = false;
|
||||
this._updateNotificationTimeout(0);
|
||||
this._updateState();
|
||||
@ -1204,7 +1205,7 @@ var MessageTray = new Lang.Class({
|
||||
// 'this._pointerInNotification', 'this._traySummoned', etc, and
|
||||
// _updateState() figures out what (if anything) needs to be done
|
||||
// at the present time.
|
||||
_updateState: function() {
|
||||
_updateState() {
|
||||
let hasMonitor = Main.layoutManager.primaryMonitor != null;
|
||||
this.actor.visible = !this._bannerBlocked && hasMonitor && this._banner != null;
|
||||
if (this._bannerBlocked || !hasMonitor)
|
||||
@ -1219,7 +1220,7 @@ var MessageTray = new Lang.Class({
|
||||
|
||||
// Filter out acknowledged notifications.
|
||||
let changed = false;
|
||||
this._notificationQueue = this._notificationQueue.filter(function(n) {
|
||||
this._notificationQueue = this._notificationQueue.filter(n => {
|
||||
changed = changed || n.acknowledged;
|
||||
return !n.acknowledged;
|
||||
});
|
||||
@ -1262,7 +1263,7 @@ var MessageTray = new Lang.Class({
|
||||
this._notificationExpired = false;
|
||||
},
|
||||
|
||||
_tween: function(actor, statevar, value, params) {
|
||||
_tween(actor, statevar, value, params) {
|
||||
let onComplete = params.onComplete;
|
||||
let onCompleteScope = params.onCompleteScope;
|
||||
let onCompleteParams = params.onCompleteParams;
|
||||
@ -1279,24 +1280,24 @@ var MessageTray = new Lang.Class({
|
||||
this[statevar] = valuing;
|
||||
},
|
||||
|
||||
_tweenComplete: function(statevar, value, onComplete, onCompleteScope, onCompleteParams) {
|
||||
_tweenComplete(statevar, value, onComplete, onCompleteScope, onCompleteParams) {
|
||||
this[statevar] = value;
|
||||
if (onComplete)
|
||||
onComplete.apply(onCompleteScope, onCompleteParams);
|
||||
this._updateState();
|
||||
},
|
||||
|
||||
_clampOpacity: function() {
|
||||
_clampOpacity() {
|
||||
this._bannerBin.opacity = Math.max(0, Math.min(this._bannerBin._opacity, 255));
|
||||
},
|
||||
|
||||
_onIdleMonitorBecameActive: function() {
|
||||
_onIdleMonitorBecameActive() {
|
||||
this._userActiveWhileNotificationShown = true;
|
||||
this._updateNotificationTimeout(2000);
|
||||
this._updateState();
|
||||
},
|
||||
|
||||
_showNotification: function() {
|
||||
_showNotification() {
|
||||
this._notification = this._notificationQueue.shift();
|
||||
this.emit('queue-changed');
|
||||
|
||||
@ -1304,15 +1305,15 @@ var MessageTray = new Lang.Class({
|
||||
if (!this._userActiveWhileNotificationShown) {
|
||||
// If the user isn't active, set up a watch to let us know
|
||||
// when the user becomes active.
|
||||
this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive));
|
||||
this.idleMonitor.add_user_active_watch(this._onIdleMonitorBecameActive.bind(this));
|
||||
}
|
||||
|
||||
this._banner = this._notification.createBanner();
|
||||
this._bannerClickedId = this._banner.connect('done-displaying',
|
||||
Lang.bind(this, this._escapeTray));
|
||||
this._bannerUnfocusedId = this._banner.connect('unfocused', Lang.bind(this, function() {
|
||||
this._escapeTray.bind(this));
|
||||
this._bannerUnfocusedId = this._banner.connect('unfocused', () => {
|
||||
this._updateState();
|
||||
}));
|
||||
});
|
||||
|
||||
this._bannerBin.add_actor(this._banner.actor);
|
||||
|
||||
@ -1340,7 +1341,7 @@ var MessageTray = new Lang.Class({
|
||||
this._resetNotificationLeftTimeout();
|
||||
},
|
||||
|
||||
_updateShowingNotification: function() {
|
||||
_updateShowingNotification() {
|
||||
this._notification.acknowledged = true;
|
||||
this._notification.playSound();
|
||||
|
||||
@ -1374,12 +1375,12 @@ var MessageTray = new Lang.Class({
|
||||
this._tween(this._bannerBin, '_notificationState', State.SHOWN, tweenParams);
|
||||
},
|
||||
|
||||
_showNotificationCompleted: function() {
|
||||
_showNotificationCompleted() {
|
||||
if (this._notification.urgency != Urgency.CRITICAL)
|
||||
this._updateNotificationTimeout(NOTIFICATION_TIMEOUT * 1000);
|
||||
},
|
||||
|
||||
_updateNotificationTimeout: function(timeout) {
|
||||
_updateNotificationTimeout(timeout) {
|
||||
if (this._notificationTimeoutId) {
|
||||
Mainloop.source_remove(this._notificationTimeoutId);
|
||||
this._notificationTimeoutId = 0;
|
||||
@ -1387,12 +1388,12 @@ var MessageTray = new Lang.Class({
|
||||
if (timeout > 0) {
|
||||
this._notificationTimeoutId =
|
||||
Mainloop.timeout_add(timeout,
|
||||
Lang.bind(this, this._notificationTimeout));
|
||||
this._notificationTimeout.bind(this));
|
||||
GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell] this._notificationTimeout');
|
||||
}
|
||||
},
|
||||
|
||||
_notificationTimeout: function() {
|
||||
_notificationTimeout() {
|
||||
let [x, y, mods] = global.get_pointer();
|
||||
if (y < this._lastSeenMouseY - 10 && !this._notificationHovered) {
|
||||
// The mouse is moving towards the notification, so don't
|
||||
@ -1416,7 +1417,7 @@ var MessageTray = new Lang.Class({
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
_hideNotification: function(animate) {
|
||||
_hideNotification(animate) {
|
||||
this._notificationFocusGrabber.ungrabFocus();
|
||||
|
||||
if (this._bannerClickedId) {
|
||||
@ -1450,7 +1451,7 @@ var MessageTray = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_hideNotificationCompleted: function() {
|
||||
_hideNotificationCompleted() {
|
||||
let notification = this._notification;
|
||||
this._notification = null;
|
||||
if (notification.isTransient)
|
||||
@ -1464,14 +1465,14 @@ var MessageTray = new Lang.Class({
|
||||
this.actor.hide();
|
||||
},
|
||||
|
||||
_expandActiveNotification: function() {
|
||||
_expandActiveNotification() {
|
||||
if (!this._banner)
|
||||
return;
|
||||
|
||||
this._expandBanner(false);
|
||||
},
|
||||
|
||||
_expandBanner: function(autoExpanding) {
|
||||
_expandBanner(autoExpanding) {
|
||||
// Don't animate changes in notifications that are auto-expanding.
|
||||
this._banner.expand(!autoExpanding);
|
||||
|
||||
@ -1480,7 +1481,7 @@ var MessageTray = new Lang.Class({
|
||||
this._ensureBannerFocused();
|
||||
},
|
||||
|
||||
_ensureBannerFocused: function() {
|
||||
_ensureBannerFocused() {
|
||||
this._notificationFocusGrabber.grabFocus();
|
||||
}
|
||||
});
|
||||
@ -1490,11 +1491,11 @@ var SystemNotificationSource = new Lang.Class({
|
||||
Name: 'SystemNotificationSource',
|
||||
Extends: Source,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent(_("System Information"), 'dialog-information-symbolic');
|
||||
},
|
||||
|
||||
open: function() {
|
||||
open() {
|
||||
this.destroy();
|
||||
}
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ var State = {
|
||||
var ModalDialog = new Lang.Class({
|
||||
Name: 'ModalDialog',
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { shellReactive: false,
|
||||
styleClass: null,
|
||||
actionMode: Shell.ActionMode.SYSTEM_MODAL,
|
||||
@ -60,7 +60,7 @@ var ModalDialog = new Lang.Class({
|
||||
coordinate: Clutter.BindCoordinate.ALL });
|
||||
this._group.add_constraint(constraint);
|
||||
|
||||
this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
|
||||
this._group.connect('destroy', this._onGroupDestroy.bind(this));
|
||||
|
||||
this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
||||
this._backgroundBin = new St.Bin({ child: this.backgroundStack,
|
||||
@ -89,43 +89,30 @@ var ModalDialog = new Lang.Class({
|
||||
this._savedKeyFocus = null;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._group.destroy();
|
||||
},
|
||||
|
||||
clearButtons: function() {
|
||||
clearButtons() {
|
||||
this.dialogLayout.clearButtons();
|
||||
},
|
||||
|
||||
setButtons: function(buttons) {
|
||||
setButtons(buttons) {
|
||||
this.clearButtons();
|
||||
|
||||
for (let i = 0; i < buttons.length; i++) {
|
||||
let buttonInfo = buttons[i];
|
||||
|
||||
let x_alignment;
|
||||
if (buttons.length == 1)
|
||||
x_alignment = St.Align.END;
|
||||
else if (i == 0)
|
||||
x_alignment = St.Align.START;
|
||||
else if (i == buttons.length - 1)
|
||||
x_alignment = St.Align.END;
|
||||
else
|
||||
x_alignment = St.Align.MIDDLE;
|
||||
|
||||
for (let buttonInfo of buttons)
|
||||
this.addButton(buttonInfo);
|
||||
}
|
||||
},
|
||||
|
||||
addButton: function (buttonInfo) {
|
||||
addButton(buttonInfo) {
|
||||
return this.dialogLayout.addButton(buttonInfo);
|
||||
},
|
||||
|
||||
_onGroupDestroy: function() {
|
||||
_onGroupDestroy() {
|
||||
this.emit('destroy');
|
||||
},
|
||||
|
||||
_fadeOpen: function(onPrimary) {
|
||||
_fadeOpen(onPrimary) {
|
||||
if (onPrimary)
|
||||
this._monitorConstraint.primary = true;
|
||||
else
|
||||
@ -142,27 +129,26 @@ var ModalDialog = new Lang.Class({
|
||||
{ opacity: 255,
|
||||
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this.state = State.OPENED;
|
||||
this.emit('opened');
|
||||
})
|
||||
onComplete: () => {
|
||||
this.state = State.OPENED;
|
||||
this.emit('opened');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setInitialKeyFocus: function(actor) {
|
||||
setInitialKeyFocus(actor) {
|
||||
if (this._initialKeyFocusDestroyId)
|
||||
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
||||
|
||||
this._initialKeyFocus = actor;
|
||||
|
||||
this._initialKeyFocusDestroyId = actor.connect('destroy', Lang.bind(this, function() {
|
||||
this._initialKeyFocusDestroyId = actor.connect('destroy', () => {
|
||||
this._initialKeyFocus = null;
|
||||
this._initialKeyFocusDestroyId = 0;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
open: function(timestamp, onPrimary) {
|
||||
open(timestamp, onPrimary) {
|
||||
if (this.state == State.OPENED || this.state == State.OPENING)
|
||||
return true;
|
||||
|
||||
@ -173,7 +159,7 @@ var ModalDialog = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_closeComplete: function() {
|
||||
_closeComplete() {
|
||||
this.state = State.CLOSED;
|
||||
this._group.hide();
|
||||
this.emit('closed');
|
||||
@ -182,7 +168,7 @@ var ModalDialog = new Lang.Class({
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
close: function(timestamp) {
|
||||
close(timestamp) {
|
||||
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
||||
return;
|
||||
|
||||
@ -195,8 +181,7 @@ var ModalDialog = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: OPEN_AND_CLOSE_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
this._closeComplete)
|
||||
onComplete: this._closeComplete.bind(this)
|
||||
})
|
||||
else
|
||||
this._closeComplete();
|
||||
@ -205,7 +190,7 @@ var ModalDialog = new Lang.Class({
|
||||
// Drop modal status without closing the dialog; this makes the
|
||||
// dialog insensitive as well, so it needs to be followed shortly
|
||||
// by either a close() or a pushModal()
|
||||
popModal: function(timestamp) {
|
||||
popModal(timestamp) {
|
||||
if (!this._hasModal)
|
||||
return;
|
||||
|
||||
@ -222,7 +207,7 @@ var ModalDialog = new Lang.Class({
|
||||
this._eventBlocker.raise_top();
|
||||
},
|
||||
|
||||
pushModal: function (timestamp) {
|
||||
pushModal(timestamp) {
|
||||
if (this._hasModal)
|
||||
return true;
|
||||
|
||||
@ -257,7 +242,7 @@ var ModalDialog = new Lang.Class({
|
||||
// e.g., if a user clicked "Log Out" then the dialog should go away
|
||||
// imediately, but the lightbox should remain until the logout is
|
||||
// complete.
|
||||
_fadeOutDialog: function(timestamp) {
|
||||
_fadeOutDialog(timestamp) {
|
||||
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
||||
return;
|
||||
|
||||
@ -269,10 +254,9 @@ var ModalDialog = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: FADE_OUT_DIALOG_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this.state = State.FADED_OUT;
|
||||
})
|
||||
onComplete: () => {
|
||||
this.state = State.FADED_OUT;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -51,7 +51,7 @@ var MediaMessage = new Lang.Class({
|
||||
Name: 'MediaMessage',
|
||||
Extends: MessageList.Message,
|
||||
|
||||
_init: function(player) {
|
||||
_init(player) {
|
||||
this._player = player;
|
||||
|
||||
this.parent('', '');
|
||||
@ -60,35 +60,35 @@ var MediaMessage = new Lang.Class({
|
||||
this.setIcon(this._icon);
|
||||
|
||||
this._prevButton = this.addMediaControl('media-skip-backward-symbolic',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._player.previous();
|
||||
}));
|
||||
});
|
||||
|
||||
this._playPauseButton = this.addMediaControl(null,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._player.playPause();
|
||||
}));
|
||||
});
|
||||
|
||||
this._nextButton = this.addMediaControl('media-skip-forward-symbolic',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._player.next();
|
||||
}));
|
||||
});
|
||||
|
||||
this._player.connect('changed', Lang.bind(this, this._update));
|
||||
this._player.connect('closed', Lang.bind(this, this.close));
|
||||
this._player.connect('changed', this._update.bind(this));
|
||||
this._player.connect('closed', this.close.bind(this));
|
||||
this._update();
|
||||
},
|
||||
|
||||
_onClicked: function() {
|
||||
_onClicked() {
|
||||
this._player.raise();
|
||||
Main.panel.closeCalendar();
|
||||
},
|
||||
|
||||
_updateNavButton: function(button, sensitive) {
|
||||
_updateNavButton(button, sensitive) {
|
||||
button.reactive = sensitive;
|
||||
},
|
||||
|
||||
_update: function() {
|
||||
_update() {
|
||||
this.setTitle(this._player.trackArtists.join(', '));
|
||||
this.setBody(this._player.trackTitle);
|
||||
|
||||
@ -114,13 +114,13 @@ var MediaMessage = new Lang.Class({
|
||||
var MprisPlayer = new Lang.Class({
|
||||
Name: 'MprisPlayer',
|
||||
|
||||
_init: function(busName) {
|
||||
_init(busName) {
|
||||
this._mprisProxy = new MprisProxy(Gio.DBus.session, busName,
|
||||
'/org/mpris/MediaPlayer2',
|
||||
Lang.bind(this, this._onMprisProxyReady));
|
||||
this._onMprisProxyReady.bind(this));
|
||||
this._playerProxy = new MprisPlayerProxy(Gio.DBus.session, busName,
|
||||
'/org/mpris/MediaPlayer2',
|
||||
Lang.bind(this, this._onPlayerProxyReady));
|
||||
this._onPlayerProxyReady.bind(this));
|
||||
|
||||
this._visible = false;
|
||||
this._trackArtists = [];
|
||||
@ -144,7 +144,7 @@ var MprisPlayer = new Lang.Class({
|
||||
return this._trackCoverUrl;
|
||||
},
|
||||
|
||||
playPause: function() {
|
||||
playPause() {
|
||||
this._playerProxy.PlayPauseRemote();
|
||||
},
|
||||
|
||||
@ -152,7 +152,7 @@ var MprisPlayer = new Lang.Class({
|
||||
return this._playerProxy.CanGoNext;
|
||||
},
|
||||
|
||||
next: function() {
|
||||
next() {
|
||||
this._playerProxy.NextRemote();
|
||||
},
|
||||
|
||||
@ -160,11 +160,11 @@ var MprisPlayer = new Lang.Class({
|
||||
return this._playerProxy.CanGoPrevious;
|
||||
},
|
||||
|
||||
previous: function() {
|
||||
previous() {
|
||||
this._playerProxy.PreviousRemote();
|
||||
},
|
||||
|
||||
raise: function() {
|
||||
raise() {
|
||||
// The remote Raise() method may run into focus stealing prevention,
|
||||
// so prefer activating the app via .desktop file if possible
|
||||
let app = null;
|
||||
@ -179,7 +179,7 @@ var MprisPlayer = new Lang.Class({
|
||||
this._mprisProxy.RaiseRemote();
|
||||
},
|
||||
|
||||
_close: function() {
|
||||
_close() {
|
||||
this._mprisProxy.disconnect(this._ownerNotifyId);
|
||||
this._mprisProxy = null;
|
||||
|
||||
@ -189,21 +189,21 @@ var MprisPlayer = new Lang.Class({
|
||||
this.emit('closed');
|
||||
},
|
||||
|
||||
_onMprisProxyReady: function() {
|
||||
_onMprisProxyReady() {
|
||||
this._ownerNotifyId = this._mprisProxy.connect('notify::g-name-owner',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
if (!this._mprisProxy.g_name_owner)
|
||||
this._close();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onPlayerProxyReady: function() {
|
||||
_onPlayerProxyReady() {
|
||||
this._propsChangedId = this._playerProxy.connect('g-properties-changed',
|
||||
Lang.bind(this, this._updateState));
|
||||
this._updateState.bind(this));
|
||||
this._updateState();
|
||||
},
|
||||
|
||||
_updateState: function() {
|
||||
_updateState() {
|
||||
let metadata = {};
|
||||
for (let prop in this._playerProxy.Metadata)
|
||||
metadata[prop] = this._playerProxy.Metadata[prop].deep_unpack();
|
||||
@ -230,7 +230,7 @@ var MediaSection = new Lang.Class({
|
||||
Name: 'MediaSection',
|
||||
Extends: MessageList.MessageListSection,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
|
||||
this._players = new Map();
|
||||
@ -238,46 +238,44 @@ var MediaSection = new Lang.Class({
|
||||
this._proxy = new DBusProxy(Gio.DBus.session,
|
||||
'org.freedesktop.DBus',
|
||||
'/org/freedesktop/DBus',
|
||||
Lang.bind(this, this._onProxyReady));
|
||||
this._onProxyReady.bind(this));
|
||||
},
|
||||
|
||||
_shouldShow: function() {
|
||||
_shouldShow() {
|
||||
return !this.empty && Calendar.isToday(this._date);
|
||||
},
|
||||
|
||||
_addPlayer: function(busName) {
|
||||
_addPlayer(busName) {
|
||||
if (this._players.get(busName))
|
||||
return;
|
||||
|
||||
let player = new MprisPlayer(busName);
|
||||
player.connect('closed', Lang.bind(this,
|
||||
function() {
|
||||
player.connect('closed',
|
||||
() => {
|
||||
this._players.delete(busName);
|
||||
}));
|
||||
player.connect('show', Lang.bind(this,
|
||||
function() {
|
||||
});
|
||||
player.connect('show',
|
||||
() => {
|
||||
let message = new MediaMessage(player);
|
||||
this.addMessage(message, true);
|
||||
}));
|
||||
});
|
||||
this._players.set(busName, player);
|
||||
},
|
||||
|
||||
_onProxyReady: function() {
|
||||
this._proxy.ListNamesRemote(Lang.bind(this,
|
||||
function([names]) {
|
||||
names.forEach(Lang.bind(this,
|
||||
function(name) {
|
||||
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
||||
return;
|
||||
_onProxyReady() {
|
||||
this._proxy.ListNamesRemote(([names]) => {
|
||||
names.forEach(name => {
|
||||
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
||||
return;
|
||||
|
||||
this._addPlayer(name);
|
||||
}));
|
||||
}));
|
||||
this._addPlayer(name);
|
||||
});
|
||||
});
|
||||
this._proxy.connectSignal('NameOwnerChanged',
|
||||
Lang.bind(this, this._onNameOwnerChanged));
|
||||
this._onNameOwnerChanged.bind(this));
|
||||
},
|
||||
|
||||
_onNameOwnerChanged: function(proxy, sender, [name, oldOwner, newOwner]) {
|
||||
_onNameOwnerChanged(proxy, sender, [name, oldOwner, newOwner]) {
|
||||
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
||||
return;
|
||||
|
||||
|
@ -94,7 +94,7 @@ const rewriteRules = {
|
||||
var FdoNotificationDaemon = new Lang.Class({
|
||||
Name: 'FdoNotificationDaemon',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(FdoNotificationsIface, this);
|
||||
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
|
||||
|
||||
@ -106,12 +106,12 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
this._nextNotificationId = 1;
|
||||
|
||||
Shell.WindowTracker.get_default().connect('notify::focus-app',
|
||||
Lang.bind(this, this._onFocusAppChanged));
|
||||
this._onFocusAppChanged.bind(this));
|
||||
Main.overview.connect('hidden',
|
||||
Lang.bind(this, this._onFocusAppChanged));
|
||||
this._onFocusAppChanged.bind(this));
|
||||
},
|
||||
|
||||
_imageForNotificationData: function(hints) {
|
||||
_imageForNotificationData(hints) {
|
||||
if (hints['image-data']) {
|
||||
let [width, height, rowStride, hasAlpha,
|
||||
bitsPerSample, nChannels, data] = hints['image-data'];
|
||||
@ -123,7 +123,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
return null;
|
||||
},
|
||||
|
||||
_fallbackIconForNotificationData: function(hints) {
|
||||
_fallbackIconForNotificationData(hints) {
|
||||
let stockIcon;
|
||||
switch (hints.urgency) {
|
||||
case Urgency.LOW:
|
||||
@ -137,7 +137,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
return new Gio.ThemedIcon({ name: stockIcon });
|
||||
},
|
||||
|
||||
_iconForNotificationData: function(icon) {
|
||||
_iconForNotificationData(icon) {
|
||||
if (icon) {
|
||||
if (icon.substr(0, 7) == 'file://')
|
||||
return new Gio.FileIcon({ file: Gio.File.new_for_uri(icon) });
|
||||
@ -149,7 +149,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
return null;
|
||||
},
|
||||
|
||||
_lookupSource: function(title, pid) {
|
||||
_lookupSource(title, pid) {
|
||||
for (let i = 0; i < this._sources.length; i++) {
|
||||
let source = this._sources[i];
|
||||
if (source.pid == pid && source.initialTitle == title)
|
||||
@ -169,7 +169,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
//
|
||||
// Either a pid or ndata.notification is needed to retrieve or
|
||||
// create a source.
|
||||
_getSource: function(title, pid, ndata, sender) {
|
||||
_getSource(title, pid, ndata, sender) {
|
||||
if (!pid && !(ndata && ndata.notification))
|
||||
return null;
|
||||
|
||||
@ -190,17 +190,17 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
source = new FdoNotificationDaemonSource(title, pid, sender, appId);
|
||||
|
||||
this._sources.push(source);
|
||||
source.connect('destroy', Lang.bind(this, function() {
|
||||
source.connect('destroy', () => {
|
||||
let index = this._sources.indexOf(source);
|
||||
if (index >= 0)
|
||||
this._sources.splice(index, 1);
|
||||
}));
|
||||
});
|
||||
|
||||
Main.messageTray.add(source);
|
||||
return source;
|
||||
},
|
||||
|
||||
NotifyAsync: function(params, invocation) {
|
||||
NotifyAsync(params, invocation) {
|
||||
let [appName, replacesId, icon, summary, body, actions, hints, timeout] = params;
|
||||
let id;
|
||||
|
||||
@ -220,11 +220,10 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
// Ignore replacesId since we already sent back a
|
||||
// NotificationClosed for that id.
|
||||
id = this._nextNotificationId++;
|
||||
let idle_id = Mainloop.idle_add(Lang.bind(this,
|
||||
function () {
|
||||
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
let idle_id = Mainloop.idle_add(() => {
|
||||
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(idle_id, '[gnome-shell] this._emitNotificationClosed');
|
||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||
}
|
||||
@ -285,7 +284,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));;
|
||||
}
|
||||
|
||||
this._busProxy.GetConnectionUnixProcessIDRemote(sender, Lang.bind(this, function (result, excp) {
|
||||
this._busProxy.GetConnectionUnixProcessIDRemote(sender, (result, excp) => {
|
||||
// The app may have updated or removed the notification
|
||||
ndata = this._notifications[id];
|
||||
if (!ndata)
|
||||
@ -300,16 +299,16 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
source = this._getSource(appName, pid, ndata, sender, null);
|
||||
|
||||
this._senderToPid[sender] = pid;
|
||||
source.connect('destroy', Lang.bind(this, function() {
|
||||
source.connect('destroy', () => {
|
||||
delete this._senderToPid[sender];
|
||||
}));
|
||||
});
|
||||
this._notifyForSource(source, ndata);
|
||||
}));
|
||||
});
|
||||
|
||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||
},
|
||||
|
||||
_notifyForSource: function(source, ndata) {
|
||||
_notifyForSource(source, ndata) {
|
||||
let [id, icon, summary, body, actions, hints, notification] =
|
||||
[ndata.id, ndata.icon, ndata.summary, ndata.body,
|
||||
ndata.actions, ndata.hints, ndata.notification];
|
||||
@ -317,23 +316,22 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
if (notification == null) {
|
||||
notification = new MessageTray.Notification(source);
|
||||
ndata.notification = notification;
|
||||
notification.connect('destroy', Lang.bind(this,
|
||||
function(n, reason) {
|
||||
delete this._notifications[ndata.id];
|
||||
let notificationClosedReason;
|
||||
switch (reason) {
|
||||
case MessageTray.NotificationDestroyedReason.EXPIRED:
|
||||
notificationClosedReason = NotificationClosedReason.EXPIRED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.DISMISSED:
|
||||
notificationClosedReason = NotificationClosedReason.DISMISSED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
|
||||
notificationClosedReason = NotificationClosedReason.APP_CLOSED;
|
||||
break;
|
||||
}
|
||||
this._emitNotificationClosed(ndata.id, notificationClosedReason);
|
||||
}));
|
||||
notification.connect('destroy', (n, reason) => {
|
||||
delete this._notifications[ndata.id];
|
||||
let notificationClosedReason;
|
||||
switch (reason) {
|
||||
case MessageTray.NotificationDestroyedReason.EXPIRED:
|
||||
notificationClosedReason = NotificationClosedReason.EXPIRED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.DISMISSED:
|
||||
notificationClosedReason = NotificationClosedReason.DISMISSED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
|
||||
notificationClosedReason = NotificationClosedReason.APP_CLOSED;
|
||||
break;
|
||||
}
|
||||
this._emitNotificationClosed(ndata.id, notificationClosedReason);
|
||||
});
|
||||
}
|
||||
|
||||
let gicon = this._iconForNotificationData(icon, hints);
|
||||
@ -365,20 +363,20 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
if (actionId == 'default')
|
||||
hasDefaultAction = true;
|
||||
else
|
||||
notification.addAction(label, Lang.bind(this, function() {
|
||||
notification.addAction(label, () => {
|
||||
this._emitActionInvoked(ndata.id, actionId);
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDefaultAction) {
|
||||
notification.connect('activated', Lang.bind(this, function() {
|
||||
notification.connect('activated', () => {
|
||||
this._emitActionInvoked(ndata.id, 'default');
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
notification.connect('activated', Lang.bind(this, function() {
|
||||
notification.connect('activated', () => {
|
||||
source.open();
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
switch (hints.urgency) {
|
||||
@ -401,7 +399,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
source.processNotification(notification, sourceGIcon);
|
||||
},
|
||||
|
||||
CloseNotification: function(id) {
|
||||
CloseNotification(id) {
|
||||
let ndata = this._notifications[id];
|
||||
if (ndata) {
|
||||
if (ndata.notification)
|
||||
@ -410,7 +408,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
GetCapabilities: function() {
|
||||
GetCapabilities() {
|
||||
return [
|
||||
'actions',
|
||||
// 'action-icons',
|
||||
@ -425,7 +423,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
];
|
||||
},
|
||||
|
||||
GetServerInformation: function() {
|
||||
GetServerInformation() {
|
||||
return [
|
||||
Config.PACKAGE_NAME,
|
||||
'GNOME',
|
||||
@ -434,7 +432,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
];
|
||||
},
|
||||
|
||||
_onFocusAppChanged: function() {
|
||||
_onFocusAppChanged() {
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
if (!tracker.focus_app)
|
||||
return;
|
||||
@ -448,12 +446,12 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_emitNotificationClosed: function(id, reason) {
|
||||
_emitNotificationClosed(id, reason) {
|
||||
this._dbusImpl.emit_signal('NotificationClosed',
|
||||
GLib.Variant.new('(uu)', [id, reason]));
|
||||
},
|
||||
|
||||
_emitActionInvoked: function(id, action) {
|
||||
_emitActionInvoked(id, action) {
|
||||
this._dbusImpl.emit_signal('ActionInvoked',
|
||||
GLib.Variant.new('(us)', [id, action]));
|
||||
}
|
||||
@ -463,7 +461,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
Name: 'FdoNotificationDaemonSource',
|
||||
Extends: MessageTray.Source,
|
||||
|
||||
_init: function(title, pid, sender, appId) {
|
||||
_init(title, pid, sender, appId) {
|
||||
// Need to set the app before chaining up, so
|
||||
// methods called from the parent constructor can find it
|
||||
this.pid = pid;
|
||||
@ -482,12 +480,12 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
this._nameWatcherId = Gio.DBus.session.watch_name(sender,
|
||||
Gio.BusNameWatcherFlags.NONE,
|
||||
null,
|
||||
Lang.bind(this, this._onNameVanished));
|
||||
this._onNameVanished.bind(this));
|
||||
else
|
||||
this._nameWatcherId = 0;
|
||||
},
|
||||
|
||||
_createPolicy: function() {
|
||||
_createPolicy() {
|
||||
if (this.app && this.app.get_app_info()) {
|
||||
let id = this.app.get_id().replace(/\.desktop$/,'');
|
||||
return new MessageTray.NotificationApplicationPolicy(id);
|
||||
@ -496,7 +494,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onNameVanished: function() {
|
||||
_onNameVanished() {
|
||||
// Destroy the notification source when its sender is removed from DBus.
|
||||
// Only do so if this.app is set to avoid removing "notify-send" sources, senders
|
||||
// of which аre removed from DBus immediately.
|
||||
@ -506,7 +504,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
this.destroy();
|
||||
},
|
||||
|
||||
processNotification: function(notification, gicon) {
|
||||
processNotification(notification, gicon) {
|
||||
if (gicon)
|
||||
this._gicon = gicon;
|
||||
this.iconUpdated();
|
||||
@ -518,7 +516,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
this.notify(notification);
|
||||
},
|
||||
|
||||
_getApp: function(appId) {
|
||||
_getApp(appId) {
|
||||
let app;
|
||||
|
||||
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
|
||||
@ -534,7 +532,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
return null;
|
||||
},
|
||||
|
||||
setTitle: function(title) {
|
||||
setTitle(title) {
|
||||
// Do nothing if .app is set, we don't want to override the
|
||||
// app name with whatever is provided through libnotify (usually
|
||||
// garbage)
|
||||
@ -544,12 +542,12 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
this.parent(title);
|
||||
},
|
||||
|
||||
open: function() {
|
||||
open() {
|
||||
this.openApp();
|
||||
this.destroyNonResidentNotifications();
|
||||
},
|
||||
|
||||
openApp: function() {
|
||||
openApp() {
|
||||
if (this.app == null)
|
||||
return;
|
||||
|
||||
@ -558,7 +556,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
Main.panel.closeCalendar();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
if (this._nameWatcherId) {
|
||||
Gio.DBus.session.unwatch_name(this._nameWatcherId);
|
||||
this._nameWatcherId = 0;
|
||||
@ -567,7 +565,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
||||
this.parent();
|
||||
},
|
||||
|
||||
createIcon: function(size) {
|
||||
createIcon(size) {
|
||||
if (this.app) {
|
||||
return this.app.create_icon_texture(size);
|
||||
} else if (this._gicon) {
|
||||
@ -590,7 +588,7 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
||||
Name: 'GtkNotificationDaemonNotification',
|
||||
Extends: MessageTray.Notification,
|
||||
|
||||
_init: function(source, notification) {
|
||||
_init(source, notification) {
|
||||
this.parent(source);
|
||||
this._serialized = GLib.Variant.new('a{sv}', notification);
|
||||
|
||||
@ -615,10 +613,11 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
||||
}
|
||||
|
||||
if (buttons) {
|
||||
buttons.deep_unpack().forEach(Lang.bind(this, function(button) {
|
||||
this.addAction(button.label.unpack(),
|
||||
Lang.bind(this, this._onButtonClicked, button));
|
||||
}));
|
||||
buttons.deep_unpack().forEach(button => {
|
||||
this.addAction(button.label.unpack(), () => {
|
||||
this._onButtonClicked(button);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this._defaultAction = defaultAction ? defaultAction.unpack() : null;
|
||||
@ -629,7 +628,7 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
||||
datetime : time ? GLib.DateTime.new_from_unix_local(time.unpack()) : null });
|
||||
},
|
||||
|
||||
_activateAction: function(namespacedActionId, target) {
|
||||
_activateAction(namespacedActionId, target) {
|
||||
if (namespacedActionId) {
|
||||
if (namespacedActionId.startsWith('app.')) {
|
||||
let actionId = namespacedActionId.slice('app.'.length);
|
||||
@ -640,17 +639,17 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onButtonClicked: function(button) {
|
||||
_onButtonClicked(button) {
|
||||
let { 'action': action, 'target': actionTarget } = button;
|
||||
this._activateAction(action.unpack(), actionTarget);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
activate() {
|
||||
this._activateAction(this._defaultAction, this._defaultActionTarget);
|
||||
this.parent();
|
||||
},
|
||||
|
||||
serialize: function() {
|
||||
serialize() {
|
||||
return this._serialized;
|
||||
},
|
||||
});
|
||||
@ -684,7 +683,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
Name: 'GtkNotificationDaemonAppSource',
|
||||
Extends: MessageTray.Source,
|
||||
|
||||
_init: function(appId) {
|
||||
_init(appId) {
|
||||
this._appId = appId;
|
||||
this._objectPath = objectPathFromAppId(appId);
|
||||
if (!GLib.Variant.is_object_path(this._objectPath))
|
||||
@ -700,20 +699,20 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
this.parent(this._app.get_name());
|
||||
},
|
||||
|
||||
createIcon: function(size) {
|
||||
createIcon(size) {
|
||||
return this._app.create_icon_texture(size);
|
||||
},
|
||||
|
||||
_createPolicy: function() {
|
||||
_createPolicy() {
|
||||
return new MessageTray.NotificationApplicationPolicy(this._appId);
|
||||
},
|
||||
|
||||
_createApp: function(callback) {
|
||||
_createApp(callback) {
|
||||
return new FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath, callback);
|
||||
},
|
||||
|
||||
activateAction: function(actionId, target) {
|
||||
this._createApp(function (app, error) {
|
||||
activateAction(actionId, target) {
|
||||
this._createApp((app, error) => {
|
||||
if (error == null)
|
||||
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData());
|
||||
else
|
||||
@ -723,8 +722,8 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
Main.panel.closeCalendar();
|
||||
},
|
||||
|
||||
open: function() {
|
||||
this._createApp(function (app, error) {
|
||||
open() {
|
||||
this._createApp((app, error) => {
|
||||
if (error == null)
|
||||
app.ActivateRemote(getPlatformData());
|
||||
else
|
||||
@ -734,16 +733,16 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
Main.panel.closeCalendar();
|
||||
},
|
||||
|
||||
addNotification: function(notificationId, notificationParams, showBanner) {
|
||||
addNotification(notificationId, notificationParams, showBanner) {
|
||||
this._notificationPending = true;
|
||||
|
||||
if (this._notifications[notificationId])
|
||||
this._notifications[notificationId].destroy();
|
||||
|
||||
let notification = new GtkNotificationDaemonNotification(this, notificationParams);
|
||||
notification.connect('destroy', Lang.bind(this, function() {
|
||||
notification.connect('destroy', () => {
|
||||
delete this._notifications[notificationId];
|
||||
}));
|
||||
});
|
||||
this._notifications[notificationId] = notification;
|
||||
|
||||
if (showBanner)
|
||||
@ -754,18 +753,18 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
this._notificationPending = false;
|
||||
},
|
||||
|
||||
destroy: function(reason) {
|
||||
destroy(reason) {
|
||||
if (this._notificationPending)
|
||||
return;
|
||||
this.parent(reason);
|
||||
},
|
||||
|
||||
removeNotification: function(notificationId) {
|
||||
removeNotification(notificationId) {
|
||||
if (this._notifications[notificationId])
|
||||
this._notifications[notificationId].destroy(MessageTray.NotificationDestroyedReason.SOURCE_CLOSED);
|
||||
},
|
||||
|
||||
serialize: function() {
|
||||
serialize() {
|
||||
let notifications = [];
|
||||
for (let notificationId in this._notifications) {
|
||||
let notification = this._notifications[notificationId];
|
||||
@ -792,7 +791,7 @@ const GtkNotificationsIface = '<node> \
|
||||
var GtkNotificationDaemon = new Lang.Class({
|
||||
Name: 'GtkNotificationDaemon',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._sources = {};
|
||||
|
||||
this._loadNotifications();
|
||||
@ -803,29 +802,29 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
Gio.DBus.session.own_name('org.gtk.Notifications', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||
},
|
||||
|
||||
_ensureAppSource: function(appId) {
|
||||
_ensureAppSource(appId) {
|
||||
if (this._sources[appId])
|
||||
return this._sources[appId];
|
||||
|
||||
let source = new GtkNotificationDaemonAppSource(appId);
|
||||
|
||||
source.connect('destroy', Lang.bind(this, function() {
|
||||
source.connect('destroy', () => {
|
||||
delete this._sources[appId];
|
||||
this._saveNotifications();
|
||||
}));
|
||||
source.connect('count-updated', Lang.bind(this, this._saveNotifications));
|
||||
});
|
||||
source.connect('count-updated', this._saveNotifications.bind(this));
|
||||
Main.messageTray.add(source);
|
||||
this._sources[appId] = source;
|
||||
return source;
|
||||
},
|
||||
|
||||
_loadNotifications: function() {
|
||||
_loadNotifications() {
|
||||
this._isLoading = true;
|
||||
|
||||
let value = global.get_persistent_state('a(sa(sv))', 'notifications');
|
||||
if (value) {
|
||||
let sources = value.deep_unpack();
|
||||
sources.forEach(Lang.bind(this, function([appId, notifications]) {
|
||||
sources.forEach(([appId, notifications]) => {
|
||||
if (notifications.length == 0)
|
||||
return;
|
||||
|
||||
@ -836,16 +835,16 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
notifications.forEach(function([notificationId, notification]) {
|
||||
notifications.forEach(([notificationId, notification]) => {
|
||||
source.addNotification(notificationId, notification.deep_unpack(), false);
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
this._isLoading = false;
|
||||
},
|
||||
|
||||
_saveNotifications: function() {
|
||||
_saveNotifications() {
|
||||
if (this._isLoading)
|
||||
return;
|
||||
|
||||
@ -858,7 +857,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
global.set_persistent_state('notifications', new GLib.Variant('a(sa(sv))', sources));
|
||||
},
|
||||
|
||||
AddNotificationAsync: function(params, invocation) {
|
||||
AddNotificationAsync(params, invocation) {
|
||||
let [appId, notificationId, notification] = params;
|
||||
|
||||
let source;
|
||||
@ -877,7 +876,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
invocation.return_value(null);
|
||||
},
|
||||
|
||||
RemoveNotificationAsync: function(params, invocation) {
|
||||
RemoveNotificationAsync(params, invocation) {
|
||||
let [appId, notificationId] = params;
|
||||
let source = this._sources[appId];
|
||||
if (source)
|
||||
@ -890,7 +889,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
var NotificationDaemon = new Lang.Class({
|
||||
Name: 'NotificationDaemon',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._fdoNotificationDaemon = new FdoNotificationDaemon();
|
||||
this._gtkNotificationDaemon = new GtkNotificationDaemon();
|
||||
},
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user