Compare commits
471 Commits
wip/exalm/
...
3.37.2
Author | SHA1 | Date | |
---|---|---|---|
35d21c0bca | |||
b487846c0a | |||
7bbce1d5ad | |||
bf40d96a83 | |||
2d650e51a5 | |||
85d2837466 | |||
25985868e8 | |||
393c6c6805 | |||
775d6ec431 | |||
988f996407 | |||
315c8820ca | |||
8a89de04a2 | |||
63abfc163d | |||
f58cb34065 | |||
ece1329145 | |||
989118981b | |||
c511c469fe | |||
dac05c7e53 | |||
c90e7ce258 | |||
963f96292d | |||
989ee6593b | |||
2a8eea1ff5 | |||
55c287280b | |||
1fdd4ff313 | |||
3522338b3d | |||
61e3349dc7 | |||
dc27db0897 | |||
f09fbb19cf | |||
846fa77b37 | |||
b57bcf823f | |||
548e19a7cd | |||
4ae04d5aa8 | |||
5d5ca80d17 | |||
d81237b9d6 | |||
71b3b03b2f | |||
8c909e37e9 | |||
6508fa4349 | |||
ce8fb83c36 | |||
58ec607818 | |||
f06223df48 | |||
9a8ced9f5b | |||
67c45e5648 | |||
b88ed3f251 | |||
669b0f193a | |||
9cad7ae975 | |||
48e6a58250 | |||
d2583aa47b | |||
0ab34fe21f | |||
0f947d4ff9 | |||
9dc421875b | |||
9c3c9a155e | |||
faaed642a7 | |||
9b99b67fea | |||
693dd79d28 | |||
400d045a6a | |||
e20cf1ac78 | |||
8d4e650a95 | |||
82fd68b985 | |||
6ddd43f361 | |||
4e2ae30a47 | |||
32bc064d10 | |||
87606c6a6b | |||
955afb8711 | |||
3309031fd1 | |||
a2235c269a | |||
1cf2c9edd0 | |||
64a3ecf9b1 | |||
f144ed6e87 | |||
a47e0f9845 | |||
0737c8f416 | |||
fba350eaad | |||
6d5e93b00b | |||
f526e592fe | |||
751a94ab5d | |||
e0e128e207 | |||
137e6c8493 | |||
72751c2d92 | |||
b84fa852f6 | |||
d20961f323 | |||
5a01395a2b | |||
e59ca7053b | |||
6895592a7b | |||
eed27a2a4c | |||
43c6afa80f | |||
7d60f418e7 | |||
94dca1606f | |||
27774582b6 | |||
7dc08b06b1 | |||
a9d73b1017 | |||
25e4d0ba8b | |||
2d56395921 | |||
0ecddafc20 | |||
af34c8d2f4 | |||
5223599145 | |||
c96af776d6 | |||
34da48453e | |||
13dcd78be1 | |||
3bfa9916da | |||
b17017679b | |||
9d7832ea44 | |||
49605c7b00 | |||
bf8b9cecf5 | |||
c291291304 | |||
e08a4acd06 | |||
0397a104ba | |||
a41c1d4fda | |||
8ae3ed907a | |||
31cd8f738c | |||
a4cd9e0038 | |||
e06109c23c | |||
05485fe04c | |||
13062af7ef | |||
5e254666b0 | |||
d29eb8646a | |||
f1af37f220 | |||
d3880c0bff | |||
4dfa39457e | |||
325ff73c5b | |||
1fa4e3b1b2 | |||
f89091d0f0 | |||
859927df39 | |||
e7512fcd79 | |||
2b70151794 | |||
153b7d525d | |||
2e80995f19 | |||
9232cbf8a7 | |||
55f74bb863 | |||
b02e3719b3 | |||
3ba4304da9 | |||
49d6db34b7 | |||
63a0e521fd | |||
c00d79bae2 | |||
30d902f898 | |||
8f9da6f801 | |||
20648e9207 | |||
614fe202e0 | |||
c3646a7642 | |||
772df91762 | |||
c90910731f | |||
ba69cd99d1 | |||
fb6e341efd | |||
3dc4f01113 | |||
d94d0f60c8 | |||
8d79f6f4c8 | |||
c5e5bb0be1 | |||
8d139bbd95 | |||
fb1bb291eb | |||
3199620a83 | |||
c88bb66369 | |||
a60d57ea1f | |||
527ce66cd4 | |||
40415a6849 | |||
1ff638a51f | |||
2a9ccf2e2c | |||
2909d91c13 | |||
0dba12193d | |||
02f40b3b63 | |||
1fd51efc7f | |||
6f881f232e | |||
be12c71534 | |||
6aa1b817c9 | |||
300961e19e | |||
b191e9ef91 | |||
5ec5978d4a | |||
f4d90bc127 | |||
bfa34914db | |||
8d1e4659d1 | |||
b3b91f1699 | |||
ff4c5270d3 | |||
e240f7ea59 | |||
9f1ad5d86d | |||
a1ab32af0f | |||
3fac0632a8 | |||
c2b518929d | |||
c422d82752 | |||
da0c7fc2b6 | |||
167bc080d9 | |||
7d7a15f978 | |||
1b5cf0b8a8 | |||
306b005943 | |||
d229abf07d | |||
6f6251c0bc | |||
fd034e3551 | |||
f9bee05d49 | |||
37c6fbc6b2 | |||
9719604b79 | |||
b6262f0666 | |||
6c0bd207e9 | |||
91b13effc8 | |||
143ab6ac7f | |||
3e5b90dbba | |||
b82039e324 | |||
83862d04a0 | |||
52d07f6d9b | |||
21de88c3ba | |||
456ca3d3e0 | |||
f4ba3e4ab8 | |||
d4db5a59c1 | |||
4aee87a31b | |||
e8f5a842b1 | |||
5c681a76b6 | |||
53a24e6ddd | |||
b27c89f836 | |||
9f870aa1c7 | |||
c9cfeb8318 | |||
497e66ce6a | |||
bc973b80d7 | |||
85846d88f0 | |||
6b7c85b079 | |||
d80ef67d1d | |||
62f3457a95 | |||
636ab4b0e9 | |||
23e382dd33 | |||
f5a170ce46 | |||
fbd6beea2c | |||
360f5b1642 | |||
f0a785df9d | |||
e2c1bfbedd | |||
7e5a1cfd90 | |||
07deda593a | |||
1ca39e8586 | |||
402fd8ec29 | |||
fbe2e30f38 | |||
fb6ead2881 | |||
7ff7fb5d3b | |||
8030d9ad32 | |||
45bc850715 | |||
51a913730e | |||
0a4974ac8c | |||
1666fa195d | |||
a9df4e7516 | |||
343b3351f1 | |||
407b12c3cb | |||
455a8f3076 | |||
5067bda61a | |||
e138b6e3af | |||
9bc9d5165f | |||
26c2cb9f65 | |||
da44649e6f | |||
a0def23940 | |||
f49b58cf97 | |||
cadd9a99c0 | |||
7061889a29 | |||
764527c8c9 | |||
18742fcc32 | |||
5c33fe4a0a | |||
4f427f4e0d | |||
6d3c740b37 | |||
34c4627db9 | |||
b08b125df6 | |||
50301bcfd4 | |||
c2cacc63ee | |||
c226081a23 | |||
16f4e4dc4c | |||
308b58175f | |||
454e3fd39a | |||
e4d72fb2b0 | |||
f3fcc4adb7 | |||
867587ef4c | |||
b68fb35783 | |||
8dfed7e762 | |||
97fe4f761a | |||
ba8210ea98 | |||
656168543f | |||
8378c9c9e0 | |||
de16fe8dff | |||
793f053309 | |||
bea34da289 | |||
aafec16f49 | |||
73df61f36d | |||
39e6375aff | |||
ed21a4e5c1 | |||
73472ba6a7 | |||
702417ce83 | |||
766e9034e2 | |||
91748aedb7 | |||
4783d767d6 | |||
dedbf0cb09 | |||
e5b7462b94 | |||
48b0a91385 | |||
6170bea283 | |||
dcceb615bf | |||
da673639ca | |||
dd7727e315 | |||
f3ba1e65ba | |||
f8b4696211 | |||
d71d85e90c | |||
660a2b6e62 | |||
cc347bf6d8 | |||
26ffeaae47 | |||
01a57206bc | |||
279072795f | |||
c89d6a633a | |||
fecc0c06ac | |||
512862f2d7 | |||
a90fcb7ddb | |||
6baf490aab | |||
f971b8426d | |||
83c6b2ab48 | |||
24742f3566 | |||
03a46be5c7 | |||
9a26b970f9 | |||
2ef71b62df | |||
766288eec1 | |||
53e8285cf0 | |||
ff844a2a81 | |||
78997cb7eb | |||
f52574bd28 | |||
e6a814fac8 | |||
ddb85c03c3 | |||
66c4b1a8b6 | |||
11daf14e80 | |||
35484151ce | |||
1bccbe7f11 | |||
b4162afa65 | |||
eb51942a05 | |||
23e5cd4e10 | |||
13f3f75303 | |||
3dd8ffc2bb | |||
541847d8b6 | |||
fb9854c003 | |||
c748b9de5c | |||
34e85342d8 | |||
91b7474d5a | |||
d76162c1c0 | |||
2b517e352d | |||
08203c9c1e | |||
d29e5765ba | |||
61beccf733 | |||
ffb8bd5fa7 | |||
7f6e2ff36b | |||
7d94bfa642 | |||
eb3c857f23 | |||
a096ed37d6 | |||
498a743c08 | |||
2c91b6164c | |||
04352ae158 | |||
5c5dc03b78 | |||
8a89e22e8e | |||
8f851e8adf | |||
49e4757c0b | |||
dc002a61eb | |||
bea3987f3e | |||
7cd37a4017 | |||
3d69fa8b9c | |||
3a52bfbc0f | |||
38c0f3bbf2 | |||
7b1533caf7 | |||
afd83d929e | |||
d9e8a525de | |||
b25142c517 | |||
6893fc3810 | |||
13ef33ae0a | |||
f8886468ce | |||
3bf0511f1b | |||
1b485427cf | |||
ebf04e3a95 | |||
2f78b8428b | |||
00eef6cd5d | |||
5c031200ce | |||
4340260c49 | |||
96e534796f | |||
3ee878491b | |||
b92ddc0d39 | |||
c8a4a91681 | |||
e572d5d08c | |||
9829d56bfa | |||
b30d999878 | |||
35b62baf6e | |||
39f61fc41c | |||
d3939a38a3 | |||
b97fc02e57 | |||
ea1adea24d | |||
eb7533bbf1 | |||
69ea038a8f | |||
b80115dc6e | |||
36b8dcbe07 | |||
07fa5ef849 | |||
d9a75412c3 | |||
66f9a9df81 | |||
4bfdd677e3 | |||
002160e524 | |||
f2df347ddb | |||
799bbdb503 | |||
1aff64a38b | |||
574c560677 | |||
f8db5aa106 | |||
b18469427e | |||
72c4f148ef | |||
94f6976ddd | |||
be187f4149 | |||
1b872c1195 | |||
89f2187d72 | |||
943df86cb0 | |||
a5a6c699c3 | |||
a0467bf875 | |||
b1da3ae772 | |||
8af466e34d | |||
66c7616892 | |||
c05098cd12 | |||
4723dd1f4c | |||
7e4c32ec1f | |||
3d443d5b17 | |||
3155d03d9e | |||
989c0ee49e | |||
69f6c43b60 | |||
bf2d012e40 | |||
4d773a5ce9 | |||
711d4ba65c | |||
4490463513 | |||
1ec5117715 | |||
bf367daaba | |||
1de008f2d5 | |||
4baa091bc5 | |||
cb7d1925ef | |||
3ddae9d815 | |||
e22421a25a | |||
09a1e61c63 | |||
7345a6f276 | |||
fda938175e | |||
3a39fb5ab8 | |||
1a0ec782b5 | |||
a96753f085 | |||
4ff94f80a0 | |||
e6d4581959 | |||
07bbcb1b48 | |||
f4ea9074d0 | |||
d4ee2e8bbf | |||
cf82d5ba85 | |||
5e04f6eb23 | |||
0dd171a7c8 | |||
837fbbf417 | |||
d7b61e7281 | |||
073da0806c | |||
ff54b0d35e | |||
ff2a736193 | |||
c6cf81f28b | |||
104d1ae151 | |||
12e14884ef | |||
3c4a5a67e2 | |||
e4f9efc134 | |||
bd665df321 | |||
bd197789c1 | |||
daff787a62 | |||
ff1343611f | |||
da05c85f3c | |||
648179a2db | |||
a5ad81d923 | |||
abfa61abc5 | |||
abdfaeb444 | |||
06b690ff21 | |||
d0226c7897 | |||
19e084036a | |||
a7d974e670 | |||
7a0c866d97 | |||
cc3f439323 | |||
51b7eb7a2b | |||
023859ee4b | |||
09acd0a3db | |||
bf213af362 | |||
bfb0bc7a29 | |||
c00f1d040b | |||
ba7cfff90c | |||
548c41d164 | |||
172d21cf50 | |||
5c8f3a65f7 | |||
07369125b6 | |||
59cae58f25 | |||
e07b9a75b5 | |||
19fc7c4d31 | |||
d66f5ab3c6 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -60,7 +60,6 @@ src/calendar-server/evolution-calendar.desktop
|
|||||||
src/calendar-server/org.gnome.Shell.CalendarServer.service
|
src/calendar-server/org.gnome.Shell.CalendarServer.service
|
||||||
src/gnome-shell
|
src/gnome-shell
|
||||||
src/gnome-shell-calendar-server
|
src/gnome-shell-calendar-server
|
||||||
src/gnome-shell-extension-prefs
|
|
||||||
src/gnome-shell-extension-tool
|
src/gnome-shell-extension-tool
|
||||||
src/gnome-shell-hotplug-sniffer
|
src/gnome-shell-hotplug-sniffer
|
||||||
src/gnome-shell-perf-helper
|
src/gnome-shell-perf-helper
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
|
include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- review
|
- review
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- deploy
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
BUNDLE: "extensions-git.flatpak"
|
||||||
JS_LOG: "js-report.txt"
|
JS_LOG: "js-report.txt"
|
||||||
POT_LOG: "pot-update.txt"
|
POT_LOG: "pot-update.txt"
|
||||||
|
|
||||||
@ -14,7 +18,7 @@ variables:
|
|||||||
- merge_requests
|
- merge_requests
|
||||||
|
|
||||||
check_commit_log:
|
check_commit_log:
|
||||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||||
stage: review
|
stage: review
|
||||||
variables:
|
variables:
|
||||||
GIT_DEPTH: "100"
|
GIT_DEPTH: "100"
|
||||||
@ -24,10 +28,10 @@ check_commit_log:
|
|||||||
- merge_requests
|
- merge_requests
|
||||||
|
|
||||||
js_check:
|
js_check:
|
||||||
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1
|
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
|
||||||
stage: review
|
stage: review
|
||||||
script:
|
script:
|
||||||
- find js -name '*.js' -exec js60 -c -s '{}' ';' 2>&1 | tee $JS_LOG
|
- find js -name '*.js' -exec js68 -c -s '{}' ';' 2>&1 | tee $JS_LOG
|
||||||
- (! grep -q . $JS_LOG)
|
- (! grep -q . $JS_LOG)
|
||||||
<<: *only_default
|
<<: *only_default
|
||||||
artifacts:
|
artifacts:
|
||||||
@ -36,7 +40,7 @@ js_check:
|
|||||||
when: on_failure
|
when: on_failure
|
||||||
|
|
||||||
eslint:
|
eslint:
|
||||||
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1
|
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
|
||||||
stage: review
|
stage: review
|
||||||
script:
|
script:
|
||||||
- ./.gitlab-ci/run-eslint.sh
|
- ./.gitlab-ci/run-eslint.sh
|
||||||
@ -46,8 +50,22 @@ eslint:
|
|||||||
- reports
|
- reports
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
|
potfile_check:
|
||||||
|
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
|
||||||
|
stage: review
|
||||||
|
script:
|
||||||
|
- ./.gitlab-ci/check-potfiles.sh
|
||||||
|
<<: *only_default
|
||||||
|
|
||||||
|
no_template_check:
|
||||||
|
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
|
||||||
|
stage: review
|
||||||
|
script:
|
||||||
|
- ./.gitlab-ci/check-template-strings.sh
|
||||||
|
<<: *only_default
|
||||||
|
|
||||||
build:
|
build:
|
||||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||||
stage: build
|
stage: build
|
||||||
before_script:
|
before_script:
|
||||||
- .gitlab-ci/checkout-mutter.sh
|
- .gitlab-ci/checkout-mutter.sh
|
||||||
@ -65,7 +83,7 @@ build:
|
|||||||
- build
|
- build
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||||
stage: test
|
stage: test
|
||||||
variables:
|
variables:
|
||||||
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
||||||
@ -82,7 +100,7 @@ test:
|
|||||||
when: on_failure
|
when: on_failure
|
||||||
|
|
||||||
test-pot:
|
test-pot:
|
||||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||||
stage: test
|
stage: test
|
||||||
before_script:
|
before_script:
|
||||||
- ninja -C mutter/build install
|
- ninja -C mutter/build install
|
||||||
@ -96,3 +114,20 @@ test-pot:
|
|||||||
' | tee $POT_LOG
|
' | tee $POT_LOG
|
||||||
- (! grep -q . $POT_LOG)
|
- (! grep -q . $POT_LOG)
|
||||||
<<: *only_default
|
<<: *only_default
|
||||||
|
|
||||||
|
flatpak:
|
||||||
|
stage: build
|
||||||
|
variables:
|
||||||
|
SUBPROJECT: "subprojects/extensions-app"
|
||||||
|
# Your manifest path
|
||||||
|
MANIFEST_PATH: "$SUBPROJECT/build-aux/flatpak/org.gnome.Extensions.json"
|
||||||
|
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
|
||||||
|
FLATPAK_MODULE: "gnome-extensions-app"
|
||||||
|
APP_ID: "org.gnome.Extensions"
|
||||||
|
extends: .flatpak
|
||||||
|
<<: *only_default
|
||||||
|
|
||||||
|
nightly:
|
||||||
|
extends: '.publish_nightly'
|
||||||
|
variables:
|
||||||
|
BUNDLES: '$BUNDLE'
|
||||||
|
24
.gitlab-ci/Dockerfile
Normal file
24
.gitlab-ci/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Rebuild and push with
|
||||||
|
#
|
||||||
|
# cd .gitlab-ci/
|
||||||
|
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2 .
|
||||||
|
# podman push registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM registry.fedoraproject.org/fedora:32
|
||||||
|
|
||||||
|
RUN dnf -y update && dnf -y upgrade && \
|
||||||
|
dnf install -y 'dnf-command(copr)' git && \
|
||||||
|
|
||||||
|
# For syntax checks with `find . -name '*.js' -exec js68 -c -s '{}' ';'`
|
||||||
|
dnf install -y findutils mozjs68-devel && \
|
||||||
|
|
||||||
|
# For static analysis with eslint
|
||||||
|
dnf install -y nodejs && \
|
||||||
|
npm install -g eslint && \
|
||||||
|
|
||||||
|
# Shameless plug for my own tooling; useful for generating zip
|
||||||
|
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
||||||
|
dnf install -y gnome-extensions-tool meson && \
|
||||||
|
|
||||||
|
dnf clean all
|
@ -1,18 +0,0 @@
|
|||||||
FROM registry.fedoraproject.org/fedora:latest
|
|
||||||
|
|
||||||
RUN dnf -y update && dnf -y upgrade && \
|
|
||||||
dnf install -y 'dnf-command(copr)' git && \
|
|
||||||
|
|
||||||
# For syntax checks with `find . -name '*.js' -exec js60 -c -s '{}' ';'`
|
|
||||||
dnf install -y findutils mozjs60-devel && \
|
|
||||||
|
|
||||||
# For static analysis with eslint
|
|
||||||
dnf install -y nodejs && \
|
|
||||||
npm install -g eslint && \
|
|
||||||
|
|
||||||
# Shameless plug for my own tooling; useful for generating zip
|
|
||||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
|
||||||
dnf install -y gnome-extensions-tool meson && \
|
|
||||||
|
|
||||||
dnf clean all && \
|
|
||||||
rm -rf /var/cache/dnf
|
|
31
.gitlab-ci/check-potfiles.sh
Executable file
31
.gitlab-ci/check-potfiles.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
srcdirs="js src subprojects/extensions-tool"
|
||||||
|
globs=('*.js' '*.c')
|
||||||
|
|
||||||
|
# find source files that contain gettext keywords
|
||||||
|
files=$(grep -lR ${globs[@]/#/--include=} '\(gettext\|[^I_)]_\)(' $srcdirs)
|
||||||
|
|
||||||
|
# filter out excluded files
|
||||||
|
if [ -f po/POTFILES.skip ]; then
|
||||||
|
files=$(for f in $files; do ! grep -q ^$f po/POTFILES.skip && echo $f; done)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# find those that aren't listed in POTFILES.in
|
||||||
|
missing=$(for f in $files; do ! grep -q ^$f po/POTFILES.in && echo $f; done)
|
||||||
|
|
||||||
|
if [ ${#missing} -eq 0 ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >&2 <<EOT
|
||||||
|
|
||||||
|
The following files are missing from po/POTFILES.po:
|
||||||
|
|
||||||
|
EOT
|
||||||
|
for f in $missing; do
|
||||||
|
echo " $f" >&2
|
||||||
|
done
|
||||||
|
echo >&2
|
||||||
|
|
||||||
|
exit 1
|
23
.gitlab-ci/check-template-strings.sh
Executable file
23
.gitlab-ci/check-template-strings.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# find files from POTFILES.in that use js template strings
|
||||||
|
baddies=$(grep -l '${' $(grep ^js po/POTFILES.in))
|
||||||
|
|
||||||
|
if [ ${#baddies} -eq 0 ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >&2 <<EOT
|
||||||
|
|
||||||
|
xgettext cannot handle template strings properly, so we ban their use
|
||||||
|
in files with translatable strings.
|
||||||
|
|
||||||
|
The following files are listed in po/POTFILES.in and use template strings:
|
||||||
|
|
||||||
|
EOT
|
||||||
|
for f in $baddies; do
|
||||||
|
echo " $f" >&2
|
||||||
|
done
|
||||||
|
echo >&2
|
||||||
|
|
||||||
|
exit 1
|
@ -18,12 +18,14 @@ run_eslint() {
|
|||||||
local extra_args=ARGS_$1
|
local extra_args=ARGS_$1
|
||||||
local output_var=OUTPUT_$1
|
local output_var=OUTPUT_$1
|
||||||
local output=${!output_var}
|
local output=${!output_var}
|
||||||
|
local cache=.eslintcache-${1,,}
|
||||||
|
|
||||||
# ensure output exists even if eslint doesn't report any errors
|
# ensure output exists even if eslint doesn't report any errors
|
||||||
mkdir -p $(dirname $output)
|
mkdir -p $(dirname $output)
|
||||||
touch $output
|
touch $output
|
||||||
|
|
||||||
eslint -f unix ${!extra_args} -o $output js
|
eslint -f unix --cache --cache-location $cache ${!extra_args} -o $output \
|
||||||
|
js subprojects/extensions-app/js
|
||||||
}
|
}
|
||||||
|
|
||||||
list_commit_range_additions() {
|
list_commit_range_additions() {
|
||||||
|
152
NEWS
152
NEWS
@ -1,3 +1,155 @@
|
|||||||
|
3.37.2
|
||||||
|
======
|
||||||
|
* Add support for "PrefersNonDefaultGPU" desktop key [Bastien; !1226]
|
||||||
|
* Only start systemd units when running under systemd
|
||||||
|
[Carlos, Florian; #2755, !1242, !1252]
|
||||||
|
* Fix "ghost" media controls [Bryan; #2776]
|
||||||
|
* Fix zombie sockets from extensions downloader [Michael; #2774]
|
||||||
|
* Update world clocks offsets when timezone changes [Bryan; #2209]
|
||||||
|
* Support scrolling anywhere in slider menu items [Peter; #2795]
|
||||||
|
* Fix "Do Not Disturb" setting getting reset on startup [Florian; #2804]
|
||||||
|
* Only allow updates for extensions that aren't cached [Florian; !1248]
|
||||||
|
* Fix matching notifications by PID [Florian; #2592]
|
||||||
|
* Indicate extension errors in Extensions app [Florian; #2337]
|
||||||
|
* Add clipboard API for querying supported mimetypes [Andy; #2819]
|
||||||
|
* Add preview to color picker [Florian; #451]
|
||||||
|
* Improve world clocks styling [PrOF-kk; #2825]
|
||||||
|
* Remove Frequent view from app picker [Georges; !880]
|
||||||
|
* Fix pad OSD glitches [Carlos; !1290]
|
||||||
|
* Expose actor tree in looking glass [Georges; !1292]
|
||||||
|
* Fixed crashes [Jonas D., Florian; #2709, #2757]
|
||||||
|
* Misc. bug fixes and cleanups [Florian, AsciiWolf, Michael, Piotr, Ting-Wei,
|
||||||
|
Amr, Alexander, Bryan, Georges, Jonas D., Andy, Björn, Koki, Carlos; !1229,
|
||||||
|
!1231, !1233, !1235, #2578, #2735, #2751, #2602, #2777, !1249, #2796, !1268,
|
||||||
|
!1269, !1265, !1245, !1273, #2816, !1274, !1263, !1188, !1276, #2652, !1277,
|
||||||
|
!1281, #2286, !1267, !1286, !1279, !1288, !1293, !1294, !1291]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
AsciiWolf, Michael Catanzaro, Björn Daase, Jonas Dreßler, Bryan Dunsmore,
|
||||||
|
Koki Fukuda, Carlos Garnacho, Andy Holmes, Amr Ibrahim, Soslan Khubulov,
|
||||||
|
Ting-Wei Lan, Michael Lass, Alexander Mikhaylenko, Florian Müllner,
|
||||||
|
Georges Basile Stavracas Neto, Bastien Nocera, PrOF-kk, Peter Simonyi
|
||||||
|
|
||||||
|
Translators:
|
||||||
|
Fabio Tomat [fur], Cheng-Chia Tseng [zh_TW], Yuri Chornoivan [uk],
|
||||||
|
Dušan Kazik [sk], Piotr Drąg [pl], Soslan Khubulov [os],
|
||||||
|
Daniel Mustieles [es], Nathan Follens [nl], Bruce Cowan [en_GB],
|
||||||
|
Florentina Mușat [ro], Milo Casagrande [it], Anders Jonsson [sv],
|
||||||
|
Charles Monzat [fr], Danial Behzadi [fa], sicklylife [ja], Kukuh Syafaat [id],
|
||||||
|
Jordi Mas [ca], Emin Tufan Çetin [tr], Jiri Grönroos [fi], Марко Костић [sr],
|
||||||
|
Christian Kirbach [de], Changwoo Ryu [ko], Matej Urbančič [sl]
|
||||||
|
|
||||||
|
3.37.1
|
||||||
|
======
|
||||||
|
* Improve bluetooth submenu title [Mariana; #2340]
|
||||||
|
* Add openPrefs() convenience method for extensions [Florian; !1163]
|
||||||
|
* Bring back support for empty StIcons [Andre, Jonas D.; !1173, !1178]
|
||||||
|
* Wake up screen when unlocking programmatically [Florian; !1158]
|
||||||
|
* Improve extensions tool error reporting [Florian; #2391]
|
||||||
|
* Improve handling of scale-factor changes [Georges; !1176]
|
||||||
|
* Tone down weekend days with events in calendar [Jakub; #2588]
|
||||||
|
* Fix showing bluetooth submenu when devices were set up [Florian; !1174]
|
||||||
|
* Add support for parental controls filtering [Philip W.; !465]
|
||||||
|
* Provide alternative extension templates [Florian; !812]
|
||||||
|
* Improve weather section's empty state [Mariana; #2179]
|
||||||
|
* Fix translations of folder names [Florian; #2623]
|
||||||
|
* Drop Tweener [Jonas Å.; !1200]
|
||||||
|
* Match ASCII alternatives of system actions [Will; #2688]
|
||||||
|
* Fix delay on lock screen after entering wrong password [Jonas D.; #2655]
|
||||||
|
* Use globalThis instead of window [Andy; #2322]
|
||||||
|
* Inhibit remote access when disabled by session mode [Jonas Å.; !1210]
|
||||||
|
* Improve calendar-server performance [Milan; #1875]
|
||||||
|
* Add gnome-shell-extension-prefs wrapper for compatibility [Florian; !1220]
|
||||||
|
* Fix stuck lock screen after unlock [Jonas D., Florian; #2446]
|
||||||
|
* Fixed crashes [Jonas D., Florian, Carlos; #2584, #2625, !1223, !1218]
|
||||||
|
* Misc. bug fixes and cleanups [Florian, Jonas Å., Marco, Andre, Georges,
|
||||||
|
Jonas D., Jan, Philip Ch.,, Xiaoguang, Will, Jordan, Matthew, qarmin;
|
||||||
|
!1126, !1155, !1156, !1165, !1168, !1169, #2551, #2563, !1172, !1175, !1179,
|
||||||
|
!1160, #2562, #2578, !1184, #2559, !1186, #2607, !1191, !1194, !1199, !1203,
|
||||||
|
#2649, #2628, !1205, !1206, !1208, !1207, !1211, !1214, !1213, !1192, !1217,
|
||||||
|
!1219, #1615, #2691, !1094, !1177]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Marco Trevisan (Treviño), Philip Chimento, Milan Crha, Jonas Dreßler,
|
||||||
|
Carlos Garnacho, Andy Holmes, Matthew Leeds, Andre Moreira Magalhaes,
|
||||||
|
Florian Müllner, Georges Basile Stavracas Neto, Jordan Petridis,
|
||||||
|
Mariana Picolo, Jakub Steiner, Will Thompson, Jan Tojnar, Xiaoguang Wang,
|
||||||
|
Philip Withnall, qarmin, Jonas Ådahl
|
||||||
|
|
||||||
|
Translators:
|
||||||
|
Fabio Tomat [fur], Cheng-Chia Tseng [zh_TW], Danial Behzadi [fa],
|
||||||
|
Jiri Grönroos [fi], Ibai Oihanguren Sala [eu], Марко Костић [sr],
|
||||||
|
Rūdolfs Mazurs [lv], Yuri Chornoivan [uk], Carmen Bianca BAKKER [eo],
|
||||||
|
Dingzhong Chen [zh_CN], Rafael Fontenelle [pt_BR], Petr Kovář [cs],
|
||||||
|
Asier Sarasua Garmendia [eu], Daniel Mustieles [es], Emin Tufan Çetin [tr]
|
||||||
|
|
||||||
|
3.36.0
|
||||||
|
======
|
||||||
|
* Fix off-by-1900 error in date conversions [Florian; !1061]
|
||||||
|
* Fix crash on startup with topIcons* extension enabled [Florian; #2308]
|
||||||
|
* Don't require gsd-xsettings for X11 support on wayland [Olivier; !1065]
|
||||||
|
* Fix ibus support in Xorg session [Carlos; #1690]
|
||||||
|
* Improve Extensions D-Bus API [Florian; !1074]
|
||||||
|
* Allow session modes to specify alternative resource name [Marco; !1063]
|
||||||
|
* Fix link to location settings in aggregate menu [Sebastian; #2316]
|
||||||
|
* Fix illegible app folder titles with light theme [ub; !1059]
|
||||||
|
* Really fix visual glitch in sliders [Jonas; #1569]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Marco Trevisan (Treviño), Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||||
|
Sebastian Keller, Florian Müllner, ub
|
||||||
|
|
||||||
|
Translators:
|
||||||
|
Aman Alam [pa], Goran Vidović [hr], Aurimas Černius [lt],
|
||||||
|
Milo Casagrande [it], Daniel Korostil [uk], sicklylife [ja],
|
||||||
|
Marek Černocký [cs], Nathan Follens [nl]
|
||||||
|
|
||||||
|
3.35.92
|
||||||
|
=======
|
||||||
|
* Plug a memory leak [Jonas D.; !1015]
|
||||||
|
* Fix missing "back" button on login screen [Florian; #2228]
|
||||||
|
* Fix width of window preview titles in overview [Jonas D.; #58]
|
||||||
|
* Fix looking glass text with light style variant [Feichtmeier; !1023]
|
||||||
|
* Center unlock entry [Florian; !1021]
|
||||||
|
* Hide overlay scrollbars in notification popup [Jonas D.; !1013]
|
||||||
|
* Work around add_actor() slowness in icon spring animation [Daniel; !1002]
|
||||||
|
* Add disable-animations heuristics [Jonas Å.; !757]
|
||||||
|
* Fix visual glitches in on-screen keyboard [Carlos; #2214]
|
||||||
|
* Fix clearing changed textures from cache [Florian; #2244]
|
||||||
|
* Fix visual glitch in sliders [Daniel; #1569]
|
||||||
|
* Stop using dedicated lock screen background [Florian; !1001]
|
||||||
|
* Fix entries disappearing after authentication errors [Florian; #2236]
|
||||||
|
* Fix crash when animations are disabled [Florian; #2255]
|
||||||
|
* Fix passing pointer events to clients when magnified [Jonas D.; !993]
|
||||||
|
* Fix keynav on new lock screen [Florian; #2210]
|
||||||
|
* Avoid short-lived allocations on actor removal [Christian; #2263]
|
||||||
|
* Fix super-sized default avatars in user list [Florian, Sam; #2242]
|
||||||
|
* Leave overview when locking the screen [Jonas D.; !1043]
|
||||||
|
* Hide message list on login screen [Florian; #2241]
|
||||||
|
* Avoid IO on the main thread [Christian, Florian; !1050, !1051]
|
||||||
|
* Fix window animations getting stuck when client doesn't respond [Jonas; !1055]
|
||||||
|
* Only subscribe to touchpad events for touchpad gestures [Daniel; !925]
|
||||||
|
* Start X11 session services before Xwayland clients [Carlos; !836, !1056]
|
||||||
|
* Only show switch-user button with unlock prompt [Florian; !1029]
|
||||||
|
* Misc. bug fixes and cleanups [Jonas D., Florian, Georges, Jonas Å., Daniel,
|
||||||
|
Jakub, Philippe; !1018, !1020, !1024, !1027, !1026, !1022, !1031, !1035,
|
||||||
|
!1032, !1025, !1039, #2157, !1037, !1042, !1047, !1048, #2270, !1046,
|
||||||
|
!167, !1016]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Jonas Dreßler, Feichtmeier, Carlos Garnacho, Christian Hergert, Sam Hewitt,
|
||||||
|
Florian Müllner, Georges Basile Stavracas Neto, Jakub Steiner, Philippe Troin,
|
||||||
|
Daniel van Vugt, Jonas Ådahl
|
||||||
|
|
||||||
|
Translators:
|
||||||
|
Danial Behzadi [fa], Efstathios Iosifidis [el], Daniel Mustieles [es],
|
||||||
|
Sabri Ünal [tr], sicklylife [ja], Piotr Drąg [pl], Jordi Mas [ca],
|
||||||
|
Anders Jonsson [sv], Chao-Hsiung Liao [zh_TW], Asier Sarasua Garmendia [eu],
|
||||||
|
Rafael Fontenelle [pt_BR], Марко Костић [sr], Changwoo Ryu [ko],
|
||||||
|
Charles Monzat [fr], Jiri Grönroos [fi], Jor Teron [mjw], Bruce Cowan [en_GB],
|
||||||
|
Emin Tufan Çetin [tr], Alan Mortensen [da], Balázs Úr [hu], Fran Dieguez [gl],
|
||||||
|
Kukuh Syafaat [id]
|
||||||
|
|
||||||
3.35.91
|
3.35.91
|
||||||
=======
|
=======
|
||||||
* Improve magnifier [Carlos; !984]
|
* Improve magnifier [Carlos; !984]
|
||||||
|
@ -161,12 +161,16 @@ def convert_file(source_file, destination_path):
|
|||||||
try:
|
try:
|
||||||
xkb_name = locale_to_xkb(root["locale"], root["name"])
|
xkb_name = locale_to_xkb(root["locale"], root["name"])
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
logging.warn(e)
|
logging.warning(e)
|
||||||
return False
|
return False
|
||||||
destination_file = os.path.join(destination_path, xkb_name + ".json")
|
destination_file = os.path.join(destination_path, xkb_name + ".json")
|
||||||
|
|
||||||
with open(destination_file, 'w', encoding="utf-8") as dest_fd:
|
try:
|
||||||
json.dump(root, dest_fd, ensure_ascii=False, indent=2, sort_keys=True)
|
with open(destination_file, 'x', encoding="utf-8") as dest_fd:
|
||||||
|
json.dump(root, dest_fd, ensure_ascii=False, indent=2, sort_keys=True)
|
||||||
|
except FileExistsError as e:
|
||||||
|
logging.info("File %s exists, not updating", destination_file)
|
||||||
|
return False
|
||||||
|
|
||||||
logging.debug("written %s", destination_file)
|
logging.debug("written %s", destination_file)
|
||||||
|
|
@ -1,12 +1,19 @@
|
|||||||
<node>
|
<node>
|
||||||
<interface name="org.gnome.Shell.CalendarServer">
|
<interface name="org.gnome.Shell.CalendarServer">
|
||||||
<method name="GetEvents">
|
<method name="SetTimeRange">
|
||||||
<arg type="x" direction="in" />
|
<arg type="x" name="since" direction="in"/>
|
||||||
<arg type="x" direction="in" />
|
<arg type="x" name="until" direction="in"/>
|
||||||
<arg type="b" direction="in" />
|
<arg type="b" name="force_reload" direction="in"/>
|
||||||
<arg type="a(sssbxxa{sv})" direction="out" />
|
|
||||||
</method>
|
</method>
|
||||||
|
<signal name="EventsAddedOrUpdated">
|
||||||
|
<arg type="a(ssbxxa{sv})" name="events" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="EventsRemoved">
|
||||||
|
<arg type="as" name="ids" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="ClientDisappeared">
|
||||||
|
<arg type="s" name="source_uid" direction="out"/>
|
||||||
|
</signal>
|
||||||
<property name="HasCalendars" type="b" access="read" />
|
<property name="HasCalendars" type="b" access="read" />
|
||||||
<signal name="Changed" />
|
|
||||||
</interface>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
@ -199,14 +199,37 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
LaunchExtensionPrefs:
|
LaunchExtensionPrefs:
|
||||||
@uuid: The UUID of the extension
|
Deprecated for OpenExtensionPrefs
|
||||||
|
|
||||||
Launch preferences of an extension.
|
|
||||||
-->
|
-->
|
||||||
<method name="LaunchExtensionPrefs">
|
<method name="LaunchExtensionPrefs">
|
||||||
<arg type="s" direction="in" name="uuid"/>
|
<arg type="s" direction="in" name="uuid"/>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
OpenExtensionPrefs:
|
||||||
|
@uuid: The UUID of the extension
|
||||||
|
@parent_window: Identifier for the application window
|
||||||
|
@options: Vardict with further options
|
||||||
|
|
||||||
|
Opens the prefs dialog of extension @uuid.
|
||||||
|
|
||||||
|
The following @options are recognized:
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term>modal b</term>
|
||||||
|
<listitem>
|
||||||
|
<para>Whether the prefs window should be modal, default: false</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
-->
|
||||||
|
<method name="OpenExtensionPrefs">
|
||||||
|
<arg type="s" direction="in" name="uuid"/>
|
||||||
|
<arg type="s" direction="in" name="parent_window"/>
|
||||||
|
<arg type="a{sv}" direction="in" name="options"/>
|
||||||
|
</method>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
CheckForUpdates:
|
CheckForUpdates:
|
||||||
Update all extensions for which updates are available
|
Update all extensions for which updates are available
|
||||||
@ -234,5 +257,11 @@
|
|||||||
-->
|
-->
|
||||||
<property name="ShellVersion" type="s" access="read"/>
|
<property name="ShellVersion" type="s" access="read"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
UserExtensionsEnabled:
|
||||||
|
Whether user extensions are enabled
|
||||||
|
-->
|
||||||
|
<property name="UserExtensionsEnabled" type="b" access="readwrite"/>
|
||||||
|
|
||||||
</interface>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/org/gnome/shell/dbus-interfaces">
|
<gresource prefix="/org/gnome/shell/dbus-interfaces">
|
||||||
<file preprocess="xml-stripblanks">net.hadess.SensorProxy.xml</file>
|
<file preprocess="xml-stripblanks">net.hadess.SensorProxy.xml</file>
|
||||||
<file preprocess="xml-stripblanks">net.hadess.SwitcherooControl.xml</file>
|
|
||||||
<file preprocess="xml-stripblanks">org.freedesktop.Application.xml</file>
|
<file preprocess="xml-stripblanks">org.freedesktop.Application.xml</file>
|
||||||
<file preprocess="xml-stripblanks">org.freedesktop.bolt1.Device.xml</file>
|
<file preprocess="xml-stripblanks">org.freedesktop.bolt1.Device.xml</file>
|
||||||
<file preprocess="xml-stripblanks">org.freedesktop.bolt1.Manager.xml</file>
|
<file preprocess="xml-stripblanks">org.freedesktop.bolt1.Manager.xml</file>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<file>checkbox-off-focused.svg</file>
|
<file>checkbox-off-focused.svg</file>
|
||||||
<file>checkbox-off.svg</file>
|
<file>checkbox-off.svg</file>
|
||||||
<file>checkbox.svg</file>
|
<file>checkbox.svg</file>
|
||||||
|
<file alias="icons/color-pick.svg">color-pick.svg</file>
|
||||||
<file>dash-placeholder.svg</file>
|
<file>dash-placeholder.svg</file>
|
||||||
<file>gnome-shell.css</file>
|
<file>gnome-shell.css</file>
|
||||||
<file>gnome-shell-high-contrast.css</file>
|
<file>gnome-shell-high-contrast.css</file>
|
||||||
|
@ -19,6 +19,10 @@ Before=gnome-session-initialized.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=notify
|
||||||
ExecStart=@bindir@/gnome-shell
|
ExecStart=@bindir@/gnome-shell
|
||||||
|
|
||||||
|
# unset some environment variables that were set by the shell and won't work now that the shell is gone
|
||||||
|
ExecStopPost=-systemctl --user unset-environment GNOME_SETUP_DISPLAY WAYLAND_DISPLAY DISPLAY XAUTHORITY
|
||||||
|
|
||||||
# Exit code 1 means we are probably *not* dealing with an extension failure
|
# Exit code 1 means we are probably *not* dealing with an extension failure
|
||||||
SuccessExitStatus=1
|
SuccessExitStatus=1
|
||||||
# On wayland we cannot restart
|
# On wayland we cannot restart
|
||||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@ -1,6 +1,6 @@
|
|||||||
desktop_files = [
|
desktop_files = [
|
||||||
'org.gnome.Shell.desktop',
|
'org.gnome.Shell.desktop',
|
||||||
'org.gnome.Extensions.desktop',
|
'org.gnome.Shell.Extensions.desktop',
|
||||||
]
|
]
|
||||||
service_files = []
|
service_files = []
|
||||||
|
|
||||||
|
10
data/org.gnome.Shell.Extensions.desktop.in.in
Normal file
10
data/org.gnome.Shell.Extensions.desktop.in.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
# Keep in sync with subprojects/extensions-app
|
||||||
|
Name=Extensions
|
||||||
|
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
|
||||||
|
Icon=org.gnome.Shell.Extensions
|
||||||
|
# Never launch this, just provide name+icon to portal dialog
|
||||||
|
Exec=false
|
||||||
|
OnlyShowIn=GNOME;
|
||||||
|
NoDisplay=true
|
@ -12,7 +12,9 @@
|
|||||||
"w"
|
"w"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"e"
|
"e",
|
||||||
|
"é",
|
||||||
|
"ë"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"r"
|
"r"
|
||||||
@ -21,30 +23,58 @@
|
|||||||
"t"
|
"t"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"y"
|
"y",
|
||||||
|
"ý",
|
||||||
|
"ÿ"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"u"
|
"u",
|
||||||
|
"ú",
|
||||||
|
"ü",
|
||||||
|
"û",
|
||||||
|
"ù",
|
||||||
|
"ū"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"i"
|
"i",
|
||||||
|
"í",
|
||||||
|
"ï"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"o"
|
"o",
|
||||||
|
"ó",
|
||||||
|
"ô",
|
||||||
|
"ò",
|
||||||
|
"õ",
|
||||||
|
"œ",
|
||||||
|
"ō"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"p"
|
"p"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"å"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
"a"
|
"a",
|
||||||
|
"á",
|
||||||
|
"ä",
|
||||||
|
"à",
|
||||||
|
"â",
|
||||||
|
"ã",
|
||||||
|
"ā"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"s"
|
"s",
|
||||||
|
"ß",
|
||||||
|
"ś",
|
||||||
|
"š"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"d"
|
"d",
|
||||||
|
"ð"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"f"
|
"f"
|
||||||
@ -62,7 +92,16 @@
|
|||||||
"k"
|
"k"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"l"
|
"l",
|
||||||
|
"ł"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"ø",
|
||||||
|
"ö"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"æ",
|
||||||
|
"ä"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -82,7 +121,9 @@
|
|||||||
"b"
|
"b"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"n"
|
"n",
|
||||||
|
"ñ",
|
||||||
|
"ń"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"m"
|
"m"
|
||||||
@ -121,7 +162,9 @@
|
|||||||
"W"
|
"W"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"E"
|
"E",
|
||||||
|
"É",
|
||||||
|
"Ë"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"R"
|
"R"
|
||||||
@ -130,30 +173,58 @@
|
|||||||
"T"
|
"T"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Y"
|
"Y",
|
||||||
|
"Ý",
|
||||||
|
"Ÿ"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"U"
|
"U",
|
||||||
|
"Ú",
|
||||||
|
"Ü",
|
||||||
|
"Û",
|
||||||
|
"Ù",
|
||||||
|
"Ū"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"I"
|
"I",
|
||||||
|
"Í",
|
||||||
|
"Ï"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"O"
|
"O",
|
||||||
|
"Ó",
|
||||||
|
"Ô",
|
||||||
|
"Ò",
|
||||||
|
"Õ",
|
||||||
|
"Œ",
|
||||||
|
"Ō"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"P"
|
"P"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Å"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
"A"
|
"A",
|
||||||
|
"Á",
|
||||||
|
"Ä",
|
||||||
|
"À",
|
||||||
|
"Â",
|
||||||
|
"Ã",
|
||||||
|
"Ā"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"S"
|
"S",
|
||||||
|
"SS",
|
||||||
|
"Ś",
|
||||||
|
"Š"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"D"
|
"D",
|
||||||
|
"Ð"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"F"
|
"F"
|
||||||
@ -171,7 +242,16 @@
|
|||||||
"K"
|
"K"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"L"
|
"L",
|
||||||
|
"Ł"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Ø",
|
||||||
|
"Ö"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Æ",
|
||||||
|
"Ä"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -191,7 +271,9 @@
|
|||||||
"B"
|
"B"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"N"
|
"N",
|
||||||
|
"Ñ",
|
||||||
|
"Ń"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"M"
|
"M"
|
||||||
@ -277,10 +359,10 @@
|
|||||||
"#"
|
"#"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"$",
|
"€",
|
||||||
"¢",
|
"¢",
|
||||||
"£",
|
"£",
|
||||||
"€",
|
"$",
|
||||||
"¥",
|
"¥",
|
||||||
"₱"
|
"₱"
|
||||||
],
|
],
|
||||||
@ -419,13 +501,14 @@
|
|||||||
"£"
|
"£"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
"¥"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"$",
|
||||||
"¢"
|
"¢"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"€"
|
"¢"
|
||||||
],
|
|
||||||
[
|
|
||||||
"¥"
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"^",
|
"^",
|
||||||
|
94
data/theme/color-pick.svg
Normal file
94
data/theme/color-pick.svg
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
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="5.4116011mm"
|
||||||
|
height="5.1374583mm"
|
||||||
|
viewBox="0 0 5.4116011 5.1374583"
|
||||||
|
version="1.1"
|
||||||
|
id="svg5595"
|
||||||
|
inkscape:version="0.92.4 (unknown)"
|
||||||
|
sodipodi:docname="color-pick.svg">
|
||||||
|
<defs
|
||||||
|
id="defs5589">
|
||||||
|
<filter
|
||||||
|
inkscape:collect="always"
|
||||||
|
x="-0.10291173"
|
||||||
|
width="1.2058235"
|
||||||
|
y="-0.065432459"
|
||||||
|
height="1.1308649"
|
||||||
|
id="filter5601"
|
||||||
|
style="color-interpolation-filters:sRGB">
|
||||||
|
<feGaussianBlur
|
||||||
|
inkscape:collect="always"
|
||||||
|
stdDeviation="0.610872"
|
||||||
|
id="feGaussianBlur5603" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="15.839192"
|
||||||
|
inkscape:cx="39.387731"
|
||||||
|
inkscape:cy="12.554326"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1016"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0" />
|
||||||
|
<metadata
|
||||||
|
id="metadata5592">
|
||||||
|
<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></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-103.12753,-146.26461)">
|
||||||
|
<circle
|
||||||
|
r="8.4810486"
|
||||||
|
cy="9.82623"
|
||||||
|
cx="10.226647"
|
||||||
|
id="circle7584"
|
||||||
|
style="color:#000000;display:inline;overflow:visible;opacity:0.6;vector-effect:none;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;filter:url(#filter5601)"
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,103.12753,146.26461)" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;display:inline;overflow:visible;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:0.26399338;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
|
||||||
|
d="m 108.07728,148.64122 c 0,1.2393 -1.00465,2.24394 -2.24395,2.24394 -1.23929,0 -2.24716,-1.00465 -2.25221,-2.24394 l -0.009,-2.24458 2.26136,6.4e-4 c 1.2393,3.4e-4 2.24395,1.00464 2.24395,2.24394 z"
|
||||||
|
id="path7523-7"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ssscss" />
|
||||||
|
<circle
|
||||||
|
style="color:#000000;display:inline;overflow:visible;opacity:1;vector-effect:none;fill:#50dbb5;fill-opacity:1;stroke:none;stroke-width:0.36885914;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal"
|
||||||
|
id="path7482-1"
|
||||||
|
cx="105.83707"
|
||||||
|
cy="148.64352"
|
||||||
|
r="1.844296" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.7 KiB |
@ -14,8 +14,6 @@ $app_icon_padding: 24px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//.app-display { spacing: 20px; }
|
|
||||||
|
|
||||||
/* App Icons */
|
/* App Icons */
|
||||||
|
|
||||||
$app_grid_fg_color: #fff;
|
$app_grid_fg_color: #fff;
|
||||||
@ -35,9 +33,9 @@ $app_grid_fg_color: #fff;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* App Folders */
|
/* App Folders */
|
||||||
.app-folder {
|
.app-well-app.app-folder {
|
||||||
.overview-icon {
|
background-color: transparentize($osd_bg_color, 0.8);
|
||||||
}
|
border-radius: $base_border_radius + 4px; // same as %icon_tile
|
||||||
}
|
}
|
||||||
|
|
||||||
// expanded folder
|
// expanded folder
|
||||||
@ -60,7 +58,7 @@ $app_grid_fg_color: #fff;
|
|||||||
& .folder-name-entry { width: 300px }
|
& .folder-name-entry { width: 300px }
|
||||||
|
|
||||||
/* FIXME: this is to keep the label in sync with the entry */
|
/* FIXME: this is to keep the label in sync with the entry */
|
||||||
& .folder-name-label { padding: 5px 7px }
|
& .folder-name-label { padding: 5px 7px; color: $osd_fg_color; }
|
||||||
|
|
||||||
& .edit-folder-button {
|
& .edit-folder-button {
|
||||||
@extend %button;
|
@extend %button;
|
||||||
@ -73,10 +71,6 @@ $app_grid_fg_color: #fff;
|
|||||||
& > StIcon { icon-size: 16px }
|
& > StIcon { icon-size: 16px }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& StButton#vhandle,
|
|
||||||
& StButton#vhandle:hover,
|
|
||||||
& StButton#vhandle:active { background-color: transparent; }
|
|
||||||
}
|
}
|
||||||
.app-folder-dialog-container {
|
.app-folder-dialog-container {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
@ -127,15 +121,11 @@ $app_grid_fg_color: #fff;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Some hacks I don't even know
|
// Some hacks I don't even know
|
||||||
.all-apps,
|
.all-apps {
|
||||||
.frequent-apps > StBoxLayout {
|
|
||||||
// horizontal padding to make sure scrollbars or dash don't overlap content
|
// horizontal padding to make sure scrollbars or dash don't overlap content
|
||||||
padding: 0px 88px 10px 88px;
|
padding: 0px 88px 10px 88px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Label when no frequent apps
|
|
||||||
.no-frequent-applications-label { @extend %status_text; }
|
|
||||||
|
|
||||||
// shutdown and other actions in the grid
|
// shutdown and other actions in the grid
|
||||||
.system-action-icon {
|
.system-action-icon {
|
||||||
background-color: rgba(0,0,0,0.8);
|
background-color: rgba(0,0,0,0.8);
|
||||||
@ -143,44 +133,3 @@ $app_grid_fg_color: #fff;
|
|||||||
border-radius: 99px;
|
border-radius: 99px;
|
||||||
icon-size: $app_icon_size * 0.5;
|
icon-size: $app_icon_size * 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Frequent | All toggle */
|
|
||||||
|
|
||||||
// container
|
|
||||||
.app-view-controls {
|
|
||||||
padding-bottom: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
// buttons
|
|
||||||
.app-view-control {
|
|
||||||
padding: 4px 32px;
|
|
||||||
margin: 0 4px;
|
|
||||||
|
|
||||||
&, &:hover, &:checked {
|
|
||||||
@include button(undecorated);
|
|
||||||
color: darken($osd_fg_color, 25%);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: $osd_fg_color;
|
|
||||||
box-shadow: inset 0 -2px darken($osd_fg_color, 25%);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
box-shadow: inset 0 -2px $osd_fg_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:checked {
|
|
||||||
color: $osd_fg_color;
|
|
||||||
box-shadow: inset 0 -2px $selected_bg_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
border-right-width: 0;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -153,9 +153,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.calendar-day-with-events {
|
.calendar-day-with-events {
|
||||||
color: lighten($fg_color,10%);
|
|
||||||
font-weight: bold;
|
|
||||||
background-image: url("resource:///org/gnome/shell/theme/calendar-today.svg");
|
background-image: url("resource:///org/gnome/shell/theme/calendar-today.svg");
|
||||||
|
&.calendar-work-day {
|
||||||
|
color: lighten($fg_color,10%);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-other-month-day {
|
.calendar-other-month-day {
|
||||||
@ -202,7 +204,7 @@
|
|||||||
.world-clocks-time {
|
.world-clocks-time {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: $fg_color;
|
color: $fg_color;
|
||||||
font-feature-settings: "lnum";
|
font-feature-settings: "tnum";
|
||||||
@include fontsize($base_font_size);
|
@include fontsize($base_font_size);
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
/* Looking Glass */
|
/* Looking Glass */
|
||||||
|
|
||||||
|
$text_fg_color: #ccc;
|
||||||
|
|
||||||
// Dialog
|
// Dialog
|
||||||
#LookingGlassDialog {
|
#LookingGlassDialog {
|
||||||
background-color: $osd_bg_color;
|
background-color: $osd_bg_color;
|
||||||
@ -52,6 +54,11 @@
|
|||||||
&:hover { color: lighten($link_color, 10%); }
|
&:hover { color: lighten($link_color, 10%); }
|
||||||
&:active { color: darken($link_color, 10%); }
|
&:active { color: darken($link_color, 10%); }
|
||||||
}
|
}
|
||||||
|
.actor-link {
|
||||||
|
color: $text_fg_color;
|
||||||
|
&:hover { color: lighten($text_fg_color, 20%); }
|
||||||
|
&:active { color: darken($text_fg_color, 20%); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lg-completions-text {
|
.lg-completions-text {
|
||||||
|
@ -54,6 +54,10 @@
|
|||||||
@extend %status_text;
|
@extend %status_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grid-search-results {
|
||||||
|
spacing: $base_spacing * 6;
|
||||||
|
}
|
||||||
|
|
||||||
// Search results with icons
|
// Search results with icons
|
||||||
.grid-search-result {
|
.grid-search-result {
|
||||||
@extend %app-well-app;
|
@extend %app-well-app;
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
|
|
||||||
&:outlined {
|
&:outlined {
|
||||||
border: 1px solid darken($borders_color,5%);
|
background-color: transparentize($osd_fg_color, 0.7);
|
||||||
background-color: transparentize($osd_fg_color, 0.9);
|
|
||||||
box-shadow: inset 0 2px 2px 0 rgba(0,0,0,0.4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&:selected {
|
&:selected {
|
||||||
background-color: transparentize($osd_fg_color, 0.9);
|
background-color: transparentize($osd_fg_color, 0.7);
|
||||||
color: $osd_fg_color;
|
color: $osd_fg_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#!/bin/env bash
|
#!/bin/env bash
|
||||||
|
|
||||||
CLDR_LAYOUTS_TARBALL="http://www.unicode.org/Public/cldr/latest/keyboards.zip"
|
CLDR_LAYOUTS_TARBALL="http://www.unicode.org/Public/cldr/latest/keyboards.zip"
|
||||||
CLDR2JSON_GIT="git://repo.or.cz/cldr2json.git"
|
|
||||||
|
|
||||||
WORKDIR=".osk-layout-workbench"
|
WORKDIR=".osk-layout-workbench"
|
||||||
CLDR2JSON="$WORKDIR/cldr2json/cldr2json.py"
|
CLDR2JSON="cldr2json/cldr2json.py"
|
||||||
SRCDIR="$WORKDIR/keyboards/android"
|
SRCDIR="$WORKDIR/keyboards/android"
|
||||||
DESTDIR="osk-layouts"
|
DESTDIR="osk-layouts"
|
||||||
GRESOURCE_FILE="gnome-shell-osk-layouts.gresource.xml"
|
GRESOURCE_FILE="gnome-shell-osk-layouts.gresource.xml"
|
||||||
@ -20,7 +19,6 @@ mkdir -p "osk-layouts"
|
|||||||
# Download stuff on the work dir
|
# Download stuff on the work dir
|
||||||
pushd $WORKDIR
|
pushd $WORKDIR
|
||||||
gio copy $CLDR_LAYOUTS_TARBALL .
|
gio copy $CLDR_LAYOUTS_TARBALL .
|
||||||
git clone $CLDR2JSON_GIT
|
|
||||||
unzip keyboards.zip
|
unzip keyboards.zip
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
5
js/dbusServices/dbus-service.in
Normal file
5
js/dbusServices/dbus-service.in
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
imports.package.start({
|
||||||
|
name: '@PACKAGE_NAME@',
|
||||||
|
prefix: '@prefix@',
|
||||||
|
libdir: '@libdir@',
|
||||||
|
});
|
3
js/dbusServices/dbus-service.service.in
Normal file
3
js/dbusServices/dbus-service.service.in
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[D-BUS Service]
|
||||||
|
Name=@service@
|
||||||
|
Exec=@gjs@ @pkgdatadir@/@service@
|
177
js/dbusServices/dbusService.js
Normal file
177
js/dbusServices/dbusService.js
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
/* exported DBusService, ServiceImplementation */
|
||||||
|
|
||||||
|
const { Gio, GLib } = imports.gi;
|
||||||
|
|
||||||
|
const Signals = imports.signals;
|
||||||
|
|
||||||
|
const IDLE_SHUTDOWN_TIME = 2; // s
|
||||||
|
|
||||||
|
var ServiceImplementation = class {
|
||||||
|
constructor(info, objectPath) {
|
||||||
|
this._objectPath = objectPath;
|
||||||
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(info, this);
|
||||||
|
|
||||||
|
this._injectTracking('return_dbus_error');
|
||||||
|
this._injectTracking('return_error_literal');
|
||||||
|
this._injectTracking('return_gerror');
|
||||||
|
this._injectTracking('return_value');
|
||||||
|
this._injectTracking('return_value_with_unix_fd_list');
|
||||||
|
|
||||||
|
this._senders = new Map();
|
||||||
|
this._holdCount = 0;
|
||||||
|
|
||||||
|
this._hasSignals = this._dbusImpl.get_info().signals.length > 0;
|
||||||
|
this._shutdownTimeoutId = 0;
|
||||||
|
|
||||||
|
// subclasses may override this to disable automatic shutdown
|
||||||
|
this._autoShutdown = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// subclasses may override this to own additional names
|
||||||
|
register() {
|
||||||
|
}
|
||||||
|
|
||||||
|
export() {
|
||||||
|
this._dbusImpl.export(Gio.DBus.session, this._objectPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
unexport() {
|
||||||
|
this._dbusImpl.unexport();
|
||||||
|
}
|
||||||
|
|
||||||
|
hold() {
|
||||||
|
this._holdCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
release() {
|
||||||
|
if (this._holdCount === 0) {
|
||||||
|
logError(new Error('Unmatched call to release()'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._holdCount--;
|
||||||
|
|
||||||
|
if (this._holdCount === 0)
|
||||||
|
this._queueShutdownCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _handleError:
|
||||||
|
* @param {Gio.DBusMethodInvocation}
|
||||||
|
* @param {Error}
|
||||||
|
*
|
||||||
|
* Complete @invocation with an appropriate error if @error is set;
|
||||||
|
* useful for implementing early returns from method implementations.
|
||||||
|
*
|
||||||
|
* @returns {bool} - true if @invocation was completed
|
||||||
|
*/
|
||||||
|
|
||||||
|
_handleError(invocation, error) {
|
||||||
|
if (error === null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (error instanceof GLib.Error) {
|
||||||
|
invocation.return_gerror(error);
|
||||||
|
} else {
|
||||||
|
let name = error.name;
|
||||||
|
if (!name.includes('.')) // likely a normal JS error
|
||||||
|
name = `org.gnome.gjs.JSError.${name}`;
|
||||||
|
invocation.return_dbus_error(name, error.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_maybeShutdown() {
|
||||||
|
if (!this._autoShutdown)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this._holdCount > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.emit('shutdown');
|
||||||
|
}
|
||||||
|
|
||||||
|
_queueShutdownCheck() {
|
||||||
|
if (this._shutdownTimeoutId)
|
||||||
|
GLib.source_remove(this._shutdownTimeoutId);
|
||||||
|
|
||||||
|
this._shutdownTimeoutId = GLib.timeout_add_seconds(
|
||||||
|
GLib.PRIORITY_DEFAULT, IDLE_SHUTDOWN_TIME,
|
||||||
|
() => {
|
||||||
|
this._shutdownTimeoutId = 0;
|
||||||
|
this._maybeShutdown();
|
||||||
|
|
||||||
|
return GLib.SOURCE_REMOVE;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_trackSender(sender) {
|
||||||
|
if (this._senders.has(sender))
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.hold();
|
||||||
|
this._senders.set(sender,
|
||||||
|
this._dbusImpl.get_connection().watch_name(
|
||||||
|
sender,
|
||||||
|
Gio.BusNameWatcherFlags.NONE,
|
||||||
|
null,
|
||||||
|
() => this._untrackSender(sender)));
|
||||||
|
}
|
||||||
|
|
||||||
|
_untrackSender(sender) {
|
||||||
|
const id = this._senders.get(sender);
|
||||||
|
|
||||||
|
if (id)
|
||||||
|
this._dbusImpl.get_connection().unwatch_name(id);
|
||||||
|
|
||||||
|
if (this._senders.delete(sender))
|
||||||
|
this.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
_injectTracking(methodName) {
|
||||||
|
const { prototype } = Gio.DBusMethodInvocation;
|
||||||
|
const origMethod = prototype[methodName];
|
||||||
|
const that = this;
|
||||||
|
|
||||||
|
prototype[methodName] = function (...args) {
|
||||||
|
origMethod.apply(this, args);
|
||||||
|
|
||||||
|
if (that._hasSignals)
|
||||||
|
that._trackSender(this.get_sender());
|
||||||
|
|
||||||
|
that._queueShutdownCheck();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Signals.addSignalMethods(ServiceImplementation.prototype);
|
||||||
|
|
||||||
|
var DBusService = class {
|
||||||
|
constructor(name, service) {
|
||||||
|
this._name = name;
|
||||||
|
this._service = service;
|
||||||
|
this._loop = new GLib.MainLoop(null, false);
|
||||||
|
|
||||||
|
this._service.connect('shutdown', () => this._loop.quit());
|
||||||
|
}
|
||||||
|
|
||||||
|
run() {
|
||||||
|
// Bail out when not running under gnome-shell
|
||||||
|
Gio.DBus.watch_name(Gio.BusType.SESSION,
|
||||||
|
'org.gnome.Shell',
|
||||||
|
Gio.BusNameWatcherFlags.NONE,
|
||||||
|
null,
|
||||||
|
() => this._loop.quit());
|
||||||
|
|
||||||
|
this._service.register();
|
||||||
|
|
||||||
|
Gio.DBus.own_name(Gio.BusType.SESSION,
|
||||||
|
this._name,
|
||||||
|
Gio.BusNameOwnerFlags.REPLACE,
|
||||||
|
() => this._service.export(),
|
||||||
|
null,
|
||||||
|
() => this._loop.quit());
|
||||||
|
|
||||||
|
this._loop.run();
|
||||||
|
}
|
||||||
|
};
|
2
js/dbusServices/extensions/css/application.css
Normal file
2
js/dbusServices/extensions/css/application.css
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.expander-frame > * { border-top-width: 0; }
|
||||||
|
.expander-toolbar { border: 0 solid @borders; border-top-width: 1px; }
|
274
js/dbusServices/extensions/extensionsService.js
Normal file
274
js/dbusServices/extensions/extensionsService.js
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
/* exported ExtensionsService */
|
||||||
|
|
||||||
|
const { Gdk, Gio, GLib, GObject, Gtk, Shew } = imports.gi;
|
||||||
|
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
|
||||||
|
const { loadInterfaceXML } = imports.misc.fileUtils;
|
||||||
|
const { ServiceImplementation } = imports.dbusService;
|
||||||
|
|
||||||
|
const ExtensionsIface = loadInterfaceXML('org.gnome.Shell.Extensions');
|
||||||
|
const ExtensionsProxy = Gio.DBusProxy.makeProxyWrapper(ExtensionsIface);
|
||||||
|
|
||||||
|
var ExtensionsService = class extends ServiceImplementation {
|
||||||
|
constructor() {
|
||||||
|
super(ExtensionsIface, '/org/gnome/Shell/Extensions');
|
||||||
|
|
||||||
|
this._proxy = new ExtensionsProxy(Gio.DBus.session,
|
||||||
|
'org.gnome.Shell', '/org/gnome/Shell');
|
||||||
|
|
||||||
|
this._proxy.connectSignal('ExtensionStateChanged',
|
||||||
|
(proxy, sender, params) => {
|
||||||
|
this._dbusImpl.emit_signal('ExtensionStateChanged',
|
||||||
|
new GLib.Variant('(sa{sv})', params));
|
||||||
|
});
|
||||||
|
|
||||||
|
this._proxy.connect('g-properties-changed', () => {
|
||||||
|
this._dbusImpl.emit_property_changed('UserExtensionsEnabled',
|
||||||
|
new GLib.Variant('b', this._proxy.UserExtensionsEnabled));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get ShellVersion() {
|
||||||
|
return this._proxy.ShellVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
get UserExtensionsEnabled() {
|
||||||
|
return this._proxy.UserExtensionsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
set UserExtensionsEnabled(enable) {
|
||||||
|
this._proxy.UserExtensionsEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
ListExtensionsAsync(params, invocation) {
|
||||||
|
this._proxy.ListExtensionsRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(a{sa{sv}})', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
GetExtensionInfoAsync(params, invocation) {
|
||||||
|
this._proxy.GetExtensionInfoRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(a{sv})', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
GetExtensionErrorsAsync(params, invocation) {
|
||||||
|
this._proxy.GetExtensionErrorsRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(as)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
InstallRemoteExtensionAsync(params, invocation) {
|
||||||
|
this._proxy.InstallRemoteExtensionRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(s)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
UninstallExtensionAsync(params, invocation) {
|
||||||
|
this._proxy.UninstallExtensionRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(b)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
EnableExtensionAsync(params, invocation) {
|
||||||
|
this._proxy.EnableExtensionRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(b)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
DisableExtensionAsync(params, invocation) {
|
||||||
|
this._proxy.DisableExtensionRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(b)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
LaunchExtensionPrefsAsync([uuid], invocation) {
|
||||||
|
this.OpenExtensionPrefsAsync([uuid, '', {}], invocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenExtensionPrefsAsync(params, invocation) {
|
||||||
|
const [uuid, parentWindow, options] = params;
|
||||||
|
|
||||||
|
this._proxy.GetExtensionInfoRemote(uuid, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const [serialized] = res;
|
||||||
|
const extension = ExtensionUtils.deserializeExtension(serialized);
|
||||||
|
|
||||||
|
const window = new ExtensionPrefsDialog(extension);
|
||||||
|
window.realize();
|
||||||
|
|
||||||
|
let externalWindow = null;
|
||||||
|
|
||||||
|
if (parentWindow)
|
||||||
|
externalWindow = Shew.ExternalWindow.new_from_handle(parentWindow);
|
||||||
|
|
||||||
|
if (externalWindow)
|
||||||
|
externalWindow.set_parent_of(window.window);
|
||||||
|
|
||||||
|
if (options.modal)
|
||||||
|
window.modal = options.modal.get_boolean();
|
||||||
|
|
||||||
|
window.connect('destroy', () => this.release());
|
||||||
|
this.hold();
|
||||||
|
|
||||||
|
window.show();
|
||||||
|
|
||||||
|
invocation.return_value(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckForUpdatesAsync(params, invocation) {
|
||||||
|
this._proxy.CheckForUpdatesRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var ExtensionPrefsDialog = GObject.registerClass({
|
||||||
|
GTypeName: 'ExtensionPrefsDialog',
|
||||||
|
Template: 'resource:///org/gnome/Shell/Extensions/ui/extension-prefs-dialog.ui',
|
||||||
|
InternalChildren: [
|
||||||
|
'headerBar',
|
||||||
|
'stack',
|
||||||
|
'expander',
|
||||||
|
'expanderArrow',
|
||||||
|
'revealer',
|
||||||
|
'errorView',
|
||||||
|
],
|
||||||
|
}, class ExtensionPrefsDialog extends Gtk.Window {
|
||||||
|
_init(extension) {
|
||||||
|
super._init();
|
||||||
|
|
||||||
|
this._uuid = extension.uuid;
|
||||||
|
this._url = extension.metadata.url || '';
|
||||||
|
|
||||||
|
this._headerBar.title = extension.metadata.name;
|
||||||
|
|
||||||
|
this._actionGroup = new Gio.SimpleActionGroup();
|
||||||
|
this.insert_action_group('win', this._actionGroup);
|
||||||
|
|
||||||
|
this._initActions();
|
||||||
|
this._addCustomStylesheet();
|
||||||
|
|
||||||
|
this._gesture = new Gtk.GestureMultiPress({
|
||||||
|
widget: this._expander,
|
||||||
|
button: 0,
|
||||||
|
exclusive: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
this._gesture.connect('released', (gesture, nPress) => {
|
||||||
|
if (nPress === 1)
|
||||||
|
this._revealer.reveal_child = !this._revealer.reveal_child;
|
||||||
|
});
|
||||||
|
|
||||||
|
this._revealer.connect('notify::reveal-child', () => {
|
||||||
|
this._expanderArrow.icon_name = this._revealer.reveal_child
|
||||||
|
? 'pan-down-symbolic'
|
||||||
|
: 'pan-end-symbolic';
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
ExtensionUtils.installImporter(extension);
|
||||||
|
|
||||||
|
// give extension prefs access to their own extension object
|
||||||
|
ExtensionUtils.getCurrentExtension = () => extension;
|
||||||
|
|
||||||
|
const prefsModule = extension.imports.prefs;
|
||||||
|
prefsModule.init(extension.metadata);
|
||||||
|
|
||||||
|
const widget = prefsModule.buildPrefsWidget();
|
||||||
|
this._stack.add(widget);
|
||||||
|
this._stack.visible_child = widget;
|
||||||
|
} catch (e) {
|
||||||
|
this._setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_setError(exc) {
|
||||||
|
this._errorView.buffer.text = `${exc}\n\nStack trace:\n`;
|
||||||
|
// Indent stack trace.
|
||||||
|
this._errorView.buffer.text +=
|
||||||
|
exc.stack.split('\n').map(line => ` ${line}`).join('\n');
|
||||||
|
|
||||||
|
// markdown for pasting in gitlab issues
|
||||||
|
let lines = [
|
||||||
|
`The settings of extension ${this._uuid} had an error:`,
|
||||||
|
'```',
|
||||||
|
`${exc}`,
|
||||||
|
'```',
|
||||||
|
'',
|
||||||
|
'Stack trace:',
|
||||||
|
'```',
|
||||||
|
exc.stack.replace(/\n$/, ''), // stack without trailing newline
|
||||||
|
'```',
|
||||||
|
'',
|
||||||
|
];
|
||||||
|
this._errorMarkdown = lines.join('\n');
|
||||||
|
this._actionGroup.lookup('copy-error').enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_initActions() {
|
||||||
|
let action;
|
||||||
|
|
||||||
|
action = new Gio.SimpleAction({
|
||||||
|
name: 'copy-error',
|
||||||
|
enabled: false,
|
||||||
|
});
|
||||||
|
action.connect('activate', () => {
|
||||||
|
const clipboard = Gtk.Clipboard.get_default(this.get_display());
|
||||||
|
clipboard.set_text(this._errorMarkdown, -1);
|
||||||
|
});
|
||||||
|
this._actionGroup.add_action(action);
|
||||||
|
|
||||||
|
action = new Gio.SimpleAction({
|
||||||
|
name: 'show-url',
|
||||||
|
enabled: this._url !== '',
|
||||||
|
});
|
||||||
|
action.connect('activate', () => {
|
||||||
|
Gio.AppInfo.launch_default_for_uri(this._url,
|
||||||
|
this.get_display().get_app_launch_context());
|
||||||
|
});
|
||||||
|
this._actionGroup.add_action(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
_addCustomStylesheet() {
|
||||||
|
let provider = new Gtk.CssProvider();
|
||||||
|
let uri = 'resource:///org/gnome/Shell/Extensions/css/application.css';
|
||||||
|
try {
|
||||||
|
provider.load_from_file(Gio.File.new_for_uri(uri));
|
||||||
|
} catch (e) {
|
||||||
|
logError(e, 'Failed to add application style');
|
||||||
|
}
|
||||||
|
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
|
||||||
|
provider,
|
||||||
|
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
}
|
||||||
|
});
|
20
js/dbusServices/extensions/main.js
Normal file
20
js/dbusServices/extensions/main.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/* exported main */
|
||||||
|
|
||||||
|
imports.gi.versions.Gdk = '3.0';
|
||||||
|
imports.gi.versions.Gtk = '3.0';
|
||||||
|
|
||||||
|
const { Gtk } = imports.gi;
|
||||||
|
const pkg = imports.package;
|
||||||
|
|
||||||
|
const { DBusService } = imports.dbusService;
|
||||||
|
const { ExtensionsService } = imports.extensionsService;
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
Gtk.init(null);
|
||||||
|
pkg.initFormat();
|
||||||
|
|
||||||
|
const service = new DBusService(
|
||||||
|
'org.gnome.Shell.Extensions',
|
||||||
|
new ExtensionsService());
|
||||||
|
service.run();
|
||||||
|
}
|
197
js/dbusServices/extensions/ui/extension-prefs-dialog.ui
Normal file
197
js/dbusServices/extensions/ui/extension-prefs-dialog.ui
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.22.1 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.20"/>
|
||||||
|
<template class="ExtensionPrefsDialog" parent="GtkWindow">
|
||||||
|
<property name="default_width">600</property>
|
||||||
|
<property name="default_height">400</property>
|
||||||
|
<child type="titlebar">
|
||||||
|
<object class="GtkHeaderBar" id="headerBar">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="show_close_button">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkStack" id="stack">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="hscrollbar_policy">never</property>
|
||||||
|
<property name="propagate_natural_height">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkViewport">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin">100</property>
|
||||||
|
<property name="margin_bottom">60</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Something’s gone wrong</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="scale" value="1.44"/> <!-- x-large -->
|
||||||
|
</attributes>
|
||||||
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">We’re very sorry, but there’s been a problem: the settings for this extension can’t be displayed. We recommend that you report the issue to the extension authors.</property>
|
||||||
|
<property name="justify">center</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="margin_top">12</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="expander">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEventBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="margin">12</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="expanderArrow">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon_name">pan-end-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Technical Details</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRevealer" id="revealer">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<style>
|
||||||
|
<class name="expander-frame"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTextView" id="errorView">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="monospace">True</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
<property name="wrap_mode">word</property>
|
||||||
|
<property name="left_margin">12</property>
|
||||||
|
<property name="right_margin">12</property>
|
||||||
|
<property name="top_margin">12</property>
|
||||||
|
<property name="bottom_margin">12</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToolbar">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<style>
|
||||||
|
<class name="expander-toolbar"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToolItem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="action_name">win.copy-error</property>
|
||||||
|
<style>
|
||||||
|
<class name="flat"/>
|
||||||
|
<class name="image-button"/>
|
||||||
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon_name">edit-copy-symbolic</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorToolItem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="draw">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToolItem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="homeButton">
|
||||||
|
<property name="visible"
|
||||||
|
bind-source="homeButton"
|
||||||
|
bind-property="sensitive"
|
||||||
|
bind-flags="sync-create"/>
|
||||||
|
<property name="label" translatable="yes">Homepage</property>
|
||||||
|
<property name="tooltip_text" translatable="yes">Visit extension homepage</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
|
<property name="action_name">win.show-url</property>
|
||||||
|
<style>
|
||||||
|
<class name="flat"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</template>
|
||||||
|
</interface>
|
42
js/dbusServices/meson.build
Normal file
42
js/dbusServices/meson.build
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
launcherconf = configuration_data()
|
||||||
|
launcherconf.set('PACKAGE_NAME', meson.project_name())
|
||||||
|
launcherconf.set('prefix', prefix)
|
||||||
|
launcherconf.set('libdir', libdir)
|
||||||
|
|
||||||
|
dbus_services = {
|
||||||
|
'org.gnome.Shell.Extensions': 'extensions',
|
||||||
|
'org.gnome.Shell.Notifications': 'notifications',
|
||||||
|
}
|
||||||
|
|
||||||
|
config_dir = '@0@/..'.format(meson.current_build_dir())
|
||||||
|
|
||||||
|
foreach service, dir : dbus_services
|
||||||
|
configure_file(
|
||||||
|
input: 'dbus-service.in',
|
||||||
|
output: service,
|
||||||
|
configuration: launcherconf,
|
||||||
|
install_dir: pkgdatadir,
|
||||||
|
)
|
||||||
|
|
||||||
|
serviceconf = configuration_data()
|
||||||
|
serviceconf.set('service', service)
|
||||||
|
serviceconf.set('gjs', gjs.path())
|
||||||
|
serviceconf.set('pkgdatadir', pkgdatadir)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
input: 'dbus-service.service.in',
|
||||||
|
output: service + '.service',
|
||||||
|
configuration: serviceconf,
|
||||||
|
install_dir: servicedir
|
||||||
|
)
|
||||||
|
|
||||||
|
gnome.compile_resources(
|
||||||
|
service + '.src',
|
||||||
|
service + '.src.gresource.xml',
|
||||||
|
dependencies: [config_js],
|
||||||
|
source_dir: ['.', '..', dir, config_dir],
|
||||||
|
gresource_bundle: true,
|
||||||
|
install: true,
|
||||||
|
install_dir: pkgdatadir
|
||||||
|
)
|
||||||
|
endforeach
|
11
js/dbusServices/notifications/main.js
Normal file
11
js/dbusServices/notifications/main.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* exported main */
|
||||||
|
|
||||||
|
const { DBusService } = imports.dbusService;
|
||||||
|
const { NotificationDaemon } = imports.notificationDaemon;
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
const service = new DBusService(
|
||||||
|
'org.gnome.Shell.Notifications',
|
||||||
|
new NotificationDaemon());
|
||||||
|
service.run();
|
||||||
|
}
|
105
js/dbusServices/notifications/notificationDaemon.js
Normal file
105
js/dbusServices/notifications/notificationDaemon.js
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
/* exported NotificationDaemon */
|
||||||
|
|
||||||
|
const { Gio, GLib } = imports.gi;
|
||||||
|
|
||||||
|
const { loadInterfaceXML } = imports.misc.fileUtils;
|
||||||
|
const { ServiceImplementation } = imports.dbusService;
|
||||||
|
|
||||||
|
const NotificationsIface = loadInterfaceXML('org.freedesktop.Notifications');
|
||||||
|
const NotificationsProxy = Gio.DBusProxy.makeProxyWrapper(NotificationsIface);
|
||||||
|
|
||||||
|
Gio._promisify(Gio.DBusConnection.prototype, 'call', 'call_finish');
|
||||||
|
|
||||||
|
var NotificationDaemon = class extends ServiceImplementation {
|
||||||
|
constructor() {
|
||||||
|
super(NotificationsIface, '/org/freedesktop/Notifications');
|
||||||
|
|
||||||
|
this._autoShutdown = false;
|
||||||
|
|
||||||
|
this._proxy = new NotificationsProxy(Gio.DBus.session,
|
||||||
|
'org.gnome.Shell',
|
||||||
|
'/org/freedesktop/Notifications',
|
||||||
|
(proxy, error) => {
|
||||||
|
if (error)
|
||||||
|
log(error.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
this._proxy.connectSignal('ActionInvoked',
|
||||||
|
(proxy, sender, params) => {
|
||||||
|
this._dbusImpl.emit_signal('ActionInvoked',
|
||||||
|
new GLib.Variant('(us)', params));
|
||||||
|
});
|
||||||
|
this._proxy.connectSignal('NotificationClosed',
|
||||||
|
(proxy, sender, params) => {
|
||||||
|
this._dbusImpl.emit_signal('NotificationClosed',
|
||||||
|
new GLib.Variant('(uu)', params));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
register() {
|
||||||
|
Gio.DBus.session.own_name(
|
||||||
|
'org.freedesktop.Notifications',
|
||||||
|
Gio.BusNameOwnerFlags.REPLACE,
|
||||||
|
null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
async NotifyAsync(params, invocation) {
|
||||||
|
const pid = await this._getSenderPid(invocation.get_sender());
|
||||||
|
const hints = params[6];
|
||||||
|
|
||||||
|
params[6] = {
|
||||||
|
...hints,
|
||||||
|
'sender-pid': new GLib.Variant('u', pid),
|
||||||
|
};
|
||||||
|
|
||||||
|
this._proxy.NotifyRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(u)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseNotificationAsync(params, invocation) {
|
||||||
|
this._proxy.CloseNotificationRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
GetCapabilitiesAsync(params, invocation) {
|
||||||
|
this._proxy.GetCapabilitiesRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(as)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
GetServerInformationAsync(params, invocation) {
|
||||||
|
this._proxy.GetServerInformationRemote(...params, (res, error) => {
|
||||||
|
if (this._handleError(invocation, error))
|
||||||
|
return;
|
||||||
|
|
||||||
|
invocation.return_value(new GLib.Variant('(ssss)', res));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async _getSenderPid(sender) {
|
||||||
|
const res = await Gio.DBus.session.call(
|
||||||
|
'org.freedesktop.DBus',
|
||||||
|
'/',
|
||||||
|
'org.freedesktop.DBus',
|
||||||
|
'GetConnectionUnixProcessID',
|
||||||
|
new GLib.Variant('(s)', [sender]),
|
||||||
|
new GLib.VariantType('(u)'),
|
||||||
|
Gio.DBusCallFlags.NONE,
|
||||||
|
-1,
|
||||||
|
null);
|
||||||
|
const [pid] = res.deepUnpack();
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
};
|
18
js/dbusServices/org.gnome.Shell.Extensions.src.gresource.xml
Normal file
18
js/dbusServices/org.gnome.Shell.Extensions.src.gresource.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gresources>
|
||||||
|
<gresource prefix="/org/gnome/Shell/Extensions/js">
|
||||||
|
<file>main.js</file>
|
||||||
|
<file>extensionsService.js</file>
|
||||||
|
<file>dbusService.js</file>
|
||||||
|
|
||||||
|
<file>misc/config.js</file>
|
||||||
|
<file>misc/extensionUtils.js</file>
|
||||||
|
<file>misc/fileUtils.js</file>
|
||||||
|
<file>misc/params.js</file>
|
||||||
|
</gresource>
|
||||||
|
|
||||||
|
<gresource prefix="/org/gnome/Shell/Extensions">
|
||||||
|
<file>css/application.css</file>
|
||||||
|
<file>ui/extension-prefs-dialog.ui</file>
|
||||||
|
</gresource>
|
||||||
|
</gresources>
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gresources>
|
||||||
|
<gresource prefix="/org/gnome/Shell/Notifications/js">
|
||||||
|
<file>main.js</file>
|
||||||
|
<file>notificationDaemon.js</file>
|
||||||
|
<file>dbusService.js</file>
|
||||||
|
|
||||||
|
<file>misc/config.js</file>
|
||||||
|
<file>misc/fileUtils.js</file>
|
||||||
|
</gresource>
|
||||||
|
</gresources>
|
@ -120,7 +120,7 @@ var AuthPrompt = GObject.registerClass({
|
|||||||
vfunc_key_press_event(keyPressEvent) {
|
vfunc_key_press_event(keyPressEvent) {
|
||||||
if (keyPressEvent.keyval == Clutter.KEY_Escape)
|
if (keyPressEvent.keyval == Clutter.KEY_Escape)
|
||||||
this.cancel();
|
this.cancel();
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return super.vfunc_key_press_event(keyPressEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
_initEntryRow() {
|
_initEntryRow() {
|
||||||
@ -184,7 +184,7 @@ var AuthPrompt = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
this._defaultButtonWell.add_constraint(new Clutter.BindConstraint({
|
this._defaultButtonWell.add_constraint(new Clutter.BindConstraint({
|
||||||
source: this.cancelButton,
|
source: this.cancelButton,
|
||||||
coordinate: Clutter.BindCoordinate.SIZE,
|
coordinate: Clutter.BindCoordinate.WIDTH,
|
||||||
}));
|
}));
|
||||||
this._mainBox.add_child(this._defaultButtonWell);
|
this._mainBox.add_child(this._defaultButtonWell);
|
||||||
|
|
||||||
@ -424,8 +424,13 @@ var AuthPrompt = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateSensitivity(sensitive) {
|
updateSensitivity(sensitive) {
|
||||||
|
if (this._entry.reactive === sensitive)
|
||||||
|
return;
|
||||||
|
|
||||||
this._entry.reactive = sensitive;
|
this._entry.reactive = sensitive;
|
||||||
this._entry.clutter_text.editable = sensitive;
|
|
||||||
|
if (sensitive)
|
||||||
|
this._entry.grab_key_focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_hide() {
|
vfunc_hide() {
|
||||||
|
@ -35,7 +35,6 @@ const UserWidget = imports.ui.userWidget;
|
|||||||
const _FADE_ANIMATION_TIME = 250;
|
const _FADE_ANIMATION_TIME = 250;
|
||||||
const _SCROLL_ANIMATION_TIME = 500;
|
const _SCROLL_ANIMATION_TIME = 500;
|
||||||
const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0;
|
const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0;
|
||||||
const _LOGO_ICON_HEIGHT = 48;
|
|
||||||
|
|
||||||
var UserListItem = GObject.registerClass({
|
var UserListItem = GObject.registerClass({
|
||||||
Signals: { 'activate': {} },
|
Signals: { 'activate': {} },
|
||||||
@ -178,6 +177,7 @@ var UserList = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfunc_key_focus_in() {
|
vfunc_key_focus_in() {
|
||||||
|
super.vfunc_key_focus_in();
|
||||||
this._moveFocusToItems();
|
this._moveFocusToItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +456,6 @@ var LoginDialog = GObject.registerClass({
|
|||||||
let notListedLabel = new St.Label({
|
let notListedLabel = new St.Label({
|
||||||
text: _("Not listed?"),
|
text: _("Not listed?"),
|
||||||
style_class: 'login-dialog-not-listed-label',
|
style_class: 'login-dialog-not-listed-label',
|
||||||
x_align: Clutter.ActorAlign.START,
|
|
||||||
});
|
});
|
||||||
this._notListedButton = new St.Button({
|
this._notListedButton = new St.Button({
|
||||||
style_class: 'login-dialog-not-listed-button',
|
style_class: 'login-dialog-not-listed-button',
|
||||||
@ -464,6 +463,7 @@ var LoginDialog = GObject.registerClass({
|
|||||||
can_focus: true,
|
can_focus: true,
|
||||||
child: notListedLabel,
|
child: notListedLabel,
|
||||||
reactive: true,
|
reactive: true,
|
||||||
|
x_align: Clutter.ActorAlign.START,
|
||||||
});
|
});
|
||||||
|
|
||||||
this._notListedButton.connect('clicked', this._hideUserListAskForUsernameAndBeginVerification.bind(this));
|
this._notListedButton.connect('clicked', this._hideUserListAskForUsernameAndBeginVerification.bind(this));
|
||||||
@ -589,8 +589,8 @@ var LoginDialog = GObject.registerClass({
|
|||||||
return actorBox;
|
return actorBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(dialogBox, flags) {
|
vfunc_allocate(dialogBox) {
|
||||||
this.set_allocation(dialogBox, flags);
|
this.set_allocation(dialogBox);
|
||||||
|
|
||||||
let themeNode = this.get_theme_node();
|
let themeNode = this.get_theme_node();
|
||||||
dialogBox = themeNode.get_content_box(dialogBox);
|
dialogBox = themeNode.get_content_box(dialogBox);
|
||||||
@ -719,19 +719,19 @@ var LoginDialog = GObject.registerClass({
|
|||||||
|
|
||||||
// Finally hand out the allocations
|
// Finally hand out the allocations
|
||||||
if (bannerAllocation)
|
if (bannerAllocation)
|
||||||
this._bannerView.allocate(bannerAllocation, flags);
|
this._bannerView.allocate(bannerAllocation);
|
||||||
|
|
||||||
if (authPromptAllocation)
|
if (authPromptAllocation)
|
||||||
this._authPrompt.allocate(authPromptAllocation, flags);
|
this._authPrompt.allocate(authPromptAllocation);
|
||||||
|
|
||||||
if (userSelectionAllocation)
|
if (userSelectionAllocation)
|
||||||
this._userSelectionBox.allocate(userSelectionAllocation, flags);
|
this._userSelectionBox.allocate(userSelectionAllocation);
|
||||||
|
|
||||||
if (logoAllocation)
|
if (logoAllocation)
|
||||||
this._logoBin.allocate(logoAllocation, flags);
|
this._logoBin.allocate(logoAllocation);
|
||||||
|
|
||||||
if (sessionMenuButtonAllocation)
|
if (sessionMenuButtonAllocation)
|
||||||
this._sessionMenuButton.allocate(sessionMenuButtonAllocation, flags);
|
this._sessionMenuButton.allocate(sessionMenuButtonAllocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ensureUserListLoaded() {
|
_ensureUserListLoaded() {
|
||||||
@ -810,12 +810,13 @@ var LoginDialog = GObject.registerClass({
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this._logoBin.destroy_all_children();
|
this._logoBin.destroy_all_children();
|
||||||
if (this._logoFile && this._logoBin.resource_scale > 0) {
|
const [valid, resourceScale] = this._logoBin.get_resource_scale();
|
||||||
|
if (this._logoFile && valid) {
|
||||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||||
this._logoBin.add_child(this._textureCache.load_file_async(this._logoFile,
|
this._logoBin.add_child(this._textureCache.load_file_async(this._logoFile,
|
||||||
-1, _LOGO_ICON_HEIGHT,
|
-1, -1,
|
||||||
scaleFactor,
|
scaleFactor,
|
||||||
this._logoBin.resource_scale));
|
resourceScale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* exported BANNER_MESSAGE_KEY, BANNER_MESSAGE_TEXT_KEY, LOGO_KEY,
|
/* exported BANNER_MESSAGE_KEY, BANNER_MESSAGE_TEXT_KEY, LOGO_KEY,
|
||||||
DISABLE_USER_LIST_KEY, fadeInActor, fadeOutActor, cloneAndFadeOutActor */
|
DISABLE_USER_LIST_KEY, fadeInActor, fadeOutActor, cloneAndFadeOutActor */
|
||||||
|
|
||||||
const { Clutter, Gio, GLib } = imports.gi;
|
const { Clutter, Gdm, Gio, GLib } = imports.gi;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Batch = imports.gdm.batch;
|
const Batch = imports.gdm.batch;
|
||||||
@ -12,6 +12,15 @@ const Main = imports.ui.main;
|
|||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const SmartcardManager = imports.misc.smartcardManager;
|
const SmartcardManager = imports.misc.smartcardManager;
|
||||||
|
|
||||||
|
Gio._promisify(Gdm.Client.prototype,
|
||||||
|
'open_reauthentication_channel', 'open_reauthentication_channel_finish');
|
||||||
|
Gio._promisify(Gdm.Client.prototype,
|
||||||
|
'get_user_verifier', 'get_user_verifier_finish');
|
||||||
|
Gio._promisify(Gdm.UserVerifierProxy.prototype,
|
||||||
|
'call_begin_verification_for_user', 'call_begin_verification_for_user_finish');
|
||||||
|
Gio._promisify(Gdm.UserVerifierProxy.prototype,
|
||||||
|
'call_begin_verification', 'call_begin_verification_finish');
|
||||||
|
|
||||||
var PASSWORD_SERVICE_NAME = 'gdm-password';
|
var PASSWORD_SERVICE_NAME = 'gdm-password';
|
||||||
var FINGERPRINT_SERVICE_NAME = 'gdm-fingerprint';
|
var FINGERPRINT_SERVICE_NAME = 'gdm-fingerprint';
|
||||||
var SMARTCARD_SERVICE_NAME = 'gdm-smartcard';
|
var SMARTCARD_SERVICE_NAME = 'gdm-smartcard';
|
||||||
@ -168,14 +177,12 @@ var ShellUserVerifier = class {
|
|||||||
|
|
||||||
this._checkForFingerprintReader();
|
this._checkForFingerprintReader();
|
||||||
|
|
||||||
if (userName) {
|
// If possible, reauthenticate an already running session,
|
||||||
// If possible, reauthenticate an already running session,
|
// so any session specific credentials get updated appropriately
|
||||||
// so any session specific credentials get updated appropriately
|
if (userName)
|
||||||
this._client.open_reauthentication_channel(userName, this._cancellable,
|
this._openReauthenticationChannel(userName);
|
||||||
this._reauthenticationChannelOpened.bind(this));
|
else
|
||||||
} else {
|
this._getUserVerifier();
|
||||||
this._client.get_user_verifier(this._cancellable, this._userVerifierGot.bind(this));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
@ -339,10 +346,11 @@ var ShellUserVerifier = class {
|
|||||||
this._verificationFailed(false);
|
this._verificationFailed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_reauthenticationChannelOpened(client, result) {
|
async _openReauthenticationChannel(userName) {
|
||||||
try {
|
try {
|
||||||
this._clearUserVerifier();
|
this._clearUserVerifier();
|
||||||
this._userVerifier = client.open_reauthentication_channel_finish(result);
|
this._userVerifier = await this._client.open_reauthentication_channel(
|
||||||
|
userName, this._cancellable);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
return;
|
return;
|
||||||
@ -351,8 +359,7 @@ var ShellUserVerifier = class {
|
|||||||
// Gdm emits org.freedesktop.DBus.Error.AccessDenied when there
|
// Gdm emits org.freedesktop.DBus.Error.AccessDenied when there
|
||||||
// is no session to reauthenticate. Fall back to performing
|
// is no session to reauthenticate. Fall back to performing
|
||||||
// verification from this login session
|
// verification from this login session
|
||||||
client.get_user_verifier(this._cancellable,
|
this._getUserVerifier();
|
||||||
this._userVerifierGot.bind(this));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,10 +373,11 @@ var ShellUserVerifier = class {
|
|||||||
this._hold.release();
|
this._hold.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
_userVerifierGot(client, result) {
|
async _getUserVerifier() {
|
||||||
try {
|
try {
|
||||||
this._clearUserVerifier();
|
this._clearUserVerifier();
|
||||||
this._userVerifier = client.get_user_verifier_finish(result);
|
this._userVerifier =
|
||||||
|
await this._client.get_user_verifier(this._cancellable);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
return;
|
return;
|
||||||
@ -421,35 +429,25 @@ var ShellUserVerifier = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_startService(serviceName) {
|
async _startService(serviceName) {
|
||||||
this._hold.acquire();
|
this._hold.acquire();
|
||||||
if (this._userName) {
|
try {
|
||||||
this._userVerifier.call_begin_verification_for_user(serviceName, this._userName, this._cancellable, (obj, result) => {
|
if (this._userName) {
|
||||||
try {
|
await this._userVerifier.call_begin_verification_for_user(
|
||||||
obj.call_begin_verification_for_user_finish(result);
|
serviceName, this._userName, this._cancellable);
|
||||||
} catch (e) {
|
} else {
|
||||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
await this._userVerifier.call_begin_verification(
|
||||||
return;
|
serviceName, this._cancellable);
|
||||||
this._reportInitError('Failed to start verification for user', e);
|
}
|
||||||
return;
|
} catch (e) {
|
||||||
}
|
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
|
return;
|
||||||
this._hold.release();
|
this._reportInitError(this._userName
|
||||||
});
|
? 'Failed to start verification for user'
|
||||||
} else {
|
: 'Failed to start verification', e);
|
||||||
this._userVerifier.call_begin_verification(serviceName, this._cancellable, (obj, result) => {
|
return;
|
||||||
try {
|
|
||||||
obj.call_begin_verification_finish(result);
|
|
||||||
} catch (e) {
|
|
||||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
|
||||||
return;
|
|
||||||
this._reportInitError('Failed to start verification', e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._hold.release();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
this._hold.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
_beginVerification() {
|
_beginVerification() {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
<file>misc/modemManager.js</file>
|
<file>misc/modemManager.js</file>
|
||||||
<file>misc/objectManager.js</file>
|
<file>misc/objectManager.js</file>
|
||||||
<file>misc/params.js</file>
|
<file>misc/params.js</file>
|
||||||
|
<file>misc/parentalControlsManager.js</file>
|
||||||
<file>misc/permissionStore.js</file>
|
<file>misc/permissionStore.js</file>
|
||||||
<file>misc/smartcardManager.js</file>
|
<file>misc/smartcardManager.js</file>
|
||||||
<file>misc/systemActions.js</file>
|
<file>misc/systemActions.js</file>
|
||||||
@ -101,7 +102,6 @@
|
|||||||
<file>ui/swipeTracker.js</file>
|
<file>ui/swipeTracker.js</file>
|
||||||
<file>ui/switcherPopup.js</file>
|
<file>ui/switcherPopup.js</file>
|
||||||
<file>ui/switchMonitor.js</file>
|
<file>ui/switchMonitor.js</file>
|
||||||
<file>ui/tweener.js</file>
|
|
||||||
<file>ui/unlockDialog.js</file>
|
<file>ui/unlockDialog.js</file>
|
||||||
<file>ui/userWidget.js</file>
|
<file>ui/userWidget.js</file>
|
||||||
<file>ui/viewSelector.js</file>
|
<file>ui/viewSelector.js</file>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
subdir('misc')
|
subdir('misc')
|
||||||
|
subdir('dbusServices')
|
||||||
|
|
||||||
js_resources = gnome.compile_resources(
|
js_resources = gnome.compile_resources(
|
||||||
'js-resources', 'js-resources.gresource.xml',
|
'js-resources', 'js-resources.gresource.xml',
|
||||||
@ -13,10 +14,3 @@ portal_resources = gnome.compile_resources(
|
|||||||
c_name: 'portal_js_resources',
|
c_name: 'portal_js_resources',
|
||||||
dependencies: [config_js]
|
dependencies: [config_js]
|
||||||
)
|
)
|
||||||
|
|
||||||
prefs_resources = gnome.compile_resources(
|
|
||||||
'prefs-resources', 'prefs-resources.gresource.xml',
|
|
||||||
source_dir: ['.', meson.current_build_dir()],
|
|
||||||
c_name: 'prefs_js_resources',
|
|
||||||
dependencies: [config_js]
|
|
||||||
)
|
|
||||||
|
@ -15,6 +15,5 @@ var LOCALEDIR = '@datadir@/locale';
|
|||||||
/* other standard directories */
|
/* other standard directories */
|
||||||
var LIBEXECDIR = '@libexecdir@';
|
var LIBEXECDIR = '@libexecdir@';
|
||||||
var PKGDATADIR = '@datadir@/@PACKAGE_NAME@';
|
var PKGDATADIR = '@datadir@/@PACKAGE_NAME@';
|
||||||
var VPNDIR = '@vpndir@';
|
|
||||||
/* g-i package versions */
|
/* g-i package versions */
|
||||||
var LIBMUTTER_API_VERSION = '@LIBMUTTER_API_VERSION@'
|
var LIBMUTTER_API_VERSION = '@LIBMUTTER_API_VERSION@'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported ExtensionState, ExtensionType, getCurrentExtension,
|
/* exported ExtensionState, ExtensionType, getCurrentExtension,
|
||||||
getSettings, initTranslations, isOutOfDate, installImporter,
|
getSettings, initTranslations, openPrefs, isOutOfDate,
|
||||||
serializeExtension, deserializeExtension */
|
installImporter, serializeExtension, deserializeExtension */
|
||||||
|
|
||||||
// Common utils for the extension system and the extension
|
// Common utils for the extension system and the extension
|
||||||
// preferences tool
|
// preferences tool
|
||||||
@ -153,6 +153,27 @@ function getSettings(schema) {
|
|||||||
return new Gio.Settings({ settings_schema: schemaObj });
|
return new Gio.Settings({ settings_schema: schemaObj });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openPrefs:
|
||||||
|
*
|
||||||
|
* Open the preference dialog of the current extension
|
||||||
|
*/
|
||||||
|
function openPrefs() {
|
||||||
|
const extension = getCurrentExtension();
|
||||||
|
|
||||||
|
if (!extension)
|
||||||
|
throw new Error('openPrefs() can only be called from extensions');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const extensionManager = imports.ui.main.extensionManager;
|
||||||
|
extensionManager.openExtensionPrefs(extension.uuid, '', {});
|
||||||
|
} catch (e) {
|
||||||
|
if (e.name === 'ImportError')
|
||||||
|
throw new Error('openPrefs() cannot be called from preferences');
|
||||||
|
logError(e, 'Failed to open extension preferences');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* versionCheck:
|
* versionCheck:
|
||||||
* @param {string[]} required - an array of versions we're compatible with
|
* @param {string[]} required - an array of versions we're compatible with
|
||||||
|
@ -76,19 +76,15 @@ function loadInterfaceXML(iface) {
|
|||||||
_ifaceResource._register();
|
_ifaceResource._register();
|
||||||
}
|
}
|
||||||
|
|
||||||
let xml = null;
|
|
||||||
let uri = `resource:///org/gnome/shell/dbus-interfaces/${iface}.xml`;
|
let uri = `resource:///org/gnome/shell/dbus-interfaces/${iface}.xml`;
|
||||||
let f = Gio.File.new_for_uri(uri);
|
let f = Gio.File.new_for_uri(uri);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let [ok_, bytes] = f.load_contents(null);
|
let [ok_, bytes] = f.load_contents(null);
|
||||||
if (bytes instanceof Uint8Array)
|
return imports.byteArray.toString(bytes);
|
||||||
xml = imports.byteArray.toString(bytes);
|
|
||||||
else
|
|
||||||
xml = bytes.toString();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(`Failed to load D-Bus interface ${iface}`);
|
log(`Failed to load D-Bus interface ${iface}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return xml;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported getIBusManager */
|
/* exported getIBusManager */
|
||||||
|
|
||||||
const { Gio, GLib, IBus } = imports.gi;
|
const { Gio, GLib, IBus, Meta } = imports.gi;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const IBusCandidatePopup = imports.ui.ibusCandidatePopup;
|
const IBusCandidatePopup = imports.ui.ibusCandidatePopup;
|
||||||
|
|
||||||
|
Gio._promisify(IBus.Bus.prototype,
|
||||||
|
'list_engines_async', 'list_engines_async_finish');
|
||||||
|
Gio._promisify(IBus.Bus.prototype,
|
||||||
|
'request_name_async', 'request_name_async_finish');
|
||||||
|
Gio._promisify(IBus.Bus.prototype,
|
||||||
|
'get_global_engine_async', 'get_global_engine_async_finish');
|
||||||
|
Gio._promisify(IBus.Bus.prototype,
|
||||||
|
'set_global_engine_async', 'set_global_engine_async_finish');
|
||||||
|
|
||||||
// Ensure runtime version matches
|
// Ensure runtime version matches
|
||||||
_checkIBusVersion(1, 5, 2);
|
_checkIBusVersion(1, 5, 2);
|
||||||
|
|
||||||
@ -55,13 +64,18 @@ var IBusManager = class {
|
|||||||
this._ibus.set_watch_ibus_signal(true);
|
this._ibus.set_watch_ibus_signal(true);
|
||||||
this._ibus.connect('global-engine-changed', this._engineChanged.bind(this));
|
this._ibus.connect('global-engine-changed', this._engineChanged.bind(this));
|
||||||
|
|
||||||
this._spawn();
|
this._spawn(Meta.is_wayland_compositor() ? [] : ['--xim']);
|
||||||
}
|
}
|
||||||
|
|
||||||
_spawn(extraArgs = []) {
|
_spawn(extraArgs = []) {
|
||||||
try {
|
try {
|
||||||
let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs];
|
let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs];
|
||||||
Gio.Subprocess.new(cmdLine, Gio.SubprocessFlags.NONE);
|
let launcher = Gio.SubprocessLauncher.new(Gio.SubprocessFlags.NONE);
|
||||||
|
// Forward the right X11 Display for ibus-x11
|
||||||
|
let display = GLib.getenv('GNOME_SETUP_DISPLAY');
|
||||||
|
if (display)
|
||||||
|
launcher.setenv('DISPLAY', display, true);
|
||||||
|
launcher.spawnv(cmdLine);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(`Failed to launch ibus-daemon: ${e.message}`);
|
log(`Failed to launch ibus-daemon: ${e.message}`);
|
||||||
}
|
}
|
||||||
@ -97,16 +111,14 @@ var IBusManager = class {
|
|||||||
|
|
||||||
_onConnected() {
|
_onConnected() {
|
||||||
this._cancellable = new Gio.Cancellable();
|
this._cancellable = new Gio.Cancellable();
|
||||||
this._ibus.list_engines_async(-1, this._cancellable,
|
this._initEngines();
|
||||||
this._initEngines.bind(this));
|
this._initPanelService();
|
||||||
this._ibus.request_name_async(IBus.SERVICE_PANEL,
|
|
||||||
IBus.BusNameFlag.REPLACE_EXISTING, -1, this._cancellable,
|
|
||||||
this._initPanelService.bind(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_initEngines(ibus, result) {
|
async _initEngines() {
|
||||||
try {
|
try {
|
||||||
let enginesList = this._ibus.list_engines_async_finish(result);
|
const enginesList =
|
||||||
|
await this._ibus.list_engines_async(-1, this._cancellable);
|
||||||
for (let i = 0; i < enginesList.length; ++i) {
|
for (let i = 0; i < enginesList.length; ++i) {
|
||||||
let name = enginesList[i].get_name();
|
let name = enginesList[i].get_name();
|
||||||
this._engines.set(name, enginesList[i]);
|
this._engines.set(name, enginesList[i]);
|
||||||
@ -121,56 +133,52 @@ var IBusManager = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_initPanelService(ibus, result) {
|
async _initPanelService() {
|
||||||
let success = false;
|
|
||||||
try {
|
try {
|
||||||
success = !!this._ibus.request_name_async_finish(result);
|
await this._ibus.request_name_async(IBus.SERVICE_PANEL,
|
||||||
|
IBus.BusNameFlag.REPLACE_EXISTING, -1, this._cancellable);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||||
return;
|
logError(e);
|
||||||
logError(e);
|
this._clear();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
this._panelService = new IBus.PanelService({
|
||||||
this._panelService = new IBus.PanelService({ connection: this._ibus.get_connection(),
|
connection: this._ibus.get_connection(),
|
||||||
object_path: IBus.PATH_PANEL });
|
object_path: IBus.PATH_PANEL,
|
||||||
this._candidatePopup.setPanelService(this._panelService);
|
});
|
||||||
this._panelService.connect('update-property', this._updateProperty.bind(this));
|
this._candidatePopup.setPanelService(this._panelService);
|
||||||
this._panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
this._panelService.connect('update-property', this._updateProperty.bind(this));
|
||||||
let cursorLocation = { x, y, width: w, height: h };
|
this._panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
||||||
this.emit('set-cursor-location', cursorLocation);
|
let cursorLocation = { x, y, width: w, height: h };
|
||||||
});
|
this.emit('set-cursor-location', cursorLocation);
|
||||||
this._panelService.connect('focus-in', (panel, path) => {
|
});
|
||||||
if (!GLib.str_has_suffix(path, '/InputContext_1'))
|
this._panelService.connect('focus-in', (panel, path) => {
|
||||||
this.emit('focus-in');
|
if (!GLib.str_has_suffix(path, '/InputContext_1'))
|
||||||
});
|
this.emit('focus-in');
|
||||||
this._panelService.connect('focus-out', () => this.emit('focus-out'));
|
});
|
||||||
|
this._panelService.connect('focus-out', () => this.emit('focus-out'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// IBus versions older than 1.5.10 have a bug which
|
// IBus versions older than 1.5.10 have a bug which
|
||||||
// causes spurious set-content-type emissions when
|
// causes spurious set-content-type emissions when
|
||||||
// switching input focus that temporarily lose purpose
|
// switching input focus that temporarily lose purpose
|
||||||
// and hints defeating its intended semantics and
|
// and hints defeating its intended semantics and
|
||||||
// confusing users. We thus don't use it in that case.
|
// confusing users. We thus don't use it in that case.
|
||||||
_checkIBusVersion(1, 5, 10);
|
_checkIBusVersion(1, 5, 10);
|
||||||
this._panelService.connect('set-content-type', this._setContentType.bind(this));
|
this._panelService.connect('set-content-type', this._setContentType.bind(this));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
this._updateReadiness();
|
||||||
|
|
||||||
|
try {
|
||||||
// If an engine is already active we need to get its properties
|
// If an engine is already active we need to get its properties
|
||||||
this._ibus.get_global_engine_async(-1, this._cancellable, (_bus, res) => {
|
const engine =
|
||||||
let engine;
|
await this._ibus.get_global_engine_async(-1, this._cancellable);
|
||||||
try {
|
this._engineChanged(this._ibus, engine.get_name());
|
||||||
engine = this._ibus.get_global_engine_async_finish(res);
|
} catch (e) {
|
||||||
if (!engine)
|
|
||||||
return;
|
|
||||||
} catch (e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._engineChanged(this._ibus, engine.get_name());
|
|
||||||
});
|
|
||||||
this._updateReadiness();
|
|
||||||
} else {
|
|
||||||
this._clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +227,7 @@ var IBusManager = class {
|
|||||||
return this._engines.get(id);
|
return this._engines.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
setEngine(id, callback) {
|
async setEngine(id, callback) {
|
||||||
// Send id even if id == this._currentEngineName
|
// Send id even if id == this._currentEngineName
|
||||||
// because 'properties-registered' signal can be emitted
|
// because 'properties-registered' signal can be emitted
|
||||||
// while this._ibusSources == null on a lock screen.
|
// while this._ibusSources == null on a lock screen.
|
||||||
@ -229,18 +237,16 @@ var IBusManager = class {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._ibus.set_global_engine_async(id,
|
try {
|
||||||
this._MAX_INPUT_SOURCE_ACTIVATION_TIME,
|
await this._ibus.set_global_engine_async(id,
|
||||||
this._cancellable, (_bus, res) => {
|
this._MAX_INPUT_SOURCE_ACTIVATION_TIME,
|
||||||
try {
|
this._cancellable);
|
||||||
this._ibus.set_global_engine_async_finish(res);
|
} catch (e) {
|
||||||
} catch (e) {
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
logError(e);
|
||||||
logError(e);
|
}
|
||||||
}
|
if (callback)
|
||||||
if (callback)
|
callback();
|
||||||
callback();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preloadEngines(ids) {
|
preloadEngines(ids) {
|
||||||
|
@ -4,6 +4,9 @@ const { Clutter, GLib, Gio, GObject, IBus } = imports.gi;
|
|||||||
|
|
||||||
const Keyboard = imports.ui.status.keyboard;
|
const Keyboard = imports.ui.status.keyboard;
|
||||||
|
|
||||||
|
Gio._promisify(IBus.Bus.prototype,
|
||||||
|
'create_input_context_async', 'create_input_context_async_finish');
|
||||||
|
|
||||||
var HIDE_PANEL_TIME = 50;
|
var HIDE_PANEL_TIME = 50;
|
||||||
|
|
||||||
var InputMethod = GObject.registerClass(
|
var InputMethod = GObject.registerClass(
|
||||||
@ -46,15 +49,11 @@ class InputMethod extends Clutter.InputMethod {
|
|||||||
this._currentSource = this._inputSourceManager.currentSource;
|
this._currentSource = this._inputSourceManager.currentSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onConnected() {
|
async _onConnected() {
|
||||||
this._cancellable = new Gio.Cancellable();
|
this._cancellable = new Gio.Cancellable();
|
||||||
this._ibus.create_input_context_async('gnome-shell', -1,
|
|
||||||
this._cancellable, this._setContext.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
_setContext(bus, res) {
|
|
||||||
try {
|
try {
|
||||||
this._context = this._ibus.create_input_context_async_finish(res);
|
this._context = await this._ibus.create_input_context_async(
|
||||||
|
'gnome-shell', -1, this._cancellable);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||||
logError(e);
|
logError(e);
|
||||||
@ -97,8 +96,13 @@ class InputMethod extends Clutter.InputMethod {
|
|||||||
this.commit(text.get_text());
|
this.commit(text.get_text());
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDeleteSurroundingText() {
|
_onDeleteSurroundingText(_context, offset, nchars) {
|
||||||
this.delete_surrounding();
|
try {
|
||||||
|
this.delete_surrounding(offset, nchars);
|
||||||
|
} catch (e) {
|
||||||
|
// We may get out of bounds for negative offset on older mutter
|
||||||
|
this.delete_surrounding(0, nchars + offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onUpdatePreeditText(_context, text, pos, visible) {
|
_onUpdatePreeditText(_context, text, pos, visible) {
|
||||||
|
@ -24,8 +24,7 @@ function getCompletions(text, commandHeader, globalCompletionList) {
|
|||||||
[expr_, base, attrHead] = matches;
|
[expr_, base, attrHead] = matches;
|
||||||
|
|
||||||
methods = getPropertyNamesFromExpression(base, commandHeader).filter(
|
methods = getPropertyNamesFromExpression(base, commandHeader).filter(
|
||||||
attr => attr.slice(0, attrHead.length) == attrHead
|
attr => attr.slice(0, attrHead.length) === attrHead);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for the empty expression or partially entered words
|
// Look for the empty expression or partially entered words
|
||||||
@ -34,8 +33,7 @@ function getCompletions(text, commandHeader, globalCompletionList) {
|
|||||||
if (text == '' || matches) {
|
if (text == '' || matches) {
|
||||||
[expr_, attrHead] = matches;
|
[expr_, attrHead] = matches;
|
||||||
methods = globalCompletionList.filter(
|
methods = globalCompletionList.filter(
|
||||||
attr => attr.slice(0, attrHead.length) == attrHead
|
attr => attr.slice(0, attrHead.length) === attrHead);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported getKeyboardManager, holdKeyboard, releaseKeyboard */
|
/* exported getKeyboardManager, holdKeyboard, releaseKeyboard */
|
||||||
|
|
||||||
const { GLib, GnomeDesktop, Meta } = imports.gi;
|
const { GLib, GnomeDesktop } = imports.gi;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
@ -62,11 +62,11 @@ var KeyboardManager = class {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this._currentKeymap = { layouts, variants, options };
|
this._currentKeymap = { layouts, variants, options };
|
||||||
Meta.get_backend().set_keymap(layouts, variants, options);
|
global.backend.set_keymap(layouts, variants, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
_applyLayoutGroupIndex(idx) {
|
_applyLayoutGroupIndex(idx) {
|
||||||
Meta.get_backend().lock_layout_group(idx);
|
global.backend.lock_layout_group(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(id) {
|
apply(id) {
|
||||||
|
@ -50,25 +50,22 @@ function canLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function registerSessionWithGDM() {
|
async function registerSessionWithGDM() {
|
||||||
log("Registering session with GDM");
|
log("Registering session with GDM");
|
||||||
Gio.DBus.system.call('org.gnome.DisplayManager',
|
try {
|
||||||
'/org/gnome/DisplayManager/Manager',
|
await Gio.DBus.system.call(
|
||||||
'org.gnome.DisplayManager.Manager',
|
'org.gnome.DisplayManager',
|
||||||
'RegisterSession',
|
'/org/gnome/DisplayManager/Manager',
|
||||||
GLib.Variant.new('(a{sv})', [{}]), null,
|
'org.gnome.DisplayManager.Manager',
|
||||||
Gio.DBusCallFlags.NONE, -1, null,
|
'RegisterSession',
|
||||||
(source, result) => {
|
GLib.Variant.new('(a{sv})', [{}]), null,
|
||||||
try {
|
Gio.DBusCallFlags.NONE, -1, null);
|
||||||
source.call_finish(result);
|
} catch (e) {
|
||||||
} catch (e) {
|
if (!e.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_METHOD))
|
||||||
if (!e.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_METHOD))
|
log(`Error registering session with GDM: ${e.message}`);
|
||||||
log(`Error registering session with GDM: ${e.message}`);
|
else
|
||||||
else
|
log('Not calling RegisterSession(): method not exported, GDM too old?');
|
||||||
log("Not calling RegisterSession(): method not exported, GDM too old?");
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let _loginManager = null;
|
let _loginManager = null;
|
||||||
@ -174,24 +171,19 @@ var LoginManagerSystemd = class {
|
|||||||
this._proxy.SuspendRemote(true);
|
this._proxy.SuspendRemote(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
inhibit(reason, callback) {
|
async inhibit(reason, callback) {
|
||||||
let inVariant = GLib.Variant.new('(ssss)',
|
try {
|
||||||
['sleep',
|
const inVariant = new GLib.Variant('(ssss)',
|
||||||
'GNOME Shell',
|
['sleep', 'GNOME Shell', reason, 'delay']);
|
||||||
reason,
|
const [outVariant_, fdList] =
|
||||||
'delay']);
|
await this._proxy.call_with_unix_fd_list('Inhibit',
|
||||||
this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null,
|
inVariant, 0, -1, null, null);
|
||||||
(proxy, result) => {
|
const [fd] = fdList.steal_fds();
|
||||||
let fd = -1;
|
callback(new Gio.UnixInputStream({ fd }));
|
||||||
try {
|
} catch (e) {
|
||||||
let [outVariant_, fdList] = proxy.call_with_unix_fd_list_finish(result);
|
logError(e, 'Error getting systemd inhibitor');
|
||||||
fd = fdList.steal_fds()[0];
|
callback(null);
|
||||||
callback(new Gio.UnixInputStream({ fd }));
|
}
|
||||||
} catch (e) {
|
|
||||||
logError(e, "Error getting systemd inhibitor");
|
|
||||||
callback(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
|
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
|
||||||
|
@ -7,7 +7,6 @@ jsconf.set10('HAVE_BLUETOOTH', bt_dep.found())
|
|||||||
jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager)
|
jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager)
|
||||||
jsconf.set('datadir', datadir)
|
jsconf.set('datadir', datadir)
|
||||||
jsconf.set('libexecdir', libexecdir)
|
jsconf.set('libexecdir', libexecdir)
|
||||||
jsconf.set('vpndir', vpndir)
|
|
||||||
|
|
||||||
config_js = configure_file(
|
config_js = configure_file(
|
||||||
input: 'config.js.in',
|
input: 'config.js.in',
|
||||||
|
@ -223,7 +223,7 @@ var BroadbandModem = GObject.registerClass({
|
|||||||
}, class BroadbandModem extends ModemBase {
|
}, class BroadbandModem extends ModemBase {
|
||||||
_init(path, capabilities) {
|
_init(path, capabilities) {
|
||||||
super._init({ capabilities });
|
super._init({ capabilities });
|
||||||
this._proxy = new BroadbandModemProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
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_3gpp = new BroadbandModem3gppProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||||
this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ var BroadbandModem = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_reloadSignalQuality() {
|
_reloadSignalQuality() {
|
||||||
let [quality, recent_] = this.SignalQuality;
|
let [quality, recent_] = this._proxy.SignalQuality;
|
||||||
this._setSignalQuality(quality);
|
this._setSignalQuality(quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,7 @@ var ObjectManager = class {
|
|||||||
// Start out inhibiting load until at least the proxy
|
// Start out inhibiting load until at least the proxy
|
||||||
// manager is loaded and the remote objects are fetched
|
// manager is loaded and the remote objects are fetched
|
||||||
this._numLoadInhibitors = 1;
|
this._numLoadInhibitors = 1;
|
||||||
this._managerProxy.init_async(GLib.PRIORITY_DEFAULT,
|
this._initManagerProxy();
|
||||||
this._cancellable,
|
|
||||||
this._onManagerProxyLoaded.bind(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_tryToCompleteLoad() {
|
_tryToCompleteLoad() {
|
||||||
@ -73,7 +71,7 @@ var ObjectManager = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_addInterface(objectPath, interfaceName, onFinished) {
|
async _addInterface(objectPath, interfaceName, onFinished) {
|
||||||
let info = this._interfaceInfos[interfaceName];
|
let info = this._interfaceInfos[interfaceName];
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@ -89,40 +87,38 @@ var ObjectManager = class {
|
|||||||
g_interface_info: info,
|
g_interface_info: info,
|
||||||
g_flags: Gio.DBusProxyFlags.DO_NOT_AUTO_START });
|
g_flags: Gio.DBusProxyFlags.DO_NOT_AUTO_START });
|
||||||
|
|
||||||
proxy.init_async(GLib.PRIORITY_DEFAULT, this._cancellable, (initable, result) => {
|
try {
|
||||||
try {
|
await proxy.init_async(GLib.PRIORITY_DEFAULT, this._cancellable);
|
||||||
initable.init_finish(result);
|
} catch (e) {
|
||||||
} catch (e) {
|
logError(e, `could not initialize proxy for interface ${interfaceName}`);
|
||||||
logError(e, `could not initialize proxy for interface ${interfaceName}`);
|
|
||||||
|
|
||||||
if (onFinished)
|
|
||||||
onFinished();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let isNewObject;
|
|
||||||
if (!this._objects[objectPath]) {
|
|
||||||
this._objects[objectPath] = {};
|
|
||||||
isNewObject = true;
|
|
||||||
} else {
|
|
||||||
isNewObject = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._objects[objectPath][interfaceName] = proxy;
|
|
||||||
|
|
||||||
if (!this._interfaces[interfaceName])
|
|
||||||
this._interfaces[interfaceName] = [];
|
|
||||||
|
|
||||||
this._interfaces[interfaceName].push(proxy);
|
|
||||||
|
|
||||||
if (isNewObject)
|
|
||||||
this.emit('object-added', objectPath);
|
|
||||||
|
|
||||||
this.emit('interface-added', interfaceName, proxy);
|
|
||||||
|
|
||||||
if (onFinished)
|
if (onFinished)
|
||||||
onFinished();
|
onFinished();
|
||||||
});
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let isNewObject;
|
||||||
|
if (!this._objects[objectPath]) {
|
||||||
|
this._objects[objectPath] = {};
|
||||||
|
isNewObject = true;
|
||||||
|
} else {
|
||||||
|
isNewObject = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._objects[objectPath][interfaceName] = proxy;
|
||||||
|
|
||||||
|
if (!this._interfaces[interfaceName])
|
||||||
|
this._interfaces[interfaceName] = [];
|
||||||
|
|
||||||
|
this._interfaces[interfaceName].push(proxy);
|
||||||
|
|
||||||
|
if (isNewObject)
|
||||||
|
this.emit('object-added', objectPath);
|
||||||
|
|
||||||
|
this.emit('interface-added', interfaceName, proxy);
|
||||||
|
|
||||||
|
if (onFinished)
|
||||||
|
onFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
_removeInterface(objectPath, interfaceName) {
|
_removeInterface(objectPath, interfaceName) {
|
||||||
@ -151,9 +147,10 @@ var ObjectManager = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onManagerProxyLoaded(initable, result) {
|
async _initManagerProxy() {
|
||||||
try {
|
try {
|
||||||
initable.init_finish(result);
|
await this._managerProxy.init_async(
|
||||||
|
GLib.PRIORITY_DEFAULT, this._cancellable);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logError(e, `could not initialize object manager for object ${this._serviceName}`);
|
logError(e, `could not initialize object manager for object ${this._serviceName}`);
|
||||||
|
|
||||||
|
146
js/misc/parentalControlsManager.js
Normal file
146
js/misc/parentalControlsManager.js
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
//
|
||||||
|
// Copyright (C) 2018, 2019, 2020 Endless Mobile, Inc.
|
||||||
|
//
|
||||||
|
// This is a GNOME Shell component to wrap the interactions over
|
||||||
|
// D-Bus with the malcontent library.
|
||||||
|
//
|
||||||
|
// Licensed under the GNU General Public License Version 2
|
||||||
|
//
|
||||||
|
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
/* exported getDefault */
|
||||||
|
|
||||||
|
const { Gio, GObject, Shell } = imports.gi;
|
||||||
|
|
||||||
|
// We require libmalcontent ≥ 0.6.0
|
||||||
|
const HAVE_MALCONTENT = imports.package.checkSymbol(
|
||||||
|
'Malcontent', '0', 'ManagerGetValueFlags');
|
||||||
|
|
||||||
|
var Malcontent = null;
|
||||||
|
if (HAVE_MALCONTENT) {
|
||||||
|
Malcontent = imports.gi.Malcontent;
|
||||||
|
Gio._promisify(Malcontent.Manager.prototype, 'get_app_filter_async', 'get_app_filter_finish');
|
||||||
|
}
|
||||||
|
|
||||||
|
let _singleton = null;
|
||||||
|
|
||||||
|
function getDefault() {
|
||||||
|
if (_singleton === null)
|
||||||
|
_singleton = new ParentalControlsManager();
|
||||||
|
|
||||||
|
return _singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A manager class which provides cached access to the constructing user’s
|
||||||
|
// parental controls settings. It’s possible for the user’s parental controls
|
||||||
|
// to change at runtime if the Parental Controls application is used by an
|
||||||
|
// administrator from within the user’s session.
|
||||||
|
var ParentalControlsManager = GObject.registerClass({
|
||||||
|
Signals: {
|
||||||
|
'app-filter-changed': {},
|
||||||
|
},
|
||||||
|
}, class ParentalControlsManager extends GObject.Object {
|
||||||
|
_init() {
|
||||||
|
super._init();
|
||||||
|
|
||||||
|
this._initialized = false;
|
||||||
|
this._disabled = false;
|
||||||
|
this._appFilter = null;
|
||||||
|
|
||||||
|
this._initializeManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
async _initializeManager() {
|
||||||
|
if (!HAVE_MALCONTENT) {
|
||||||
|
log('Skipping parental controls support as it’s disabled');
|
||||||
|
this._initialized = true;
|
||||||
|
this.emit('app-filter-changed');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log(`Getting parental controls for user ${Shell.util_get_uid()}`);
|
||||||
|
try {
|
||||||
|
const connection = await Gio.DBus.get(Gio.BusType.SYSTEM, null);
|
||||||
|
this._manager = new Malcontent.Manager({ connection });
|
||||||
|
this._appFilter = await this._manager.get_app_filter_async(
|
||||||
|
Shell.util_get_uid(),
|
||||||
|
Malcontent.ManagerGetValueFlags.NONE,
|
||||||
|
null);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.matches(Malcontent.ManagerError, Malcontent.ManagerError.DISABLED)) {
|
||||||
|
log('Parental controls globally disabled');
|
||||||
|
this._disabled = true;
|
||||||
|
} else {
|
||||||
|
logError(e, 'Failed to get parental controls settings');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._manager.connect('app-filter-changed', this._onAppFilterChanged.bind(this));
|
||||||
|
|
||||||
|
// Signal initialisation is complete.
|
||||||
|
this._initialized = true;
|
||||||
|
this.emit('app-filter-changed');
|
||||||
|
}
|
||||||
|
|
||||||
|
async _onAppFilterChanged(manager, uid) {
|
||||||
|
// Emit 'changed' signal only if app-filter is changed for currently logged-in user.
|
||||||
|
let currentUid = Shell.util_get_uid();
|
||||||
|
if (currentUid !== uid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this._appFilter = await this._manager.get_app_filter_async(
|
||||||
|
currentUid,
|
||||||
|
Malcontent.ManagerGetValueFlags.NONE,
|
||||||
|
null);
|
||||||
|
this.emit('app-filter-changed');
|
||||||
|
} catch (e) {
|
||||||
|
// Log an error and keep the old app filter.
|
||||||
|
logError(e, `Failed to get new MctAppFilter for uid ${Shell.util_get_uid()} on app-filter-changed`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get initialized() {
|
||||||
|
return this._initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate whether the given app (a Gio.DesktopAppInfo) should be shown
|
||||||
|
// on the desktop, in search results, etc. The app should be shown if:
|
||||||
|
// - The .desktop file doesn’t say it should be hidden.
|
||||||
|
// - The executable from the .desktop file’s Exec line isn’t blacklisted in
|
||||||
|
// the user’s parental controls.
|
||||||
|
// - None of the flatpak app IDs from the X-Flatpak and the
|
||||||
|
// X-Flatpak-RenamedFrom lines are blacklisted in the user’s parental
|
||||||
|
// controls.
|
||||||
|
shouldShowApp(appInfo) {
|
||||||
|
// Quick decision?
|
||||||
|
if (!appInfo.should_show())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Are parental controls enabled (at configure time or runtime)?
|
||||||
|
if (!HAVE_MALCONTENT || this._disabled)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Have we finished initialising yet?
|
||||||
|
if (!this.initialized) {
|
||||||
|
log(`Warning: Hiding app because parental controls not yet initialised: ${appInfo.get_id()}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._appFilter.is_appinfo_allowed(appInfo);
|
||||||
|
}
|
||||||
|
});
|
@ -83,13 +83,17 @@ const SystemActions = GObject.registerClass({
|
|||||||
this._canHavePowerOff = true;
|
this._canHavePowerOff = true;
|
||||||
this._canHaveSuspend = true;
|
this._canHaveSuspend = true;
|
||||||
|
|
||||||
|
function tokenizeKeywords(keywords) {
|
||||||
|
return keywords.split(';').map(keyword => GLib.str_tokenize_and_fold(keyword, null)).flat(2);
|
||||||
|
}
|
||||||
|
|
||||||
this._actions = new Map();
|
this._actions = new Map();
|
||||||
this._actions.set(POWER_OFF_ACTION_ID, {
|
this._actions.set(POWER_OFF_ACTION_ID, {
|
||||||
// Translators: The name of the power-off action in search
|
// Translators: The name of the power-off action in search
|
||||||
name: C_("search-result", "Power Off"),
|
name: C_("search-result", "Power Off"),
|
||||||
iconName: 'system-shutdown-symbolic',
|
iconName: 'system-shutdown-symbolic',
|
||||||
// Translators: A list of keywords that match the power-off action, separated by semicolons
|
// Translators: A list of keywords that match the power-off action, separated by semicolons
|
||||||
keywords: _('power off;shutdown;reboot;restart;halt;stop').split(/[; ]/),
|
keywords: tokenizeKeywords(_('power off;shutdown;reboot;restart;halt;stop')),
|
||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
this._actions.set(LOCK_SCREEN_ACTION_ID, {
|
this._actions.set(LOCK_SCREEN_ACTION_ID, {
|
||||||
@ -97,15 +101,15 @@ const SystemActions = GObject.registerClass({
|
|||||||
name: C_("search-result", "Lock Screen"),
|
name: C_("search-result", "Lock Screen"),
|
||||||
iconName: 'system-lock-screen-symbolic',
|
iconName: 'system-lock-screen-symbolic',
|
||||||
// Translators: A list of keywords that match the lock screen action, separated by semicolons
|
// Translators: A list of keywords that match the lock screen action, separated by semicolons
|
||||||
keywords: _("lock screen").split(/[; ]/),
|
keywords: tokenizeKeywords(_('lock screen')),
|
||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
this._actions.set(LOGOUT_ACTION_ID, {
|
this._actions.set(LOGOUT_ACTION_ID, {
|
||||||
// Translators: The name of the logout action in search
|
// Translators: The name of the logout action in search
|
||||||
name: C_("search-result", "Log Out"),
|
name: C_("search-result", "Log Out"),
|
||||||
iconName: 'application-exit-symbolic',
|
iconName: 'system-log-out-symbolic',
|
||||||
// Translators: A list of keywords that match the logout action, separated by semicolons
|
// Translators: A list of keywords that match the logout action, separated by semicolons
|
||||||
keywords: _("logout;log out;sign off").split(/[; ]/),
|
keywords: tokenizeKeywords(_('logout;log out;sign off')),
|
||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
this._actions.set(SUSPEND_ACTION_ID, {
|
this._actions.set(SUSPEND_ACTION_ID, {
|
||||||
@ -113,7 +117,7 @@ const SystemActions = GObject.registerClass({
|
|||||||
name: C_("search-result", "Suspend"),
|
name: C_("search-result", "Suspend"),
|
||||||
iconName: 'media-playback-pause-symbolic',
|
iconName: 'media-playback-pause-symbolic',
|
||||||
// Translators: A list of keywords that match the suspend action, separated by semicolons
|
// Translators: A list of keywords that match the suspend action, separated by semicolons
|
||||||
keywords: _("suspend;sleep").split(/[; ]/),
|
keywords: tokenizeKeywords(_('suspend;sleep')),
|
||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
this._actions.set(SWITCH_USER_ACTION_ID, {
|
this._actions.set(SWITCH_USER_ACTION_ID, {
|
||||||
@ -121,14 +125,14 @@ const SystemActions = GObject.registerClass({
|
|||||||
name: C_("search-result", "Switch User"),
|
name: C_("search-result", "Switch User"),
|
||||||
iconName: 'system-switch-user-symbolic',
|
iconName: 'system-switch-user-symbolic',
|
||||||
// Translators: A list of keywords that match the switch user action, separated by semicolons
|
// Translators: A list of keywords that match the switch user action, separated by semicolons
|
||||||
keywords: _("switch user").split(/[; ]/),
|
keywords: tokenizeKeywords(_('switch user')),
|
||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
this._actions.set(LOCK_ORIENTATION_ACTION_ID, {
|
this._actions.set(LOCK_ORIENTATION_ACTION_ID, {
|
||||||
name: '',
|
name: '',
|
||||||
iconName: '',
|
iconName: '',
|
||||||
// Translators: A list of keywords that match the lock orientation action, separated by semicolons
|
// Translators: A list of keywords that match the lock orientation action, separated by semicolons
|
||||||
keywords: _("lock orientation;unlock orientation;screen;rotation").split(/[; ]/),
|
keywords: tokenizeKeywords(_('lock orientation;unlock orientation;screen;rotation')),
|
||||||
available: false,
|
available: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -277,7 +281,7 @@ const SystemActions = GObject.registerClass({
|
|||||||
|
|
||||||
getMatchingActions(terms) {
|
getMatchingActions(terms) {
|
||||||
// terms is a list of strings
|
// terms is a list of strings
|
||||||
terms = terms.map(term => term.toLowerCase());
|
terms = terms.map(term => GLib.str_tokenize_and_fold(term, null)[0]);
|
||||||
|
|
||||||
let results = [];
|
let results = [];
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ const PermissionStore = imports.misc.permissionStore;
|
|||||||
|
|
||||||
const { loadInterfaceXML } = imports.misc.fileUtils;
|
const { loadInterfaceXML } = imports.misc.fileUtils;
|
||||||
|
|
||||||
|
Gio._promisify(Geoclue.Simple, 'new', 'new_finish');
|
||||||
|
|
||||||
const WeatherIntegrationIface = loadInterfaceXML('org.gnome.Shell.WeatherIntegration');
|
const WeatherIntegrationIface = loadInterfaceXML('org.gnome.Shell.WeatherIntegration');
|
||||||
|
|
||||||
const WEATHER_BUS_NAME = 'org.gnome.Weather';
|
const WEATHER_BUS_NAME = 'org.gnome.Weather';
|
||||||
@ -79,16 +81,7 @@ var WeatherClient = class {
|
|||||||
this._weatherApp = null;
|
this._weatherApp = null;
|
||||||
this._weatherProxy = null;
|
this._weatherProxy = null;
|
||||||
|
|
||||||
let nodeInfo = Gio.DBusNodeInfo.new_for_xml(WeatherIntegrationIface);
|
this._createWeatherProxy();
|
||||||
Gio.DBusProxy.new(
|
|
||||||
Gio.DBus.session,
|
|
||||||
Gio.DBusProxyFlags.DO_NOT_AUTO_START | Gio.DBusProxyFlags.GET_INVALIDATED_PROPERTIES,
|
|
||||||
nodeInfo.lookup_interface(WEATHER_INTEGRATION_IFACE),
|
|
||||||
WEATHER_BUS_NAME,
|
|
||||||
WEATHER_OBJECT_PATH,
|
|
||||||
WEATHER_INTEGRATION_IFACE,
|
|
||||||
null,
|
|
||||||
this._onWeatherProxyReady.bind(this));
|
|
||||||
|
|
||||||
this._settings = new Gio.Settings({
|
this._settings = new Gio.Settings({
|
||||||
schema_id: 'org.gnome.shell.weather',
|
schema_id: 'org.gnome.shell.weather',
|
||||||
@ -146,9 +139,17 @@ var WeatherClient = class {
|
|||||||
(!this._needsAuth || this._weatherAuthorized);
|
(!this._needsAuth || this._weatherAuthorized);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onWeatherProxyReady(o, res) {
|
async _createWeatherProxy() {
|
||||||
|
const nodeInfo = Gio.DBusNodeInfo.new_for_xml(WeatherIntegrationIface);
|
||||||
try {
|
try {
|
||||||
this._weatherProxy = Gio.DBusProxy.new_finish(res);
|
this._weatherProxy = await Gio.DBusProxy.new(
|
||||||
|
Gio.DBus.session,
|
||||||
|
Gio.DBusProxyFlags.DO_NOT_AUTO_START | Gio.DBusProxyFlags.GET_INVALIDATED_PROPERTIES,
|
||||||
|
nodeInfo.lookup_interface(WEATHER_INTEGRATION_IFACE),
|
||||||
|
WEATHER_BUS_NAME,
|
||||||
|
WEATHER_OBJECT_PATH,
|
||||||
|
WEATHER_INTEGRATION_IFACE,
|
||||||
|
null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(`Failed to create GNOME Weather proxy: ${e}`);
|
log(`Failed to create GNOME Weather proxy: ${e}`);
|
||||||
return;
|
return;
|
||||||
@ -239,25 +240,23 @@ var WeatherClient = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_startGClueService() {
|
async _startGClueService() {
|
||||||
if (this._gclueStarting)
|
if (this._gclueStarting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._gclueStarting = true;
|
this._gclueStarting = true;
|
||||||
|
|
||||||
Geoclue.Simple.new('org.gnome.Shell', Geoclue.AccuracyLevel.CITY, null,
|
try {
|
||||||
(o, res) => {
|
this._gclueService = await Geoclue.Simple.new(
|
||||||
try {
|
'org.gnome.Shell', Geoclue.AccuracyLevel.CITY, null);
|
||||||
this._gclueService = Geoclue.Simple.new_finish(res);
|
} catch (e) {
|
||||||
} catch (e) {
|
log(`Failed to connect to Geoclue2 service: ${e.message}`);
|
||||||
log(`Failed to connect to Geoclue2 service: ${e.message}`);
|
this._setLocation(this._mostRecentLocation);
|
||||||
this._setLocation(this._mostRecentLocation);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
this._gclueStarted = true;
|
||||||
this._gclueStarted = true;
|
this._gclueService.get_client().distance_threshold = 100;
|
||||||
this._gclueService.get_client().distance_threshold = 100;
|
this._updateLocationMonitoring();
|
||||||
this._updateLocationMonitoring();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onGClueLocationChanged() {
|
_onGClueLocationChanged() {
|
||||||
|
@ -5,6 +5,5 @@
|
|||||||
|
|
||||||
<file>misc/config.js</file>
|
<file>misc/config.js</file>
|
||||||
<file>misc/fileUtils.js</file>
|
<file>misc/fileUtils.js</file>
|
||||||
<file>misc/params.js</file>
|
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<gresources>
|
|
||||||
<gresource prefix="/org/gnome/shell">
|
|
||||||
<file>extensionPrefs/main.js</file>
|
|
||||||
|
|
||||||
<file>misc/config.js</file>
|
|
||||||
<file>misc/extensionUtils.js</file>
|
|
||||||
<file>misc/fileUtils.js</file>
|
|
||||||
<file>misc/params.js</file>
|
|
||||||
|
|
||||||
<file alias="css/application.css">extensionPrefs/css/application.css</file>
|
|
||||||
|
|
||||||
<file alias="ui/extension-row.ui">extensionPrefs/ui/extension-row.ui</file>
|
|
||||||
<file alias="ui/extensions-window.ui">extensionPrefs/ui/extensions-window.ui</file>
|
|
||||||
</gresource>
|
|
||||||
</gresources>
|
|
@ -68,8 +68,8 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
|
|||||||
this._items = this._switcherList.icons;
|
this._items = this._switcherList.icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
super.vfunc_allocate(box, flags);
|
super.vfunc_allocate(box);
|
||||||
|
|
||||||
// Allocate the thumbnails
|
// Allocate the thumbnails
|
||||||
// We try to avoid overflowing the screen so we base the resulting size on
|
// We try to avoid overflowing the screen so we base the resulting size on
|
||||||
@ -102,7 +102,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
|
|||||||
this._thumbnails.addClones(primary.y + primary.height - bottomPadding - childBox.y1);
|
this._thumbnails.addClones(primary.y + primary.height - bottomPadding - childBox.y1);
|
||||||
let [, childNaturalHeight] = this._thumbnails.get_preferred_height(-1);
|
let [, childNaturalHeight] = this._thumbnails.get_preferred_height(-1);
|
||||||
childBox.y2 = childBox.y1 + childNaturalHeight;
|
childBox.y2 = childBox.y1 + childNaturalHeight;
|
||||||
this._thumbnails.allocate(childBox, flags);
|
this._thumbnails.allocate(childBox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,12 +280,10 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
super._onDestroy();
|
|
||||||
|
|
||||||
if (this._thumbnails)
|
|
||||||
this._destroyThumbnails();
|
|
||||||
if (this._thumbnailTimeoutId != 0)
|
if (this._thumbnailTimeoutId != 0)
|
||||||
GLib.source_remove(this._thumbnailTimeoutId);
|
GLib.source_remove(this._thumbnailTimeoutId);
|
||||||
|
|
||||||
|
super._onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -365,8 +363,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
this._thumbnails = null;
|
this._thumbnails = null;
|
||||||
if (this._switcherList._items[this._selectedIndex])
|
this._switcherList.removeAccessibleState(this._selectedIndex, Atk.StateType.EXPANDED);
|
||||||
this._switcherList._items[this._selectedIndex].remove_accessible_state(Atk.StateType.EXPANDED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_createThumbnails() {
|
_createThumbnails() {
|
||||||
@ -395,7 +392,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
this._switcherList._items[this._selectedIndex].add_accessible_state(Atk.StateType.EXPANDED);
|
this._switcherList.addAccessibleState(this._selectedIndex, Atk.StateType.EXPANDED);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -684,8 +681,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
|
|||||||
// Cache the window list now; we don't handle dynamic changes here,
|
// Cache the window list now; we don't handle dynamic changes here,
|
||||||
// and we don't want to be continually retrieving it
|
// and we don't want to be continually retrieving it
|
||||||
appIcon.cachedWindows = allWindows.filter(
|
appIcon.cachedWindows = allWindows.filter(
|
||||||
w => windowTracker.get_window_app(w) == appIcon.app
|
w => windowTracker.get_window_app(w) === appIcon.app);
|
||||||
);
|
|
||||||
if (appIcon.cachedWindows.length > 0)
|
if (appIcon.cachedWindows.length > 0)
|
||||||
this._addIcon(appIcon);
|
this._addIcon(appIcon);
|
||||||
}
|
}
|
||||||
@ -753,9 +749,9 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
|
|||||||
return super.vfunc_get_preferred_height(forWidth);
|
return super.vfunc_get_preferred_height(forWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
// Allocate the main list items
|
// Allocate the main list items
|
||||||
super.vfunc_allocate(box, flags);
|
super.vfunc_allocate(box);
|
||||||
|
|
||||||
let contentBox = this.get_theme_node().get_content_box(box);
|
let contentBox = this.get_theme_node().get_content_box(box);
|
||||||
|
|
||||||
@ -770,13 +766,15 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
|
|||||||
childBox.x2 = childBox.x1 + arrowWidth;
|
childBox.x2 = childBox.x1 + arrowWidth;
|
||||||
childBox.y1 = contentBox.y1 + itemBox.y2 + arrowHeight;
|
childBox.y1 = contentBox.y1 + itemBox.y2 + arrowHeight;
|
||||||
childBox.y2 = childBox.y1 + arrowHeight;
|
childBox.y2 = childBox.y1 + arrowHeight;
|
||||||
this._arrows[i].allocate(childBox, flags);
|
this._arrows[i].allocate(childBox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We override SwitcherList's _onItemEnter method to delay
|
// We override SwitcherList's _onItemEnter method to delay
|
||||||
// activation when the thumbnail list is open
|
// activation when the thumbnail list is open
|
||||||
_onItemEnter(index) {
|
_onItemEnter(item) {
|
||||||
|
const index = this._items.indexOf(item);
|
||||||
|
|
||||||
if (this._mouseTimeOutId != 0)
|
if (this._mouseTimeOutId != 0)
|
||||||
GLib.source_remove(this._mouseTimeOutId);
|
GLib.source_remove(this._mouseTimeOutId);
|
||||||
if (this._altTabPopup.thumbnailsVisible) {
|
if (this._altTabPopup.thumbnailsVisible) {
|
||||||
@ -1058,28 +1056,28 @@ class WindowSwitcher extends SwitcherPopup.SwitcherList {
|
|||||||
return [minHeight, natHeight];
|
return [minHeight, natHeight];
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
let themeNode = this.get_theme_node();
|
let themeNode = this.get_theme_node();
|
||||||
let contentBox = themeNode.get_content_box(box);
|
let contentBox = themeNode.get_content_box(box);
|
||||||
|
const labelHeight = this._label.height;
|
||||||
|
const totalLabelHeight =
|
||||||
|
labelHeight + themeNode.get_padding(St.Side.BOTTOM);
|
||||||
|
|
||||||
let childBox = new Clutter.ActorBox();
|
box.y2 -= totalLabelHeight;
|
||||||
childBox.x1 = contentBox.x1;
|
super.vfunc_allocate(box);
|
||||||
childBox.x2 = contentBox.x2;
|
|
||||||
childBox.y2 = contentBox.y2;
|
|
||||||
childBox.y1 = childBox.y2 - this._label.height;
|
|
||||||
this._label.allocate(childBox, flags);
|
|
||||||
|
|
||||||
let totalLabelHeight = this._label.height + themeNode.get_padding(St.Side.BOTTOM);
|
|
||||||
childBox.x1 = box.x1;
|
|
||||||
childBox.x2 = box.x2;
|
|
||||||
childBox.y1 = box.y1;
|
|
||||||
childBox.y2 = box.y2 - totalLabelHeight;
|
|
||||||
super.vfunc_allocate(childBox, flags);
|
|
||||||
|
|
||||||
// Hooking up the parent vfunc will call this.set_allocation() with
|
// Hooking up the parent vfunc will call this.set_allocation() with
|
||||||
// the height without the label height, so call it again with the
|
// the height without the label height, so call it again with the
|
||||||
// correct size here.
|
// correct size here.
|
||||||
this.set_allocation(box, flags);
|
box.y2 += totalLabelHeight;
|
||||||
|
this.set_allocation(box);
|
||||||
|
|
||||||
|
const childBox = new Clutter.ActorBox();
|
||||||
|
childBox.x1 = contentBox.x1;
|
||||||
|
childBox.x2 = contentBox.x2;
|
||||||
|
childBox.y2 = contentBox.y2;
|
||||||
|
childBox.y1 = childBox.y2 - labelHeight;
|
||||||
|
this._label.allocate(childBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
highlight(index, justOutline) {
|
highlight(index, justOutline) {
|
||||||
|
@ -15,8 +15,7 @@ class Animation extends St.Bin {
|
|||||||
const themeContext = St.ThemeContext.get_for_stage(global.stage);
|
const themeContext = St.ThemeContext.get_for_stage(global.stage);
|
||||||
|
|
||||||
super._init({
|
super._init({
|
||||||
width: width * themeContext.scale_factor,
|
style: `width: ${width}px; height: ${height}px;`,
|
||||||
height: height * themeContext.scale_factor,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.connect('destroy', this._onDestroy.bind(this));
|
this.connect('destroy', this._onDestroy.bind(this));
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@
|
|||||||
/* exported getAppFavorites */
|
/* exported getAppFavorites */
|
||||||
|
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
|
const ParentalControlsManager = imports.misc.parentalControlsManager;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
@ -12,6 +13,7 @@ const RENAMED_DESKTOP_IDS = {
|
|||||||
'cheese.desktop': 'org.gnome.Cheese.desktop',
|
'cheese.desktop': 'org.gnome.Cheese.desktop',
|
||||||
'dconf-editor.desktop': 'ca.desrt.dconf-editor.desktop',
|
'dconf-editor.desktop': 'ca.desrt.dconf-editor.desktop',
|
||||||
'empathy.desktop': 'org.gnome.Empathy.desktop',
|
'empathy.desktop': 'org.gnome.Empathy.desktop',
|
||||||
|
'eog.desktop': 'org.gnome.eog.desktop',
|
||||||
'epiphany.desktop': 'org.gnome.Epiphany.desktop',
|
'epiphany.desktop': 'org.gnome.Epiphany.desktop',
|
||||||
'evolution.desktop': 'org.gnome.Evolution.desktop',
|
'evolution.desktop': 'org.gnome.Evolution.desktop',
|
||||||
'file-roller.desktop': 'org.gnome.FileRoller.desktop',
|
'file-roller.desktop': 'org.gnome.FileRoller.desktop',
|
||||||
@ -64,6 +66,13 @@ const RENAMED_DESKTOP_IDS = {
|
|||||||
|
|
||||||
class AppFavorites {
|
class AppFavorites {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
// Filter the apps through the user’s parental controls.
|
||||||
|
this._parentalControlsManager = ParentalControlsManager.getDefault();
|
||||||
|
this._parentalControlsManager.connect('app-filter-changed', () => {
|
||||||
|
this.reload();
|
||||||
|
this.emit('changed');
|
||||||
|
});
|
||||||
|
|
||||||
this.FAVORITE_APPS_KEY = 'favorite-apps';
|
this.FAVORITE_APPS_KEY = 'favorite-apps';
|
||||||
this._favorites = {};
|
this._favorites = {};
|
||||||
global.settings.connect('changed::%s'.format(this.FAVORITE_APPS_KEY), this._onFavsChanged.bind(this));
|
global.settings.connect('changed::%s'.format(this.FAVORITE_APPS_KEY), this._onFavsChanged.bind(this));
|
||||||
@ -95,7 +104,7 @@ class AppFavorites {
|
|||||||
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
|
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
|
||||||
|
|
||||||
let apps = ids.map(id => appSys.lookup_app(id))
|
let apps = ids.map(id => appSys.lookup_app(id))
|
||||||
.filter(app => app != null);
|
.filter(app => app !== null && this._parentalControlsManager.shouldShowApp(app.app_info));
|
||||||
this._favorites = {};
|
this._favorites = {};
|
||||||
for (let i = 0; i < apps.length; i++) {
|
for (let i = 0; i < apps.length; i++) {
|
||||||
let app = apps[i];
|
let app = apps[i];
|
||||||
@ -134,6 +143,9 @@ class AppFavorites {
|
|||||||
if (!app)
|
if (!app)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!this._parentalControlsManager.shouldShowApp(app.app_info))
|
||||||
|
return false;
|
||||||
|
|
||||||
let ids = this._getIds();
|
let ids = this._getIds();
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
ids.push(appId);
|
ids.push(appId);
|
||||||
|
@ -147,9 +147,8 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
|
|||||||
_onDeviceSelected(dialog, device) {
|
_onDeviceSelected(dialog, device) {
|
||||||
let connection = this._dbusImpl.get_connection();
|
let connection = this._dbusImpl.get_connection();
|
||||||
let info = this._dbusImpl.get_info();
|
let info = this._dbusImpl.get_info();
|
||||||
let deviceName = Object.keys(AudioDevice).filter(
|
const deviceName = Object.keys(AudioDevice)
|
||||||
dev => AudioDevice[dev] == device
|
.filter(dev => AudioDevice[dev] === device)[0].toLowerCase();
|
||||||
)[0].toLowerCase();
|
|
||||||
connection.emit_signal(this._audioSelectionDialog._sender,
|
connection.emit_signal(this._audioSelectionDialog._sender,
|
||||||
this._dbusImpl.get_object_path(),
|
this._dbusImpl.get_object_path(),
|
||||||
info ? info.name : null,
|
info ? info.name : null,
|
||||||
|
@ -30,8 +30,8 @@ var BarLevel = GObject.registerClass({
|
|||||||
accessible_role: Atk.Role.LEVEL_BAR,
|
accessible_role: Atk.Role.LEVEL_BAR,
|
||||||
};
|
};
|
||||||
super._init(Object.assign(defaultParams, params));
|
super._init(Object.assign(defaultParams, params));
|
||||||
this.connect('allocation-changed', (actor, box) => {
|
this.connect('notify::allocation', () => {
|
||||||
this._barLevelWidth = box.get_width();
|
this._barLevelWidth = this.allocation.get_width();
|
||||||
});
|
});
|
||||||
|
|
||||||
this._customAccessible = St.GenericAccessible.new_for_actor(this);
|
this._customAccessible = St.GenericAccessible.new_for_actor(this);
|
||||||
|
@ -196,8 +196,13 @@ var BoxPointer = GObject.registerClass({
|
|||||||
return themeNode.adjust_preferred_height(...height);
|
return themeNode.adjust_preferred_height(...height);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
this.set_allocation(box, flags);
|
if (this._sourceActor && this._sourceActor.mapped) {
|
||||||
|
this._reposition(box);
|
||||||
|
this._updateFlip(box);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set_allocation(box);
|
||||||
|
|
||||||
let themeNode = this.get_theme_node();
|
let themeNode = this.get_theme_node();
|
||||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||||
@ -209,7 +214,7 @@ var BoxPointer = GObject.registerClass({
|
|||||||
childBox.y1 = 0;
|
childBox.y1 = 0;
|
||||||
childBox.x2 = availWidth;
|
childBox.x2 = availWidth;
|
||||||
childBox.y2 = availHeight;
|
childBox.y2 = availHeight;
|
||||||
this._border.allocate(childBox, flags);
|
this._border.allocate(childBox);
|
||||||
|
|
||||||
childBox.x1 = borderWidth;
|
childBox.x1 = borderWidth;
|
||||||
childBox.y1 = borderWidth;
|
childBox.y1 = borderWidth;
|
||||||
@ -229,13 +234,7 @@ var BoxPointer = GObject.registerClass({
|
|||||||
childBox.x2 -= rise;
|
childBox.x2 -= rise;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.bin.allocate(childBox, flags);
|
this.bin.allocate(childBox);
|
||||||
|
|
||||||
if (this._sourceActor && this._sourceActor.mapped) {
|
|
||||||
this._reposition(box);
|
|
||||||
this._updateFlip(box);
|
|
||||||
this.set_allocation(box, flags);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_drawBorder(area) {
|
_drawBorder(area) {
|
||||||
|
@ -199,46 +199,52 @@ class DBusEventSource extends EventSourceBase {
|
|||||||
|
|
||||||
this._initialized = false;
|
this._initialized = false;
|
||||||
this._dbusProxy = new CalendarServer();
|
this._dbusProxy = new CalendarServer();
|
||||||
this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, (object, result) => {
|
this._initProxy();
|
||||||
let loaded = false;
|
}
|
||||||
|
|
||||||
try {
|
async _initProxy() {
|
||||||
this._dbusProxy.init_finish(result);
|
let loaded = false;
|
||||||
loaded = true;
|
|
||||||
} catch (e) {
|
try {
|
||||||
if (e.matches(Gio.DBusError, Gio.DBusError.TIMED_OUT)) {
|
await this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null);
|
||||||
// Ignore timeouts and install signals as normal, because with high
|
loaded = true;
|
||||||
// probability the service will appear later on, and we will get a
|
} catch (e) {
|
||||||
// NameOwnerChanged which will finish loading
|
// Ignore timeouts and install signals as normal, because with high
|
||||||
//
|
// probability the service will appear later on, and we will get a
|
||||||
// (But still _initialized to false, because the proxy does not know
|
// NameOwnerChanged which will finish loading
|
||||||
// about the HasCalendars property and would cause an exception trying
|
//
|
||||||
// to read it)
|
// (But still _initialized to false, because the proxy does not know
|
||||||
} else {
|
// about the HasCalendars property and would cause an exception trying
|
||||||
log('Error loading calendars: %s'.format(e.message));
|
// to read it)
|
||||||
return;
|
if (!e.matches(Gio.DBusError, Gio.DBusError.TIMED_OUT)) {
|
||||||
}
|
log('Error loading calendars: %s'.format(e.message));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._dbusProxy.connectSignal('Changed', this._onChanged.bind(this));
|
this._dbusProxy.connectSignal('EventsAddedOrUpdated',
|
||||||
|
this._onEventsAddedOrUpdated.bind(this));
|
||||||
|
this._dbusProxy.connectSignal('EventsRemoved',
|
||||||
|
this._onEventsRemoved.bind(this));
|
||||||
|
this._dbusProxy.connectSignal('ClientDisappeared',
|
||||||
|
this._onClientDisappeared.bind(this));
|
||||||
|
|
||||||
this._dbusProxy.connect('notify::g-name-owner', () => {
|
this._dbusProxy.connect('notify::g-name-owner', () => {
|
||||||
if (this._dbusProxy.g_name_owner)
|
if (this._dbusProxy.g_name_owner)
|
||||||
this._onNameAppeared();
|
|
||||||
else
|
|
||||||
this._onNameVanished();
|
|
||||||
});
|
|
||||||
|
|
||||||
this._dbusProxy.connect('g-properties-changed', () => {
|
|
||||||
this.notify('has-calendars');
|
|
||||||
});
|
|
||||||
|
|
||||||
this._initialized = loaded;
|
|
||||||
if (loaded) {
|
|
||||||
this.notify('has-calendars');
|
|
||||||
this._onNameAppeared();
|
this._onNameAppeared();
|
||||||
}
|
else
|
||||||
|
this._onNameVanished();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._dbusProxy.connect('g-properties-changed', () => {
|
||||||
|
this.notify('has-calendars');
|
||||||
|
});
|
||||||
|
|
||||||
|
this._initialized = loaded;
|
||||||
|
if (loaded) {
|
||||||
|
this.notify('has-calendars');
|
||||||
|
this._onNameAppeared();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
@ -257,7 +263,7 @@ class DBusEventSource extends EventSourceBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_resetCache() {
|
_resetCache() {
|
||||||
this._events = [];
|
this._events = new Map();
|
||||||
this._lastRequestBegin = null;
|
this._lastRequestBegin = null;
|
||||||
this._lastRequestEnd = null;
|
this._lastRequestEnd = null;
|
||||||
}
|
}
|
||||||
@ -273,28 +279,47 @@ class DBusEventSource extends EventSourceBase {
|
|||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
}
|
}
|
||||||
|
|
||||||
_onChanged() {
|
_onEventsAddedOrUpdated(dbusProxy, nameOwner, argArray) {
|
||||||
this._loadEvents(false);
|
const [appointments = []] = argArray;
|
||||||
|
let changed = false;
|
||||||
|
|
||||||
|
for (let n = 0; n < appointments.length; n++) {
|
||||||
|
const [id, summary, allDay, startTime, endTime] = appointments[n];
|
||||||
|
const date = new Date(startTime * 1000);
|
||||||
|
const end = new Date(endTime * 1000);
|
||||||
|
let event = new CalendarEvent(id, date, end, summary, allDay);
|
||||||
|
this._events.set(event.id, event);
|
||||||
|
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
this.emit('changed');
|
||||||
}
|
}
|
||||||
|
|
||||||
_onEventsReceived(results, _error) {
|
_onEventsRemoved(dbusProxy, nameOwner, argArray) {
|
||||||
let newEvents = [];
|
const [ids = []] = argArray;
|
||||||
let appointments = results[0] || [];
|
|
||||||
for (let n = 0; n < appointments.length; n++) {
|
|
||||||
let a = appointments[n];
|
|
||||||
let date = new Date(a[4] * 1000);
|
|
||||||
let end = new Date(a[5] * 1000);
|
|
||||||
let id = a[0];
|
|
||||||
let summary = a[1];
|
|
||||||
let allDay = a[3];
|
|
||||||
let event = new CalendarEvent(id, date, end, summary, allDay);
|
|
||||||
newEvents.push(event);
|
|
||||||
}
|
|
||||||
newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
|
|
||||||
|
|
||||||
this._events = newEvents;
|
let changed = false;
|
||||||
this._isLoading = false;
|
for (const id of ids)
|
||||||
this.emit('changed');
|
changed |= this._events.delete(id);
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
this.emit('changed');
|
||||||
|
}
|
||||||
|
|
||||||
|
_onClientDisappeared(dbusProxy, nameOwner, argArray) {
|
||||||
|
let [sourceUid = ''] = argArray;
|
||||||
|
sourceUid += '\n';
|
||||||
|
|
||||||
|
let changed = false;
|
||||||
|
for (const id of this._events.keys()) {
|
||||||
|
if (id.startsWith(sourceUid))
|
||||||
|
changed |= this._events.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
this.emit('changed');
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadEvents(forceReload) {
|
_loadEvents(forceReload) {
|
||||||
@ -303,33 +328,38 @@ class DBusEventSource extends EventSourceBase {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (this._curRequestBegin && this._curRequestEnd) {
|
if (this._curRequestBegin && this._curRequestEnd) {
|
||||||
this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
|
if (forceReload) {
|
||||||
this._curRequestEnd.getTime() / 1000,
|
this._events.clear();
|
||||||
forceReload,
|
this.emit('changed');
|
||||||
this._onEventsReceived.bind(this),
|
}
|
||||||
Gio.DBusCallFlags.NONE);
|
this._dbusProxy.SetTimeRangeRemote(
|
||||||
|
this._curRequestBegin.getTime() / 1000,
|
||||||
|
this._curRequestEnd.getTime() / 1000,
|
||||||
|
forceReload,
|
||||||
|
Gio.DBusCallFlags.NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
requestRange(begin, end) {
|
requestRange(begin, end) {
|
||||||
if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
|
if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
|
||||||
this._isLoading = true;
|
|
||||||
this._lastRequestBegin = begin;
|
this._lastRequestBegin = begin;
|
||||||
this._lastRequestEnd = end;
|
this._lastRequestEnd = end;
|
||||||
this._curRequestBegin = begin;
|
this._curRequestBegin = begin;
|
||||||
this._curRequestEnd = end;
|
this._curRequestEnd = end;
|
||||||
this._loadEvents(false);
|
this._loadEvents(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*_getFilteredEvents(begin, end) {
|
||||||
|
for (const event of this._events.values()) {
|
||||||
|
if (_dateIntervalsOverlap(event.date, event.end, begin, end))
|
||||||
|
yield event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getEvents(begin, end) {
|
getEvents(begin, end) {
|
||||||
let result = [];
|
let result = [...this._getFilteredEvents(begin, end)];
|
||||||
for (let n = 0; n < this._events.length; n++) {
|
|
||||||
let event = this._events[n];
|
|
||||||
|
|
||||||
if (_dateIntervalsOverlap(event.date, event.end, begin, end))
|
|
||||||
result.push(event);
|
|
||||||
}
|
|
||||||
result.sort((event1, event2) => {
|
result.sort((event1, event2) => {
|
||||||
// sort events by end time on ending day
|
// sort events by end time on ending day
|
||||||
let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
|
let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
|
||||||
@ -343,12 +373,8 @@ class DBusEventSource extends EventSourceBase {
|
|||||||
let dayBegin = _getBeginningOfDay(day);
|
let dayBegin = _getBeginningOfDay(day);
|
||||||
let dayEnd = _getEndOfDay(day);
|
let dayEnd = _getEndOfDay(day);
|
||||||
|
|
||||||
let events = this.getEvents(dayBegin, dayEnd);
|
const { done } = this._getFilteredEvents(dayBegin, dayEnd).next();
|
||||||
|
return !done;
|
||||||
if (events.length == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -700,12 +726,11 @@ var Calendar = GObject.registerClass({
|
|||||||
var EventMessage = GObject.registerClass(
|
var EventMessage = GObject.registerClass(
|
||||||
class EventMessage extends MessageList.Message {
|
class EventMessage extends MessageList.Message {
|
||||||
_init(event, date) {
|
_init(event, date) {
|
||||||
super._init('', event.summary);
|
super._init('', '');
|
||||||
|
|
||||||
this._event = event;
|
|
||||||
this._date = date;
|
this._date = date;
|
||||||
|
|
||||||
this.setTitle(this._formatEventTime());
|
this.update(event);
|
||||||
|
|
||||||
this._icon = new St.Icon({ icon_name: 'x-office-calendar-symbolic' });
|
this._icon = new St.Icon({ icon_name: 'x-office-calendar-symbolic' });
|
||||||
this.setIcon(this._icon);
|
this.setIcon(this._icon);
|
||||||
@ -717,6 +742,13 @@ class EventMessage extends MessageList.Message {
|
|||||||
super.vfunc_style_changed();
|
super.vfunc_style_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update(event) {
|
||||||
|
this._event = event;
|
||||||
|
|
||||||
|
this.setTitle(this._formatEventTime());
|
||||||
|
this.setBody(event.summary);
|
||||||
|
}
|
||||||
|
|
||||||
_formatEventTime() {
|
_formatEventTime() {
|
||||||
let periodBegin = _getBeginningOfDay(this._date);
|
let periodBegin = _getBeginningOfDay(this._date);
|
||||||
let periodEnd = _getEndOfDay(this._date);
|
let periodEnd = _getEndOfDay(this._date);
|
||||||
@ -837,8 +869,9 @@ class EventsSection extends MessageList.MessageListSection {
|
|||||||
this._title.connect('clicked', this._onTitleClicked.bind(this));
|
this._title.connect('clicked', this._onTitleClicked.bind(this));
|
||||||
this._title.connect('key-focus-in', this._onKeyFocusIn.bind(this));
|
this._title.connect('key-focus-in', this._onKeyFocusIn.bind(this));
|
||||||
|
|
||||||
Shell.AppSystem.get_default().connect('installed-changed',
|
this._appSys = Shell.AppSystem.get_default();
|
||||||
this._appInstalledChanged.bind(this));
|
this._appSys.connect('installed-changed',
|
||||||
|
this._appInstalledChanged.bind(this));
|
||||||
this._appInstalledChanged();
|
this._appInstalledChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,7 +906,7 @@ class EventsSection extends MessageList.MessageListSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_reloadEvents() {
|
_reloadEvents() {
|
||||||
if (this._eventSource.isLoading)
|
if (this._eventSource.isLoading || this._reloading)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._reloading = true;
|
this._reloading = true;
|
||||||
@ -899,6 +932,7 @@ class EventsSection extends MessageList.MessageListSection {
|
|||||||
this._messageById.set(event.id, message);
|
this._messageById.set(event.id, message);
|
||||||
this.addMessage(message, false);
|
this.addMessage(message, false);
|
||||||
} else {
|
} else {
|
||||||
|
message.update(event);
|
||||||
this.moveMessage(message, i, false);
|
this.moveMessage(message, i, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -931,10 +965,13 @@ class EventsSection extends MessageList.MessageListSection {
|
|||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
Main.panel.closeCalendar();
|
Main.panel.closeCalendar();
|
||||||
|
|
||||||
let app = this._getCalendarApp();
|
let appInfo = this._getCalendarApp();
|
||||||
if (app.get_id() == 'evolution.desktop')
|
if (appInfo.get_id() === 'org.gnome.Evolution.desktop') {
|
||||||
app = Gio.DesktopAppInfo.new('evolution-calendar.desktop');
|
let app = this._appSys.lookup_app('evolution-calendar.desktop');
|
||||||
app.launch([], global.create_app_launch_context(0, -1));
|
if (app)
|
||||||
|
appInfo = app.app_info;
|
||||||
|
}
|
||||||
|
appInfo.launch([], global.create_app_launch_context(0, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
setDate(date) {
|
setDate(date) {
|
||||||
@ -1149,17 +1186,22 @@ class CalendarMessageList extends St.Widget {
|
|||||||
let hbox = new St.BoxLayout({ style_class: 'message-list-controls' });
|
let hbox = new St.BoxLayout({ style_class: 'message-list-controls' });
|
||||||
box.add_child(hbox);
|
box.add_child(hbox);
|
||||||
|
|
||||||
hbox.add_child(new St.Label({
|
const dndLabel = new St.Label({
|
||||||
text: _('Do Not Disturb'),
|
text: _('Do Not Disturb'),
|
||||||
y_align: Clutter.ActorAlign.CENTER,
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
}));
|
});
|
||||||
|
hbox.add_child(dndLabel);
|
||||||
|
|
||||||
this._dndSwitch = new DoNotDisturbSwitch();
|
this._dndSwitch = new DoNotDisturbSwitch();
|
||||||
this._dndButton = new St.Button({
|
this._dndButton = new St.Button({
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
|
toggle_mode: true,
|
||||||
child: this._dndSwitch,
|
child: this._dndSwitch,
|
||||||
|
label_actor: dndLabel,
|
||||||
});
|
});
|
||||||
this._dndButton.connect('clicked', () => this._dndSwitch.toggle());
|
this._dndSwitch.bind_property('state',
|
||||||
|
this._dndButton, 'checked',
|
||||||
|
GObject.BindingFlags.BIDIRECTIONAL | GObject.BindingFlags.SYNC_CREATE);
|
||||||
hbox.add_child(this._dndButton);
|
hbox.add_child(this._dndButton);
|
||||||
|
|
||||||
this._clearButton = new St.Button({
|
this._clearButton = new St.Button({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* exported CheckBox */
|
/* exported CheckBox */
|
||||||
const { Clutter, GObject, Pango, St } = imports.gi;
|
const { Atk, Clutter, GObject, Pango, St } = imports.gi;
|
||||||
|
|
||||||
var CheckBox = GObject.registerClass(
|
var CheckBox = GObject.registerClass(
|
||||||
class CheckBox extends St.Button {
|
class CheckBox extends St.Button {
|
||||||
@ -15,6 +15,7 @@ class CheckBox extends St.Button {
|
|||||||
toggle_mode: true,
|
toggle_mode: true,
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
});
|
});
|
||||||
|
this.set_accessible_role(Atk.Role.CHECK_BOX);
|
||||||
|
|
||||||
this._box = new St.Bin({ y_align: Clutter.ActorAlign.START });
|
this._box = new St.Bin({ y_align: Clutter.ActorAlign.START });
|
||||||
container.add_actor(this._box);
|
container.add_actor(this._box);
|
||||||
@ -22,6 +23,7 @@ class CheckBox extends St.Button {
|
|||||||
this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
|
this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
|
||||||
this._label.clutter_text.set_line_wrap(true);
|
this._label.clutter_text.set_line_wrap(true);
|
||||||
this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
|
this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
|
||||||
|
this.set_label_actor(this._label);
|
||||||
container.add_actor(this._label);
|
container.add_actor(this._label);
|
||||||
|
|
||||||
if (label)
|
if (label)
|
||||||
|
@ -188,6 +188,8 @@ var CloseDialog = GObject.registerClass({
|
|||||||
global.stage.disconnect(this._keyFocusChangedId);
|
global.stage.disconnect(this._keyFocusChangedId);
|
||||||
this._keyFocusChangedId = 0;
|
this._keyFocusChangedId = 0;
|
||||||
|
|
||||||
|
this._dialog._dialog.remove_all_transitions();
|
||||||
|
|
||||||
let dialog = this._dialog;
|
let dialog = this._dialog;
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
this._removeWindowEffect();
|
this._removeWindowEffect();
|
||||||
|
@ -13,17 +13,13 @@ var ComponentManager = class {
|
|||||||
_sessionUpdated() {
|
_sessionUpdated() {
|
||||||
let newEnabledComponents = Main.sessionMode.components;
|
let newEnabledComponents = Main.sessionMode.components;
|
||||||
|
|
||||||
newEnabledComponents.filter(
|
newEnabledComponents
|
||||||
name => !this._enabledComponents.includes(name)
|
.filter(name => !this._enabledComponents.includes(name))
|
||||||
).forEach(name => {
|
.forEach(name => this._enableComponent(name));
|
||||||
this._enableComponent(name);
|
|
||||||
});
|
|
||||||
|
|
||||||
this._enabledComponents.filter(
|
this._enabledComponents
|
||||||
name => !newEnabledComponents.includes(name)
|
.filter(name => !newEnabledComponents.includes(name))
|
||||||
).forEach(name => {
|
.forEach(name => this._disableComponent(name));
|
||||||
this._disableComponent(name);
|
|
||||||
});
|
|
||||||
|
|
||||||
this._enabledComponents = newEnabledComponents;
|
this._enabledComponents = newEnabledComponents;
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,7 @@ var ContentTypeDiscoverer = class {
|
|||||||
_emitCallback(mount, contentTypes = []) {
|
_emitCallback(mount, contentTypes = []) {
|
||||||
// we're not interested in win32 software content types here
|
// we're not interested in win32 software content types here
|
||||||
contentTypes = contentTypes.filter(
|
contentTypes = contentTypes.filter(
|
||||||
type => type != 'x-content/win32-software'
|
type => type !== 'x-content/win32-software');
|
||||||
);
|
|
||||||
|
|
||||||
let apps = [];
|
let apps = [];
|
||||||
contentTypes.forEach(type => {
|
contentTypes.forEach(type => {
|
||||||
|
@ -111,15 +111,11 @@ class KeyringDialog extends ModalDialog.ModalDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateSensitivity(sensitive) {
|
_updateSensitivity(sensitive) {
|
||||||
if (this._passwordEntry) {
|
if (this._passwordEntry)
|
||||||
this._passwordEntry.reactive = sensitive;
|
this._passwordEntry.reactive = sensitive;
|
||||||
this._passwordEntry.clutter_text.editable = sensitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._confirmEntry) {
|
if (this._confirmEntry)
|
||||||
this._confirmEntry.reactive = sensitive;
|
this._confirmEntry.reactive = sensitive;
|
||||||
this._confirmEntry.clutter_text.editable = sensitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._continueButton.can_focus = sensitive;
|
this._continueButton.can_focus = sensitive;
|
||||||
this._continueButton.reactive = sensitive;
|
this._continueButton.reactive = sensitive;
|
||||||
|
@ -4,13 +4,16 @@
|
|||||||
const { Clutter, Gio, GLib, GObject, NM, Pango, Shell, St } = imports.gi;
|
const { Clutter, Gio, GLib, GObject, NM, Pango, Shell, St } = imports.gi;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Config = imports.misc.config;
|
|
||||||
const Dialog = imports.ui.dialog;
|
const Dialog = imports.ui.dialog;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const MessageTray = imports.ui.messageTray;
|
const MessageTray = imports.ui.messageTray;
|
||||||
const ModalDialog = imports.ui.modalDialog;
|
const ModalDialog = imports.ui.modalDialog;
|
||||||
const ShellEntry = imports.ui.shellEntry;
|
const ShellEntry = imports.ui.shellEntry;
|
||||||
|
|
||||||
|
Gio._promisify(Shell.NetworkAgent.prototype, 'init_async', 'init_finish');
|
||||||
|
Gio._promisify(Shell.NetworkAgent.prototype,
|
||||||
|
'search_vpn_plugin', 'search_vpn_plugin_finish');
|
||||||
|
|
||||||
const VPN_UI_GROUP = 'VPN Plugin UI';
|
const VPN_UI_GROUP = 'VPN Plugin UI';
|
||||||
|
|
||||||
var NetworkSecretDialog = GObject.registerClass(
|
var NetworkSecretDialog = GObject.registerClass(
|
||||||
@ -480,39 +483,37 @@ var VPNRequestHandler = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_readStdoutOldStyle() {
|
async _readStdoutOldStyle() {
|
||||||
this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, (stream, result) => {
|
const [line, len_] =
|
||||||
let [line, len_] = this._dataStdout.read_line_finish_utf8(result);
|
await this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null);
|
||||||
|
|
||||||
if (line == null) {
|
if (line === null) {
|
||||||
// end of file
|
// end of file
|
||||||
this._stdout.close(null);
|
this._stdout.close(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._vpnChildProcessLineOldStyle(line);
|
this._vpnChildProcessLineOldStyle(line);
|
||||||
|
|
||||||
// try to read more!
|
// try to read more!
|
||||||
this._readStdoutOldStyle();
|
this._readStdoutOldStyle();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_readStdoutNewStyle() {
|
async _readStdoutNewStyle() {
|
||||||
this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, (stream, result) => {
|
const cnt =
|
||||||
let cnt = this._dataStdout.fill_finish(result);
|
await this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null);
|
||||||
|
|
||||||
if (cnt == 0) {
|
if (cnt === 0) {
|
||||||
// end of file
|
// end of file
|
||||||
this._showNewStyleDialog();
|
this._showNewStyleDialog();
|
||||||
|
|
||||||
this._stdout.close(null);
|
this._stdout.close(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to read more
|
// Try to read more
|
||||||
this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size());
|
this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size());
|
||||||
this._readStdoutNewStyle();
|
this._readStdoutNewStyle();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_showNewStyleDialog() {
|
_showNewStyleDialog() {
|
||||||
@ -615,27 +616,21 @@ var NetworkAgent = class {
|
|||||||
this._vpnRequests = { };
|
this._vpnRequests = { };
|
||||||
this._notifications = { };
|
this._notifications = { };
|
||||||
|
|
||||||
this._pluginDir = Gio.file_new_for_path(Config.VPNDIR);
|
|
||||||
try {
|
|
||||||
let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null);
|
|
||||||
monitor.connect('changed', () => (this._vpnCacheBuilt = false));
|
|
||||||
} catch (e) {
|
|
||||||
log('Failed to create monitor for VPN plugin dir: %s'.format(e.message));
|
|
||||||
}
|
|
||||||
|
|
||||||
this._native.connect('new-request', this._newRequest.bind(this));
|
this._native.connect('new-request', this._newRequest.bind(this));
|
||||||
this._native.connect('cancel-request', this._cancelRequest.bind(this));
|
this._native.connect('cancel-request', this._cancelRequest.bind(this));
|
||||||
|
|
||||||
this._initialized = false;
|
this._initialized = false;
|
||||||
this._native.init_async(GLib.PRIORITY_DEFAULT, null, (o, res) => {
|
this._initNative();
|
||||||
try {
|
}
|
||||||
this._native.init_finish(res);
|
|
||||||
this._initialized = true;
|
async _initNative() {
|
||||||
} catch (e) {
|
try {
|
||||||
this._native = null;
|
await this._native.init_async(GLib.PRIORITY_DEFAULT, null);
|
||||||
logError(e, 'error initializing the NetworkManager Agent');
|
this._initialized = true;
|
||||||
}
|
} catch (e) {
|
||||||
});
|
this._native = null;
|
||||||
|
logError(e, 'error initializing the NetworkManager Agent');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
@ -766,13 +761,11 @@ var NetworkAgent = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_vpnRequest(requestId, connection, hints, flags) {
|
async _vpnRequest(requestId, connection, hints, flags) {
|
||||||
let vpnSetting = connection.get_setting_vpn();
|
let vpnSetting = connection.get_setting_vpn();
|
||||||
let serviceType = vpnSetting.service_type;
|
let serviceType = vpnSetting.service_type;
|
||||||
|
|
||||||
this._buildVPNServiceCache();
|
let binary = await this._findAuthBinary(serviceType);
|
||||||
|
|
||||||
let binary = this._vpnBinaries[serviceType];
|
|
||||||
if (!binary) {
|
if (!binary) {
|
||||||
log('Invalid VPN service type (cannot find authentication binary)');
|
log('Invalid VPN service type (cannot find authentication binary)');
|
||||||
|
|
||||||
@ -788,36 +781,30 @@ var NetworkAgent = class {
|
|||||||
this._vpnRequests[requestId] = vpnRequest;
|
this._vpnRequests[requestId] = vpnRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildVPNServiceCache() {
|
async _findAuthBinary(serviceType) {
|
||||||
if (this._vpnCacheBuilt)
|
let plugin;
|
||||||
return;
|
|
||||||
|
|
||||||
this._vpnCacheBuilt = true;
|
try {
|
||||||
this._vpnBinaries = { };
|
plugin = await this._native.search_vpn_plugin(serviceType);
|
||||||
|
} catch (e) {
|
||||||
|
logError(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
NM.VpnPluginInfo.list_load().forEach(plugin => {
|
const fileName = plugin.get_auth_dialog();
|
||||||
let service = plugin.get_service();
|
if (!GLib.file_test(fileName, GLib.FileTest.IS_EXECUTABLE)) {
|
||||||
let fileName = plugin.get_auth_dialog();
|
log('VPN plugin at %s is not executable'.format(fileName));
|
||||||
let supportsHints = plugin.supports_hints();
|
return null;
|
||||||
let externalUIMode = false;
|
}
|
||||||
|
|
||||||
let prop = plugin.lookup_property('GNOME', 'supports-external-ui-mode');
|
const prop = plugin.lookup_property('GNOME', 'supports-external-ui-mode');
|
||||||
if (prop) {
|
const trimmedProp = prop ? prop.trim().toLowerCase() : '';
|
||||||
prop = prop.trim().toLowerCase();
|
|
||||||
externalUIMode = ['true', 'yes', 'on', '1'].includes(prop);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GLib.file_test(fileName, GLib.FileTest.IS_EXECUTABLE)) {
|
return {
|
||||||
let binary = { fileName, externalUIMode, supportsHints };
|
fileName,
|
||||||
this._vpnBinaries[service] = binary;
|
supportsHints: plugin.supports_hints(),
|
||||||
|
externalUIMode: ['true', 'yes', 'on', '1'].includes(trimmedProp),
|
||||||
plugin.get_aliases().forEach(alias => {
|
};
|
||||||
this._vpnBinaries[alias] = binary;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
log('VPN plugin at %s is not executable'.format(fileName));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var Component = NetworkAgent;
|
var Component = NetworkAgent;
|
||||||
|
@ -327,12 +327,16 @@ var AuthenticationDialog = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let resetDialog = () => {
|
let resetDialog = () => {
|
||||||
|
this._sessionRequestTimeoutId = 0;
|
||||||
|
|
||||||
if (this.state != ModalDialog.State.OPENED)
|
if (this.state != ModalDialog.State.OPENED)
|
||||||
return;
|
return GLib.SOURCE_REMOVE;
|
||||||
|
|
||||||
this._passwordEntry.hide();
|
this._passwordEntry.hide();
|
||||||
this._cancelButton.grab_key_focus();
|
this._cancelButton.grab_key_focus();
|
||||||
this._okButton.reactive = false;
|
this._okButton.reactive = false;
|
||||||
|
|
||||||
|
return GLib.SOURCE_REMOVE;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (delay) {
|
if (delay) {
|
||||||
|
@ -2,12 +2,19 @@
|
|||||||
/* exported Component */
|
/* exported Component */
|
||||||
|
|
||||||
const { Clutter, Gio, GLib, GObject, St } = imports.gi;
|
const { Clutter, Gio, GLib, GObject, St } = imports.gi;
|
||||||
const Lang = imports.lang;
|
|
||||||
|
|
||||||
var Tpl = null;
|
var Tpl = null;
|
||||||
var Tp = null;
|
var Tp = null;
|
||||||
try {
|
try {
|
||||||
({ TelepathyGLib: Tp, TelepathyLogger: Tpl } = imports.gi);
|
({ TelepathyGLib: Tp, TelepathyLogger: Tpl } = imports.gi);
|
||||||
|
|
||||||
|
Gio._promisify(Tp.Channel.prototype, 'close_async', 'close_finish');
|
||||||
|
Gio._promisify(Tp.Channel.prototype,
|
||||||
|
'send_message_async', 'send_message_finish');
|
||||||
|
Gio._promisify(Tp.ChannelDispatchOperation.prototype,
|
||||||
|
'claim_with_async', 'claim_with_finish');
|
||||||
|
Gio._promisify(Tpl.LogManager.prototype,
|
||||||
|
'get_filtered_events_async', 'get_filtered_events_finish');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Telepathy is not available, chat integration will be disabled.');
|
log('Telepathy is not available, chat integration will be disabled.');
|
||||||
}
|
}
|
||||||
@ -40,36 +47,59 @@ var NotificationDirection = {
|
|||||||
RECEIVED: 'chat-received',
|
RECEIVED: 'chat-received',
|
||||||
};
|
};
|
||||||
|
|
||||||
function makeMessageFromTpMessage(tpMessage, direction) {
|
const ChatMessage = HAVE_TP ? GObject.registerClass({
|
||||||
let [text, flags_] = tpMessage.to_text();
|
Properties: {
|
||||||
|
'message-type': GObject.ParamSpec.int(
|
||||||
|
'message-type', 'message-type', 'message-type',
|
||||||
|
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
||||||
|
Math.min(...Object.values(Tp.ChannelTextMessageType)),
|
||||||
|
Math.max(...Object.values(Tp.ChannelTextMessageType)),
|
||||||
|
Tp.ChannelTextMessageType.NORMAL),
|
||||||
|
'text': GObject.ParamSpec.string(
|
||||||
|
'text', 'text', 'text',
|
||||||
|
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
||||||
|
null),
|
||||||
|
'sender': GObject.ParamSpec.string(
|
||||||
|
'sender', 'sender', 'sender',
|
||||||
|
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
||||||
|
null),
|
||||||
|
'timestamp': GObject.ParamSpec.int64(
|
||||||
|
'timestamp', 'timestamp', 'timestamp',
|
||||||
|
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
||||||
|
0, Number.MAX_SAFE_INTEGER, 0),
|
||||||
|
'direction': GObject.ParamSpec.string(
|
||||||
|
'direction', 'direction', 'direction',
|
||||||
|
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
||||||
|
null),
|
||||||
|
},
|
||||||
|
}, class ChatMessageClass extends GObject.Object {
|
||||||
|
static newFromTpMessage(tpMessage, direction) {
|
||||||
|
return new ChatMessage({
|
||||||
|
'message-type': tpMessage.get_message_type(),
|
||||||
|
'text': tpMessage.to_text()[0],
|
||||||
|
'sender': tpMessage.sender.alias,
|
||||||
|
'timestamp': direction === NotificationDirection.RECEIVED
|
||||||
|
? tpMessage.get_received_timestamp() : tpMessage.get_sent_timestamp(),
|
||||||
|
direction,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let timestamp = tpMessage.get_sent_timestamp();
|
static newFromTplTextEvent(tplTextEvent) {
|
||||||
if (timestamp == 0)
|
let direction =
|
||||||
timestamp = tpMessage.get_received_timestamp();
|
tplTextEvent.get_sender().get_entity_type() === Tpl.EntityType.SELF
|
||||||
|
? NotificationDirection.SENT : NotificationDirection.RECEIVED;
|
||||||
|
|
||||||
return {
|
return new ChatMessage({
|
||||||
messageType: tpMessage.get_message_type(),
|
'message-type': tplTextEvent.get_message_type(),
|
||||||
text,
|
'text': tplTextEvent.get_message(),
|
||||||
sender: tpMessage.sender.alias,
|
'sender': tplTextEvent.get_sender().get_alias(),
|
||||||
timestamp,
|
'timestamp': tplTextEvent.get_timestamp(),
|
||||||
direction,
|
direction,
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
}) : null;
|
||||||
|
|
||||||
|
|
||||||
function makeMessageFromTplEvent(event) {
|
|
||||||
let sent = event.get_sender().get_entity_type() == Tpl.EntityType.SELF;
|
|
||||||
let direction = sent ? NotificationDirection.SENT : NotificationDirection.RECEIVED;
|
|
||||||
|
|
||||||
return {
|
|
||||||
messageType: event.get_message_type(),
|
|
||||||
text: event.get_message(),
|
|
||||||
sender: event.get_sender().get_alias(),
|
|
||||||
timestamp: event.get_timestamp(),
|
|
||||||
direction,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var TelepathyComponent = class {
|
var TelepathyComponent = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._client = null;
|
this._client = null;
|
||||||
@ -193,7 +223,7 @@ class TelepathyClient extends Tp.BaseClient {
|
|||||||
|
|
||||||
// We can only handle text channel, so close any other channel
|
// We can only handle text channel, so close any other channel
|
||||||
if (!(channel instanceof Tp.TextChannel)) {
|
if (!(channel instanceof Tp.TextChannel)) {
|
||||||
channel.close_async(null);
|
channel.close_async();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +269,7 @@ class TelepathyClient extends Tp.BaseClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_approveTextChannel(account, conn, channel, dispatchOp, context) {
|
async _approveTextChannel(account, conn, channel, dispatchOp, context) {
|
||||||
let [targetHandle_, targetHandleType] = channel.get_handle();
|
let [targetHandle_, targetHandleType] = channel.get_handle();
|
||||||
|
|
||||||
if (targetHandleType != Tp.HandleType.CONTACT) {
|
if (targetHandleType != Tp.HandleType.CONTACT) {
|
||||||
@ -248,17 +278,15 @@ class TelepathyClient extends Tp.BaseClient {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Approve private text channels right away as we are going to handle it
|
|
||||||
dispatchOp.claim_with_async(this, (o, result) => {
|
|
||||||
try {
|
|
||||||
dispatchOp.claim_with_finish(result);
|
|
||||||
this._handlingChannels(account, conn, [channel], false);
|
|
||||||
} catch (err) {
|
|
||||||
log('Failed to Claim channel: %s'.format(err.toString()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
context.accept();
|
context.accept();
|
||||||
|
|
||||||
|
// Approve private text channels right away as we are going to handle it
|
||||||
|
try {
|
||||||
|
await dispatchOp.claim_with_async(this);
|
||||||
|
this._handlingChannels(account, conn, [channel], false);
|
||||||
|
} catch (err) {
|
||||||
|
log('Failed to Claim channel: %s'.format(err.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_delegatedChannelsCb(_client, _channels) {
|
_delegatedChannelsCb(_client, _channels) {
|
||||||
@ -270,12 +298,12 @@ class TelepathyClient extends Tp.BaseClient {
|
|||||||
var ChatSource = HAVE_TP ? GObject.registerClass(
|
var ChatSource = HAVE_TP ? GObject.registerClass(
|
||||||
class ChatSource extends MessageTray.Source {
|
class ChatSource extends MessageTray.Source {
|
||||||
_init(account, conn, channel, contact, client) {
|
_init(account, conn, channel, contact, client) {
|
||||||
super._init(contact.get_alias());
|
|
||||||
|
|
||||||
this._account = account;
|
this._account = account;
|
||||||
this._contact = contact;
|
this._contact = contact;
|
||||||
this._client = client;
|
this._client = client;
|
||||||
|
|
||||||
|
super._init(contact.get_alias());
|
||||||
|
|
||||||
this.isChat = true;
|
this.isChat = true;
|
||||||
this._pendingMessages = [];
|
this._pendingMessages = [];
|
||||||
|
|
||||||
@ -419,19 +447,16 @@ class ChatSource extends MessageTray.Source {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_getLogMessages() {
|
async _getLogMessages() {
|
||||||
let logManager = Tpl.LogManager.dup_singleton();
|
let logManager = Tpl.LogManager.dup_singleton();
|
||||||
let entity = Tpl.Entity.new_from_tp_contact(this._contact, Tpl.EntityType.CONTACT);
|
let entity = Tpl.Entity.new_from_tp_contact(this._contact, Tpl.EntityType.CONTACT);
|
||||||
|
|
||||||
logManager.get_filtered_events_async(this._account, entity,
|
const [events] = await logManager.get_filtered_events_async(
|
||||||
Tpl.EventTypeMask.TEXT, SCROLLBACK_HISTORY_LINES,
|
this._account, entity,
|
||||||
null, this._displayPendingMessages.bind(this));
|
Tpl.EventTypeMask.TEXT, SCROLLBACK_HISTORY_LINES,
|
||||||
}
|
null);
|
||||||
|
|
||||||
_displayPendingMessages(logManager, result) {
|
let logMessages = events.map(e => ChatMessage.newFromTplTextEvent(e));
|
||||||
let [success_, events] = logManager.get_filtered_events_finish(result);
|
|
||||||
|
|
||||||
let logMessages = events.map(makeMessageFromTplEvent);
|
|
||||||
this._ensureNotification();
|
this._ensureNotification();
|
||||||
|
|
||||||
let pendingTpMessages = this._channel.get_pending_messages();
|
let pendingTpMessages = this._channel.get_pending_messages();
|
||||||
@ -443,7 +468,8 @@ class ChatSource extends MessageTray.Source {
|
|||||||
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
|
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pendingMessages.push(makeMessageFromTpMessage(message, NotificationDirection.RECEIVED));
|
pendingMessages.push(ChatMessage.newFromTpMessage(message,
|
||||||
|
NotificationDirection.RECEIVED));
|
||||||
|
|
||||||
this._pendingMessages.push(message);
|
this._pendingMessages.push(message);
|
||||||
}
|
}
|
||||||
@ -486,9 +512,7 @@ class ChatSource extends MessageTray.Source {
|
|||||||
this._ackMessages();
|
this._ackMessages();
|
||||||
// The chat box has been destroyed so it can't
|
// The chat box has been destroyed so it can't
|
||||||
// handle the channel any more.
|
// handle the channel any more.
|
||||||
this._channel.close_async((channel, result) => {
|
this._channel.close_async();
|
||||||
channel.close_finish(result);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// Don't indicate any unread messages when the notification
|
// Don't indicate any unread messages when the notification
|
||||||
// that represents them has been destroyed.
|
// that represents them has been destroyed.
|
||||||
@ -541,7 +565,8 @@ class ChatSource extends MessageTray.Source {
|
|||||||
this._pendingMessages.push(message);
|
this._pendingMessages.push(message);
|
||||||
this.countUpdated();
|
this.countUpdated();
|
||||||
|
|
||||||
message = makeMessageFromTpMessage(message, NotificationDirection.RECEIVED);
|
message = ChatMessage.newFromTpMessage(message,
|
||||||
|
NotificationDirection.RECEIVED);
|
||||||
this._notification.appendMessage(message);
|
this._notification.appendMessage(message);
|
||||||
|
|
||||||
// Wait a bit before notifying for the received message, a handler
|
// Wait a bit before notifying for the received message, a handler
|
||||||
@ -566,7 +591,8 @@ class ChatSource extends MessageTray.Source {
|
|||||||
// our client and other clients as well.
|
// our client and other clients as well.
|
||||||
_messageSent(channel, message, _flags, _token) {
|
_messageSent(channel, message, _flags, _token) {
|
||||||
this._ensureNotification();
|
this._ensureNotification();
|
||||||
message = makeMessageFromTpMessage(message, NotificationDirection.SENT);
|
message = ChatMessage.newFromTpMessage(message,
|
||||||
|
NotificationDirection.SENT);
|
||||||
this._notification.appendMessage(message);
|
this._notification.appendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,9 +610,7 @@ class ChatSource extends MessageTray.Source {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let msg = Tp.ClientMessage.new_text(type, text);
|
let msg = Tp.ClientMessage.new_text(type, text);
|
||||||
this._channel.send_message_async(msg, 0, (src, result) => {
|
this._channel.send_message_async(msg, 0);
|
||||||
this._channel.send_message_finish(result);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setChatState(state) {
|
setChatState(state) {
|
||||||
@ -630,11 +654,19 @@ class ChatSource extends MessageTray.Source {
|
|||||||
}
|
}
|
||||||
}) : null;
|
}) : null;
|
||||||
|
|
||||||
|
const ChatNotificationMessage = HAVE_TP ? GObject.registerClass(
|
||||||
|
class ChatNotificationMessage extends GObject.Object {
|
||||||
|
_init(props = {}) {
|
||||||
|
super._init();
|
||||||
|
this.set(props);
|
||||||
|
}
|
||||||
|
}) : null;
|
||||||
|
|
||||||
var ChatNotification = HAVE_TP ? GObject.registerClass({
|
var ChatNotification = HAVE_TP ? GObject.registerClass({
|
||||||
Signals: {
|
Signals: {
|
||||||
'message-removed': { param_types: [Tp.Message.$gtype] },
|
'message-removed': { param_types: [ChatNotificationMessage.$gtype] },
|
||||||
'message-added': { param_types: [Tp.Message.$gtype] },
|
'message-added': { param_types: [ChatNotificationMessage.$gtype] },
|
||||||
'timestamp-changed': { param_types: [Tp.Message.$gtype] },
|
'timestamp-changed': { param_types: [ChatNotificationMessage.$gtype] },
|
||||||
},
|
},
|
||||||
}, class ChatNotification extends MessageTray.Notification {
|
}, class ChatNotification extends MessageTray.Notification {
|
||||||
_init(source) {
|
_init(source) {
|
||||||
@ -735,21 +767,24 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
|
|||||||
styles: [],
|
styles: [],
|
||||||
timestamp: currentTime,
|
timestamp: currentTime,
|
||||||
noTimestamp: false });
|
noTimestamp: false });
|
||||||
|
const { noTimestamp } = props;
|
||||||
|
delete props.noTimestamp;
|
||||||
|
|
||||||
// Reset the old message timeout
|
// Reset the old message timeout
|
||||||
if (this._timestampTimeoutId)
|
if (this._timestampTimeoutId)
|
||||||
GLib.source_remove(this._timestampTimeoutId);
|
GLib.source_remove(this._timestampTimeoutId);
|
||||||
this._timestampTimeoutId = 0;
|
this._timestampTimeoutId = 0;
|
||||||
|
|
||||||
let message = { realMessage: props.group != 'meta',
|
let message = new ChatNotificationMessage({
|
||||||
showTimestamp: false };
|
realMessage: props.group !== 'meta',
|
||||||
Lang.copyProperties(props, message);
|
showTimestamp: false,
|
||||||
delete message.noTimestamp;
|
...props,
|
||||||
|
});
|
||||||
|
|
||||||
this.messages.unshift(message);
|
this.messages.unshift(message);
|
||||||
this.emit('message-added', message);
|
this.emit('message-added', message);
|
||||||
|
|
||||||
if (!props.noTimestamp) {
|
if (!noTimestamp) {
|
||||||
let timestamp = props.timestamp;
|
let timestamp = props.timestamp;
|
||||||
if (timestamp < currentTime - SCROLLBACK_IMMEDIATE_TIME) {
|
if (timestamp < currentTime - SCROLLBACK_IMMEDIATE_TIME) {
|
||||||
this.appendTimestamp();
|
this.appendTimestamp();
|
||||||
|
@ -292,11 +292,11 @@ class DashActor extends St.Widget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
let contentBox = this.get_theme_node().get_content_box(box);
|
let contentBox = this.get_theme_node().get_content_box(box);
|
||||||
let availWidth = contentBox.x2 - contentBox.x1;
|
let availWidth = contentBox.x2 - contentBox.x1;
|
||||||
|
|
||||||
this.set_allocation(box, flags);
|
this.set_allocation(box);
|
||||||
|
|
||||||
let [appIcons, showAppsButton] = this.get_children();
|
let [appIcons, showAppsButton] = this.get_children();
|
||||||
let [, showAppsNatHeight] = showAppsButton.get_preferred_height(availWidth);
|
let [, showAppsNatHeight] = showAppsButton.get_preferred_height(availWidth);
|
||||||
@ -306,11 +306,11 @@ class DashActor extends St.Widget {
|
|||||||
childBox.y1 = contentBox.y1;
|
childBox.y1 = contentBox.y1;
|
||||||
childBox.x2 = contentBox.x2;
|
childBox.x2 = contentBox.x2;
|
||||||
childBox.y2 = contentBox.y2 - showAppsNatHeight;
|
childBox.y2 = contentBox.y2 - showAppsNatHeight;
|
||||||
appIcons.allocate(childBox, flags);
|
appIcons.allocate(childBox);
|
||||||
|
|
||||||
childBox.y1 = contentBox.y2 - showAppsNatHeight;
|
childBox.y1 = contentBox.y2 - showAppsNatHeight;
|
||||||
childBox.y2 = contentBox.y2;
|
childBox.y2 = contentBox.y2;
|
||||||
showAppsButton.allocate(childBox, flags);
|
showAppsButton.allocate(childBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_get_preferred_height(forWidth) {
|
vfunc_get_preferred_height(forWidth) {
|
||||||
@ -815,7 +815,12 @@ var Dash = GObject.registerClass({
|
|||||||
else
|
else
|
||||||
pos = 0; // always insert at the top when dash is empty
|
pos = 0; // always insert at the top when dash is empty
|
||||||
|
|
||||||
if (pos != this._dragPlaceholderPos && pos <= numFavorites && this._animatingPlaceholdersCount == 0) {
|
// Put the placeholder after the last favorite if we are not
|
||||||
|
// in the favorites zone
|
||||||
|
if (pos > numFavorites)
|
||||||
|
pos = numFavorites;
|
||||||
|
|
||||||
|
if (pos !== this._dragPlaceholderPos && this._animatingPlaceholdersCount === 0) {
|
||||||
this._dragPlaceholderPos = pos;
|
this._dragPlaceholderPos = pos;
|
||||||
|
|
||||||
// Don't allow positioning before or after self
|
// Don't allow positioning before or after self
|
||||||
@ -843,11 +848,6 @@ var Dash = GObject.registerClass({
|
|||||||
this._dragPlaceholder.show(fadeIn);
|
this._dragPlaceholder.show(fadeIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the drag placeholder if we are not in the
|
|
||||||
// "favorites zone"
|
|
||||||
if (pos > numFavorites)
|
|
||||||
this._clearDragPlaceholder();
|
|
||||||
|
|
||||||
if (!this._dragPlaceholder)
|
if (!this._dragPlaceholder)
|
||||||
return DND.DragMotionResult.NO_DROP;
|
return DND.DragMotionResult.NO_DROP;
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ class WorldClocksSection extends St.Button {
|
|||||||
});
|
});
|
||||||
this._clock = new GnomeDesktop.WallClock();
|
this._clock = new GnomeDesktop.WallClock();
|
||||||
this._clockNotifyId = 0;
|
this._clockNotifyId = 0;
|
||||||
|
this._tzNotifyId = 0;
|
||||||
|
|
||||||
this._locations = [];
|
this._locations = [];
|
||||||
|
|
||||||
@ -166,8 +167,6 @@ class WorldClocksSection extends St.Button {
|
|||||||
layout.attach(header, 0, 0, 2, 1);
|
layout.attach(header, 0, 0, 2, 1);
|
||||||
this.label_actor = header;
|
this.label_actor = header;
|
||||||
|
|
||||||
let localOffset = GLib.DateTime.new_now_local().get_utc_offset();
|
|
||||||
|
|
||||||
for (let i = 0; i < this._locations.length; i++) {
|
for (let i = 0; i < this._locations.length; i++) {
|
||||||
let l = this._locations[i].location;
|
let l = this._locations[i].location;
|
||||||
|
|
||||||
@ -180,14 +179,14 @@ class WorldClocksSection extends St.Button {
|
|||||||
|
|
||||||
let time = new St.Label({ style_class: 'world-clocks-time' });
|
let time = new St.Label({ style_class: 'world-clocks-time' });
|
||||||
|
|
||||||
let otherOffset = this._getTimeAtLocation(l).get_utc_offset();
|
const tz = new St.Label({
|
||||||
let offset = (otherOffset - localOffset) / GLib.TIME_SPAN_HOUR;
|
style_class: 'world-clocks-timezone',
|
||||||
let fmt = Math.trunc(offset) == offset ? '%s%.0f' : '%s%.1f';
|
x_align: Clutter.ActorAlign.END,
|
||||||
let prefix = offset >= 0 ? '+' : '-';
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
let tz = new St.Label({ style_class: 'world-clocks-timezone',
|
});
|
||||||
text: fmt.format(prefix, Math.abs(offset)),
|
|
||||||
x_align: Clutter.ActorAlign.END,
|
time.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
y_align: Clutter.ActorAlign.CENTER });
|
tz.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
|
|
||||||
if (this._grid.text_direction == Clutter.TextDirection.RTL) {
|
if (this._grid.text_direction == Clutter.TextDirection.RTL) {
|
||||||
layout.attach(tz, 0, i + 1, 1, 1);
|
layout.attach(tz, 0, i + 1, 1, 1);
|
||||||
@ -199,32 +198,65 @@ class WorldClocksSection extends St.Button {
|
|||||||
layout.attach(tz, 2, i + 1, 1, 1);
|
layout.attach(tz, 2, i + 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._locations[i].actor = time;
|
this._locations[i].timeLabel = time;
|
||||||
|
this._locations[i].tzLabel = tz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._grid.get_n_children() > 1) {
|
if (this._grid.get_n_children() > 1) {
|
||||||
if (!this._clockNotifyId) {
|
if (!this._clockNotifyId) {
|
||||||
this._clockNotifyId =
|
this._clockNotifyId =
|
||||||
this._clock.connect('notify::clock', this._updateLabels.bind(this));
|
this._clock.connect('notify::clock', this._updateTimeLabels.bind(this));
|
||||||
}
|
}
|
||||||
this._updateLabels();
|
if (!this._tzNotifyId) {
|
||||||
|
this._tzNotifyId =
|
||||||
|
this._clock.connect('notify::timezone', this._updateTimezoneLabels.bind(this));
|
||||||
|
}
|
||||||
|
this._updateTimeLabels();
|
||||||
|
this._updateTimezoneLabels();
|
||||||
} else {
|
} else {
|
||||||
if (this._clockNotifyId)
|
if (this._clockNotifyId)
|
||||||
this._clock.disconnect(this._clockNotifyId);
|
this._clock.disconnect(this._clockNotifyId);
|
||||||
this._clockNotifyId = 0;
|
this._clockNotifyId = 0;
|
||||||
|
|
||||||
|
if (this._tzNotifyId)
|
||||||
|
this._clock.disconnect(this._tzNotifyId);
|
||||||
|
this._tzNotifyId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getTimezoneOffsetAtLocation(location) {
|
||||||
|
const localOffset = GLib.DateTime.new_now_local().get_utc_offset();
|
||||||
|
const utcOffset = this._getTimeAtLocation(location).get_utc_offset();
|
||||||
|
const offsetCurrentTz = utcOffset - localOffset;
|
||||||
|
const offsetHours = Math.abs(offsetCurrentTz) / GLib.TIME_SPAN_HOUR;
|
||||||
|
const offsetMinutes =
|
||||||
|
(Math.abs(offsetCurrentTz) % GLib.TIME_SPAN_HOUR) /
|
||||||
|
GLib.TIME_SPAN_MINUTE;
|
||||||
|
|
||||||
|
const prefix = offsetCurrentTz >= 0 ? '+' : '-';
|
||||||
|
const text = offsetMinutes === 0
|
||||||
|
? '%s%d'.format(prefix, offsetHours)
|
||||||
|
: '%s%d\u2236%d'.format(prefix, offsetHours, offsetMinutes);
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
_getTimeAtLocation(location) {
|
_getTimeAtLocation(location) {
|
||||||
let tz = GLib.TimeZone.new(location.get_timezone().get_tzid());
|
let tz = GLib.TimeZone.new(location.get_timezone().get_tzid());
|
||||||
return GLib.DateTime.new_now(tz);
|
return GLib.DateTime.new_now(tz);
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateLabels() {
|
_updateTimeLabels() {
|
||||||
for (let i = 0; i < this._locations.length; i++) {
|
for (let i = 0; i < this._locations.length; i++) {
|
||||||
let l = this._locations[i];
|
let l = this._locations[i];
|
||||||
let now = this._getTimeAtLocation(l.location);
|
let now = this._getTimeAtLocation(l.location);
|
||||||
l.actor.text = Util.formatTime(now, { timeOnly: true });
|
l.timeLabel.text = Util.formatTime(now, { timeOnly: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateTimezoneLabels() {
|
||||||
|
for (let i = 0; i < this._locations.length; i++) {
|
||||||
|
let l = this._locations[i];
|
||||||
|
l.tzLabel.text = this._getTimezoneOffsetAtLocation(l.location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,13 +300,13 @@ class WeatherSection extends St.Button {
|
|||||||
this.child = box;
|
this.child = box;
|
||||||
|
|
||||||
let titleBox = new St.BoxLayout({ style_class: 'weather-header-box' });
|
let titleBox = new St.BoxLayout({ style_class: 'weather-header-box' });
|
||||||
titleBox.add_child(new St.Label({
|
this._titleLabel = new St.Label({
|
||||||
style_class: 'weather-header',
|
style_class: 'weather-header',
|
||||||
x_align: Clutter.ActorAlign.START,
|
x_align: Clutter.ActorAlign.START,
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
y_align: Clutter.ActorAlign.END,
|
y_align: Clutter.ActorAlign.END,
|
||||||
text: _('Weather'),
|
});
|
||||||
}));
|
titleBox.add_child(this._titleLabel);
|
||||||
box.add_child(titleBox);
|
box.add_child(titleBox);
|
||||||
|
|
||||||
this._titleLocation = new St.Label({
|
this._titleLocation = new St.Label({
|
||||||
@ -384,21 +416,28 @@ class WeatherSection extends St.Button {
|
|||||||
layout.attach(label, 0, 0, 1, 1);
|
layout.attach(label, 0, 0, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_findBestLocationName(loc) {
|
||||||
|
const locName = loc.get_name();
|
||||||
|
|
||||||
|
if (loc.get_level() === GWeather.LocationLevel.CITY ||
|
||||||
|
!loc.has_coords())
|
||||||
|
return locName;
|
||||||
|
|
||||||
|
const world = GWeather.Location.get_world();
|
||||||
|
const city = world.find_nearest_city(...loc.get_coords());
|
||||||
|
const cityName = city.get_name();
|
||||||
|
|
||||||
|
return locName.includes(cityName) ? cityName : locName;
|
||||||
|
}
|
||||||
|
|
||||||
_updateForecasts() {
|
_updateForecasts() {
|
||||||
this._forecastGrid.destroy_all_children();
|
this._forecastGrid.destroy_all_children();
|
||||||
|
|
||||||
if (!this._weatherClient.hasLocation) {
|
if (!this._weatherClient.hasLocation)
|
||||||
this._setStatusLabel(_("Select a location…"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
let info = this._weatherClient.info;
|
const { info } = this._weatherClient;
|
||||||
let loc = info.get_location();
|
this._titleLocation.text = this._findBestLocationName(info.location);
|
||||||
if (loc.get_level() !== GWeather.LocationLevel.CITY && loc.has_coords()) {
|
|
||||||
let world = GWeather.Location.get_world();
|
|
||||||
loc = world.find_nearest_city(...loc.get_coords());
|
|
||||||
}
|
|
||||||
this._titleLocation.text = loc.get_name();
|
|
||||||
|
|
||||||
if (this._weatherClient.loading) {
|
if (this._weatherClient.loading) {
|
||||||
this._setStatusLabel(_("Loading…"));
|
this._setStatusLabel(_("Loading…"));
|
||||||
@ -422,6 +461,12 @@ class WeatherSection extends St.Button {
|
|||||||
if (!this.visible)
|
if (!this.visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this._weatherClient.hasLocation)
|
||||||
|
this._titleLabel.text = _('Weather');
|
||||||
|
else
|
||||||
|
this._titleLabel.text = _('Select weather location…');
|
||||||
|
|
||||||
|
this._forecastGrid.visible = this._weatherClient.hasLocation;
|
||||||
this._titleLocation.visible = this._weatherClient.hasLocation;
|
this._titleLocation.visible = this._weatherClient.hasLocation;
|
||||||
|
|
||||||
this._updateForecasts();
|
this._updateForecasts();
|
||||||
@ -440,7 +485,6 @@ class MessagesIndicator extends St.Icon {
|
|||||||
|
|
||||||
this._sources = [];
|
this._sources = [];
|
||||||
this._count = 0;
|
this._count = 0;
|
||||||
this._doNotDisturb = false;
|
|
||||||
|
|
||||||
this._settings = new Gio.Settings({
|
this._settings = new Gio.Settings({
|
||||||
schema_id: 'org.gnome.desktop.notifications',
|
schema_id: 'org.gnome.desktop.notifications',
|
||||||
@ -521,8 +565,8 @@ class FreezableBinLayout extends Clutter.BinLayout {
|
|||||||
return this._savedHeight;
|
return this._savedHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(container, allocation, flags) {
|
vfunc_allocate(container, allocation) {
|
||||||
super.vfunc_allocate(container, allocation, flags);
|
super.vfunc_allocate(container, allocation);
|
||||||
|
|
||||||
let [width, height] = allocation.get_size();
|
let [width, height] = allocation.get_size();
|
||||||
this._savedWidth = [width, width];
|
this._savedWidth = [width, width];
|
||||||
|
@ -278,7 +278,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/SessionManager/EndSessionDialog');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/SessionManager/EndSessionDialog');
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPkOfflineProxyCreated(proxy, error) {
|
async _onPkOfflineProxyCreated(proxy, error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
log(error.message);
|
log(error.message);
|
||||||
return;
|
return;
|
||||||
@ -293,15 +293,12 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// It only makes sense to check for this permission if PackageKit is available.
|
// It only makes sense to check for this permission if PackageKit is available.
|
||||||
Polkit.Permission.new(
|
try {
|
||||||
'org.freedesktop.packagekit.trigger-offline-update', null, null,
|
this._updatesPermission = await Polkit.Permission.new(
|
||||||
(source, res) => {
|
'org.freedesktop.packagekit.trigger-offline-update', null, null);
|
||||||
try {
|
} catch (e) {
|
||||||
this._updatesPermission = Polkit.Permission.new_finish(res);
|
log('No permission to trigger offline updates: %s'.format(e.toString()));
|
||||||
} catch (e) {
|
}
|
||||||
log('No permission to trigger offline updates: %s'.format(e.toString()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
@ -346,10 +343,8 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
|
|
||||||
// Use a different description when we are installing a system upgrade
|
// Use a different description when we are installing a system upgrade
|
||||||
// if the PackageKit proxy is available (i.e. PackageKit is available).
|
// if the PackageKit proxy is available (i.e. PackageKit is available).
|
||||||
if (this._pkOfflineProxy && dialogContent.upgradeDescription) {
|
if (dialogContent.upgradeDescription) {
|
||||||
let name = this._pkOfflineProxy.PreparedUpgrade['name'].deep_unpack();
|
const { name, version } = this._updateInfo.PreparedUpgrade;
|
||||||
let version = this._pkOfflineProxy.PreparedUpgrade['version'].deep_unpack();
|
|
||||||
|
|
||||||
if (name != null && version != null)
|
if (name != null && version != null)
|
||||||
description = dialogContent.upgradeDescription(name, version);
|
description = dialogContent.upgradeDescription(name, version);
|
||||||
}
|
}
|
||||||
@ -608,16 +603,46 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenAsync(parameters, invocation) {
|
async _getUpdateInfo() {
|
||||||
|
const connection = this._pkOfflineProxy.get_connection();
|
||||||
|
const reply = await connection.call(
|
||||||
|
this._pkOfflineProxy.g_name,
|
||||||
|
this._pkOfflineProxy.g_object_path,
|
||||||
|
'org.freedesktop.DBus.Properties',
|
||||||
|
'GetAll',
|
||||||
|
new GLib.Variant('(s)', [this._pkOfflineProxy.g_interface_name]),
|
||||||
|
null,
|
||||||
|
Gio.DBusCallFlags.NONE,
|
||||||
|
-1,
|
||||||
|
null);
|
||||||
|
const [info] = reply.recursiveUnpack();
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
async OpenAsync(parameters, invocation) {
|
||||||
let [type, timestamp, totalSecondsToStayOpen, inhibitorObjectPaths] = parameters;
|
let [type, timestamp, totalSecondsToStayOpen, inhibitorObjectPaths] = parameters;
|
||||||
this._totalSecondsToStayOpen = totalSecondsToStayOpen;
|
this._totalSecondsToStayOpen = totalSecondsToStayOpen;
|
||||||
this._type = type;
|
this._type = type;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this._updateInfo = await this._getUpdateInfo();
|
||||||
|
} catch (e) {
|
||||||
|
if (this._pkOfflineProxy !== null)
|
||||||
|
log('Failed to get update info from PackageKit: %s'.format(e.message));
|
||||||
|
|
||||||
|
this._updateInfo = {
|
||||||
|
UpdateTriggered: false,
|
||||||
|
UpdatePrepared: false,
|
||||||
|
UpgradeTriggered: false,
|
||||||
|
PreparedUpgrade: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Only consider updates and upgrades if PackageKit is available.
|
// Only consider updates and upgrades if PackageKit is available.
|
||||||
if (this._pkOfflineProxy && this._type == DialogType.RESTART) {
|
if (this._pkOfflineProxy && this._type == DialogType.RESTART) {
|
||||||
if (this._pkOfflineProxy.UpdateTriggered)
|
if (this._updateInfo.UpdateTriggered)
|
||||||
this._type = DialogType.UPDATE_RESTART;
|
this._type = DialogType.UPDATE_RESTART;
|
||||||
else if (this._pkOfflineProxy.UpgradeTriggered)
|
else if (this._updateInfo.UpgradeTriggered)
|
||||||
this._type = DialogType.UPGRADE_RESTART;
|
this._type = DialogType.UPGRADE_RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,14 +671,13 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
|
|||||||
if (dialogContent.showOtherSessions)
|
if (dialogContent.showOtherSessions)
|
||||||
this._loadSessions();
|
this._loadSessions();
|
||||||
|
|
||||||
// Only consider updates and upgrades if PackageKit is available.
|
let updateTriggered = this._updateInfo.UpdateTriggered;
|
||||||
let updateTriggered = this._pkOfflineProxy ? this._pkOfflineProxy.UpdateTriggered : false;
|
let updatePrepared = this._updateInfo.UpdatePrepared;
|
||||||
let updatePrepared = this._pkOfflineProxy ? this._pkOfflineProxy.UpdatePrepared : false;
|
|
||||||
let updatesAllowed = this._updatesPermission && this._updatesPermission.allowed;
|
let updatesAllowed = this._updatesPermission && this._updatesPermission.allowed;
|
||||||
|
|
||||||
_setCheckBoxLabel(this._checkBox, dialogContent.checkBoxText || '');
|
_setCheckBoxLabel(this._checkBox, dialogContent.checkBoxText || '');
|
||||||
this._checkBox.visible = dialogContent.checkBoxText && updatePrepared && updatesAllowed;
|
this._checkBox.visible = dialogContent.checkBoxText && updatePrepared && updatesAllowed;
|
||||||
this._checkBox.checked = updatePrepared && updateTriggered;
|
this._checkBox.checked = this._checkBox.visible;
|
||||||
|
|
||||||
// We show the warning either together with the checkbox, or when
|
// We show the warning either together with the checkbox, or when
|
||||||
// updates have already been triggered, but the user doesn't have
|
// updates have already been triggered, but the user doesn't have
|
||||||
|
@ -10,8 +10,22 @@ imports.gi.versions.Gtk = '3.0';
|
|||||||
imports.gi.versions.TelepathyGLib = '0.12';
|
imports.gi.versions.TelepathyGLib = '0.12';
|
||||||
imports.gi.versions.TelepathyLogger = '0.2';
|
imports.gi.versions.TelepathyLogger = '0.2';
|
||||||
|
|
||||||
const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
|
const { Clutter, Gio, GLib, GObject, Meta, Polkit, Shell, St } = imports.gi;
|
||||||
const Gettext = imports.gettext;
|
const Gettext = imports.gettext;
|
||||||
|
const System = imports.system;
|
||||||
|
|
||||||
|
Gio._promisify(Gio.DataInputStream.prototype, 'fill_async', 'fill_finish');
|
||||||
|
Gio._promisify(Gio.DataInputStream.prototype,
|
||||||
|
'read_line_async', 'read_line_finish');
|
||||||
|
Gio._promisify(Gio.DBus, 'get', 'get_finish');
|
||||||
|
Gio._promisify(Gio.DBusConnection.prototype, 'call', 'call_finish');
|
||||||
|
Gio._promisify(Gio.DBusProxy, 'new', 'new_finish');
|
||||||
|
Gio._promisify(Gio.DBusProxy.prototype, 'init_async', 'init_finish');
|
||||||
|
Gio._promisify(Gio.DBusProxy.prototype,
|
||||||
|
'call_with_unix_fd_list', 'call_with_unix_fd_list_finish');
|
||||||
|
Gio._promisify(Polkit.Permission, 'new', 'new_finish');
|
||||||
|
|
||||||
|
let _localTimeZone = null;
|
||||||
|
|
||||||
// We can't import shell JS modules yet, because they may have
|
// We can't import shell JS modules yet, because they may have
|
||||||
// variable initializations, etc, that depend on init() already having
|
// variable initializations, etc, that depend on init() already having
|
||||||
@ -231,16 +245,15 @@ function _loggingFunc(...args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
// Add some bindings to the global JS namespace; (gjs keeps the web
|
// Add some bindings to the global JS namespace
|
||||||
// browser convention of having that namespace be called 'window'.)
|
globalThis.global = Shell.Global.get();
|
||||||
window.global = Shell.Global.get();
|
|
||||||
|
|
||||||
window.log = _loggingFunc;
|
globalThis.log = _loggingFunc;
|
||||||
|
|
||||||
window._ = Gettext.gettext;
|
globalThis._ = Gettext.gettext;
|
||||||
window.C_ = Gettext.pgettext;
|
globalThis.C_ = Gettext.pgettext;
|
||||||
window.ngettext = Gettext.ngettext;
|
globalThis.ngettext = Gettext.ngettext;
|
||||||
window.N_ = s => s;
|
globalThis.N_ = s => s;
|
||||||
|
|
||||||
GObject.gtypeNameBasedOnJSPath = true;
|
GObject.gtypeNameBasedOnJSPath = true;
|
||||||
|
|
||||||
@ -272,6 +285,11 @@ function init() {
|
|||||||
_easeActorProperty(this, 'value', target, params);
|
_easeActorProperty(this, 'value', target, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Clutter.Actor.prototype[Symbol.iterator] = function* () {
|
||||||
|
for (let c = this.get_first_child(); c; c = c.get_next_sibling())
|
||||||
|
yield c;
|
||||||
|
};
|
||||||
|
|
||||||
Clutter.Actor.prototype.toString = function () {
|
Clutter.Actor.prototype.toString = function () {
|
||||||
return St.describe_actor(this);
|
return St.describe_actor(this);
|
||||||
};
|
};
|
||||||
@ -285,6 +303,13 @@ function init() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Gio._LocalFilePrototype.touch_async = function (callback) {
|
||||||
|
Shell.util_touch_file_async(this, callback);
|
||||||
|
};
|
||||||
|
Gio._LocalFilePrototype.touch_finish = function (result) {
|
||||||
|
return Shell.util_touch_file_finish(this, result);
|
||||||
|
};
|
||||||
|
|
||||||
St.set_slow_down_factor = function (factor) {
|
St.set_slow_down_factor = function (factor) {
|
||||||
let { stack } = new Error();
|
let { stack } = new Error();
|
||||||
log(`St.set_slow_down_factor() is deprecated, use St.Settings.slow_down_factor\n${stack}`);
|
log(`St.set_slow_down_factor() is deprecated, use St.Settings.slow_down_factor\n${stack}`);
|
||||||
@ -304,9 +329,25 @@ function init() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Override to clear our own timezone cache as well
|
||||||
|
const origClearDateCaches = System.clearDateCaches;
|
||||||
|
System.clearDateCaches = function () {
|
||||||
|
_localTimeZone = null;
|
||||||
|
origClearDateCaches();
|
||||||
|
};
|
||||||
|
|
||||||
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=508783
|
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=508783
|
||||||
Date.prototype.toLocaleFormat = function (format) {
|
Date.prototype.toLocaleFormat = function (format) {
|
||||||
let dt = GLib.DateTime.new_from_unix_local(this.getTime() / 1000);
|
if (_localTimeZone === null)
|
||||||
|
_localTimeZone = GLib.TimeZone.new_local();
|
||||||
|
|
||||||
|
let dt = GLib.DateTime.new(_localTimeZone,
|
||||||
|
this.getFullYear(),
|
||||||
|
this.getMonth() + 1,
|
||||||
|
this.getDate(),
|
||||||
|
this.getHours(),
|
||||||
|
this.getMinutes(),
|
||||||
|
this.getSeconds());
|
||||||
return dt ? dt.format(format) : '';
|
return dt ? dt.format(format) : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -319,9 +360,7 @@ function init() {
|
|||||||
|
|
||||||
// OK, now things are initialized enough that we can import shell JS
|
// OK, now things are initialized enough that we can import shell JS
|
||||||
const Format = imports.format;
|
const Format = imports.format;
|
||||||
const Tweener = imports.ui.tweener;
|
|
||||||
|
|
||||||
Tweener.init();
|
|
||||||
String.prototype.format = Format.format;
|
String.prototype.format = Format.format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,15 @@ function uninstallExtension(uuid) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
FileUtils.recursivelyDeleteDir(extension.dir, true);
|
FileUtils.recursivelyDeleteDir(extension.dir, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const updatesDir = Gio.File.new_for_path(GLib.build_filenamev(
|
||||||
|
[global.userdatadir, 'extension-updates', extension.uuid]));
|
||||||
|
FileUtils.recursivelyDeleteDir(updatesDir, true);
|
||||||
|
} catch (e) {
|
||||||
|
// not an error
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +108,9 @@ function gotExtensionZipFile(session, message, uuid, dir, callback, errback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function downloadExtensionUpdate(uuid) {
|
function downloadExtensionUpdate(uuid) {
|
||||||
|
if (!Main.extensionManager.updatesSupported)
|
||||||
|
return;
|
||||||
|
|
||||||
let dir = Gio.File.new_for_path(
|
let dir = Gio.File.new_for_path(
|
||||||
GLib.build_filenamev([global.userdatadir, 'extension-updates', uuid]));
|
GLib.build_filenamev([global.userdatadir, 'extension-updates', uuid]));
|
||||||
|
|
||||||
@ -117,6 +129,9 @@ function downloadExtensionUpdate(uuid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkForUpdates() {
|
function checkForUpdates() {
|
||||||
|
if (!Main.extensionManager.updatesSupported)
|
||||||
|
return;
|
||||||
|
|
||||||
let metadatas = {};
|
let metadatas = {};
|
||||||
Main.extensionManager.getUuids().forEach(uuid => {
|
Main.extensionManager.getUuids().forEach(uuid => {
|
||||||
let extension = Main.extensionManager.lookup(uuid);
|
let extension = Main.extensionManager.lookup(uuid);
|
||||||
@ -127,6 +142,9 @@ function checkForUpdates() {
|
|||||||
metadatas[uuid] = extension.metadata;
|
metadatas[uuid] = extension.metadata;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Object.keys(metadatas).length === 0)
|
||||||
|
return; // nothing to update
|
||||||
|
|
||||||
let versionCheck = global.settings.get_boolean(
|
let versionCheck = global.settings.get_boolean(
|
||||||
'disable-extension-version-validation');
|
'disable-extension-version-validation');
|
||||||
let params = {
|
let params = {
|
||||||
@ -144,9 +162,7 @@ function checkForUpdates() {
|
|||||||
let operations = JSON.parse(message.response_body.data);
|
let operations = JSON.parse(message.response_body.data);
|
||||||
for (let uuid in operations) {
|
for (let uuid in operations) {
|
||||||
let operation = operations[uuid];
|
let operation = operations[uuid];
|
||||||
if (operation == 'blacklist')
|
if (operation === 'upgrade' || operation === 'downgrade')
|
||||||
uninstallExtension(uuid);
|
|
||||||
else if (operation == 'upgrade' || operation == 'downgrade')
|
|
||||||
downloadExtensionUpdate(uuid);
|
downloadExtensionUpdate(uuid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -222,7 +238,7 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
_httpSession = new Soup.SessionAsync({ ssl_use_system_ca_file: true });
|
_httpSession = new Soup.Session({ ssl_use_system_ca_file: true });
|
||||||
|
|
||||||
// See: https://bugzilla.gnome.org/show_bug.cgi?id=655189 for context.
|
// See: https://bugzilla.gnome.org/show_bug.cgi?id=655189 for context.
|
||||||
// _httpSession.add_feature(new Soup.ProxyResolverDefault());
|
// _httpSession.add_feature(new Soup.ProxyResolverDefault());
|
||||||
|
@ -26,6 +26,7 @@ var ExtensionManager = class {
|
|||||||
this._updateNotified = false;
|
this._updateNotified = false;
|
||||||
|
|
||||||
this._extensions = new Map();
|
this._extensions = new Map();
|
||||||
|
this._unloadedExtensions = new Map();
|
||||||
this._enabledExtensions = [];
|
this._enabledExtensions = [];
|
||||||
this._extensionOrder = [];
|
this._extensionOrder = [];
|
||||||
|
|
||||||
@ -60,6 +61,11 @@ var ExtensionManager = class {
|
|||||||
ExtensionDownloader.checkForUpdates();
|
ExtensionDownloader.checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get updatesSupported() {
|
||||||
|
const appSys = Shell.AppSystem.get_default();
|
||||||
|
return appSys.lookup_app('org.gnome.Extensions.desktop') !== null;
|
||||||
|
}
|
||||||
|
|
||||||
lookup(uuid) {
|
lookup(uuid) {
|
||||||
return this._extensions.get(uuid);
|
return this._extensions.get(uuid);
|
||||||
}
|
}
|
||||||
@ -97,18 +103,18 @@ var ExtensionManager = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension.stylesheet) {
|
|
||||||
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
|
|
||||||
theme.unload_stylesheet(extension.stylesheet);
|
|
||||||
delete extension.stylesheet;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
extension.stateObj.disable();
|
extension.stateObj.disable();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logExtensionError(uuid, e);
|
this.logExtensionError(uuid, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (extension.stylesheet) {
|
||||||
|
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
|
||||||
|
theme.unload_stylesheet(extension.stylesheet);
|
||||||
|
delete extension.stylesheet;
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < order.length; i++) {
|
for (let i = 0; i < order.length; i++) {
|
||||||
let otherUuid = order[i];
|
let otherUuid = order[i];
|
||||||
try {
|
try {
|
||||||
@ -210,6 +216,24 @@ var ExtensionManager = class {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openExtensionPrefs(uuid, parentWindow, options) {
|
||||||
|
const extension = this.lookup(uuid);
|
||||||
|
if (!extension || !extension.hasPrefs)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Gio.DBus.session.call(
|
||||||
|
'org.gnome.Shell.Extensions',
|
||||||
|
'/org/gnome/Shell/Extensions',
|
||||||
|
'org.gnome.Shell.Extensions',
|
||||||
|
'OpenExtensionPrefs',
|
||||||
|
new GLib.Variant('(ssa{sv})', [uuid, parentWindow, options]),
|
||||||
|
null,
|
||||||
|
Gio.DBusCallFlags.NONE,
|
||||||
|
-1,
|
||||||
|
null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
notifyExtensionUpdate(uuid) {
|
notifyExtensionUpdate(uuid) {
|
||||||
let extension = this.lookup(uuid);
|
let extension = this.lookup(uuid);
|
||||||
if (!extension)
|
if (!extension)
|
||||||
@ -236,7 +260,8 @@ var ExtensionManager = class {
|
|||||||
if (!extension)
|
if (!extension)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let message = error.toString();
|
const message = error instanceof Error
|
||||||
|
? error.message : error.toString();
|
||||||
|
|
||||||
extension.error = message;
|
extension.error = message;
|
||||||
extension.state = ExtensionState.ERROR;
|
extension.state = ExtensionState.ERROR;
|
||||||
@ -245,6 +270,7 @@ var ExtensionManager = class {
|
|||||||
extension.errors.push(message);
|
extension.errors.push(message);
|
||||||
|
|
||||||
logError(error, 'Extension %s'.format(uuid));
|
logError(error, 'Extension %s'.format(uuid));
|
||||||
|
this._updateCanChange(extension);
|
||||||
this.emit('extension-state-changed', extension);
|
this.emit('extension-state-changed', extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +320,14 @@ var ExtensionManager = class {
|
|||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_canLoad(extension) {
|
||||||
|
if (!this._unloadedExtensions.has(extension.uuid))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
const version = this._unloadedExtensions.get(extension.uuid);
|
||||||
|
return extension.metadata.version === version;
|
||||||
|
}
|
||||||
|
|
||||||
loadExtension(extension) {
|
loadExtension(extension) {
|
||||||
// Default to error, we set success as the last step
|
// Default to error, we set success as the last step
|
||||||
extension.state = ExtensionState.ERROR;
|
extension.state = ExtensionState.ERROR;
|
||||||
@ -302,6 +336,9 @@ var ExtensionManager = class {
|
|||||||
|
|
||||||
if (checkVersion && ExtensionUtils.isOutOfDate(extension)) {
|
if (checkVersion && ExtensionUtils.isOutOfDate(extension)) {
|
||||||
extension.state = ExtensionState.OUT_OF_DATE;
|
extension.state = ExtensionState.OUT_OF_DATE;
|
||||||
|
} else if (!this._canLoad(extension)) {
|
||||||
|
this.logExtensionError(extension.uuid, new Error(
|
||||||
|
'A different version was loaded previously. You need to log out for changes to take effect.'));
|
||||||
} else {
|
} else {
|
||||||
let enabled = this._enabledExtensions.includes(extension.uuid);
|
let enabled = this._enabledExtensions.includes(extension.uuid);
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
@ -312,6 +349,8 @@ var ExtensionManager = class {
|
|||||||
} else {
|
} else {
|
||||||
extension.state = ExtensionState.INITIALIZED;
|
extension.state = ExtensionState.INITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._unloadedExtensions.delete(extension.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._updateCanChange(extension);
|
this._updateCanChange(extension);
|
||||||
@ -319,15 +358,22 @@ var ExtensionManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unloadExtension(extension) {
|
unloadExtension(extension) {
|
||||||
|
const { uuid, type } = extension;
|
||||||
|
|
||||||
// Try to disable it -- if it's ERROR'd, we can't guarantee that,
|
// Try to disable it -- if it's ERROR'd, we can't guarantee that,
|
||||||
// but it will be removed on next reboot, and hopefully nothing
|
// but it will be removed on next reboot, and hopefully nothing
|
||||||
// broke too much.
|
// broke too much.
|
||||||
this._callExtensionDisable(extension.uuid);
|
this._callExtensionDisable(uuid);
|
||||||
|
|
||||||
extension.state = ExtensionState.UNINSTALLED;
|
extension.state = ExtensionState.UNINSTALLED;
|
||||||
this.emit('extension-state-changed', extension);
|
this.emit('extension-state-changed', extension);
|
||||||
|
|
||||||
this._extensions.delete(extension.uuid);
|
// If we did install an importer, it is now cached and it's
|
||||||
|
// impossible to load a different version
|
||||||
|
if (type === ExtensionType.PER_USER && extension.imports)
|
||||||
|
this._unloadedExtensions.set(uuid, extension.metadata.version);
|
||||||
|
|
||||||
|
this._extensions.delete(uuid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,19 +486,15 @@ var ExtensionManager = class {
|
|||||||
|
|
||||||
// Find and enable all the newly enabled extensions: UUIDs found in the
|
// Find and enable all the newly enabled extensions: UUIDs found in the
|
||||||
// new setting, but not in the old one.
|
// new setting, but not in the old one.
|
||||||
newEnabledExtensions.filter(
|
newEnabledExtensions
|
||||||
uuid => !this._enabledExtensions.includes(uuid)
|
.filter(uuid => !this._enabledExtensions.includes(uuid))
|
||||||
).forEach(uuid => {
|
.forEach(uuid => this._callExtensionEnable(uuid));
|
||||||
this._callExtensionEnable(uuid);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Find and disable all the newly disabled extensions: UUIDs found in the
|
// Find and disable all the newly disabled extensions: UUIDs found in the
|
||||||
// old setting, but not in the new one.
|
// old setting, but not in the new one.
|
||||||
this._extensionOrder.filter(
|
this._extensionOrder
|
||||||
uuid => !newEnabledExtensions.includes(uuid)
|
.filter(uuid => !newEnabledExtensions.includes(uuid))
|
||||||
).reverse().forEach(uuid => {
|
.reverse().forEach(uuid => this._callExtensionDisable(uuid));
|
||||||
this._callExtensionDisable(uuid);
|
|
||||||
});
|
|
||||||
|
|
||||||
this._enabledExtensions = newEnabledExtensions;
|
this._enabledExtensions = newEnabledExtensions;
|
||||||
}
|
}
|
||||||
@ -481,6 +523,9 @@ var ExtensionManager = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_installExtensionUpdates() {
|
_installExtensionUpdates() {
|
||||||
|
if (!this.updatesSupported)
|
||||||
|
return;
|
||||||
|
|
||||||
FileUtils.collectFromDatadirs('extension-updates', true, (dir, info) => {
|
FileUtils.collectFromDatadirs('extension-updates', true, (dir, info) => {
|
||||||
let fileType = info.get_file_type();
|
let fileType = info.get_file_type();
|
||||||
if (fileType !== Gio.FileType.DIRECTORY)
|
if (fileType !== Gio.FileType.DIRECTORY)
|
||||||
@ -489,9 +534,14 @@ var ExtensionManager = class {
|
|||||||
let extensionDir = Gio.File.new_for_path(
|
let extensionDir = Gio.File.new_for_path(
|
||||||
GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
|
GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
|
||||||
|
|
||||||
FileUtils.recursivelyDeleteDir(extensionDir, false);
|
try {
|
||||||
FileUtils.recursivelyMoveDir(dir, extensionDir);
|
FileUtils.recursivelyDeleteDir(extensionDir, false);
|
||||||
FileUtils.recursivelyDeleteDir(dir, true);
|
FileUtils.recursivelyMoveDir(dir, extensionDir);
|
||||||
|
} catch (e) {
|
||||||
|
log('Failed to install extension updates for %s'.format(uuid));
|
||||||
|
} finally {
|
||||||
|
FileUtils.recursivelyDeleteDir(dir, true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,8 +114,11 @@ class BaseIcon extends St.Bin {
|
|||||||
if (this._setSizeManually) {
|
if (this._setSizeManually) {
|
||||||
size = this.iconSize;
|
size = this.iconSize;
|
||||||
} else {
|
} else {
|
||||||
|
const { scaleFactor } =
|
||||||
|
St.ThemeContext.get_for_stage(global.stage);
|
||||||
|
|
||||||
let [found, len] = node.lookup_length('icon-size', false);
|
let [found, len] = node.lookup_length('icon-size', false);
|
||||||
size = found ? len : ICON_SIZE;
|
size = found ? len / scaleFactor : ICON_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.iconSize == size && this._iconBin.child)
|
if (this.iconSize == size && this._iconBin.child)
|
||||||
@ -194,9 +197,9 @@ function zoomOutActorAtPos(actor, x, y) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function animateIconPosition(icon, box, flags, nChangedIcons) {
|
function animateIconPosition(icon, box, nChangedIcons) {
|
||||||
if (!icon.has_allocation() || icon.allocation.equal(box) || icon.opacity === 0) {
|
if (!icon.has_allocation() || icon.allocation.equal(box) || icon.opacity === 0) {
|
||||||
icon.allocate(box, flags);
|
icon.allocate(box);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +207,7 @@ function animateIconPosition(icon, box, flags, nChangedIcons) {
|
|||||||
icon.set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
|
icon.set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||||
icon.set_easing_delay(nChangedIcons * ICON_POSITION_DELAY);
|
icon.set_easing_delay(nChangedIcons * ICON_POSITION_DELAY);
|
||||||
|
|
||||||
icon.allocate(box, flags);
|
icon.allocate(box);
|
||||||
|
|
||||||
icon.restore_easing_state();
|
icon.restore_easing_state();
|
||||||
|
|
||||||
@ -223,7 +226,6 @@ var IconGrid = GObject.registerClass({
|
|||||||
columnLimit: null,
|
columnLimit: null,
|
||||||
minRows: 1,
|
minRows: 1,
|
||||||
minColumns: 1,
|
minColumns: 1,
|
||||||
fillParent: false,
|
|
||||||
xAlign: St.Align.MIDDLE,
|
xAlign: St.Align.MIDDLE,
|
||||||
padWithSpacing: false });
|
padWithSpacing: false });
|
||||||
this._rowLimit = params.rowLimit;
|
this._rowLimit = params.rowLimit;
|
||||||
@ -231,7 +233,6 @@ var IconGrid = GObject.registerClass({
|
|||||||
this._minRows = params.minRows;
|
this._minRows = params.minRows;
|
||||||
this._minColumns = params.minColumns;
|
this._minColumns = params.minColumns;
|
||||||
this._xAlign = params.xAlign;
|
this._xAlign = params.xAlign;
|
||||||
this._fillParent = params.fillParent;
|
|
||||||
this._padWithSpacing = params.padWithSpacing;
|
this._padWithSpacing = params.padWithSpacing;
|
||||||
|
|
||||||
this.topPadding = 0;
|
this.topPadding = 0;
|
||||||
@ -239,6 +240,12 @@ var IconGrid = GObject.registerClass({
|
|||||||
this.rightPadding = 0;
|
this.rightPadding = 0;
|
||||||
this.leftPadding = 0;
|
this.leftPadding = 0;
|
||||||
|
|
||||||
|
this._nPages = 0;
|
||||||
|
this.currentPage = 0;
|
||||||
|
this._rowsPerPage = 0;
|
||||||
|
this._spaceBetweenPages = 0;
|
||||||
|
this._childrenPerPage = 0;
|
||||||
|
|
||||||
this._updateIconSizesLaterId = 0;
|
this._updateIconSizesLaterId = 0;
|
||||||
|
|
||||||
this._items = [];
|
this._items = [];
|
||||||
@ -294,11 +301,6 @@ var IconGrid = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfunc_get_preferred_width(_forHeight) {
|
vfunc_get_preferred_width(_forHeight) {
|
||||||
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
|
|
||||||
return [0, 0];
|
|
||||||
|
|
||||||
let nChildren = this.get_n_children();
|
let nChildren = this.get_n_children();
|
||||||
let nColumns = this._colLimit
|
let nColumns = this._colLimit
|
||||||
? Math.min(this._colLimit, nChildren)
|
? Math.min(this._colLimit, nChildren)
|
||||||
@ -317,52 +319,23 @@ var IconGrid = GObject.registerClass({
|
|||||||
return this.get_children().filter(actor => actor.visible);
|
return this.get_children().filter(actor => actor.visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_get_preferred_height(forWidth) {
|
_availableHeightPerPageForItems() {
|
||||||
if (this._fillParent)
|
return this.usedHeightForNRows(this._rowsPerPage) - (this.topPadding + this.bottomPadding);
|
||||||
// Ignore all size requests of children and request a size of 0;
|
|
||||||
// later we'll allocate as many children as fit the parent
|
|
||||||
return [0, 0];
|
|
||||||
|
|
||||||
let themeNode = this.get_theme_node();
|
|
||||||
let children = this._getVisibleChildren();
|
|
||||||
let nColumns;
|
|
||||||
|
|
||||||
forWidth = themeNode.adjust_for_width(forWidth);
|
|
||||||
|
|
||||||
if (forWidth < 0)
|
|
||||||
nColumns = children.length;
|
|
||||||
else
|
|
||||||
[nColumns] = this._computeLayout(forWidth);
|
|
||||||
|
|
||||||
let nRows;
|
|
||||||
if (nColumns > 0)
|
|
||||||
nRows = Math.ceil(children.length / nColumns);
|
|
||||||
else
|
|
||||||
nRows = 0;
|
|
||||||
if (this._rowLimit)
|
|
||||||
nRows = Math.min(nRows, this._rowLimit);
|
|
||||||
let totalSpacing = Math.max(0, nRows - 1) * this._getSpacing();
|
|
||||||
let height = nRows * this._getVItemSize() + totalSpacing + this.topPadding + this.bottomPadding;
|
|
||||||
|
|
||||||
return themeNode.adjust_preferred_height(height, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_get_preferred_height() {
|
||||||
this.set_allocation(box, flags);
|
const height = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
||||||
|
return [height, height];
|
||||||
|
}
|
||||||
|
|
||||||
let themeNode = this.get_theme_node();
|
vfunc_allocate(box) {
|
||||||
box = themeNode.get_content_box(box);
|
if (this._childrenPerPage === 0)
|
||||||
|
log('computePages() must be called before allocate(); pagination will not work.');
|
||||||
|
|
||||||
if (this._fillParent) {
|
this.set_allocation(box);
|
||||||
// Reset the passed in box to fill the parent
|
|
||||||
let parentBox = this.get_parent().allocation;
|
|
||||||
let gridBox = themeNode.get_content_box(parentBox);
|
|
||||||
box = themeNode.get_content_box(gridBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
let children = this._getVisibleChildren();
|
let children = this._getVisibleChildren();
|
||||||
let availWidth = box.x2 - box.x1;
|
let availWidth = box.x2 - box.x1;
|
||||||
let availHeight = box.y2 - box.y1;
|
|
||||||
let spacing = this._getSpacing();
|
let spacing = this._getSpacing();
|
||||||
let [nColumns, usedWidth] = this._computeLayout(availWidth);
|
let [nColumns, usedWidth] = this._computeLayout(availWidth);
|
||||||
|
|
||||||
@ -378,34 +351,27 @@ var IconGrid = GObject.registerClass({
|
|||||||
leftEmptySpace = availWidth - usedWidth;
|
leftEmptySpace = availWidth - usedWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
let animating = this._clonesAnimating.length > 0;
|
|
||||||
let x = box.x1 + leftEmptySpace + this.leftPadding;
|
let x = box.x1 + leftEmptySpace + this.leftPadding;
|
||||||
let y = box.y1 + this.topPadding;
|
let y = box.y1 + this.topPadding;
|
||||||
let columnIndex = 0;
|
let columnIndex = 0;
|
||||||
let rowIndex = 0;
|
|
||||||
let nChangedIcons = 0;
|
let nChangedIcons = 0;
|
||||||
for (let i = 0; i < children.length; i++) {
|
for (let i = 0; i < children.length; i++) {
|
||||||
let childBox = this._calculateChildBox(children[i], x, y, box);
|
let childBox = this._calculateChildBox(children[i], x, y, box);
|
||||||
|
|
||||||
if (this._rowLimit && rowIndex >= this._rowLimit ||
|
if (animateIconPosition(children[i], childBox, nChangedIcons))
|
||||||
this._fillParent && childBox.y2 > availHeight - this.bottomPadding) {
|
nChangedIcons++;
|
||||||
children[i].opacity = 0;
|
|
||||||
} else {
|
|
||||||
if (!animating)
|
|
||||||
children[i].opacity = 255;
|
|
||||||
|
|
||||||
if (animateIconPosition(children[i], childBox, flags, nChangedIcons))
|
children[i].show();
|
||||||
nChangedIcons++;
|
|
||||||
}
|
|
||||||
|
|
||||||
columnIndex++;
|
columnIndex++;
|
||||||
if (columnIndex == nColumns) {
|
if (columnIndex === nColumns)
|
||||||
columnIndex = 0;
|
columnIndex = 0;
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (columnIndex == 0) {
|
if (columnIndex == 0) {
|
||||||
y += this._getVItemSize() + spacing;
|
y += this._getVItemSize() + spacing;
|
||||||
|
if ((i + 1) % this._childrenPerPage === 0)
|
||||||
|
y += this._spaceBetweenPages - spacing + this.bottomPadding + this.topPadding;
|
||||||
x = box.x1 + leftEmptySpace + this.leftPadding;
|
x = box.x1 + leftEmptySpace + this.leftPadding;
|
||||||
} else {
|
} else {
|
||||||
x += this._getHItemSize() + spacing;
|
x += this._getHItemSize() + spacing;
|
||||||
@ -457,7 +423,11 @@ var IconGrid = GObject.registerClass({
|
|||||||
* set of items to be animated.
|
* set of items to be animated.
|
||||||
*/
|
*/
|
||||||
_getChildrenToAnimate() {
|
_getChildrenToAnimate() {
|
||||||
return this._getVisibleChildren().filter(child => child.opacity > 0);
|
const children = this._getVisibleChildren().filter(child => child.opacity > 0);
|
||||||
|
const firstIndex = this._childrenPerPage * this.currentPage;
|
||||||
|
const lastIndex = firstIndex + this._childrenPerPage;
|
||||||
|
|
||||||
|
return children.slice(firstIndex, lastIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
_resetAnimationActors() {
|
_resetAnimationActors() {
|
||||||
@ -733,16 +703,6 @@ var IconGrid = GObject.registerClass({
|
|||||||
return usedWidth + this.leftPadding + this.rightPadding;
|
return usedWidth + this.leftPadding + this.rightPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAll() {
|
|
||||||
this._items = [];
|
|
||||||
this.remove_all_children();
|
|
||||||
}
|
|
||||||
|
|
||||||
destroyAll() {
|
|
||||||
this._items = [];
|
|
||||||
this.destroy_all_children();
|
|
||||||
}
|
|
||||||
|
|
||||||
addItem(item, index) {
|
addItem(item, index) {
|
||||||
if (!(item.icon instanceof BaseIcon))
|
if (!(item.icon instanceof BaseIcon))
|
||||||
throw new Error('Only items with a BaseIcon icon property can be added to IconGrid');
|
throw new Error('Only items with a BaseIcon icon property can be added to IconGrid');
|
||||||
@ -758,14 +718,6 @@ var IconGrid = GObject.registerClass({
|
|||||||
this.remove_child(item);
|
this.remove_child(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemAtIndex(index) {
|
|
||||||
return this.get_child_at_index(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
visibleItemsCount() {
|
|
||||||
return this.get_children().filter(c => c.is_visible()).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
setSpacing(spacing) {
|
setSpacing(spacing) {
|
||||||
this._fixedSpacing = spacing;
|
this._fixedSpacing = spacing;
|
||||||
}
|
}
|
||||||
@ -815,6 +767,24 @@ var IconGrid = GObject.registerClass({
|
|||||||
this.topPadding = this.rightPadding = this.bottomPadding = this.leftPadding = spacing;
|
this.topPadding = this.rightPadding = this.bottomPadding = this.leftPadding = spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_computePages(availWidthPerPage, availHeightPerPage) {
|
||||||
|
const [nColumns] = this._computeLayout(availWidthPerPage);
|
||||||
|
const children = this._getVisibleChildren();
|
||||||
|
let nRows;
|
||||||
|
if (nColumns > 0)
|
||||||
|
nRows = Math.ceil(children.length / nColumns);
|
||||||
|
else
|
||||||
|
nRows = 0;
|
||||||
|
if (this._rowLimit)
|
||||||
|
nRows = Math.min(nRows, this._rowLimit);
|
||||||
|
|
||||||
|
// We want to contain the grid inside the parent box with padding
|
||||||
|
this._rowsPerPage = this.rowsForHeight(availHeightPerPage);
|
||||||
|
this._nPages = Math.ceil(nRows / this._rowsPerPage);
|
||||||
|
this._spaceBetweenPages = availHeightPerPage - (this.topPadding + this.bottomPadding) - this._availableHeightPerPageForItems();
|
||||||
|
this._childrenPerPage = nColumns * this._rowsPerPage;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function must to be called before iconGrid allocation,
|
* This function must to be called before iconGrid allocation,
|
||||||
* to know how much spacing can the grid has
|
* to know how much spacing can the grid has
|
||||||
@ -840,6 +810,7 @@ var IconGrid = GObject.registerClass({
|
|||||||
this._updateIconSizesLaterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
this._updateIconSizesLaterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||||
this._updateIconSizes.bind(this));
|
this._updateIconSizes.bind(this));
|
||||||
}
|
}
|
||||||
|
this._computePages(availWidth, availHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
|
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
|
||||||
@ -852,116 +823,6 @@ var IconGrid = GObject.registerClass({
|
|||||||
|
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
var PaginatedIconGrid = GObject.registerClass(
|
|
||||||
class PaginatedIconGrid extends IconGrid {
|
|
||||||
_init(params) {
|
|
||||||
super._init(params);
|
|
||||||
this._nPages = 0;
|
|
||||||
this.currentPage = 0;
|
|
||||||
this._rowsPerPage = 0;
|
|
||||||
this._spaceBetweenPages = 0;
|
|
||||||
this._childrenPerPage = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
vfunc_get_preferred_height(_forWidth) {
|
|
||||||
let height = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
|
||||||
return [height, height];
|
|
||||||
}
|
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
|
||||||
if (this._childrenPerPage == 0)
|
|
||||||
log('computePages() must be called before allocate(); pagination will not work.');
|
|
||||||
|
|
||||||
this.set_allocation(box, flags);
|
|
||||||
|
|
||||||
if (this._fillParent) {
|
|
||||||
// Reset the passed in box to fill the parent
|
|
||||||
let parentBox = this.get_parent().allocation;
|
|
||||||
let gridBox = this.get_theme_node().get_content_box(parentBox);
|
|
||||||
box = this.get_theme_node().get_content_box(gridBox);
|
|
||||||
}
|
|
||||||
let children = this._getVisibleChildren();
|
|
||||||
let availWidth = box.x2 - box.x1;
|
|
||||||
let spacing = this._getSpacing();
|
|
||||||
let [nColumns, usedWidth] = this._computeLayout(availWidth);
|
|
||||||
|
|
||||||
let leftEmptySpace;
|
|
||||||
switch (this._xAlign) {
|
|
||||||
case St.Align.START:
|
|
||||||
leftEmptySpace = 0;
|
|
||||||
break;
|
|
||||||
case St.Align.MIDDLE:
|
|
||||||
leftEmptySpace = Math.floor((availWidth - usedWidth) / 2);
|
|
||||||
break;
|
|
||||||
case St.Align.END:
|
|
||||||
leftEmptySpace = availWidth - usedWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
let x = box.x1 + leftEmptySpace + this.leftPadding;
|
|
||||||
let y = box.y1 + this.topPadding;
|
|
||||||
let columnIndex = 0;
|
|
||||||
|
|
||||||
let nChangedIcons = 0;
|
|
||||||
for (let i = 0; i < children.length; i++) {
|
|
||||||
let childBox = this._calculateChildBox(children[i], x, y, box);
|
|
||||||
|
|
||||||
if (animateIconPosition(children[i], childBox, flags, nChangedIcons))
|
|
||||||
nChangedIcons++;
|
|
||||||
|
|
||||||
children[i].show();
|
|
||||||
|
|
||||||
columnIndex++;
|
|
||||||
if (columnIndex == nColumns)
|
|
||||||
columnIndex = 0;
|
|
||||||
|
|
||||||
if (columnIndex == 0) {
|
|
||||||
y += this._getVItemSize() + spacing;
|
|
||||||
if ((i + 1) % this._childrenPerPage == 0)
|
|
||||||
y += this._spaceBetweenPages - spacing + this.bottomPadding + this.topPadding;
|
|
||||||
x = box.x1 + leftEmptySpace + this.leftPadding;
|
|
||||||
} else {
|
|
||||||
x += this._getHItemSize() + spacing;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overridden from IconGrid
|
|
||||||
_getChildrenToAnimate() {
|
|
||||||
let children = super._getChildrenToAnimate();
|
|
||||||
let firstIndex = this._childrenPerPage * this.currentPage;
|
|
||||||
let lastIndex = firstIndex + this._childrenPerPage;
|
|
||||||
|
|
||||||
return children.slice(firstIndex, lastIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
_computePages(availWidthPerPage, availHeightPerPage) {
|
|
||||||
let [nColumns, usedWidth_] = this._computeLayout(availWidthPerPage);
|
|
||||||
let nRows;
|
|
||||||
let children = this._getVisibleChildren();
|
|
||||||
if (nColumns > 0)
|
|
||||||
nRows = Math.ceil(children.length / nColumns);
|
|
||||||
else
|
|
||||||
nRows = 0;
|
|
||||||
if (this._rowLimit)
|
|
||||||
nRows = Math.min(nRows, this._rowLimit);
|
|
||||||
|
|
||||||
// We want to contain the grid inside the parent box with padding
|
|
||||||
this._rowsPerPage = this.rowsForHeight(availHeightPerPage);
|
|
||||||
this._nPages = Math.ceil(nRows / this._rowsPerPage);
|
|
||||||
this._spaceBetweenPages = availHeightPerPage - (this.topPadding + this.bottomPadding) - this._availableHeightPerPageForItems();
|
|
||||||
this._childrenPerPage = nColumns * this._rowsPerPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
adaptToSize(availWidth, availHeight) {
|
|
||||||
super.adaptToSize(availWidth, availHeight);
|
|
||||||
this._computePages(availWidth, availHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
_availableHeightPerPageForItems() {
|
|
||||||
return this.usedHeightForNRows(this._rowsPerPage) - (this.topPadding + this.bottomPadding);
|
|
||||||
}
|
|
||||||
|
|
||||||
nPages() {
|
nPages() {
|
||||||
return this._nPages;
|
return this._nPages;
|
||||||
|
@ -61,7 +61,7 @@ class AspectContainer extends St.Widget {
|
|||||||
this.queue_relayout();
|
this.queue_relayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
if (box.get_width() > 0 && box.get_height() > 0) {
|
if (box.get_width() > 0 && box.get_height() > 0) {
|
||||||
let sizeRatio = box.get_width() / box.get_height();
|
let sizeRatio = box.get_width() / box.get_height();
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class AspectContainer extends St.Widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.vfunc_allocate(box, flags);
|
super.vfunc_allocate(box);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -498,7 +498,7 @@ var Key = GObject.registerClass({
|
|||||||
var KeyboardModel = class {
|
var KeyboardModel = class {
|
||||||
constructor(groupName) {
|
constructor(groupName) {
|
||||||
let names = [groupName];
|
let names = [groupName];
|
||||||
if (names.includes('+'))
|
if (groupName.includes('+'))
|
||||||
names.push(groupName.replace(/\+.*/, ''));
|
names.push(groupName.replace(/\+.*/, ''));
|
||||||
names.push('us');
|
names.push('us');
|
||||||
|
|
||||||
@ -722,7 +722,7 @@ var EmojiPager = GObject.registerClass({
|
|||||||
|
|
||||||
_onPan(action) {
|
_onPan(action) {
|
||||||
let [dist_, dx, dy_] = action.get_motion_delta(0);
|
let [dist_, dx, dy_] = action.get_motion_delta(0);
|
||||||
this.delta = this.delta + dx;
|
this.delta += dx;
|
||||||
|
|
||||||
if (this._currentKey != null) {
|
if (this._currentKey != null) {
|
||||||
this._currentKey.cancel();
|
this._currentKey.cancel();
|
||||||
@ -935,8 +935,7 @@ var EmojiSelection = GObject.registerClass({
|
|||||||
this.add_child(this._emojiPager);
|
this.add_child(this._emojiPager);
|
||||||
|
|
||||||
this._pageIndicator = new PageIndicators.PageIndicators(
|
this._pageIndicator = new PageIndicators.PageIndicators(
|
||||||
Clutter.Orientation.HORIZONTAL
|
Clutter.Orientation.HORIZONTAL);
|
||||||
);
|
|
||||||
this.add_child(this._pageIndicator);
|
this.add_child(this._pageIndicator);
|
||||||
this._pageIndicator.setReactive(false);
|
this._pageIndicator.setReactive(false);
|
||||||
|
|
||||||
@ -1119,11 +1118,12 @@ var KeyboardManager = class KeyBoardManager {
|
|||||||
this._seat.connect('notify::touch-mode', this._syncEnabled.bind(this));
|
this._seat.connect('notify::touch-mode', this._syncEnabled.bind(this));
|
||||||
|
|
||||||
this._lastDevice = null;
|
this._lastDevice = null;
|
||||||
Meta.get_backend().connect('last-device-changed', (backend, device) => {
|
global.backend.connect('last-device-changed', (backend, device) => {
|
||||||
if (device.get_device_name().indexOf('XTEST') < 0) {
|
if (device.device_type === Clutter.InputDeviceType.KEYBOARD_DEVICE)
|
||||||
this._lastDevice = device;
|
return;
|
||||||
this._syncEnabled();
|
|
||||||
}
|
this._lastDevice = device;
|
||||||
|
this._syncEnabled();
|
||||||
});
|
});
|
||||||
this._syncEnabled();
|
this._syncEnabled();
|
||||||
}
|
}
|
||||||
@ -1148,9 +1148,9 @@ var KeyboardManager = class KeyBoardManager {
|
|||||||
this._keyboard = new Keyboard();
|
this._keyboard = new Keyboard();
|
||||||
} else if (!enabled && this._keyboard) {
|
} else if (!enabled && this._keyboard) {
|
||||||
this._keyboard.setCursorLocation(null);
|
this._keyboard.setCursorLocation(null);
|
||||||
Main.layoutManager.hideKeyboard(true);
|
|
||||||
this._keyboard.destroy();
|
this._keyboard.destroy();
|
||||||
this._keyboard = null;
|
this._keyboard = null;
|
||||||
|
Main.layoutManager.hideKeyboard(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,6 +1256,10 @@ class Keyboard extends St.BoxLayout {
|
|||||||
return this._keyboardVisible && super.visible;
|
return this._keyboardVisible && super.visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set visible(visible) {
|
||||||
|
super.visible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
_onFocusPositionChanged(focusTracker) {
|
_onFocusPositionChanged(focusTracker) {
|
||||||
let rect = focusTracker.getCurrentRect();
|
let rect = focusTracker.getCurrentRect();
|
||||||
this.setCursorLocation(focusTracker.currentWindow, rect.x, rect.y, rect.width, rect.height);
|
this.setCursorLocation(focusTracker.currentWindow, rect.x, rect.y, rect.width, rect.height);
|
||||||
@ -1868,6 +1872,10 @@ var KeyboardController = class {
|
|||||||
Main.inputMethod.disconnect(this._notifyContentPurposeId);
|
Main.inputMethod.disconnect(this._notifyContentPurposeId);
|
||||||
Main.inputMethod.disconnect(this._notifyContentHintsId);
|
Main.inputMethod.disconnect(this._notifyContentHintsId);
|
||||||
Main.inputMethod.disconnect(this._notifyInputPanelStateId);
|
Main.inputMethod.disconnect(this._notifyInputPanelStateId);
|
||||||
|
|
||||||
|
// Make sure any buttons pressed by the virtual device are released
|
||||||
|
// immediately instead of waiting for the next GC cycle
|
||||||
|
this._virtualDevice.run_dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSourcesModified() {
|
_onSourcesModified() {
|
||||||
|
@ -246,7 +246,7 @@ var LayoutManager = GObject.registerClass({
|
|||||||
vertical: true });
|
vertical: true });
|
||||||
this.addChrome(this.panelBox, { affectsStruts: true,
|
this.addChrome(this.panelBox, { affectsStruts: true,
|
||||||
trackFullscreen: true });
|
trackFullscreen: true });
|
||||||
this.panelBox.connect('allocation-changed',
|
this.panelBox.connect('notify::allocation',
|
||||||
this._panelBoxChanged.bind(this));
|
this._panelBoxChanged.bind(this));
|
||||||
|
|
||||||
this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup',
|
this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup',
|
||||||
@ -612,10 +612,20 @@ var LayoutManager = GObject.registerClass({
|
|||||||
|
|
||||||
let signalId = this._systemBackground.connect('loaded', () => {
|
let signalId = this._systemBackground.connect('loaded', () => {
|
||||||
this._systemBackground.disconnect(signalId);
|
this._systemBackground.disconnect(signalId);
|
||||||
this._systemBackground.show();
|
|
||||||
global.stage.show();
|
|
||||||
|
|
||||||
this._prepareStartupAnimation();
|
// We're mostly prepared for the startup animation
|
||||||
|
// now, but since a lot is going on asynchronously
|
||||||
|
// during startup, let's defer the startup animation
|
||||||
|
// until the event loop is uncontended and idle.
|
||||||
|
// This helps to prevent us from running the animation
|
||||||
|
// when the system is bogged down
|
||||||
|
const id = GLib.idle_add(GLib.PRIORITY_LOW, () => {
|
||||||
|
this._systemBackground.show();
|
||||||
|
global.stage.show();
|
||||||
|
this._prepareStartupAnimation();
|
||||||
|
return GLib.SOURCE_REMOVE;
|
||||||
|
});
|
||||||
|
GLib.Source.set_name_by_id(id, '[gnome-shell] Startup Animation');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,17 +682,7 @@ var LayoutManager = GObject.registerClass({
|
|||||||
|
|
||||||
this.emit('startup-prepared');
|
this.emit('startup-prepared');
|
||||||
|
|
||||||
// We're mostly prepared for the startup animation
|
this._startupAnimation();
|
||||||
// now, but since a lot is going on asynchronously
|
|
||||||
// during startup, let's defer the startup animation
|
|
||||||
// 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, () => {
|
|
||||||
this._startupAnimation();
|
|
||||||
return GLib.SOURCE_REMOVE;
|
|
||||||
});
|
|
||||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_startupAnimation() {
|
_startupAnimation() {
|
||||||
@ -765,7 +765,7 @@ var LayoutManager = GObject.registerClass({
|
|||||||
this._keyboardHeightNotifyId = 0;
|
this._keyboardHeightNotifyId = 0;
|
||||||
}
|
}
|
||||||
this.keyboardBox.ease({
|
this.keyboardBox.ease({
|
||||||
translation_y: this.keyboardBox.height,
|
translation_y: 0,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: immediate ? 0 : KEYBOARD_ANIMATION_TIME,
|
duration: immediate ? 0 : KEYBOARD_ANIMATION_TIME,
|
||||||
mode: Clutter.AnimationMode.EASE_IN_QUAD,
|
mode: Clutter.AnimationMode.EASE_IN_QUAD,
|
||||||
|
@ -27,13 +27,11 @@ var RadialShaderEffect = GObject.registerClass({
|
|||||||
'brightness': GObject.ParamSpec.float(
|
'brightness': GObject.ParamSpec.float(
|
||||||
'brightness', 'brightness', 'brightness',
|
'brightness', 'brightness', 'brightness',
|
||||||
GObject.ParamFlags.READWRITE,
|
GObject.ParamFlags.READWRITE,
|
||||||
0, 1, 1
|
0, 1, 1),
|
||||||
),
|
|
||||||
'sharpness': GObject.ParamSpec.float(
|
'sharpness': GObject.ParamSpec.float(
|
||||||
'sharpness', 'sharpness', 'sharpness',
|
'sharpness', 'sharpness', 'sharpness',
|
||||||
GObject.ParamFlags.READWRITE,
|
GObject.ParamFlags.READWRITE,
|
||||||
0, 1, 0
|
0, 1, 0),
|
||||||
),
|
|
||||||
},
|
},
|
||||||
}, class RadialShaderEffect extends Shell.GLSLEffect {
|
}, class RadialShaderEffect extends Shell.GLSLEffect {
|
||||||
_init(params) {
|
_init(params) {
|
||||||
|
@ -37,10 +37,9 @@ const LG_ANIMATION_TIME = 500;
|
|||||||
|
|
||||||
function _getAutoCompleteGlobalKeywords() {
|
function _getAutoCompleteGlobalKeywords() {
|
||||||
const keywords = ['true', 'false', 'null', 'new'];
|
const keywords = ['true', 'false', 'null', 'new'];
|
||||||
// Don't add the private properties of window (i.e., ones starting with '_')
|
// Don't add the private properties of globalThis (i.e., ones starting with '_')
|
||||||
const windowProperties = Object.getOwnPropertyNames(window).filter(
|
const windowProperties = Object.getOwnPropertyNames(globalThis).filter(
|
||||||
a => a.charAt(0) != '_'
|
a => a.charAt(0) !== '_');
|
||||||
);
|
|
||||||
const headerProperties = JsParse.getDeclaredConstants(commandHeader);
|
const headerProperties = JsParse.getDeclaredConstants(commandHeader);
|
||||||
|
|
||||||
return keywords.concat(windowProperties).concat(headerProperties);
|
return keywords.concat(windowProperties).concat(headerProperties);
|
||||||
@ -555,8 +554,8 @@ var Inspector = GObject.registerClass({
|
|||||||
this._lookingGlass = lookingGlass;
|
this._lookingGlass = lookingGlass;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
this.set_allocation(box, flags);
|
this.set_allocation(box);
|
||||||
|
|
||||||
if (!this._eventHandler)
|
if (!this._eventHandler)
|
||||||
return;
|
return;
|
||||||
@ -571,7 +570,7 @@ var Inspector = GObject.registerClass({
|
|||||||
childBox.x2 = childBox.x1 + natWidth;
|
childBox.x2 = childBox.x1 + natWidth;
|
||||||
childBox.y1 = primary.y + Math.floor((primary.height - natHeight) / 2);
|
childBox.y1 = primary.y + Math.floor((primary.height - natHeight) / 2);
|
||||||
childBox.y2 = childBox.y1 + natHeight;
|
childBox.y2 = childBox.y1 + natHeight;
|
||||||
this._eventHandler.allocate(childBox, flags);
|
this._eventHandler.allocate(childBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
_close() {
|
_close() {
|
||||||
@ -803,6 +802,191 @@ var Extensions = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var ActorLink = GObject.registerClass({
|
||||||
|
Signals: {
|
||||||
|
'inspect-actor': {},
|
||||||
|
},
|
||||||
|
}, class ActorLink extends St.Button {
|
||||||
|
_init(actor) {
|
||||||
|
this._arrow = new St.Icon({
|
||||||
|
icon_name: 'pan-end-symbolic',
|
||||||
|
icon_size: 8,
|
||||||
|
x_align: Clutter.ActorAlign.CENTER,
|
||||||
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
|
pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }),
|
||||||
|
});
|
||||||
|
|
||||||
|
const label = new St.Label({
|
||||||
|
text: actor.toString(),
|
||||||
|
x_align: Clutter.ActorAlign.START,
|
||||||
|
});
|
||||||
|
|
||||||
|
const inspectButton = new St.Button({
|
||||||
|
child: new St.Icon({
|
||||||
|
icon_name: 'insert-object-symbolic',
|
||||||
|
icon_size: 12,
|
||||||
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
|
}),
|
||||||
|
reactive: true,
|
||||||
|
x_expand: true,
|
||||||
|
x_align: Clutter.ActorAlign.START,
|
||||||
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
|
});
|
||||||
|
inspectButton.connect('clicked', () => this.emit('inspect-actor'));
|
||||||
|
|
||||||
|
const box = new St.BoxLayout();
|
||||||
|
box.add_child(this._arrow);
|
||||||
|
box.add_child(label);
|
||||||
|
box.add_child(inspectButton);
|
||||||
|
|
||||||
|
super._init({
|
||||||
|
reactive: true,
|
||||||
|
track_hover: true,
|
||||||
|
toggle_mode: true,
|
||||||
|
style_class: 'actor-link',
|
||||||
|
child: box,
|
||||||
|
x_align: Clutter.ActorAlign.START,
|
||||||
|
});
|
||||||
|
|
||||||
|
this._actor = actor;
|
||||||
|
}
|
||||||
|
|
||||||
|
vfunc_clicked() {
|
||||||
|
this._arrow.ease({
|
||||||
|
rotation_angle_z: this.checked ? 90 : 0,
|
||||||
|
duration: 250,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var ActorTreeViewer = GObject.registerClass(
|
||||||
|
class ActorTreeViewer extends St.BoxLayout {
|
||||||
|
_init(lookingGlass) {
|
||||||
|
super._init();
|
||||||
|
|
||||||
|
this._lookingGlass = lookingGlass;
|
||||||
|
this._actorData = new Map();
|
||||||
|
}
|
||||||
|
|
||||||
|
_showActorChildren(actor) {
|
||||||
|
const data = this._actorData.get(actor);
|
||||||
|
if (!data || data.visible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
data.visible = true;
|
||||||
|
data.actorAddedId = actor.connect('actor-added', (container, child) => {
|
||||||
|
this._addActor(data.children, child);
|
||||||
|
});
|
||||||
|
data.actorRemovedId = actor.connect('actor-removed', (container, child) => {
|
||||||
|
this._removeActor(child);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let child of actor)
|
||||||
|
this._addActor(data.children, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
_hideActorChildren(actor) {
|
||||||
|
const data = this._actorData.get(actor);
|
||||||
|
if (!data || !data.visible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (let child of actor)
|
||||||
|
this._removeActor(child);
|
||||||
|
|
||||||
|
data.visible = false;
|
||||||
|
if (data.actorAddedId > 0) {
|
||||||
|
actor.disconnect(data.actorAddedId);
|
||||||
|
data.actorAddedId = 0;
|
||||||
|
}
|
||||||
|
if (data.actorRemovedId > 0) {
|
||||||
|
actor.disconnect(data.actorRemovedId);
|
||||||
|
data.actorRemovedId = 0;
|
||||||
|
}
|
||||||
|
data.children.remove_all_children();
|
||||||
|
}
|
||||||
|
|
||||||
|
_addActor(container, actor) {
|
||||||
|
if (this._actorData.has(actor))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (actor === this._lookingGlass)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const button = new ActorLink(actor);
|
||||||
|
button.connect('notify::checked', () => {
|
||||||
|
this._lookingGlass.setBorderPaintTarget(actor);
|
||||||
|
if (button.checked)
|
||||||
|
this._showActorChildren(actor);
|
||||||
|
else
|
||||||
|
this._hideActorChildren(actor);
|
||||||
|
});
|
||||||
|
button.connect('inspect-actor', () => {
|
||||||
|
this._lookingGlass.inspectObject(actor, button);
|
||||||
|
});
|
||||||
|
|
||||||
|
const mainContainer = new St.BoxLayout({ vertical: true });
|
||||||
|
const childrenContainer = new St.BoxLayout({
|
||||||
|
vertical: true,
|
||||||
|
style: 'padding: 0 0 0 18px',
|
||||||
|
});
|
||||||
|
|
||||||
|
mainContainer.add_child(button);
|
||||||
|
mainContainer.add_child(childrenContainer);
|
||||||
|
|
||||||
|
this._actorData.set(actor, {
|
||||||
|
button,
|
||||||
|
container: mainContainer,
|
||||||
|
children: childrenContainer,
|
||||||
|
visible: false,
|
||||||
|
actorAddedId: 0,
|
||||||
|
actorRemovedId: 0,
|
||||||
|
actorDestroyedId: actor.connect('destroy', () => this._removeActor(actor)),
|
||||||
|
});
|
||||||
|
|
||||||
|
let belowChild = null;
|
||||||
|
const nextSibling = actor.get_next_sibling();
|
||||||
|
if (nextSibling && this._actorData.has(nextSibling))
|
||||||
|
belowChild = this._actorData.get(nextSibling).container;
|
||||||
|
|
||||||
|
container.insert_child_above(mainContainer, belowChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
_removeActor(actor) {
|
||||||
|
const data = this._actorData.get(actor);
|
||||||
|
if (!data)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (let child of actor)
|
||||||
|
this._removeActor(child);
|
||||||
|
|
||||||
|
if (data.actorAddedId > 0) {
|
||||||
|
actor.disconnect(data.actorAddedId);
|
||||||
|
data.actorAddedId = 0;
|
||||||
|
}
|
||||||
|
if (data.actorRemovedId > 0) {
|
||||||
|
actor.disconnect(data.actorRemovedId);
|
||||||
|
data.actorRemovedId = 0;
|
||||||
|
}
|
||||||
|
if (data.actorDestroyedId > 0) {
|
||||||
|
actor.disconnect(data.actorDestroyedId);
|
||||||
|
data.actorDestroyedId = 0;
|
||||||
|
}
|
||||||
|
data.container.destroy();
|
||||||
|
this._actorData.delete(actor);
|
||||||
|
}
|
||||||
|
|
||||||
|
vfunc_map() {
|
||||||
|
super.vfunc_map();
|
||||||
|
this._addActor(this, global.stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
vfunc_unmap() {
|
||||||
|
super.vfunc_unmap();
|
||||||
|
this._removeActor(global.stage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var LookingGlass = GObject.registerClass(
|
var LookingGlass = GObject.registerClass(
|
||||||
class LookingGlass extends St.BoxLayout {
|
class LookingGlass extends St.BoxLayout {
|
||||||
_init() {
|
_init() {
|
||||||
@ -834,9 +1018,9 @@ class LookingGlass extends St.BoxLayout {
|
|||||||
Main.uiGroup.add_actor(this);
|
Main.uiGroup.add_actor(this);
|
||||||
Main.uiGroup.set_child_below_sibling(this,
|
Main.uiGroup.set_child_below_sibling(this,
|
||||||
Main.layoutManager.panelBox);
|
Main.layoutManager.panelBox);
|
||||||
Main.layoutManager.panelBox.connect('allocation-changed',
|
Main.layoutManager.panelBox.connect('notify::allocation',
|
||||||
this._queueResize.bind(this));
|
this._queueResize.bind(this));
|
||||||
Main.layoutManager.keyboardBox.connect('allocation-changed',
|
Main.layoutManager.keyboardBox.connect('notify::allocation',
|
||||||
this._queueResize.bind(this));
|
this._queueResize.bind(this));
|
||||||
|
|
||||||
this._objInspector = new ObjInspector(this);
|
this._objInspector = new ObjInspector(this);
|
||||||
@ -918,6 +1102,9 @@ class LookingGlass extends St.BoxLayout {
|
|||||||
this._extensions = new Extensions(this);
|
this._extensions = new Extensions(this);
|
||||||
notebook.appendPage('Extensions', this._extensions);
|
notebook.appendPage('Extensions', this._extensions);
|
||||||
|
|
||||||
|
this._actorTreeViewer = new ActorTreeViewer(this);
|
||||||
|
notebook.appendPage('Actors', this._actorTreeViewer);
|
||||||
|
|
||||||
this._entry.clutter_text.connect('activate', (o, _e) => {
|
this._entry.clutter_text.connect('activate', (o, _e) => {
|
||||||
// Hide any completions we are currently showing
|
// Hide any completions we are currently showing
|
||||||
this._hideCompletions();
|
this._hideCompletions();
|
||||||
@ -1127,7 +1314,7 @@ class LookingGlass extends St.BoxLayout {
|
|||||||
else if (symbol == Clutter.KEY_Page_Down)
|
else if (symbol == Clutter.KEY_Page_Down)
|
||||||
this._notebook.nextTab();
|
this._notebook.nextTab();
|
||||||
}
|
}
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return super.vfunc_key_press_event(keyPressEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
|
@ -643,8 +643,7 @@ var Magnifier = class Magnifier {
|
|||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setClampScrollingAtEdges(
|
this._zoomRegions[0].setClampScrollingAtEdges(
|
||||||
!this._settings.get_boolean(CLAMP_MODE_KEY)
|
!this._settings.get_boolean(CLAMP_MODE_KEY));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,8 +651,7 @@ var Magnifier = class Magnifier {
|
|||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setMouseTrackingMode(
|
this._zoomRegions[0].setMouseTrackingMode(
|
||||||
this._settings.get_enum(MOUSE_TRACKING_KEY)
|
this._settings.get_enum(MOUSE_TRACKING_KEY));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,8 +659,7 @@ var Magnifier = class Magnifier {
|
|||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setFocusTrackingMode(
|
this._zoomRegions[0].setFocusTrackingMode(
|
||||||
this._settings.get_enum(FOCUS_TRACKING_KEY)
|
this._settings.get_enum(FOCUS_TRACKING_KEY));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,8 +667,7 @@ var Magnifier = class Magnifier {
|
|||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setCaretTrackingMode(
|
this._zoomRegions[0].setCaretTrackingMode(
|
||||||
this._settings.get_enum(CARET_TRACKING_KEY)
|
this._settings.get_enum(CARET_TRACKING_KEY));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,8 +675,7 @@ var Magnifier = class Magnifier {
|
|||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setInvertLightness(
|
this._zoomRegions[0].setInvertLightness(
|
||||||
this._settings.get_boolean(INVERT_LIGHTNESS_KEY)
|
this._settings.get_boolean(INVERT_LIGHTNESS_KEY));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,8 +683,7 @@ var Magnifier = class Magnifier {
|
|||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setColorSaturation(
|
this._zoomRegions[0].setColorSaturation(
|
||||||
this._settings.get_double(COLOR_SATURATION_KEY)
|
this._settings.get_double(COLOR_SATURATION_KEY));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1941,9 +1935,8 @@ var MagShaderEffects = class MagShaderEffects {
|
|||||||
// it modifies the brightness and/or contrast.
|
// it modifies the brightness and/or contrast.
|
||||||
let [cRed, cGreen, cBlue] = this._brightnessContrast.get_contrast();
|
let [cRed, cGreen, cBlue] = this._brightnessContrast.get_contrast();
|
||||||
this._brightnessContrast.set_enabled(
|
this._brightnessContrast.set_enabled(
|
||||||
bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE ||
|
bRed !== NO_CHANGE || bGreen !== NO_CHANGE || bBlue !== NO_CHANGE ||
|
||||||
cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE
|
cRed !== NO_CHANGE || cGreen !== NO_CHANGE || cBlue !== NO_CHANGE);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1970,8 +1963,7 @@ var MagShaderEffects = class MagShaderEffects {
|
|||||||
// a null first argument.
|
// a null first argument.
|
||||||
let [bRed, bGreen, bBlue] = this._brightnessContrast.get_brightness();
|
let [bRed, bGreen, bBlue] = this._brightnessContrast.get_brightness();
|
||||||
this._brightnessContrast.set_enabled(
|
this._brightnessContrast.set_enabled(
|
||||||
cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE ||
|
cRed !== NO_CHANGE || cGreen !== NO_CHANGE || cBlue !== NO_CHANGE ||
|
||||||
bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE
|
bRed !== NO_CHANGE || bGreen !== NO_CHANGE || bBlue !== NO_CHANGE);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -46,6 +46,7 @@ const XdndHandler = imports.ui.xdndHandler;
|
|||||||
const KbdA11yDialog = imports.ui.kbdA11yDialog;
|
const KbdA11yDialog = imports.ui.kbdA11yDialog;
|
||||||
const LocatePointer = imports.ui.locatePointer;
|
const LocatePointer = imports.ui.locatePointer;
|
||||||
const PointerA11yTimeout = imports.ui.pointerA11yTimeout;
|
const PointerA11yTimeout = imports.ui.pointerA11yTimeout;
|
||||||
|
const ParentalControlsManager = imports.misc.parentalControlsManager;
|
||||||
|
|
||||||
const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
|
const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
|
||||||
const STICKY_KEYS_ENABLE = 'stickykeys-enable';
|
const STICKY_KEYS_ENABLE = 'stickykeys-enable';
|
||||||
@ -93,6 +94,11 @@ let _a11ySettings = null;
|
|||||||
let _themeResource = null;
|
let _themeResource = null;
|
||||||
let _oskResource = null;
|
let _oskResource = null;
|
||||||
|
|
||||||
|
Gio._promisify(Gio._LocalFilePrototype, 'delete_async', 'delete_finish');
|
||||||
|
Gio._promisify(Gio._LocalFilePrototype, 'touch_async', 'touch_finish');
|
||||||
|
|
||||||
|
let _remoteAccessInhibited = false;
|
||||||
|
|
||||||
function _sessionUpdated() {
|
function _sessionUpdated() {
|
||||||
if (sessionMode.isPrimary)
|
if (sessionMode.isPrimary)
|
||||||
_loadDefaultStylesheet();
|
_loadDefaultStylesheet();
|
||||||
@ -117,24 +123,41 @@ function _sessionUpdated() {
|
|||||||
if (lookingGlass)
|
if (lookingGlass)
|
||||||
lookingGlass.close();
|
lookingGlass.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let remoteAccessController = global.backend.get_remote_access_controller();
|
||||||
|
if (remoteAccessController) {
|
||||||
|
if (sessionMode.allowScreencast && _remoteAccessInhibited) {
|
||||||
|
remoteAccessController.uninhibit_remote_access();
|
||||||
|
_remoteAccessInhibited = false;
|
||||||
|
} else if (!sessionMode.allowScreencast && !_remoteAccessInhibited) {
|
||||||
|
remoteAccessController.inhibit_remote_access();
|
||||||
|
_remoteAccessInhibited = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
// These are here so we don't break compatibility.
|
// These are here so we don't break compatibility.
|
||||||
global.logError = window.log;
|
global.logError = globalThis.log;
|
||||||
global.log = window.log;
|
global.log = globalThis.log;
|
||||||
|
|
||||||
// Chain up async errors reported from C
|
// Chain up async errors reported from C
|
||||||
global.connect('notify-error', (global, msg, detail) => {
|
global.connect('notify-error', (global, msg, detail) => {
|
||||||
notifyError(msg, detail);
|
notifyError(msg, detail);
|
||||||
});
|
});
|
||||||
|
|
||||||
Gio.DesktopAppInfo.set_desktop_env('GNOME');
|
let currentDesktop = GLib.getenv('XDG_CURRENT_DESKTOP');
|
||||||
|
if (!currentDesktop || !currentDesktop.split(':').includes('GNOME'))
|
||||||
|
Gio.DesktopAppInfo.set_desktop_env('GNOME');
|
||||||
|
|
||||||
sessionMode = new SessionMode.SessionMode();
|
sessionMode = new SessionMode.SessionMode();
|
||||||
sessionMode.connect('updated', _sessionUpdated);
|
sessionMode.connect('updated', _sessionUpdated);
|
||||||
|
|
||||||
St.Settings.get().connect('notify::gtk-theme', _loadDefaultStylesheet);
|
St.Settings.get().connect('notify::gtk-theme', _loadDefaultStylesheet);
|
||||||
|
|
||||||
|
// Initialize ParentalControlsManager before the UI
|
||||||
|
ParentalControlsManager.getDefault();
|
||||||
|
|
||||||
_initializeUI();
|
_initializeUI();
|
||||||
|
|
||||||
shellAccessDialogDBusService = new AccessDialog.AccessDialogDBus();
|
shellAccessDialogDBusService = new AccessDialog.AccessDialogDBus();
|
||||||
@ -142,6 +165,11 @@ function start() {
|
|||||||
shellDBusService = new ShellDBus.GnomeShell();
|
shellDBusService = new ShellDBus.GnomeShell();
|
||||||
shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
|
shellMountOpDBusService = new ShellMountOperation.GnomeShellMountOpHandler();
|
||||||
|
|
||||||
|
const watchId = Gio.DBus.session.watch_name('org.gnome.Shell.Notifications',
|
||||||
|
Gio.BusNameWatcherFlags.AUTO_START,
|
||||||
|
bus => bus.unwatch_name(watchId),
|
||||||
|
bus => bus.unwatch_name(watchId));
|
||||||
|
|
||||||
_sessionUpdated();
|
_sessionUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,11 +299,8 @@ function _initializeUI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sessionMode.currentMode !== 'gdm' &&
|
if (sessionMode.currentMode !== 'gdm' &&
|
||||||
sessionMode.currentMode !== 'initial-setup' &&
|
sessionMode.currentMode !== 'initial-setup')
|
||||||
screenShield === null) {
|
_handleLockScreenWarning();
|
||||||
notify(_('Screen Lock disabled'),
|
|
||||||
_('Screen Locking requires the GNOME display manager.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginManager.registerSessionWithGDM();
|
LoginManager.registerSessionWithGDM();
|
||||||
|
|
||||||
@ -288,6 +313,32 @@ function _initializeUI() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function _handleLockScreenWarning() {
|
||||||
|
const path = '%s/lock-warning-shown'.format(global.userdatadir);
|
||||||
|
const file = Gio.File.new_for_path(path);
|
||||||
|
|
||||||
|
const hasLockScreen = screenShield !== null;
|
||||||
|
if (hasLockScreen) {
|
||||||
|
try {
|
||||||
|
await file.delete_async(0, null);
|
||||||
|
} catch (e) {
|
||||||
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
|
||||||
|
logError(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (!await file.touch_async())
|
||||||
|
return;
|
||||||
|
} catch (e) {
|
||||||
|
logError(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
notify(
|
||||||
|
_('Screen Lock disabled'),
|
||||||
|
_('Screen Locking requires the GNOME display manager.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function _getStylesheet(name) {
|
function _getStylesheet(name) {
|
||||||
let stylesheet;
|
let stylesheet;
|
||||||
|
|
||||||
@ -361,7 +412,8 @@ function reloadThemeResource() {
|
|||||||
if (_themeResource)
|
if (_themeResource)
|
||||||
_themeResource._unregister();
|
_themeResource._unregister();
|
||||||
|
|
||||||
_themeResource = Gio.Resource.load('%s/gnome-shell-theme.gresource'.format(global.datadir));
|
_themeResource = Gio.Resource.load('%s/%s'.format(global.datadir,
|
||||||
|
sessionMode.themeResourceName));
|
||||||
_themeResource._register();
|
_themeResource._register();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +539,9 @@ function pushModal(actor, params) {
|
|||||||
let prevFocusDestroyId;
|
let prevFocusDestroyId;
|
||||||
if (prevFocus != null) {
|
if (prevFocus != null) {
|
||||||
prevFocusDestroyId = prevFocus.connect('destroy', () => {
|
prevFocusDestroyId = prevFocus.connect('destroy', () => {
|
||||||
let index = _findModal(actor);
|
const index = modalActorFocusStack.findIndex(
|
||||||
|
record => record.prevFocus === prevFocus);
|
||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
modalActorFocusStack[index].prevFocus = null;
|
modalActorFocusStack[index].prevFocus = null;
|
||||||
});
|
});
|
||||||
@ -763,7 +817,7 @@ function showRestartMessage(message) {
|
|||||||
|
|
||||||
var AnimationsSettings = class {
|
var AnimationsSettings = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
let backend = Meta.get_backend();
|
let backend = global.backend;
|
||||||
if (!backend.is_rendering_hardware_accelerated()) {
|
if (!backend.is_rendering_hardware_accelerated()) {
|
||||||
St.Settings.get().inhibit_animations();
|
St.Settings.get().inhibit_animations();
|
||||||
return;
|
return;
|
||||||
|
@ -285,12 +285,12 @@ var LabelExpanderLayout = GObject.registerClass({
|
|||||||
return [min, nat];
|
return [min, nat];
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(container, box, flags) {
|
vfunc_allocate(container, box) {
|
||||||
for (let i = 0; i < container.get_n_children(); i++) {
|
for (let i = 0; i < container.get_n_children(); i++) {
|
||||||
let child = container.get_child_at_index(i);
|
let child = container.get_child_at_index(i);
|
||||||
|
|
||||||
if (child.visible)
|
if (child.visible)
|
||||||
child.allocate(box, flags);
|
child.allocate(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ var Message = GObject.registerClass({
|
|||||||
this.close();
|
this.close();
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
}
|
}
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return super.vfunc_key_press_event(keyEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -136,29 +136,22 @@ var FocusGrabber = class FocusGrabber {
|
|||||||
var NotificationPolicy = GObject.registerClass({
|
var NotificationPolicy = GObject.registerClass({
|
||||||
Properties: {
|
Properties: {
|
||||||
'enable': GObject.ParamSpec.boolean(
|
'enable': GObject.ParamSpec.boolean(
|
||||||
'enable', 'enable', 'enable',
|
'enable', 'enable', 'enable', GObject.ParamFlags.READABLE, true),
|
||||||
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
|
||||||
true),
|
|
||||||
'enable-sound': GObject.ParamSpec.boolean(
|
'enable-sound': GObject.ParamSpec.boolean(
|
||||||
'enable-sound', 'enable-sound', 'enable-sound',
|
'enable-sound', 'enable-sound', 'enable-sound',
|
||||||
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
GObject.ParamFlags.READABLE, true),
|
||||||
true),
|
|
||||||
'show-banners': GObject.ParamSpec.boolean(
|
'show-banners': GObject.ParamSpec.boolean(
|
||||||
'show-banners', 'show-banners', 'show-banners',
|
'show-banners', 'show-banners', 'show-banners',
|
||||||
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
GObject.ParamFlags.READABLE, true),
|
||||||
true),
|
|
||||||
'force-expanded': GObject.ParamSpec.boolean(
|
'force-expanded': GObject.ParamSpec.boolean(
|
||||||
'force-expanded', 'force-expanded', 'force-expanded',
|
'force-expanded', 'force-expanded', 'force-expanded',
|
||||||
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
GObject.ParamFlags.READABLE, false),
|
||||||
false),
|
|
||||||
'show-in-lock-screen': GObject.ParamSpec.boolean(
|
'show-in-lock-screen': GObject.ParamSpec.boolean(
|
||||||
'show-in-lock-screen', 'show-in-lock-screen', 'show-in-lock-screen',
|
'show-in-lock-screen', 'show-in-lock-screen', 'show-in-lock-screen',
|
||||||
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
GObject.ParamFlags.READABLE, false),
|
||||||
false),
|
|
||||||
'details-in-lock-screen': GObject.ParamSpec.boolean(
|
'details-in-lock-screen': GObject.ParamSpec.boolean(
|
||||||
'details-in-lock-screen', 'details-in-lock-screen', 'details-in-lock-screen',
|
'details-in-lock-screen', 'details-in-lock-screen', 'details-in-lock-screen',
|
||||||
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
|
GObject.ParamFlags.READABLE, false),
|
||||||
false),
|
|
||||||
},
|
},
|
||||||
}, class NotificationPolicy extends GObject.Object {
|
}, class NotificationPolicy extends GObject.Object {
|
||||||
// Do nothing for the default policy. These methods are only useful for the
|
// Do nothing for the default policy. These methods are only useful for the
|
||||||
@ -169,24 +162,28 @@ var NotificationPolicy = GObject.registerClass({
|
|||||||
this.run_dispose();
|
this.run_dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get enable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
get enableSound() {
|
get enableSound() {
|
||||||
return this.enable_sound;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
get showBanners() {
|
get showBanners() {
|
||||||
return this.show_banners;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
get forceExpanded() {
|
get forceExpanded() {
|
||||||
return this.force_expanded;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get showInLockScreen() {
|
get showInLockScreen() {
|
||||||
return this.show_in_lock_screen;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get detailsInLockScreen() {
|
get detailsInLockScreen() {
|
||||||
return this.details_in_lock_screen;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -689,8 +686,8 @@ class SourceActorWithLabel extends SourceActor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
super.vfunc_allocate(box, flags);
|
super.vfunc_allocate(box);
|
||||||
|
|
||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
@ -710,7 +707,7 @@ class SourceActorWithLabel extends SourceActor {
|
|||||||
childBox.y1 = box.y2 - naturalHeight;
|
childBox.y1 = box.y2 - naturalHeight;
|
||||||
childBox.y2 = box.y2;
|
childBox.y2 = box.y2;
|
||||||
|
|
||||||
this._counterBin.allocate(childBox, flags);
|
this._counterBin.allocate(childBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateCount() {
|
_updateCount() {
|
||||||
@ -762,12 +759,10 @@ var Source = GObject.registerClass({
|
|||||||
|
|
||||||
this.notifications = [];
|
this.notifications = [];
|
||||||
|
|
||||||
this._policy = null;
|
this._policy = this._createPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
get policy() {
|
get policy() {
|
||||||
if (!this._policy)
|
|
||||||
this._policy = this._createPolicy();
|
|
||||||
return this._policy;
|
return this._policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,8 +875,6 @@ var Source = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy(reason) {
|
destroy(reason) {
|
||||||
this.policy.destroy();
|
|
||||||
|
|
||||||
let notifications = this.notifications;
|
let notifications = this.notifications;
|
||||||
this.notifications = [];
|
this.notifications = [];
|
||||||
|
|
||||||
@ -890,6 +883,7 @@ var Source = GObject.registerClass({
|
|||||||
|
|
||||||
this.emit('destroy', reason);
|
this.emit('destroy', reason);
|
||||||
|
|
||||||
|
this.policy.destroy();
|
||||||
this.run_dispose();
|
this.run_dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1170,8 +1164,7 @@ var MessageTray = GObject.registerClass({
|
|||||||
this._onNotificationDestroy.bind(this));
|
this._onNotificationDestroy.bind(this));
|
||||||
this._notificationQueue.push(notification);
|
this._notificationQueue.push(notification);
|
||||||
this._notificationQueue.sort(
|
this._notificationQueue.sort(
|
||||||
(n1, n2) => n2.urgency - n1.urgency
|
(n1, n2) => n2.urgency - n1.urgency);
|
||||||
);
|
|
||||||
this.emit('queue-changed');
|
this.emit('queue-changed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,11 @@ var MprisPlayer = class MprisPlayer {
|
|||||||
if (!this._mprisProxy.g_name_owner)
|
if (!this._mprisProxy.g_name_owner)
|
||||||
this._close();
|
this._close();
|
||||||
});
|
});
|
||||||
|
// It is possible for the bus to disappear before the previous signal
|
||||||
|
// is connected, so we must ensure that the bus still exists at this
|
||||||
|
// point.
|
||||||
|
if (!this._mprisProxy.g_name_owner)
|
||||||
|
this._close();
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPlayerProxyReady() {
|
_onPlayerProxyReady() {
|
||||||
@ -251,6 +256,10 @@ class MediaSection extends MessageList.MessageListSection {
|
|||||||
return !this.empty && Calendar.isToday(this._date);
|
return !this.empty && Calendar.isToday(this._date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get allowed() {
|
||||||
|
return !Main.sessionMode.isGreeter;
|
||||||
|
}
|
||||||
|
|
||||||
_addPlayer(busName) {
|
_addPlayer(busName) {
|
||||||
if (this._players.get(busName))
|
if (this._players.get(busName))
|
||||||
return;
|
return;
|
||||||
|
@ -10,13 +10,6 @@ const Params = imports.misc.params;
|
|||||||
|
|
||||||
const { loadInterfaceXML } = imports.misc.fileUtils;
|
const { loadInterfaceXML } = imports.misc.fileUtils;
|
||||||
|
|
||||||
// Should really be defined in Gio.js
|
|
||||||
const BusIface = loadInterfaceXML('org.freedesktop.DBus');
|
|
||||||
var BusProxy = Gio.DBusProxy.makeProxyWrapper(BusIface);
|
|
||||||
function Bus() {
|
|
||||||
return new BusProxy(Gio.DBus.session, 'org.freedesktop.DBus', '/org/freedesktop/DBus');
|
|
||||||
}
|
|
||||||
|
|
||||||
const FdoNotificationsIface = loadInterfaceXML('org.freedesktop.Notifications');
|
const FdoNotificationsIface = loadInterfaceXML('org.freedesktop.Notifications');
|
||||||
|
|
||||||
var NotificationClosedReason = {
|
var NotificationClosedReason = {
|
||||||
@ -49,9 +42,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
|
|||||||
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
|
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
|
||||||
|
|
||||||
this._sources = [];
|
this._sources = [];
|
||||||
this._senderToPid = {};
|
|
||||||
this._notifications = {};
|
this._notifications = {};
|
||||||
this._busProxy = new Bus();
|
|
||||||
|
|
||||||
this._nextNotificationId = 1;
|
this._nextNotificationId = 1;
|
||||||
|
|
||||||
@ -116,12 +107,9 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
|
|||||||
//
|
//
|
||||||
// If no existing source is found, a new source is created as long as
|
// If no existing source is found, a new source is created as long as
|
||||||
// pid is provided.
|
// pid is provided.
|
||||||
//
|
|
||||||
// Either a pid or ndata.notification is needed to retrieve or
|
|
||||||
// create a source.
|
|
||||||
_getSource(title, pid, ndata, sender) {
|
_getSource(title, pid, ndata, sender) {
|
||||||
if (!pid && !(ndata && ndata.notification))
|
if (!pid && !(ndata && ndata.notification))
|
||||||
return null;
|
throw new Error('Either a pid or ndata.notification is needed');
|
||||||
|
|
||||||
// We use notification's source for the notifications we still have
|
// We use notification's source for the notifications we still have
|
||||||
// around that are getting replaced because we don't keep sources
|
// around that are getting replaced because we don't keep sources
|
||||||
@ -218,42 +206,10 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
|
|||||||
this._notifications[id] = ndata;
|
this._notifications[id] = ndata;
|
||||||
|
|
||||||
let sender = invocation.get_sender();
|
let sender = invocation.get_sender();
|
||||||
let pid = this._senderToPid[sender];
|
let pid = hints['sender-pid'];
|
||||||
|
|
||||||
let source = this._getSource(appName, pid, ndata, sender, null);
|
let source = this._getSource(appName, pid, ndata, sender, null);
|
||||||
|
this._notifyForSource(source, ndata);
|
||||||
if (source) {
|
|
||||||
this._notifyForSource(source, ndata);
|
|
||||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (replacesId) {
|
|
||||||
// There's already a pending call to GetConnectionUnixProcessID,
|
|
||||||
// which will see the new notification data when it finishes,
|
|
||||||
// so we don't have to do anything.
|
|
||||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
|
||||||
}
|
|
||||||
|
|
||||||
this._busProxy.GetConnectionUnixProcessIDRemote(sender, (result, excp) => {
|
|
||||||
// The app may have updated or removed the notification
|
|
||||||
ndata = this._notifications[id];
|
|
||||||
if (!ndata)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (excp) {
|
|
||||||
logError(excp, 'Call to GetConnectionUnixProcessID failed');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[pid] = result;
|
|
||||||
source = this._getSource(appName, pid, ndata, sender, null);
|
|
||||||
|
|
||||||
this._senderToPid[sender] = pid;
|
|
||||||
source.connect('destroy', () => {
|
|
||||||
delete this._senderToPid[sender];
|
|
||||||
});
|
|
||||||
this._notifyForSource(source, ndata);
|
|
||||||
});
|
|
||||||
|
|
||||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||||
}
|
}
|
||||||
@ -416,12 +372,11 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
|
|||||||
var FdoNotificationDaemonSource = GObject.registerClass(
|
var FdoNotificationDaemonSource = GObject.registerClass(
|
||||||
class FdoNotificationDaemonSource extends MessageTray.Source {
|
class FdoNotificationDaemonSource extends MessageTray.Source {
|
||||||
_init(title, pid, sender, appId) {
|
_init(title, pid, sender, appId) {
|
||||||
super._init(title);
|
|
||||||
|
|
||||||
this.pid = pid;
|
this.pid = pid;
|
||||||
|
this.initialTitle = title;
|
||||||
this.app = this._getApp(appId);
|
this.app = this._getApp(appId);
|
||||||
|
|
||||||
this.initialTitle = title;
|
super._init(title);
|
||||||
|
|
||||||
if (this.app)
|
if (this.app)
|
||||||
this.title = this.app.get_name();
|
this.title = this.app.get_name();
|
||||||
@ -470,19 +425,20 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getApp(appId) {
|
_getApp(appId) {
|
||||||
|
const appSys = Shell.AppSystem.get_default();
|
||||||
let app;
|
let app;
|
||||||
|
|
||||||
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
|
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
|
||||||
if (app != null)
|
if (app != null)
|
||||||
return app;
|
return app;
|
||||||
|
|
||||||
if (appId) {
|
if (appId)
|
||||||
app = Shell.AppSystem.get_default().lookup_app('%s.desktop'.format(appId));
|
app = appSys.lookup_app('%s.desktop'.format(appId));
|
||||||
if (app != null)
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
if (!app)
|
||||||
|
app = appSys.lookup_app('%s.desktop'.format(this.initialTitle));
|
||||||
|
|
||||||
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle(title) {
|
setTitle(title) {
|
||||||
@ -631,12 +587,12 @@ class GtkNotificationDaemonAppSource extends MessageTray.Source {
|
|||||||
if (!app)
|
if (!app)
|
||||||
throw new InvalidAppError();
|
throw new InvalidAppError();
|
||||||
|
|
||||||
super._init(app.get_name());
|
|
||||||
|
|
||||||
this._appId = appId;
|
this._appId = appId;
|
||||||
this._app = app;
|
this._app = app;
|
||||||
this._objectPath = objectPath;
|
this._objectPath = objectPath;
|
||||||
|
|
||||||
|
super._init(app.get_name());
|
||||||
|
|
||||||
this._notifications = {};
|
this._notifications = {};
|
||||||
this._notificationPending = false;
|
this._notificationPending = false;
|
||||||
}
|
}
|
||||||
|
@ -400,8 +400,7 @@ var Overview = class {
|
|||||||
|
|
||||||
_getDesktopClone() {
|
_getDesktopClone() {
|
||||||
let windows = global.get_window_actors().filter(
|
let windows = global.get_window_actors().filter(
|
||||||
w => w.meta_window.get_window_type() == Meta.WindowType.DESKTOP
|
w => w.meta_window.get_window_type() === Meta.WindowType.DESKTOP);
|
||||||
);
|
|
||||||
if (windows.length == 0)
|
if (windows.length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ var SlideLayout = GObject.registerClass({
|
|||||||
return [minWidth, natWidth];
|
return [minWidth, natWidth];
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(container, box, flags) {
|
vfunc_allocate(container, box) {
|
||||||
let child = container.get_first_child();
|
let child = container.get_first_child();
|
||||||
|
|
||||||
let availWidth = Math.round(box.x2 - box.x1);
|
let availWidth = Math.round(box.x2 - box.x1);
|
||||||
@ -72,7 +72,7 @@ var SlideLayout = GObject.registerClass({
|
|||||||
actorBox.y1 = box.y1;
|
actorBox.y1 = box.y1;
|
||||||
actorBox.y2 = actorBox.y1 + availHeight;
|
actorBox.y2 = actorBox.y1 + availHeight;
|
||||||
|
|
||||||
child.allocate(actorBox, flags);
|
child.allocate(actorBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
@ -394,10 +394,10 @@ class DashSpacer extends St.Widget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var ControlsLayout = GObject.registerClass({
|
var ControlsLayout = GObject.registerClass({
|
||||||
Signals: { 'allocation-changed': { flags: GObject.SignalFlags.RUN_LAST } },
|
Signals: { 'allocation-changed': {} },
|
||||||
}, class ControlsLayout extends Clutter.BinLayout {
|
}, class ControlsLayout extends Clutter.BinLayout {
|
||||||
vfunc_allocate(container, box, flags) {
|
vfunc_allocate(container, box) {
|
||||||
super.vfunc_allocate(container, box, flags);
|
super.vfunc_allocate(container, box);
|
||||||
this.emit('allocation-changed');
|
this.emit('allocation-changed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -473,6 +473,7 @@ class ControlsManager extends St.Widget {
|
|||||||
|
|
||||||
// A workspace might have been inserted or removed before the active
|
// A workspace might have been inserted or removed before the active
|
||||||
// one, causing the adjustment to go out of sync, so update the value
|
// one, causing the adjustment to go out of sync, so update the value
|
||||||
|
this._workspaceAdjustment.remove_transition('value');
|
||||||
this._workspaceAdjustment.value = activeIndex;
|
this._workspaceAdjustment.value = activeIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
163
js/ui/padOsd.js
163
js/ui/padOsd.js
@ -2,7 +2,7 @@
|
|||||||
/* exported PadOsd, PadOsdService */
|
/* exported PadOsd, PadOsdService */
|
||||||
|
|
||||||
const { Atk, Clutter, GDesktopEnums, Gio,
|
const { Atk, Clutter, GDesktopEnums, Gio,
|
||||||
GLib, GObject, Gtk, Meta, Rsvg, St } = imports.gi;
|
GLib, GObject, Gtk, Meta, Pango, Rsvg, St } = imports.gi;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
@ -89,7 +89,7 @@ var PadChooser = GObject.registerClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var KeybindingEntry = GObject.registerClass({
|
var KeybindingEntry = GObject.registerClass({
|
||||||
Signals: { 'keybinding-edited': {} },
|
Signals: { 'keybinding-edited': { param_types: [GObject.TYPE_STRING] } },
|
||||||
}, class KeybindingEntry extends St.Entry {
|
}, class KeybindingEntry extends St.Entry {
|
||||||
_init() {
|
_init() {
|
||||||
super._init({ hint_text: _("New shortcut…"), style: 'width: 10em' });
|
super._init({ hint_text: _("New shortcut…"), style: 'width: 10em' });
|
||||||
@ -329,6 +329,7 @@ var PadDiagram = GObject.registerClass({
|
|||||||
|
|
||||||
this._imagePath = imagePath;
|
this._imagePath = imagePath;
|
||||||
this._handle = this._composeStyledDiagram();
|
this._handle = this._composeStyledDiagram();
|
||||||
|
this._initLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
@ -343,6 +344,26 @@ var PadDiagram = GObject.registerClass({
|
|||||||
this.add_actor(actor);
|
this.add_actor(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_initLabels() {
|
||||||
|
let i = 0;
|
||||||
|
for (i = 0; ; i++) {
|
||||||
|
if (!this._addLabel(Meta.PadActionType.BUTTON, i))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; ; i++) {
|
||||||
|
if (!this._addLabel(Meta.PadActionType.RING, i, CW) ||
|
||||||
|
!this._addLabel(Meta.PadActionType.RING, i, CCW))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; ; i++) {
|
||||||
|
if (!this._addLabel(Meta.PadActionType.STRIP, i, UP) ||
|
||||||
|
!this._addLabel(Meta.PadActionType.STRIP, i, DOWN))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_wrappingSvgHeader() {
|
_wrappingSvgHeader() {
|
||||||
return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
|
return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
|
||||||
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
|
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
|
||||||
@ -362,10 +383,8 @@ var PadDiagram = GObject.registerClass({
|
|||||||
|
|
||||||
for (let i = 0; i < this._activeButtons.length; i++) {
|
for (let i = 0; i < this._activeButtons.length; i++) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + this._activeButtons[i]);
|
let ch = String.fromCharCode('A'.charCodeAt() + this._activeButtons[i]);
|
||||||
css += '.%s {'.format(ch);
|
css += '.%s.Leader { stroke: %s !important; }'.format(ch, ACTIVE_COLOR);
|
||||||
css += ' stroke: %s !important;'.format(ACTIVE_COLOR);
|
css += '.%s.Button { stroke: %s !important; fill: %s !important; }'.format(ch, ACTIVE_COLOR, ACTIVE_COLOR);
|
||||||
css += ' fill: %s !important;'.format(ACTIVE_COLOR);
|
|
||||||
css += '}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return css;
|
return css;
|
||||||
@ -390,9 +409,6 @@ var PadDiagram = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_updateDiagramScale() {
|
_updateDiagramScale() {
|
||||||
if (this._handle == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
[this._actorWidth, this._actorHeight] = this.get_size();
|
[this._actorWidth, this._actorHeight] = this.get_size();
|
||||||
let dimensions = this._handle.get_dimensions();
|
let dimensions = this._handle.get_dimensions();
|
||||||
let scaleX = this._actorWidth / dimensions.width;
|
let scaleX = this._actorWidth / dimensions.width;
|
||||||
@ -405,6 +421,11 @@ var PadDiagram = GObject.registerClass({
|
|||||||
let [, natWidth] = child.get_preferred_width(natHeight);
|
let [, natWidth] = child.get_preferred_width(natHeight);
|
||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
|
// I miss Cairo.Matrix
|
||||||
|
let dimensions = this._handle.get_dimensions();
|
||||||
|
x = x * this._scale + this._actorWidth / 2 - dimensions.width / 2 * this._scale;
|
||||||
|
y = y * this._scale + this._actorHeight / 2 - dimensions.height / 2 * this._scale;
|
||||||
|
|
||||||
if (direction == LTR) {
|
if (direction == LTR) {
|
||||||
childBox.x1 = x;
|
childBox.x1 = x;
|
||||||
childBox.x2 = x + natWidth;
|
childBox.x2 = x + natWidth;
|
||||||
@ -415,22 +436,23 @@ var PadDiagram = GObject.registerClass({
|
|||||||
|
|
||||||
childBox.y1 = y - natHeight / 2;
|
childBox.y1 = y - natHeight / 2;
|
||||||
childBox.y2 = y + natHeight / 2;
|
childBox.y2 = y + natHeight / 2;
|
||||||
child.allocate(childBox, 0);
|
child.allocate(childBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(box, flags) {
|
vfunc_allocate(box) {
|
||||||
super.vfunc_allocate(box, flags);
|
super.vfunc_allocate(box);
|
||||||
|
if (this._handle === null)
|
||||||
|
return;
|
||||||
|
|
||||||
this._updateDiagramScale();
|
this._updateDiagramScale();
|
||||||
|
|
||||||
for (let i = 0; i < this._labels.length; i++) {
|
for (let i = 0; i < this._labels.length; i++) {
|
||||||
let [label, action, idx, dir] = this._labels[i];
|
const { label, x, y, arrangement } = this._labels[i];
|
||||||
let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
|
|
||||||
this._allocateChild(label, x, y, arrangement);
|
this._allocateChild(label, x, y, arrangement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._editorActor && this._curEdited) {
|
if (this._editorActor && this._curEdited) {
|
||||||
let [label_, action, idx, dir] = this._curEdited;
|
const { x, y, arrangement } = this._curEdited;
|
||||||
let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
|
|
||||||
this._allocateChild(this._editorActor, x, y, arrangement);
|
this._allocateChild(this._editorActor, x, y, arrangement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -457,17 +479,6 @@ var PadDiagram = GObject.registerClass({
|
|||||||
cr.$dispose();
|
cr.$dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
_transformPoint(x, y) {
|
|
||||||
if (this._handle == null || this._scale == null)
|
|
||||||
return [x, y];
|
|
||||||
|
|
||||||
// I miss Cairo.Matrix
|
|
||||||
let dimensions = this._handle.get_dimensions();
|
|
||||||
x = x * this._scale + this._actorWidth / 2 - dimensions.width / 2 * this._scale;
|
|
||||||
y = y * this._scale + this._actorHeight / 2 - dimensions.height / 2 * this._scale;
|
|
||||||
return [Math.round(x), Math.round(y)];
|
|
||||||
}
|
|
||||||
|
|
||||||
_getItemLabelCoords(labelName, leaderName) {
|
_getItemLabelCoords(labelName, leaderName) {
|
||||||
if (this._handle == null)
|
if (this._handle == null)
|
||||||
return [false];
|
return [false];
|
||||||
@ -495,44 +506,39 @@ var PadDiagram = GObject.registerClass({
|
|||||||
pos.y = this._imageHeight - pos.y;
|
pos.y = this._imageHeight - pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
let [x, y] = this._transformPoint(pos.x, pos.y);
|
return [true, pos.x, pos.y, direction];
|
||||||
|
|
||||||
return [true, x, y, direction];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getButtonLabelCoords(button) {
|
_getButtonLabels(button) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
||||||
let labelName = 'Label%s'.format(ch);
|
let labelName = 'Label%s'.format(ch);
|
||||||
let leaderName = 'Leader%s'.format(ch);
|
let leaderName = 'Leader%s'.format(ch);
|
||||||
|
return [labelName, leaderName];
|
||||||
return this._getItemLabelCoords(labelName, leaderName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getRingLabelCoords(number, dir) {
|
_getRingLabels(number, dir) {
|
||||||
let numStr = number > 0 ? (number + 1).toString() : '';
|
let numStr = number > 0 ? (number + 1).toString() : '';
|
||||||
let dirStr = dir == CW ? 'CW' : 'CCW';
|
let dirStr = dir == CW ? 'CW' : 'CCW';
|
||||||
let labelName = 'LabelRing%s%s'.format(numStr, dirStr);
|
let labelName = 'LabelRing%s%s'.format(numStr, dirStr);
|
||||||
let leaderName = 'LeaderRing%s%s'.format(numStr, dirStr);
|
let leaderName = 'LeaderRing%s%s'.format(numStr, dirStr);
|
||||||
|
return [labelName, leaderName];
|
||||||
return this._getItemLabelCoords(labelName, leaderName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getStripLabelCoords(number, dir) {
|
_getStripLabels(number, dir) {
|
||||||
let numStr = number > 0 ? (number + 1).toString() : '';
|
let numStr = number > 0 ? (number + 1).toString() : '';
|
||||||
let dirStr = dir == UP ? 'Up' : 'Down';
|
let dirStr = dir == UP ? 'Up' : 'Down';
|
||||||
let labelName = 'LabelStrip%s%s'.format(numStr, dirStr);
|
let labelName = 'LabelStrip%s%s'.format(numStr, dirStr);
|
||||||
let leaderName = 'LeaderStrip%s%s'.format(numStr, dirStr);
|
let leaderName = 'LeaderStrip%s%s'.format(numStr, dirStr);
|
||||||
|
return [labelName, leaderName];
|
||||||
return this._getItemLabelCoords(labelName, leaderName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getLabelCoords(action, idx, dir) {
|
_getLabelCoords(action, idx, dir) {
|
||||||
if (action == Meta.PadActionType.BUTTON)
|
if (action == Meta.PadActionType.BUTTON)
|
||||||
return this.getButtonLabelCoords(idx);
|
return this._getItemLabelCoords(...this._getButtonLabels(idx));
|
||||||
else if (action == Meta.PadActionType.RING)
|
else if (action == Meta.PadActionType.RING)
|
||||||
return this.getRingLabelCoords(idx, dir);
|
return this._getItemLabelCoords(...this._getRingLabels(idx, dir));
|
||||||
else if (action == Meta.PadActionType.STRIP)
|
else if (action == Meta.PadActionType.STRIP)
|
||||||
return this.getStripLabelCoords(idx, dir);
|
return this._getItemLabelCoords(...this._getStripLabels(idx, dir));
|
||||||
|
|
||||||
return [false];
|
return [false];
|
||||||
}
|
}
|
||||||
@ -557,26 +563,30 @@ var PadDiagram = GObject.registerClass({
|
|||||||
this._invalidateSvg();
|
this._invalidateSvg();
|
||||||
}
|
}
|
||||||
|
|
||||||
addLabel(label, type, idx, dir) {
|
_addLabel(action, idx, dir) {
|
||||||
this._labels.push([label, type, idx, dir]);
|
let [found, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
|
||||||
|
if (!found)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
let label = new St.Label();
|
||||||
|
this._labels.push({ label, action, idx, dir, x, y, arrangement });
|
||||||
this.add_actor(label);
|
this.add_actor(label);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLabels(getText) {
|
updateLabels(getText) {
|
||||||
for (let i = 0; i < this._labels.length; i++) {
|
for (let i = 0; i < this._labels.length; i++) {
|
||||||
let [label, action, idx, dir] = this._labels[i];
|
const { label, action, idx, dir } = this._labels[i];
|
||||||
let str = getText(action, idx, dir);
|
let str = getText(action, idx, dir);
|
||||||
label.set_text(str);
|
label.set_text(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.queue_relayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
_applyLabel(label, action, idx, dir, str) {
|
_applyLabel(label, action, idx, dir, str) {
|
||||||
if (str != null) {
|
if (str !== null)
|
||||||
label.set_text(str);
|
label.set_text(str);
|
||||||
|
|
||||||
let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
|
|
||||||
this._allocateChild(label, x, y, arrangement);
|
|
||||||
}
|
|
||||||
label.show();
|
label.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,18 +594,20 @@ var PadDiagram = GObject.registerClass({
|
|||||||
this._editorActor.hide();
|
this._editorActor.hide();
|
||||||
|
|
||||||
if (this._prevEdited) {
|
if (this._prevEdited) {
|
||||||
let [label, action, idx, dir] = this._prevEdited;
|
const { label, action, idx, dir } = this._prevEdited;
|
||||||
this._applyLabel(label, action, idx, dir, str);
|
this._applyLabel(label, action, idx, dir, str);
|
||||||
this._prevEdited = null;
|
this._prevEdited = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._curEdited) {
|
if (this._curEdited) {
|
||||||
let [label, action, idx, dir] = this._curEdited;
|
const { label, action, idx, dir } = this._curEdited;
|
||||||
this._applyLabel(label, action, idx, dir, str);
|
this._applyLabel(label, action, idx, dir, str);
|
||||||
if (continues)
|
if (continues)
|
||||||
this._prevEdited = this._curEdited;
|
this._prevEdited = this._curEdited;
|
||||||
this._curEdited = null;
|
this._curEdited = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.queue_relayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
startEdition(action, idx, dir) {
|
startEdition(action, idx, dir) {
|
||||||
@ -605,21 +617,19 @@ var PadDiagram = GObject.registerClass({
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (let i = 0; i < this._labels.length; i++) {
|
for (let i = 0; i < this._labels.length; i++) {
|
||||||
let [label, itemAction, itemIdx, itemDir] = this._labels[i];
|
if (action == this._labels[i].action &&
|
||||||
if (action == itemAction && idx == itemIdx && dir == itemDir) {
|
idx == this._labels[i].idx && dir == this._labels[i].dir) {
|
||||||
this._curEdited = this._labels[i];
|
this._curEdited = this._labels[i];
|
||||||
editedLabel = label;
|
editedLabel = this._curEdited.label;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._curEdited == null)
|
if (this._curEdited == null)
|
||||||
return;
|
return;
|
||||||
let [found] = this.getLabelCoords(action, idx, dir);
|
|
||||||
if (!found)
|
|
||||||
return;
|
|
||||||
this._editorActor.show();
|
this._editorActor.show();
|
||||||
editedLabel.hide();
|
editedLabel.hide();
|
||||||
|
this.queue_relayout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -693,6 +703,7 @@ var PadOsd = GObject.registerClass({
|
|||||||
|
|
||||||
this._titleLabel = new St.Label({ style: 'font-side: larger; font-weight: bold;',
|
this._titleLabel = new St.Label({ style: 'font-side: larger; font-weight: bold;',
|
||||||
x_align: Clutter.ActorAlign.CENTER });
|
x_align: Clutter.ActorAlign.CENTER });
|
||||||
|
this._titleLabel.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
|
||||||
this._titleLabel.clutter_text.set_text(padDevice.get_device_name());
|
this._titleLabel.clutter_text.set_text(padDevice.get_device_name());
|
||||||
labelBox.add_actor(this._titleLabel);
|
labelBox.add_actor(this._titleLabel);
|
||||||
|
|
||||||
@ -710,31 +721,7 @@ var PadOsd = GObject.registerClass({
|
|||||||
x_expand: true,
|
x_expand: true,
|
||||||
y_expand: true });
|
y_expand: true });
|
||||||
this.add_actor(this._padDiagram);
|
this.add_actor(this._padDiagram);
|
||||||
|
this._updateActionLabels();
|
||||||
// FIXME: Fix num buttons.
|
|
||||||
let i = 0;
|
|
||||||
for (i = 0; i < 50; i++) {
|
|
||||||
let [found] = this._padDiagram.getButtonLabelCoords(i);
|
|
||||||
if (!found)
|
|
||||||
break;
|
|
||||||
this._createLabel(Meta.PadActionType.BUTTON, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < padDevice.get_n_rings(); i++) {
|
|
||||||
let [found] = this._padDiagram.getRingLabelCoords(i, CW);
|
|
||||||
if (!found)
|
|
||||||
break;
|
|
||||||
this._createLabel(Meta.PadActionType.RING, i, CW);
|
|
||||||
this._createLabel(Meta.PadActionType.RING, i, CCW);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < padDevice.get_n_strips(); i++) {
|
|
||||||
let [found] = this._padDiagram.getStripLabelCoords(i, UP);
|
|
||||||
if (!found)
|
|
||||||
break;
|
|
||||||
this._createLabel(Meta.PadActionType.STRIP, i, UP);
|
|
||||||
this._createLabel(Meta.PadActionType.STRIP, i, DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
let buttonBox = new St.Widget({ layout_manager: new Clutter.BinLayout(),
|
let buttonBox = new St.Widget({ layout_manager: new Clutter.BinLayout(),
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
@ -787,11 +774,6 @@ var PadOsd = GObject.registerClass({
|
|||||||
return str ? str : _("None");
|
return str ? str : _("None");
|
||||||
}
|
}
|
||||||
|
|
||||||
_createLabel(type, number, dir) {
|
|
||||||
let label = new St.Label({ text: this._getActionText(type, number) });
|
|
||||||
this._padDiagram.addLabel(label, type, number, dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateActionLabels() {
|
_updateActionLabels() {
|
||||||
this._padDiagram.updateLabels(this._getActionText.bind(this));
|
this._padDiagram.updateLabels(this._getActionText.bind(this));
|
||||||
}
|
}
|
||||||
@ -867,8 +849,7 @@ var PadOsd = GObject.registerClass({
|
|||||||
this._tipLabel.set_text(_("Press any key to exit"));
|
this._tipLabel.set_text(_("Press any key to exit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this._titleLabel.clutter_text.set_markup(
|
this._titleLabel.set_text(title);
|
||||||
'<span size="larger"><b>%s</b></span>'.format(title));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_isEditedAction(type, number, dir) {
|
_isEditedAction(type, number, dir) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user