Compare commits
	
		
			340 Commits
		
	
	
		
			wip/exalm/
			...
			wip/mcrha/
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 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,9 +1,13 @@ | ||||
| include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml' | ||||
|  | ||||
| stages: | ||||
|  - review | ||||
|  - build | ||||
|  - test | ||||
|  - deploy | ||||
|  | ||||
| variables: | ||||
|     BUNDLE: "extensions-git.flatpak" | ||||
|     JS_LOG: "js-report.txt" | ||||
|     POT_LOG: "pot-update.txt" | ||||
|  | ||||
| @@ -14,7 +18,7 @@ variables: | ||||
|         - merge_requests | ||||
|  | ||||
| check_commit_log: | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v3 | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v4 | ||||
|     stage: review | ||||
|     variables: | ||||
|         GIT_DEPTH: "100" | ||||
| @@ -46,8 +50,22 @@ eslint: | ||||
|             - reports | ||||
|         when: always | ||||
|  | ||||
| potfile_check: | ||||
|     image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1 | ||||
|     stage: review | ||||
|     script: | ||||
|         - ./.gitlab-ci/check-potfiles.sh | ||||
|     <<: *only_default | ||||
|  | ||||
| no_template_check: | ||||
|     image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1 | ||||
|     stage: review | ||||
|     script: | ||||
|         - ./.gitlab-ci/check-template-strings.sh | ||||
|     <<: *only_default | ||||
|  | ||||
| build: | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v3 | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v4 | ||||
|     stage: build | ||||
|     before_script: | ||||
|         - .gitlab-ci/checkout-mutter.sh | ||||
| @@ -65,7 +83,7 @@ build: | ||||
|             - build | ||||
|  | ||||
| test: | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v3 | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v4 | ||||
|     stage: test | ||||
|     variables: | ||||
|         XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir" | ||||
| @@ -82,7 +100,7 @@ test: | ||||
|         when: on_failure | ||||
|  | ||||
| test-pot: | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v3 | ||||
|     image: registry.gitlab.gnome.org/gnome/mutter/master:v4 | ||||
|     stage: test | ||||
|     before_script: | ||||
|         - ninja -C mutter/build install | ||||
| @@ -96,3 +114,20 @@ test-pot: | ||||
|           ' | tee $POT_LOG | ||||
|         - (! grep -q . $POT_LOG) | ||||
|     <<: *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' | ||||
|   | ||||
							
								
								
									
										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 | ||||
| @@ -23,7 +23,7 @@ run_eslint() { | ||||
|   mkdir -p $(dirname $output) | ||||
|   touch $output | ||||
|  | ||||
|   eslint -f unix ${!extra_args} -o $output js | ||||
|   eslint -f unix ${!extra_args} -o $output js subprojects/extensions-app/js | ||||
| } | ||||
|  | ||||
| list_commit_range_additions() { | ||||
|   | ||||
							
								
								
									
										67
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										67
									
								
								NEWS
									
									
									
									
									
								
							| @@ -1,3 +1,70 @@ | ||||
| 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 | ||||
| ======= | ||||
| * Improve magnifier [Carlos; !984] | ||||
|   | ||||
| @@ -161,12 +161,16 @@ def convert_file(source_file, destination_path): | ||||
|     try: | ||||
|         xkb_name = locale_to_xkb(root["locale"], root["name"]) | ||||
|     except KeyError as e: | ||||
|         logging.warn(e) | ||||
|         logging.warning(e) | ||||
|         return False | ||||
|     destination_file = os.path.join(destination_path, xkb_name + ".json") | ||||
| 
 | ||||
|     with open(destination_file, 'w', encoding="utf-8") as dest_fd: | ||||
|         json.dump(root, dest_fd, ensure_ascii=False, indent=2, sort_keys=True) | ||||
|     try: | ||||
|         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) | ||||
| 
 | ||||
| @@ -1,12 +1,19 @@ | ||||
| <node> | ||||
|   <interface name="org.gnome.Shell.CalendarServer"> | ||||
|     <method name="GetEvents"> | ||||
|       <arg type="x" direction="in" /> | ||||
|       <arg type="x" direction="in" /> | ||||
|       <arg type="b" direction="in" /> | ||||
|       <arg type="a(sssbxxa{sv})" direction="out" /> | ||||
|     <method name="SetTimeRange"> | ||||
|       <arg type="x" name="since" direction="in"/> | ||||
|       <arg type="x" name="until" direction="in"/> | ||||
|       <arg type="b" name="force_reload" direction="in"/> | ||||
|     </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" /> | ||||
|     <signal name="Changed" /> | ||||
|   </interface> | ||||
| </node> | ||||
|   | ||||
| @@ -199,14 +199,37 @@ | ||||
|  | ||||
|     <!-- | ||||
|         LaunchExtensionPrefs: | ||||
|         @uuid: The UUID of the extension | ||||
|  | ||||
|         Launch preferences of an extension. | ||||
|         Deprecated for OpenExtensionPrefs | ||||
|     --> | ||||
|     <method name="LaunchExtensionPrefs"> | ||||
|       <arg type="s" direction="in" name="uuid"/> | ||||
|     </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: | ||||
|         Update all extensions for which updates are available | ||||
| @@ -234,5 +257,11 @@ | ||||
|     --> | ||||
|     <property name="ShellVersion" type="s" access="read"/> | ||||
|  | ||||
|     <!-- | ||||
|         UserExtensionsEnabled: | ||||
|         Whether user extensions are enabled | ||||
|     --> | ||||
|     <property name="UserExtensionsEnabled" type="b" access="readwrite"/> | ||||
|  | ||||
|   </interface> | ||||
| </node> | ||||
|   | ||||
| @@ -19,6 +19,10 @@ Before=gnome-session-initialized.target | ||||
| [Service] | ||||
| Type=notify | ||||
| 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 | ||||
| SuccessExitStatus=1 | ||||
| # 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 = [ | ||||
|   'org.gnome.Shell.desktop', | ||||
|   'org.gnome.Extensions.desktop', | ||||
|   'org.gnome.Shell.Extensions.desktop', | ||||
| ] | ||||
| 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" | ||||
|           ], | ||||
|           [ | ||||
|             "e" | ||||
|             "e", | ||||
|             "é", | ||||
|             "ë" | ||||
|           ], | ||||
|           [ | ||||
|             "r" | ||||
| @@ -21,30 +23,58 @@ | ||||
|             "t" | ||||
|           ], | ||||
|           [ | ||||
|             "y" | ||||
|             "y", | ||||
|             "ý", | ||||
|             "ÿ" | ||||
|           ], | ||||
|           [ | ||||
|             "u" | ||||
|             "u", | ||||
|             "ú", | ||||
|             "ü", | ||||
|             "û", | ||||
|             "ù", | ||||
|             "ū" | ||||
|           ], | ||||
|           [ | ||||
|             "i" | ||||
|             "i", | ||||
|             "í", | ||||
|             "ï" | ||||
|           ], | ||||
|           [ | ||||
|             "o" | ||||
|             "o", | ||||
|             "ó", | ||||
|             "ô", | ||||
|             "ò", | ||||
|             "õ", | ||||
|             "œ", | ||||
|             "ō" | ||||
|           ], | ||||
|           [ | ||||
|             "p" | ||||
|           ], | ||||
|           [ | ||||
|             "å" | ||||
|           ] | ||||
|         ], | ||||
|         [ | ||||
|           [ | ||||
|             "a" | ||||
|             "a", | ||||
|             "á", | ||||
|             "ä", | ||||
|             "à", | ||||
|             "â", | ||||
|             "ã", | ||||
|             "ā" | ||||
|           ], | ||||
|           [ | ||||
|             "s" | ||||
|             "s", | ||||
|             "ß", | ||||
|             "ś", | ||||
|             "š" | ||||
|           ], | ||||
|           [ | ||||
|             "d" | ||||
|             "d", | ||||
|             "ð" | ||||
|           ], | ||||
|           [ | ||||
|             "f" | ||||
| @@ -62,7 +92,16 @@ | ||||
|             "k" | ||||
|           ], | ||||
|           [ | ||||
|             "l" | ||||
|             "l", | ||||
|             "ł" | ||||
|           ], | ||||
|           [ | ||||
|             "ø", | ||||
|             "ö" | ||||
|           ], | ||||
|           [ | ||||
|             "æ", | ||||
|             "ä" | ||||
|           ] | ||||
|         ], | ||||
|         [ | ||||
| @@ -82,7 +121,9 @@ | ||||
|             "b" | ||||
|           ], | ||||
|           [ | ||||
|             "n" | ||||
|             "n", | ||||
|             "ñ", | ||||
|             "ń" | ||||
|           ], | ||||
|           [ | ||||
|             "m" | ||||
| @@ -121,7 +162,9 @@ | ||||
|             "W" | ||||
|           ], | ||||
|           [ | ||||
|             "E" | ||||
|             "E", | ||||
|             "É", | ||||
|             "Ë" | ||||
|           ], | ||||
|           [ | ||||
|             "R" | ||||
| @@ -130,30 +173,58 @@ | ||||
|             "T" | ||||
|           ], | ||||
|           [ | ||||
|             "Y" | ||||
|             "Y", | ||||
|             "Ý", | ||||
|             "Ÿ" | ||||
|           ], | ||||
|           [ | ||||
|             "U" | ||||
|             "U", | ||||
|             "Ú", | ||||
|             "Ü", | ||||
|             "Û", | ||||
|             "Ù", | ||||
|             "Ū" | ||||
|           ], | ||||
|           [ | ||||
|             "I" | ||||
|             "I", | ||||
|             "Í", | ||||
|             "Ï" | ||||
|           ], | ||||
|           [ | ||||
|             "O" | ||||
|             "O", | ||||
|             "Ó", | ||||
|             "Ô", | ||||
|             "Ò", | ||||
|             "Õ", | ||||
|             "Œ", | ||||
|             "Ō" | ||||
|           ], | ||||
|           [ | ||||
|             "P" | ||||
|           ], | ||||
|           [ | ||||
|             "Å" | ||||
|           ] | ||||
|         ], | ||||
|         [ | ||||
|           [ | ||||
|             "A" | ||||
|             "A", | ||||
|             "Á", | ||||
|             "Ä", | ||||
|             "À", | ||||
|             "Â", | ||||
|             "Ã", | ||||
|             "Ā" | ||||
|           ], | ||||
|           [ | ||||
|             "S" | ||||
|             "S", | ||||
|             "SS", | ||||
|             "Ś", | ||||
|             "Š" | ||||
|           ], | ||||
|           [ | ||||
|             "D" | ||||
|             "D", | ||||
|             "Ð" | ||||
|           ], | ||||
|           [ | ||||
|             "F" | ||||
| @@ -171,7 +242,16 @@ | ||||
|             "K" | ||||
|           ], | ||||
|           [ | ||||
|             "L" | ||||
|             "L", | ||||
|             "Ł" | ||||
|           ], | ||||
|           [ | ||||
|             "Ø", | ||||
|             "Ö" | ||||
|           ], | ||||
|           [ | ||||
|             "Æ", | ||||
|             "Ä" | ||||
|           ] | ||||
|         ], | ||||
|         [ | ||||
| @@ -191,7 +271,9 @@ | ||||
|             "B" | ||||
|           ], | ||||
|           [ | ||||
|             "N" | ||||
|             "N", | ||||
|             "Ñ", | ||||
|             "Ń" | ||||
|           ], | ||||
|           [ | ||||
|             "M" | ||||
| @@ -277,10 +359,10 @@ | ||||
|             "#" | ||||
|           ], | ||||
|           [ | ||||
|             "$", | ||||
|             "€", | ||||
|             "¢", | ||||
|             "£", | ||||
|             "€", | ||||
|             "$", | ||||
|             "¥", | ||||
|             "₱" | ||||
|           ], | ||||
| @@ -419,13 +501,14 @@ | ||||
|             "£" | ||||
|           ], | ||||
|           [ | ||||
|             "¥" | ||||
|           ], | ||||
|           [ | ||||
|             "$", | ||||
|             "¢" | ||||
|           ], | ||||
|           [ | ||||
|             "€" | ||||
|           ], | ||||
|           [ | ||||
|             "¥" | ||||
|             "¢" | ||||
|           ], | ||||
|           [ | ||||
|             "^", | ||||
| @@ -504,4 +587,4 @@ | ||||
|   ], | ||||
|   "locale": "nb", | ||||
|   "name": "Norwegian Bokmål" | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -35,9 +35,9 @@ $app_grid_fg_color: #fff; | ||||
| } | ||||
|  | ||||
| /* App Folders */ | ||||
| .app-folder { | ||||
|   .overview-icon { | ||||
|   } | ||||
| .app-well-app.app-folder { | ||||
|   background-color: transparentize($osd_bg_color, 0.8); | ||||
|   border-radius: $base_border_radius + 4px; // same as %icon_tile | ||||
| } | ||||
|  | ||||
| // expanded folder | ||||
| @@ -60,7 +60,7 @@ $app_grid_fg_color: #fff; | ||||
|     & .folder-name-entry { width: 300px } | ||||
|  | ||||
|     /* 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 { | ||||
|       @extend %button; | ||||
| @@ -73,10 +73,6 @@ $app_grid_fg_color: #fff; | ||||
|       & > StIcon { icon-size: 16px } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   & StButton#vhandle, | ||||
|   & StButton#vhandle:hover, | ||||
|   & StButton#vhandle:active { background-color: transparent; } | ||||
| } | ||||
| .app-folder-dialog-container { | ||||
|   padding: 12px; | ||||
|   | ||||
| @@ -153,9 +153,11 @@ | ||||
|   } | ||||
|  | ||||
|   .calendar-day-with-events { | ||||
|     color: lighten($fg_color,10%); | ||||
|     font-weight: bold; | ||||
|     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 { | ||||
|   | ||||
| @@ -15,13 +15,11 @@ | ||||
|     border: 1px solid transparent; | ||||
|  | ||||
|     &:outlined { | ||||
|       border: 1px solid darken($borders_color,5%); | ||||
|       background-color: transparentize($osd_fg_color, 0.9); | ||||
|       box-shadow: inset 0 2px 2px 0 rgba(0,0,0,0.4); | ||||
|       background-color: transparentize($osd_fg_color, 0.7); | ||||
|     } | ||||
|  | ||||
|     &:selected { | ||||
|       background-color: transparentize($osd_fg_color, 0.9); | ||||
|       background-color: transparentize($osd_fg_color, 0.7); | ||||
|       color: $osd_fg_color; | ||||
|     } | ||||
|   } | ||||
|   | ||||
| @@ -1,10 +1,9 @@ | ||||
| #!/bin/env bash | ||||
|  | ||||
| CLDR_LAYOUTS_TARBALL="http://www.unicode.org/Public/cldr/latest/keyboards.zip" | ||||
| CLDR2JSON_GIT="git://repo.or.cz/cldr2json.git" | ||||
|  | ||||
| WORKDIR=".osk-layout-workbench" | ||||
| CLDR2JSON="$WORKDIR/cldr2json/cldr2json.py" | ||||
| CLDR2JSON="cldr2json/cldr2json.py" | ||||
| SRCDIR="$WORKDIR/keyboards/android" | ||||
| DESTDIR="osk-layouts" | ||||
| GRESOURCE_FILE="gnome-shell-osk-layouts.gresource.xml" | ||||
| @@ -20,7 +19,6 @@ mkdir -p "osk-layouts" | ||||
| # Download stuff on the work dir | ||||
| pushd $WORKDIR | ||||
| gio copy $CLDR_LAYOUTS_TARBALL . | ||||
| git clone $CLDR2JSON_GIT | ||||
| unzip keyboards.zip | ||||
| 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(); | ||||
| } | ||||
							
								
								
									
										80
									
								
								js/dbusServices/notifications/notificationDaemon.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								js/dbusServices/notifications/notificationDaemon.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,80 @@ | ||||
| // -*- 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); | ||||
|  | ||||
| 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); | ||||
|     } | ||||
|  | ||||
|     NotifyAsync(params, invocation) { | ||||
|         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)); | ||||
|         }); | ||||
|     } | ||||
| }; | ||||
							
								
								
									
										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) { | ||||
|         if (keyPressEvent.keyval == Clutter.KEY_Escape) | ||||
|             this.cancel(); | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|         return super.vfunc_key_press_event(keyPressEvent); | ||||
|     } | ||||
|  | ||||
|     _initEntryRow() { | ||||
| @@ -184,7 +184,7 @@ var AuthPrompt = GObject.registerClass({ | ||||
|         }); | ||||
|         this._defaultButtonWell.add_constraint(new Clutter.BindConstraint({ | ||||
|             source: this.cancelButton, | ||||
|             coordinate: Clutter.BindCoordinate.SIZE, | ||||
|             coordinate: Clutter.BindCoordinate.WIDTH, | ||||
|         })); | ||||
|         this._mainBox.add_child(this._defaultButtonWell); | ||||
|  | ||||
| @@ -424,8 +424,13 @@ var AuthPrompt = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     updateSensitivity(sensitive) { | ||||
|         if (this._entry.reactive === sensitive) | ||||
|             return; | ||||
|  | ||||
|         this._entry.reactive = sensitive; | ||||
|         this._entry.clutter_text.editable = sensitive; | ||||
|  | ||||
|         if (sensitive) | ||||
|             this._entry.grab_key_focus(); | ||||
|     } | ||||
|  | ||||
|     vfunc_hide() { | ||||
|   | ||||
| @@ -35,7 +35,6 @@ const UserWidget = imports.ui.userWidget; | ||||
| const _FADE_ANIMATION_TIME = 250; | ||||
| const _SCROLL_ANIMATION_TIME = 500; | ||||
| const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0; | ||||
| const _LOGO_ICON_HEIGHT = 48; | ||||
|  | ||||
| var UserListItem = GObject.registerClass({ | ||||
|     Signals: { 'activate': {} }, | ||||
| @@ -178,6 +177,7 @@ var UserList = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     vfunc_key_focus_in() { | ||||
|         super.vfunc_key_focus_in(); | ||||
|         this._moveFocusToItems(); | ||||
|     } | ||||
|  | ||||
| @@ -456,7 +456,6 @@ var LoginDialog = GObject.registerClass({ | ||||
|         let notListedLabel = new St.Label({ | ||||
|             text: _("Not listed?"), | ||||
|             style_class: 'login-dialog-not-listed-label', | ||||
|             x_align: Clutter.ActorAlign.START, | ||||
|         }); | ||||
|         this._notListedButton = new St.Button({ | ||||
|             style_class: 'login-dialog-not-listed-button', | ||||
| @@ -464,6 +463,7 @@ var LoginDialog = GObject.registerClass({ | ||||
|             can_focus: true, | ||||
|             child: notListedLabel, | ||||
|             reactive: true, | ||||
|             x_align: Clutter.ActorAlign.START, | ||||
|         }); | ||||
|  | ||||
|         this._notListedButton.connect('clicked', this._hideUserListAskForUsernameAndBeginVerification.bind(this)); | ||||
| @@ -810,12 +810,13 @@ var LoginDialog = GObject.registerClass({ | ||||
|             return; | ||||
|  | ||||
|         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; | ||||
|             this._logoBin.add_child(this._textureCache.load_file_async(this._logoFile, | ||||
|                                                                        -1, _LOGO_ICON_HEIGHT, | ||||
|                                                                        -1, -1, | ||||
|                                                                        scaleFactor, | ||||
|                                                                        this._logoBin.resource_scale)); | ||||
|                                                                        resourceScale)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
| /* exported BANNER_MESSAGE_KEY, BANNER_MESSAGE_TEXT_KEY, LOGO_KEY, | ||||
|             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 Batch = imports.gdm.batch; | ||||
| @@ -12,6 +12,15 @@ const Main = imports.ui.main; | ||||
| const Params = imports.misc.params; | ||||
| 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 FINGERPRINT_SERVICE_NAME = 'gdm-fingerprint'; | ||||
| var SMARTCARD_SERVICE_NAME = 'gdm-smartcard'; | ||||
| @@ -168,14 +177,12 @@ var ShellUserVerifier = class { | ||||
|  | ||||
|         this._checkForFingerprintReader(); | ||||
|  | ||||
|         if (userName) { | ||||
|             // If possible, reauthenticate an already running session, | ||||
|             // so any session specific credentials get updated appropriately | ||||
|             this._client.open_reauthentication_channel(userName, this._cancellable, | ||||
|                                                        this._reauthenticationChannelOpened.bind(this)); | ||||
|         } else { | ||||
|             this._client.get_user_verifier(this._cancellable, this._userVerifierGot.bind(this)); | ||||
|         } | ||||
|         // If possible, reauthenticate an already running session, | ||||
|         // so any session specific credentials get updated appropriately | ||||
|         if (userName) | ||||
|             this._openReauthenticationChannel(userName); | ||||
|         else | ||||
|             this._getUserVerifier(); | ||||
|     } | ||||
|  | ||||
|     cancel() { | ||||
| @@ -339,10 +346,11 @@ var ShellUserVerifier = class { | ||||
|         this._verificationFailed(false); | ||||
|     } | ||||
|  | ||||
|     _reauthenticationChannelOpened(client, result) { | ||||
|     async _openReauthenticationChannel(userName) { | ||||
|         try { | ||||
|             this._clearUserVerifier(); | ||||
|             this._userVerifier = client.open_reauthentication_channel_finish(result); | ||||
|             this._userVerifier = await this._client.open_reauthentication_channel( | ||||
|                 userName, this._cancellable); | ||||
|         } catch (e) { | ||||
|             if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                 return; | ||||
| @@ -351,8 +359,7 @@ var ShellUserVerifier = class { | ||||
|                 // Gdm emits org.freedesktop.DBus.Error.AccessDenied when there | ||||
|                 // is no session to reauthenticate. Fall back to performing | ||||
|                 // verification from this login session | ||||
|                 client.get_user_verifier(this._cancellable, | ||||
|                                          this._userVerifierGot.bind(this)); | ||||
|                 this._getUserVerifier(); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
| @@ -366,10 +373,11 @@ var ShellUserVerifier = class { | ||||
|         this._hold.release(); | ||||
|     } | ||||
|  | ||||
|     _userVerifierGot(client, result) { | ||||
|     async _getUserVerifier() { | ||||
|         try { | ||||
|             this._clearUserVerifier(); | ||||
|             this._userVerifier = client.get_user_verifier_finish(result); | ||||
|             this._userVerifier = | ||||
|                 await this._client.get_user_verifier(this._cancellable); | ||||
|         } catch (e) { | ||||
|             if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                 return; | ||||
| @@ -421,35 +429,25 @@ var ShellUserVerifier = class { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _startService(serviceName) { | ||||
|     async _startService(serviceName) { | ||||
|         this._hold.acquire(); | ||||
|         if (this._userName) { | ||||
|             this._userVerifier.call_begin_verification_for_user(serviceName, this._userName, this._cancellable, (obj, result) => { | ||||
|                 try { | ||||
|                     obj.call_begin_verification_for_user_finish(result); | ||||
|                 } catch (e) { | ||||
|                     if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                         return; | ||||
|                     this._reportInitError('Failed to start verification for user', e); | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 this._hold.release(); | ||||
|             }); | ||||
|         } else { | ||||
|             this._userVerifier.call_begin_verification(serviceName, this._cancellable, (obj, result) => { | ||||
|                 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(); | ||||
|             }); | ||||
|         try { | ||||
|             if (this._userName) { | ||||
|                 await this._userVerifier.call_begin_verification_for_user( | ||||
|                     serviceName, this._userName, this._cancellable); | ||||
|             } else { | ||||
|                 await this._userVerifier.call_begin_verification( | ||||
|                     serviceName, this._cancellable); | ||||
|             } | ||||
|         } catch (e) { | ||||
|             if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                 return; | ||||
|             this._reportInitError(this._userName | ||||
|                 ? 'Failed to start verification for user' | ||||
|                 : 'Failed to start verification', e); | ||||
|             return; | ||||
|         } | ||||
|         this._hold.release(); | ||||
|     } | ||||
|  | ||||
|     _beginVerification() { | ||||
|   | ||||
| @@ -23,6 +23,7 @@ | ||||
|     <file>misc/modemManager.js</file> | ||||
|     <file>misc/objectManager.js</file> | ||||
|     <file>misc/params.js</file> | ||||
|     <file>misc/parentalControlsManager.js</file> | ||||
|     <file>misc/permissionStore.js</file> | ||||
|     <file>misc/smartcardManager.js</file> | ||||
|     <file>misc/systemActions.js</file> | ||||
| @@ -101,7 +102,6 @@ | ||||
|     <file>ui/swipeTracker.js</file> | ||||
|     <file>ui/switcherPopup.js</file> | ||||
|     <file>ui/switchMonitor.js</file> | ||||
|     <file>ui/tweener.js</file> | ||||
|     <file>ui/unlockDialog.js</file> | ||||
|     <file>ui/userWidget.js</file> | ||||
|     <file>ui/viewSelector.js</file> | ||||
| @@ -109,7 +109,6 @@ | ||||
|     <file>ui/windowMenu.js</file> | ||||
|     <file>ui/windowManager.js</file> | ||||
|     <file>ui/workspace.js</file> | ||||
|     <file>ui/workspaceAnimation.js</file> | ||||
|     <file>ui/workspaceSwitcherPopup.js</file> | ||||
|     <file>ui/workspaceThumbnail.js</file> | ||||
|     <file>ui/workspacesView.js</file> | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| subdir('misc') | ||||
| subdir('dbusServices') | ||||
|  | ||||
| js_resources = gnome.compile_resources( | ||||
|   'js-resources', 'js-resources.gresource.xml', | ||||
| @@ -13,10 +14,3 @@ portal_resources = gnome.compile_resources( | ||||
|   c_name: 'portal_js_resources', | ||||
|   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 */ | ||||
| var LIBEXECDIR = '@libexecdir@'; | ||||
| var PKGDATADIR = '@datadir@/@PACKAGE_NAME@'; | ||||
| var VPNDIR = '@vpndir@'; | ||||
| /* g-i package versions */ | ||||
| var LIBMUTTER_API_VERSION = '@LIBMUTTER_API_VERSION@' | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- | ||||
| /* exported ExtensionState, ExtensionType, getCurrentExtension, | ||||
|    getSettings, initTranslations, isOutOfDate, installImporter, | ||||
|    serializeExtension, deserializeExtension */ | ||||
|    getSettings, initTranslations, openPrefs, isOutOfDate, | ||||
|    installImporter, serializeExtension, deserializeExtension */ | ||||
|  | ||||
| // Common utils for the extension system and the extension | ||||
| // preferences tool | ||||
| @@ -153,6 +153,27 @@ function getSettings(schema) { | ||||
|     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: | ||||
|  * @param {string[]} required - an array of versions we're compatible with | ||||
|   | ||||
| @@ -76,19 +76,15 @@ function loadInterfaceXML(iface) { | ||||
|         _ifaceResource._register(); | ||||
|     } | ||||
|  | ||||
|     let xml = null; | ||||
|     let uri = `resource:///org/gnome/shell/dbus-interfaces/${iface}.xml`; | ||||
|     let f = Gio.File.new_for_uri(uri); | ||||
|  | ||||
|     try { | ||||
|         let [ok_, bytes] = f.load_contents(null); | ||||
|         if (bytes instanceof Uint8Array) | ||||
|             xml = imports.byteArray.toString(bytes); | ||||
|         else | ||||
|             xml = bytes.toString(); | ||||
|         return imports.byteArray.toString(bytes); | ||||
|     } catch (e) { | ||||
|         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 -*- | ||||
| /* exported getIBusManager */ | ||||
|  | ||||
| const { Gio, GLib, IBus } = imports.gi; | ||||
| const { Gio, GLib, IBus, Meta } = imports.gi; | ||||
| const Signals = imports.signals; | ||||
|  | ||||
| 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 | ||||
| _checkIBusVersion(1, 5, 2); | ||||
|  | ||||
| @@ -55,13 +64,18 @@ var IBusManager = class { | ||||
|         this._ibus.set_watch_ibus_signal(true); | ||||
|         this._ibus.connect('global-engine-changed', this._engineChanged.bind(this)); | ||||
|  | ||||
|         this._spawn(); | ||||
|         this._spawn(Meta.is_wayland_compositor() ? [] : ['--xim']); | ||||
|     } | ||||
|  | ||||
|     _spawn(extraArgs = []) { | ||||
|         try { | ||||
|             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) { | ||||
|             log(`Failed to launch ibus-daemon: ${e.message}`); | ||||
|         } | ||||
| @@ -97,16 +111,14 @@ var IBusManager = class { | ||||
|  | ||||
|     _onConnected() { | ||||
|         this._cancellable = new Gio.Cancellable(); | ||||
|         this._ibus.list_engines_async(-1, this._cancellable, | ||||
|             this._initEngines.bind(this)); | ||||
|         this._ibus.request_name_async(IBus.SERVICE_PANEL, | ||||
|             IBus.BusNameFlag.REPLACE_EXISTING, -1, this._cancellable, | ||||
|             this._initPanelService.bind(this)); | ||||
|         this._initEngines(); | ||||
|         this._initPanelService(); | ||||
|     } | ||||
|  | ||||
|     _initEngines(ibus, result) { | ||||
|     async _initEngines() { | ||||
|         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) { | ||||
|                 let name = enginesList[i].get_name(); | ||||
|                 this._engines.set(name, enginesList[i]); | ||||
| @@ -121,56 +133,52 @@ var IBusManager = class { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _initPanelService(ibus, result) { | ||||
|         let success = false; | ||||
|     async _initPanelService() { | ||||
|         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) { | ||||
|             if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                 return; | ||||
|             logError(e); | ||||
|             if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { | ||||
|                 logError(e); | ||||
|                 this._clear(); | ||||
|             } | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (success) { | ||||
|             this._panelService = new IBus.PanelService({ connection: this._ibus.get_connection(), | ||||
|                                                          object_path: IBus.PATH_PANEL }); | ||||
|             this._candidatePopup.setPanelService(this._panelService); | ||||
|             this._panelService.connect('update-property', this._updateProperty.bind(this)); | ||||
|             this._panelService.connect('set-cursor-location', (ps, x, y, w, h) => { | ||||
|                 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.emit('focus-in'); | ||||
|             }); | ||||
|             this._panelService.connect('focus-out', () => this.emit('focus-out')); | ||||
|         this._panelService = new IBus.PanelService({ | ||||
|             connection: this._ibus.get_connection(), | ||||
|             object_path: IBus.PATH_PANEL, | ||||
|         }); | ||||
|         this._candidatePopup.setPanelService(this._panelService); | ||||
|         this._panelService.connect('update-property', this._updateProperty.bind(this)); | ||||
|         this._panelService.connect('set-cursor-location', (ps, x, y, w, h) => { | ||||
|             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.emit('focus-in'); | ||||
|         }); | ||||
|         this._panelService.connect('focus-out', () => this.emit('focus-out')); | ||||
|  | ||||
|             try { | ||||
|                 // IBus versions older than 1.5.10 have a bug which | ||||
|                 // causes spurious set-content-type emissions when | ||||
|                 // switching input focus that temporarily lose purpose | ||||
|                 // and hints defeating its intended semantics and | ||||
|                 // confusing users. We thus don't use it in that case. | ||||
|                 _checkIBusVersion(1, 5, 10); | ||||
|                 this._panelService.connect('set-content-type', this._setContentType.bind(this)); | ||||
|             } catch (e) { | ||||
|             } | ||||
|         try { | ||||
|             // IBus versions older than 1.5.10 have a bug which | ||||
|             // causes spurious set-content-type emissions when | ||||
|             // switching input focus that temporarily lose purpose | ||||
|             // and hints defeating its intended semantics and | ||||
|             // confusing users. We thus don't use it in that case. | ||||
|             _checkIBusVersion(1, 5, 10); | ||||
|             this._panelService.connect('set-content-type', this._setContentType.bind(this)); | ||||
|         } catch (e) { | ||||
|         } | ||||
|  | ||||
|         try { | ||||
|             // If an engine is already active we need to get its properties | ||||
|             this._ibus.get_global_engine_async(-1, this._cancellable, (_bus, res) => { | ||||
|                 let engine; | ||||
|                 try { | ||||
|                     engine = this._ibus.get_global_engine_async_finish(res); | ||||
|                     if (!engine) | ||||
|                         return; | ||||
|                 } catch (e) { | ||||
|                     return; | ||||
|                 } | ||||
|                 this._engineChanged(this._ibus, engine.get_name()); | ||||
|             }); | ||||
|             const engine = | ||||
|                 await this._ibus.get_global_engine_async(-1, this._cancellable); | ||||
|             this._engineChanged(this._ibus, engine.get_name()); | ||||
|             this._updateReadiness(); | ||||
|         } else { | ||||
|             this._clear(); | ||||
|         } catch (e) { | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -219,7 +227,7 @@ var IBusManager = class { | ||||
|         return this._engines.get(id); | ||||
|     } | ||||
|  | ||||
|     setEngine(id, callback) { | ||||
|     async setEngine(id, callback) { | ||||
|         // Send id even if id == this._currentEngineName | ||||
|         // because 'properties-registered' signal can be emitted | ||||
|         // while this._ibusSources == null on a lock screen. | ||||
| @@ -229,18 +237,16 @@ var IBusManager = class { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         this._ibus.set_global_engine_async(id, | ||||
|             this._MAX_INPUT_SOURCE_ACTIVATION_TIME, | ||||
|             this._cancellable, (_bus, res) => { | ||||
|                 try { | ||||
|                     this._ibus.set_global_engine_async_finish(res); | ||||
|                 } catch (e) { | ||||
|                     if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                         logError(e); | ||||
|                 } | ||||
|                 if (callback) | ||||
|                     callback(); | ||||
|             }); | ||||
|         try { | ||||
|             await this._ibus.set_global_engine_async(id, | ||||
|                 this._MAX_INPUT_SOURCE_ACTIVATION_TIME, | ||||
|                 this._cancellable); | ||||
|         } catch (e) { | ||||
|             if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                 logError(e); | ||||
|         } | ||||
|         if (callback) | ||||
|             callback(); | ||||
|     } | ||||
|  | ||||
|     preloadEngines(ids) { | ||||
|   | ||||
| @@ -4,6 +4,9 @@ const { Clutter, GLib, Gio, GObject, IBus } = imports.gi; | ||||
|  | ||||
| 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 InputMethod = GObject.registerClass( | ||||
| @@ -46,15 +49,11 @@ class InputMethod extends Clutter.InputMethod { | ||||
|         this._currentSource = this._inputSourceManager.currentSource; | ||||
|     } | ||||
|  | ||||
|     _onConnected() { | ||||
|     async _onConnected() { | ||||
|         this._cancellable = new Gio.Cancellable(); | ||||
|         this._ibus.create_input_context_async('gnome-shell', -1, | ||||
|             this._cancellable, this._setContext.bind(this)); | ||||
|     } | ||||
|  | ||||
|     _setContext(bus, res) { | ||||
|         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) { | ||||
|             if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { | ||||
|                 logError(e); | ||||
| @@ -97,8 +96,13 @@ class InputMethod extends Clutter.InputMethod { | ||||
|         this.commit(text.get_text()); | ||||
|     } | ||||
|  | ||||
|     _onDeleteSurroundingText() { | ||||
|         this.delete_surrounding(); | ||||
|     _onDeleteSurroundingText(_context, offset, nchars) { | ||||
|         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) { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- | ||||
| /* exported getKeyboardManager, holdKeyboard, releaseKeyboard */ | ||||
|  | ||||
| const { GLib, GnomeDesktop, Meta } = imports.gi; | ||||
| const { GLib, GnomeDesktop } = imports.gi; | ||||
|  | ||||
| const Main = imports.ui.main; | ||||
|  | ||||
| @@ -62,11 +62,11 @@ var KeyboardManager = class { | ||||
|             return; | ||||
|  | ||||
|         this._currentKeymap = { layouts, variants, options }; | ||||
|         Meta.get_backend().set_keymap(layouts, variants, options); | ||||
|         global.backend.set_keymap(layouts, variants, options); | ||||
|     } | ||||
|  | ||||
|     _applyLayoutGroupIndex(idx) { | ||||
|         Meta.get_backend().lock_layout_group(idx); | ||||
|         global.backend.lock_layout_group(idx); | ||||
|     } | ||||
|  | ||||
|     apply(id) { | ||||
|   | ||||
| @@ -50,25 +50,22 @@ function canLock() { | ||||
| } | ||||
|  | ||||
|  | ||||
| function registerSessionWithGDM() { | ||||
| async function registerSessionWithGDM() { | ||||
|     log("Registering session with GDM"); | ||||
|     Gio.DBus.system.call('org.gnome.DisplayManager', | ||||
|                          '/org/gnome/DisplayManager/Manager', | ||||
|                          'org.gnome.DisplayManager.Manager', | ||||
|                          'RegisterSession', | ||||
|                          GLib.Variant.new('(a{sv})', [{}]), null, | ||||
|                          Gio.DBusCallFlags.NONE, -1, null, | ||||
|         (source, result) => { | ||||
|             try { | ||||
|                 source.call_finish(result); | ||||
|             } catch (e) { | ||||
|                 if (!e.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_METHOD)) | ||||
|                     log(`Error registering session with GDM: ${e.message}`); | ||||
|                 else | ||||
|                     log("Not calling RegisterSession(): method not exported, GDM too old?"); | ||||
|             } | ||||
|         } | ||||
|     ); | ||||
|     try { | ||||
|         await Gio.DBus.system.call( | ||||
|             'org.gnome.DisplayManager', | ||||
|             '/org/gnome/DisplayManager/Manager', | ||||
|             'org.gnome.DisplayManager.Manager', | ||||
|             'RegisterSession', | ||||
|             GLib.Variant.new('(a{sv})', [{}]), null, | ||||
|             Gio.DBusCallFlags.NONE, -1, null); | ||||
|     } catch (e) { | ||||
|         if (!e.matches(Gio.DBusError, Gio.DBusError.UNKNOWN_METHOD)) | ||||
|             log(`Error registering session with GDM: ${e.message}`); | ||||
|         else | ||||
|             log('Not calling RegisterSession(): method not exported, GDM too old?'); | ||||
|     } | ||||
| } | ||||
|  | ||||
| let _loginManager = null; | ||||
| @@ -174,24 +171,19 @@ var LoginManagerSystemd = class { | ||||
|         this._proxy.SuspendRemote(true); | ||||
|     } | ||||
|  | ||||
|     inhibit(reason, callback) { | ||||
|         let inVariant = GLib.Variant.new('(ssss)', | ||||
|                                          ['sleep', | ||||
|                                           'GNOME Shell', | ||||
|                                           reason, | ||||
|                                           'delay']); | ||||
|         this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null, | ||||
|             (proxy, result) => { | ||||
|                 let fd = -1; | ||||
|                 try { | ||||
|                     let [outVariant_, fdList] = proxy.call_with_unix_fd_list_finish(result); | ||||
|                     fd = fdList.steal_fds()[0]; | ||||
|                     callback(new Gio.UnixInputStream({ fd })); | ||||
|                 } catch (e) { | ||||
|                     logError(e, "Error getting systemd inhibitor"); | ||||
|                     callback(null); | ||||
|                 } | ||||
|             }); | ||||
|     async inhibit(reason, callback) { | ||||
|         try { | ||||
|             const inVariant = new GLib.Variant('(ssss)', | ||||
|                 ['sleep', 'GNOME Shell', reason, 'delay']); | ||||
|             const [outVariant_, fdList] = | ||||
|                 await this._proxy.call_with_unix_fd_list('Inhibit', | ||||
|                     inVariant, 0, -1, null, null); | ||||
|             const [fd] = fdList.steal_fds(); | ||||
|             callback(new Gio.UnixInputStream({ fd })); | ||||
|         } catch (e) { | ||||
|             logError(e, 'Error getting systemd inhibitor'); | ||||
|             callback(null); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _prepareForSleep(proxy, sender, [aboutToSuspend]) { | ||||
|   | ||||
| @@ -7,7 +7,6 @@ jsconf.set10('HAVE_BLUETOOTH', bt_dep.found()) | ||||
| jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager) | ||||
| jsconf.set('datadir', datadir) | ||||
| jsconf.set('libexecdir', libexecdir) | ||||
| jsconf.set('vpndir', vpndir) | ||||
|  | ||||
| config_js = configure_file( | ||||
|   input: 'config.js.in', | ||||
|   | ||||
| @@ -223,7 +223,7 @@ var BroadbandModem = GObject.registerClass({ | ||||
| }, class BroadbandModem extends ModemBase { | ||||
|     _init(path, 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_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path); | ||||
|  | ||||
| @@ -249,7 +249,7 @@ var BroadbandModem = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     _reloadSignalQuality() { | ||||
|         let [quality, recent_] = this.SignalQuality; | ||||
|         let [quality, recent_] = this._proxy.SignalQuality; | ||||
|         this._setSignalQuality(quality); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -57,9 +57,7 @@ var ObjectManager = class { | ||||
|         // Start out inhibiting load until at least the proxy | ||||
|         // manager is loaded and the remote objects are fetched | ||||
|         this._numLoadInhibitors = 1; | ||||
|         this._managerProxy.init_async(GLib.PRIORITY_DEFAULT, | ||||
|                                       this._cancellable, | ||||
|                                       this._onManagerProxyLoaded.bind(this)); | ||||
|         this._initManagerProxy(); | ||||
|     } | ||||
|  | ||||
|     _tryToCompleteLoad() { | ||||
| @@ -73,7 +71,7 @@ var ObjectManager = class { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _addInterface(objectPath, interfaceName, onFinished) { | ||||
|     async _addInterface(objectPath, interfaceName, onFinished) { | ||||
|         let info = this._interfaceInfos[interfaceName]; | ||||
|  | ||||
|         if (!info) { | ||||
| @@ -89,40 +87,38 @@ var ObjectManager = class { | ||||
|                                         g_interface_info: info, | ||||
|                                         g_flags: Gio.DBusProxyFlags.DO_NOT_AUTO_START }); | ||||
|  | ||||
|         proxy.init_async(GLib.PRIORITY_DEFAULT, this._cancellable, (initable, result) => { | ||||
|             try { | ||||
|                 initable.init_finish(result); | ||||
|             } catch (e) { | ||||
|                 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); | ||||
|         try { | ||||
|             await proxy.init_async(GLib.PRIORITY_DEFAULT, this._cancellable); | ||||
|         } catch (e) { | ||||
|             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) | ||||
|             onFinished(); | ||||
|     } | ||||
|  | ||||
|     _removeInterface(objectPath, interfaceName) { | ||||
| @@ -151,9 +147,10 @@ var ObjectManager = class { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _onManagerProxyLoaded(initable, result) { | ||||
|     async _initManagerProxy() { | ||||
|         try { | ||||
|             initable.init_finish(result); | ||||
|             await this._managerProxy.init_async( | ||||
|                 GLib.PRIORITY_DEFAULT, this._cancellable); | ||||
|         } catch (e) { | ||||
|             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._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.set(POWER_OFF_ACTION_ID, { | ||||
|             // Translators: The name of the power-off action in search | ||||
|             name: C_("search-result", "Power Off"), | ||||
|             iconName: 'system-shutdown-symbolic', | ||||
|             // 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, | ||||
|         }); | ||||
|         this._actions.set(LOCK_SCREEN_ACTION_ID, { | ||||
| @@ -97,7 +101,7 @@ const SystemActions = GObject.registerClass({ | ||||
|             name: C_("search-result", "Lock Screen"), | ||||
|             iconName: 'system-lock-screen-symbolic', | ||||
|             // Translators: A list of keywords that match the lock screen action, separated by semicolons | ||||
|             keywords: _("lock screen").split(/[; ]/), | ||||
|             keywords: tokenizeKeywords(_('lock screen')), | ||||
|             available: false, | ||||
|         }); | ||||
|         this._actions.set(LOGOUT_ACTION_ID, { | ||||
| @@ -105,7 +109,7 @@ const SystemActions = GObject.registerClass({ | ||||
|             name: C_("search-result", "Log Out"), | ||||
|             iconName: 'application-exit-symbolic', | ||||
|             // 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, | ||||
|         }); | ||||
|         this._actions.set(SUSPEND_ACTION_ID, { | ||||
| @@ -113,7 +117,7 @@ const SystemActions = GObject.registerClass({ | ||||
|             name: C_("search-result", "Suspend"), | ||||
|             iconName: 'media-playback-pause-symbolic', | ||||
|             // Translators: A list of keywords that match the suspend action, separated by semicolons | ||||
|             keywords: _("suspend;sleep").split(/[; ]/), | ||||
|             keywords: tokenizeKeywords(_('suspend;sleep')), | ||||
|             available: false, | ||||
|         }); | ||||
|         this._actions.set(SWITCH_USER_ACTION_ID, { | ||||
| @@ -121,14 +125,14 @@ const SystemActions = GObject.registerClass({ | ||||
|             name: C_("search-result", "Switch User"), | ||||
|             iconName: 'system-switch-user-symbolic', | ||||
|             // Translators: A list of keywords that match the switch user action, separated by semicolons | ||||
|             keywords: _("switch user").split(/[; ]/), | ||||
|             keywords: tokenizeKeywords(_('switch user')), | ||||
|             available: false, | ||||
|         }); | ||||
|         this._actions.set(LOCK_ORIENTATION_ACTION_ID, { | ||||
|             name: '', | ||||
|             iconName: '', | ||||
|             // 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, | ||||
|         }); | ||||
|  | ||||
| @@ -277,7 +281,7 @@ const SystemActions = GObject.registerClass({ | ||||
|  | ||||
|     getMatchingActions(terms) { | ||||
|         // 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 = []; | ||||
|  | ||||
|   | ||||
| @@ -7,6 +7,8 @@ const PermissionStore = imports.misc.permissionStore; | ||||
|  | ||||
| const { loadInterfaceXML } = imports.misc.fileUtils; | ||||
|  | ||||
| Gio._promisify(Geoclue.Simple, 'new', 'new_finish'); | ||||
|  | ||||
| const WeatherIntegrationIface = loadInterfaceXML('org.gnome.Shell.WeatherIntegration'); | ||||
|  | ||||
| const WEATHER_BUS_NAME = 'org.gnome.Weather'; | ||||
| @@ -79,16 +81,7 @@ var WeatherClient = class { | ||||
|         this._weatherApp = null; | ||||
|         this._weatherProxy = null; | ||||
|  | ||||
|         let nodeInfo = Gio.DBusNodeInfo.new_for_xml(WeatherIntegrationIface); | ||||
|         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._createWeatherProxy(); | ||||
|  | ||||
|         this._settings = new Gio.Settings({ | ||||
|             schema_id: 'org.gnome.shell.weather', | ||||
| @@ -146,9 +139,17 @@ var WeatherClient = class { | ||||
|                (!this._needsAuth || this._weatherAuthorized); | ||||
|     } | ||||
|  | ||||
|     _onWeatherProxyReady(o, res) { | ||||
|     async _createWeatherProxy() { | ||||
|         const nodeInfo = Gio.DBusNodeInfo.new_for_xml(WeatherIntegrationIface); | ||||
|         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) { | ||||
|             log(`Failed to create GNOME Weather proxy: ${e}`); | ||||
|             return; | ||||
| @@ -239,25 +240,23 @@ var WeatherClient = class { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _startGClueService() { | ||||
|     async _startGClueService() { | ||||
|         if (this._gclueStarting) | ||||
|             return; | ||||
|  | ||||
|         this._gclueStarting = true; | ||||
|  | ||||
|         Geoclue.Simple.new('org.gnome.Shell', Geoclue.AccuracyLevel.CITY, null, | ||||
|             (o, res) => { | ||||
|                 try { | ||||
|                     this._gclueService = Geoclue.Simple.new_finish(res); | ||||
|                 } catch (e) { | ||||
|                     log(`Failed to connect to Geoclue2 service: ${e.message}`); | ||||
|                     this._setLocation(this._mostRecentLocation); | ||||
|                     return; | ||||
|                 } | ||||
|                 this._gclueStarted = true; | ||||
|                 this._gclueService.get_client().distance_threshold = 100; | ||||
|                 this._updateLocationMonitoring(); | ||||
|             }); | ||||
|         try { | ||||
|             this._gclueService = await Geoclue.Simple.new( | ||||
|                 'org.gnome.Shell', Geoclue.AccuracyLevel.CITY, null); | ||||
|         } catch (e) { | ||||
|             log(`Failed to connect to Geoclue2 service: ${e.message}`); | ||||
|             this._setLocation(this._mostRecentLocation); | ||||
|             return; | ||||
|         } | ||||
|         this._gclueStarted = true; | ||||
|         this._gclueService.get_client().distance_threshold = 100; | ||||
|         this._updateLocationMonitoring(); | ||||
|     } | ||||
|  | ||||
|     _onGClueLocationChanged() { | ||||
|   | ||||
| @@ -5,6 +5,5 @@ | ||||
|  | ||||
|     <file>misc/config.js</file> | ||||
|     <file>misc/fileUtils.js</file> | ||||
|     <file>misc/params.js</file> | ||||
|   </gresource> | ||||
| </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> | ||||
| @@ -280,12 +280,10 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { | ||||
|     } | ||||
|  | ||||
|     _onDestroy() { | ||||
|         super._onDestroy(); | ||||
|  | ||||
|         if (this._thumbnails) | ||||
|             this._destroyThumbnails(); | ||||
|         if (this._thumbnailTimeoutId != 0) | ||||
|             GLib.source_remove(this._thumbnailTimeoutId); | ||||
|  | ||||
|         super._onDestroy(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -365,8 +363,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { | ||||
|             }, | ||||
|         }); | ||||
|         this._thumbnails = null; | ||||
|         if (this._switcherList._items[this._selectedIndex]) | ||||
|             this._switcherList._items[this._selectedIndex].remove_accessible_state(Atk.StateType.EXPANDED); | ||||
|         this._switcherList.removeAccessibleState(this._selectedIndex, Atk.StateType.EXPANDED); | ||||
|     } | ||||
|  | ||||
|     _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); | ||||
|     } | ||||
| }); | ||||
|  | ||||
| @@ -776,7 +773,9 @@ class AppSwitcher extends SwitcherPopup.SwitcherList { | ||||
|  | ||||
|     // We override SwitcherList's _onItemEnter method to delay | ||||
|     // activation when the thumbnail list is open | ||||
|     _onItemEnter(index) { | ||||
|     _onItemEnter(item) { | ||||
|         const index = this._items.indexOf(item); | ||||
|  | ||||
|         if (this._mouseTimeOutId != 0) | ||||
|             GLib.source_remove(this._mouseTimeOutId); | ||||
|         if (this._altTabPopup.thumbnailsVisible) { | ||||
|   | ||||
| @@ -15,8 +15,7 @@ class Animation extends St.Bin { | ||||
|         const themeContext = St.ThemeContext.get_for_stage(global.stage); | ||||
|  | ||||
|         super._init({ | ||||
|             width: width * themeContext.scale_factor, | ||||
|             height: height * themeContext.scale_factor, | ||||
|             style: `width: ${width}px; height: ${height}px;`, | ||||
|         }); | ||||
|  | ||||
|         this.connect('destroy', this._onDestroy.bind(this)); | ||||
|   | ||||
| @@ -10,6 +10,7 @@ const GrabHelper = imports.ui.grabHelper; | ||||
| const IconGrid = imports.ui.iconGrid; | ||||
| const Main = imports.ui.main; | ||||
| const PageIndicators = imports.ui.pageIndicators; | ||||
| const ParentalControlsManager = imports.misc.parentalControlsManager; | ||||
| const PopupMenu = imports.ui.popupMenu; | ||||
| const Search = imports.ui.search; | ||||
| const SwipeTracker = imports.ui.swipeTracker; | ||||
| @@ -71,15 +72,9 @@ function _getFolderName(folder) { | ||||
|     let name = folder.get_string('name'); | ||||
|  | ||||
|     if (folder.get_boolean('translate')) { | ||||
|         let keyfile = new GLib.KeyFile(); | ||||
|         let path = 'desktop-directories/%s'.format(name); | ||||
|  | ||||
|         try { | ||||
|             keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE); | ||||
|             name = keyfile.get_locale_string('Desktop Entry', 'Name', null); | ||||
|         } catch (e) { | ||||
|             return name; | ||||
|         } | ||||
|         let translated = Shell.util_get_translated_folder_name(name); | ||||
|         if (translated !== null) | ||||
|             return translated; | ||||
|     } | ||||
|  | ||||
|     return name; | ||||
| @@ -120,15 +115,10 @@ function _findBestFolderName(apps) { | ||||
|     }, commonCategories); | ||||
|  | ||||
|     for (let category of commonCategories) { | ||||
|         let keyfile = new GLib.KeyFile(); | ||||
|         let path = 'desktop-directories/%s.directory'.format(category); | ||||
|  | ||||
|         try { | ||||
|             keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE); | ||||
|             return keyfile.get_locale_string('Desktop Entry', 'Name', null); | ||||
|         } catch (e) { | ||||
|             continue; | ||||
|         } | ||||
|         const directory = '%s.directory'.format(category); | ||||
|         const translated = Shell.util_get_translated_folder_name(directory); | ||||
|         if (translated !== null) | ||||
|             return translated; | ||||
|     } | ||||
|  | ||||
|     return null; | ||||
| @@ -169,6 +159,16 @@ var BaseAppView = GObject.registerClass({ | ||||
|  | ||||
|         this._items = new Map(); | ||||
|         this._orderedItems = []; | ||||
|  | ||||
|         this._animateLaterId = 0; | ||||
|         this._viewLoadedHandlerId = 0; | ||||
|         this._viewIsReady = false; | ||||
|  | ||||
|         // Filter the apps through the user’s parental controls. | ||||
|         this._parentalControlsManager = ParentalControlsManager.getDefault(); | ||||
|         this._parentalControlsManager.connect('app-filter-changed', () => { | ||||
|             this._redisplay(); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     _childFocused(_actor) { | ||||
| @@ -204,6 +204,7 @@ var BaseAppView = GObject.registerClass({ | ||||
|             this._items.set(icon.id, icon); | ||||
|         }); | ||||
|  | ||||
|         this._viewIsReady = true; | ||||
|         this.emit('view-loaded'); | ||||
|     } | ||||
|  | ||||
| @@ -253,6 +254,18 @@ var BaseAppView = GObject.registerClass({ | ||||
|             Main.overview.dash.showAppsButton); | ||||
|     } | ||||
|  | ||||
|     _clearAnimateLater() { | ||||
|         if (this._animateLaterId) { | ||||
|             Meta.later_remove(this._animateLaterId); | ||||
|             this._animateLaterId = 0; | ||||
|         } | ||||
|         if (this._viewLoadedHandlerId) { | ||||
|             this.disconnect(this._viewLoadedHandlerId); | ||||
|             this._viewLoadedHandlerId = 0; | ||||
|         } | ||||
|         this._grid.opacity = 255; | ||||
|     } | ||||
|  | ||||
|     animate(animationDirection, onComplete) { | ||||
|         if (onComplete) { | ||||
|             let animationDoneId = this._grid.connect('animation-done', () => { | ||||
| @@ -261,16 +274,38 @@ var BaseAppView = GObject.registerClass({ | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         this._clearAnimateLater(); | ||||
|  | ||||
|         if (animationDirection == IconGrid.AnimationDirection.IN) { | ||||
|             let id = this._grid.connect('paint', () => { | ||||
|                 this._grid.disconnect(id); | ||||
|                 this._doSpringAnimation(animationDirection); | ||||
|             }); | ||||
|             const doSpringAnimationLater = laterType => { | ||||
|                 this._animateLaterId = Meta.later_add(laterType, | ||||
|                     () => { | ||||
|                         this._animateLaterId = 0; | ||||
|                         this._doSpringAnimation(animationDirection); | ||||
|                         return GLib.SOURCE_REMOVE; | ||||
|                     }); | ||||
|             }; | ||||
|  | ||||
|             if (this._viewIsReady) { | ||||
|                 this._grid.opacity = 0; | ||||
|                 doSpringAnimationLater(Meta.LaterType.IDLE); | ||||
|             } else { | ||||
|                 this._viewLoadedHandlerId = this.connect('view-loaded', | ||||
|                     () => { | ||||
|                         this._clearAnimateLater(); | ||||
|                         doSpringAnimationLater(Meta.LaterType.BEFORE_REDRAW); | ||||
|                     }); | ||||
|             } | ||||
|         } else { | ||||
|             this._doSpringAnimation(animationDirection); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     vfunc_unmap() { | ||||
|         this._clearAnimateLater(); | ||||
|         super.vfunc_unmap(); | ||||
|     } | ||||
|  | ||||
|     animateSwitch(animationDirection) { | ||||
|         this.remove_all_transitions(); | ||||
|         this._grid.remove_all_transitions(); | ||||
| @@ -307,14 +342,37 @@ var AllView = GObject.registerClass({ | ||||
|             use_pagination: true, | ||||
|         }); | ||||
|  | ||||
|         this._grid._delegate = this; | ||||
|  | ||||
|         this._stack = new St.Widget({ | ||||
|             layout_manager: new Clutter.BinLayout(), | ||||
|             x_expand: true, | ||||
|             y_expand: true, | ||||
|         }); | ||||
|         this.add_actor(this._stack); | ||||
|  | ||||
|         let box = new St.BoxLayout({ | ||||
|             vertical: true, | ||||
|             y_align: Clutter.ActorAlign.START, | ||||
|         }); | ||||
|         box.add_child(this._grid); | ||||
|  | ||||
|         this._scrollView = new St.ScrollView({ | ||||
|             style_class: 'all-apps', | ||||
|             x_expand: true, | ||||
|             y_expand: true, | ||||
|             reactive: true, | ||||
|         }); | ||||
|         this.add_actor(this._scrollView); | ||||
|         this._grid._delegate = this; | ||||
|         this._scrollView.add_actor(box); | ||||
|         this._stack.add_actor(this._scrollView); | ||||
|  | ||||
|         this._eventBlocker = new St.Widget({ | ||||
|             x_expand: true, | ||||
|             y_expand: true, | ||||
|             reactive: true, | ||||
|             visible: false, | ||||
|         }); | ||||
|         this._stack.add_actor(this._eventBlocker); | ||||
|  | ||||
|         this._scrollView.set_policy(St.PolicyType.NEVER, | ||||
|                                     St.PolicyType.EXTERNAL); | ||||
| @@ -335,24 +393,7 @@ var AllView = GObject.registerClass({ | ||||
|  | ||||
|         this._folderIcons = []; | ||||
|  | ||||
|         this._stack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); | ||||
|         let box = new St.BoxLayout({ | ||||
|             vertical: true, | ||||
|             y_align: Clutter.ActorAlign.START, | ||||
|         }); | ||||
|  | ||||
|         this._grid.currentPage = 0; | ||||
|         this._stack.add_actor(this._grid); | ||||
|         this._eventBlocker = new St.Widget({ | ||||
|             x_expand: true, | ||||
|             y_expand: true, | ||||
|             reactive: true, | ||||
|             visible: false, | ||||
|         }); | ||||
|         this._stack.add_actor(this._eventBlocker); | ||||
|  | ||||
|         box.add_actor(this._stack); | ||||
|         this._scrollView.add_actor(box); | ||||
|  | ||||
|         this._scrollView.connect('scroll-event', this._onScroll.bind(this)); | ||||
|  | ||||
| @@ -392,10 +433,12 @@ var AllView = GObject.registerClass({ | ||||
|         this._redisplayWorkId = Main.initializeDeferredWork(this, this._redisplay.bind(this)); | ||||
|  | ||||
|         Shell.AppSystem.get_default().connect('installed-changed', () => { | ||||
|             this._viewIsReady = false; | ||||
|             Main.queueDeferredWork(this._redisplayWorkId); | ||||
|         }); | ||||
|         this._folderSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders' }); | ||||
|         this._folderSettings.connect('changed::folder-children', () => { | ||||
|             this._viewIsReady = false; | ||||
|             Main.queueDeferredWork(this._redisplayWorkId); | ||||
|         }); | ||||
|  | ||||
| @@ -431,6 +474,10 @@ var AllView = GObject.registerClass({ | ||||
|  | ||||
|     _redisplay() { | ||||
|         super._redisplay(); | ||||
|  | ||||
|         this._folderIcons.forEach(icon => { | ||||
|             icon.view._redisplay(); | ||||
|         }); | ||||
|         this._refilterApps(); | ||||
|     } | ||||
|  | ||||
| @@ -481,7 +528,7 @@ var AllView = GObject.registerClass({ | ||||
|             } catch (e) { | ||||
|                 return false; | ||||
|             } | ||||
|             return appInfo.should_show(); | ||||
|             return this._parentalControlsManager.shouldShowApp(appInfo); | ||||
|         }); | ||||
|  | ||||
|         let apps = this._appInfoList.map(app => app.get_id()); | ||||
| @@ -591,7 +638,7 @@ var AllView = GObject.registerClass({ | ||||
|  | ||||
|         this._grid.currentPage = pageNumber; | ||||
|  | ||||
|         // Tween the change between pages. | ||||
|         // Animate the change between pages. | ||||
|         this._adjustment.ease(this._grid.getPageY(this._grid.currentPage), { | ||||
|             mode: Clutter.AnimationMode.EASE_OUT_CUBIC, | ||||
|             duration: animate ? PAGE_SWITCH_TIME : 0, | ||||
| @@ -699,8 +746,6 @@ var AllView = GObject.registerClass({ | ||||
|  | ||||
|             // Toggle search entry | ||||
|             Main.overview.searchEntry.reactive = !isOpen; | ||||
|             Main.overview.searchEntry.clutter_text.reactive = !isOpen; | ||||
|             Main.overview.searchEntry.clutter_text.editable = !isOpen; | ||||
|  | ||||
|             this._displayingPopup = isOpen; | ||||
|         }); | ||||
| @@ -973,7 +1018,7 @@ class FrequentView extends BaseAppView { | ||||
|         let favoritesWritable = global.settings.is_writable('favorite-apps'); | ||||
|  | ||||
|         for (let i = 0; i < mostUsed.length; i++) { | ||||
|             if (!mostUsed[i].get_app_info().should_show()) | ||||
|             if (!this._parentalControlsManager.shouldShowApp(mostUsed[i].get_app_info())) | ||||
|                 continue; | ||||
|             let appIcon = this._items.get(mostUsed[i].get_id()); | ||||
|             if (!appIcon) { | ||||
| @@ -1219,6 +1264,8 @@ var AppSearchProvider = class AppSearchProvider { | ||||
|         this.canLaunchSearch = false; | ||||
|  | ||||
|         this._systemActions = new SystemActions.getDefault(); | ||||
|  | ||||
|         this._parentalControlsManager = ParentalControlsManager.getDefault(); | ||||
|     } | ||||
|  | ||||
|     getResultMetas(apps, callback) { | ||||
| @@ -1253,14 +1300,27 @@ var AppSearchProvider = class AppSearchProvider { | ||||
|     } | ||||
|  | ||||
|     getInitialResultSet(terms, callback, _cancellable) { | ||||
|         // Defer until the parental controls manager is initialised, so the | ||||
|         // results can be filtered correctly. | ||||
|         if (!this._parentalControlsManager.initialized) { | ||||
|             let initializedId = this._parentalControlsManager.connect('app-filter-changed', () => { | ||||
|                 if (this._parentalControlsManager.initialized) { | ||||
|                     this._parentalControlsManager.disconnect(initializedId); | ||||
|                     this.getInitialResultSet(terms, callback, _cancellable); | ||||
|                 } | ||||
|             }); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         let query = terms.join(' '); | ||||
|         let groups = Shell.AppSystem.search(query); | ||||
|         let usage = Shell.AppUsage.get_default(); | ||||
|         let results = []; | ||||
|  | ||||
|         groups.forEach(group => { | ||||
|             group = group.filter(appID => { | ||||
|                 let app = Gio.DesktopAppInfo.new(appID); | ||||
|                 return app && app.should_show(); | ||||
|                 const app = this._appSys.lookup_app(appID); | ||||
|                 return app && this._parentalControlsManager.shouldShowApp(app.app_info); | ||||
|             }); | ||||
|             results = results.concat(group.sort( | ||||
|                 (a, b) => usage.compare(a, b) | ||||
| @@ -1308,7 +1368,7 @@ class FolderView extends BaseAppView { | ||||
|             x_expand: true, | ||||
|             y_expand: true, | ||||
|         }); | ||||
|         this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC); | ||||
|         this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.EXTERNAL); | ||||
|         this.add_actor(this._scrollView); | ||||
|  | ||||
|         let scrollableContainer = new St.BoxLayout({ | ||||
| @@ -1324,7 +1384,6 @@ class FolderView extends BaseAppView { | ||||
|         action.connect('pan', this._onPan.bind(this)); | ||||
|         this._scrollView.add_action(action); | ||||
|  | ||||
|         this._folder.connect('changed', this._redisplay.bind(this)); | ||||
|         this._redisplay(); | ||||
|     } | ||||
|  | ||||
| @@ -1346,12 +1405,12 @@ class FolderView extends BaseAppView { | ||||
|         }); | ||||
|         layout.hookup_style(icon); | ||||
|         let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size); | ||||
|         let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor; | ||||
|  | ||||
|         let numItems = this._orderedItems.length; | ||||
|         let rtl = icon.get_text_direction() == Clutter.TextDirection.RTL; | ||||
|         for (let i = 0; i < 4; i++) { | ||||
|             let bin = new St.Bin({ width: subSize * scale, height: subSize * scale }); | ||||
|             const style = 'width: %dpx; height: %dpx;'.format(subSize, subSize); | ||||
|             let bin = new St.Bin({ style }); | ||||
|             if (i < numItems) | ||||
|                 bin.child = this._orderedItems[i].app.create_icon_texture(subSize); | ||||
|             layout.attach(bin, rtl ? (i + 1) % 2 : i % 2, Math.floor(i / 2), 1, 1); | ||||
| @@ -1400,7 +1459,7 @@ class FolderView extends BaseAppView { | ||||
|             if (!app) | ||||
|                 return; | ||||
|  | ||||
|             if (!app.get_app_info().should_show()) | ||||
|             if (!this._parentalControlsManager.shouldShowApp(app.get_app_info())) | ||||
|                 return; | ||||
|  | ||||
|             if (apps.some(appIcon => appIcon.id == appId)) | ||||
| @@ -1429,6 +1488,22 @@ class FolderView extends BaseAppView { | ||||
|         return apps; | ||||
|     } | ||||
|  | ||||
|     addApp(app) { | ||||
|         let folderApps = this._folder.get_strv('apps'); | ||||
|         folderApps.push(app.id); | ||||
|  | ||||
|         this._folder.set_strv('apps', folderApps); | ||||
|  | ||||
|         // Also remove from 'excluded-apps' if the app id is listed | ||||
|         // there. This is only possible on categories-based folders. | ||||
|         let excludedApps = this._folder.get_strv('excluded-apps'); | ||||
|         let index = excludedApps.indexOf(app.id); | ||||
|         if (index >= 0) { | ||||
|             excludedApps.splice(index, 1); | ||||
|             this._folder.set_strv('excluded-apps', excludedApps); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     removeApp(app) { | ||||
|         let folderApps = this._folder.get_strv('apps'); | ||||
|         let index = folderApps.indexOf(app.id); | ||||
| @@ -1459,8 +1534,6 @@ class FolderView extends BaseAppView { | ||||
|         } else { | ||||
|             this._folder.set_strv('apps', folderApps); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
| }); | ||||
|  | ||||
| @@ -1494,26 +1567,26 @@ var FolderIcon = GObject.registerClass({ | ||||
|  | ||||
|         this.view = new FolderView(this._folder, id, parentView); | ||||
|  | ||||
|         this._itemDragBeginId = Main.overview.connect( | ||||
|             'item-drag-begin', this._onDragBegin.bind(this)); | ||||
|         this._itemDragEndId = Main.overview.connect( | ||||
|             'item-drag-end', this._onDragEnd.bind(this)); | ||||
|         this._iconIsHovering = false; | ||||
|  | ||||
|         this.connect('destroy', this._onDestroy.bind(this)); | ||||
|  | ||||
|         this._folder.connect('changed', this._redisplay.bind(this)); | ||||
|         this._redisplay(); | ||||
|         this._folderChangedId = this._folder.connect( | ||||
|             'changed', this._sync.bind(this)); | ||||
|         this._sync(); | ||||
|     } | ||||
|  | ||||
|     _onDestroy() { | ||||
|         Main.overview.disconnect(this._itemDragBeginId); | ||||
|         Main.overview.disconnect(this._itemDragEndId); | ||||
|         if (this._dragMonitor) { | ||||
|             DND.removeDragMonitor(this._dragMonitor); | ||||
|             this._dragMonitor = null; | ||||
|         } | ||||
|  | ||||
|         this.view.destroy(); | ||||
|  | ||||
|         if (this._spaceReadySignalId) { | ||||
|             this._parentView.disconnect(this._spaceReadySignalId); | ||||
|             this._spaceReadySignalId = 0; | ||||
|         if (this._folderChangedId) { | ||||
|             this._folder.disconnect(this._folderChangedId); | ||||
|             delete this._folderChangedId; | ||||
|         } | ||||
|  | ||||
|         if (this._dialog) | ||||
| @@ -1541,29 +1614,32 @@ var FolderIcon = GObject.registerClass({ | ||||
|         return this.view.getAllItems().map(item => item.id); | ||||
|     } | ||||
|  | ||||
|     _onDragBegin() { | ||||
|         this._dragMonitor = { | ||||
|             dragMotion: this._onDragMotion.bind(this), | ||||
|         }; | ||||
|         DND.addDragMonitor(this._dragMonitor); | ||||
|     _setHoveringByDnd(hovering) { | ||||
|         if (this._iconIsHovering == hovering) | ||||
|             return; | ||||
|  | ||||
|         this._iconIsHovering = hovering; | ||||
|  | ||||
|         if (hovering) { | ||||
|             this._dragMonitor = { | ||||
|                 dragMotion: this._onDragMotion.bind(this), | ||||
|             }; | ||||
|             DND.addDragMonitor(this._dragMonitor); | ||||
|             this.add_style_pseudo_class('drop'); | ||||
|         } else { | ||||
|             DND.removeDragMonitor(this._dragMonitor); | ||||
|             this.remove_style_pseudo_class('drop'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _onDragMotion(dragEvent) { | ||||
|         let target = dragEvent.targetActor; | ||||
|  | ||||
|         if (!this.contains(target) || !this._canAccept(dragEvent.source)) | ||||
|             this.remove_style_pseudo_class('drop'); | ||||
|         else | ||||
|             this.add_style_pseudo_class('drop'); | ||||
|         if (!this.contains(dragEvent.targetActor) || | ||||
|             !this._canAccept(dragEvent.source)) | ||||
|             this._setHoveringByDnd(false); | ||||
|  | ||||
|         return DND.DragMotionResult.CONTINUE; | ||||
|     } | ||||
|  | ||||
|     _onDragEnd() { | ||||
|         this.remove_style_pseudo_class('drop'); | ||||
|         DND.removeDragMonitor(this._dragMonitor); | ||||
|     } | ||||
|  | ||||
|     _canAccept(source) { | ||||
|         if (!(source instanceof AppIcon)) | ||||
|             return false; | ||||
| @@ -1582,27 +1658,18 @@ var FolderIcon = GObject.registerClass({ | ||||
|         if (!this._canAccept(source)) | ||||
|             return DND.DragMotionResult.NO_DROP; | ||||
|  | ||||
|         this._setHoveringByDnd(true); | ||||
|  | ||||
|         return DND.DragMotionResult.MOVE_DROP; | ||||
|     } | ||||
|  | ||||
|     acceptDrop(source) { | ||||
|         this._setHoveringByDnd(false); | ||||
|  | ||||
|         if (!this._canAccept(source)) | ||||
|             return false; | ||||
|  | ||||
|         let app = source.app; | ||||
|         let folderApps = this._folder.get_strv('apps'); | ||||
|         folderApps.push(app.id); | ||||
|  | ||||
|         this._folder.set_strv('apps', folderApps); | ||||
|  | ||||
|         // Also remove from 'excluded-apps' if the app id is listed | ||||
|         // there. This is only possible on categories-based folders. | ||||
|         let excludedApps = this._folder.get_strv('excluded-apps'); | ||||
|         let index = excludedApps.indexOf(app.id); | ||||
|         if (index >= 0) { | ||||
|             excludedApps.splice(index, 1); | ||||
|             this._folder.set_strv('excluded-apps', excludedApps); | ||||
|         } | ||||
|         this.view.addApp(source.app); | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
| @@ -1617,11 +1684,11 @@ var FolderIcon = GObject.registerClass({ | ||||
|         this.emit('name-changed'); | ||||
|     } | ||||
|  | ||||
|     _redisplay() { | ||||
|     _sync() { | ||||
|         this.emit('apps-changed'); | ||||
|         this._updateName(); | ||||
|         this.visible = this.view.getAllItems().length > 0; | ||||
|         this.icon.update(); | ||||
|         this.emit('apps-changed'); | ||||
|     } | ||||
|  | ||||
|     _createIcon(iconSize) { | ||||
| @@ -1902,6 +1969,7 @@ var AppFolderDialog = GObject.registerClass({ | ||||
|  | ||||
|     vfunc_allocate(box, flags) { | ||||
|         let contentBox = this.get_theme_node().get_content_box(box); | ||||
|         contentBox = this._viewBox.get_theme_node().get_content_box(contentBox); | ||||
|  | ||||
|         let [, entryBoxHeight] = this._entryBox.get_size(); | ||||
|         let spacing = this._viewBox.layout_manager.spacing; | ||||
| @@ -1910,6 +1978,8 @@ var AppFolderDialog = GObject.registerClass({ | ||||
|             contentBox.get_width(), | ||||
|             contentBox.get_height() - entryBoxHeight - spacing); | ||||
|  | ||||
|         this._view._grid.topPadding = 0; | ||||
|  | ||||
|         super.vfunc_allocate(box, flags); | ||||
|  | ||||
|         // We can only start zooming after receiving an allocation | ||||
| @@ -2025,7 +2095,6 @@ var AppIcon = GObject.registerClass({ | ||||
|  | ||||
|         this._delegate = this; | ||||
|  | ||||
|         this._hasDndHover = false; | ||||
|         this._folderPreviewId = 0; | ||||
|  | ||||
|         // Get the isDraggable property without passing it on to the BaseIcon: | ||||
| @@ -2074,11 +2143,7 @@ var AppIcon = GObject.registerClass({ | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         this._dragMonitor = null; | ||||
|         this._itemDragBeginId = Main.overview.connect( | ||||
|             'item-drag-begin', this._onDragBegin.bind(this)); | ||||
|         this._itemDragEndId = Main.overview.connect( | ||||
|             'item-drag-end', this._onDragEnd.bind(this)); | ||||
|         this._otherIconIsHovering = false; | ||||
|  | ||||
|         this._menuTimeoutId = 0; | ||||
|         this._stateChangedId = this.app.connect('notify::state', () => { | ||||
| @@ -2090,9 +2155,6 @@ var AppIcon = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     _onDestroy() { | ||||
|         Main.overview.disconnect(this._itemDragBeginId); | ||||
|         Main.overview.disconnect(this._itemDragEndId); | ||||
|  | ||||
|         if (this._folderPreviewId > 0) { | ||||
|             GLib.source_remove(this._folderPreviewId); | ||||
|             this._folderPreviewId = 0; | ||||
| @@ -2143,7 +2205,7 @@ var AppIcon = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     vfunc_leave_event(crossingEvent) { | ||||
|         let ret = super.vfunc_leave_event(crossingEvent); | ||||
|         const ret = super.vfunc_leave_event(crossingEvent); | ||||
|  | ||||
|         this.fake_release(); | ||||
|         this._removeMenuTimeout(); | ||||
| @@ -2151,22 +2213,22 @@ var AppIcon = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     vfunc_button_press_event(buttonEvent) { | ||||
|         super.vfunc_button_press_event(buttonEvent); | ||||
|         const ret = super.vfunc_button_press_event(buttonEvent); | ||||
|         if (buttonEvent.button == 1) { | ||||
|             this._setPopupTimeout(); | ||||
|         } else if (buttonEvent.button == 3) { | ||||
|             this.popupMenu(); | ||||
|             return Clutter.EVENT_STOP; | ||||
|         } | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|         return ret; | ||||
|     } | ||||
|  | ||||
|     vfunc_touch_event(touchEvent) { | ||||
|         super.vfunc_touch_event(touchEvent); | ||||
|         const ret = super.vfunc_touch_event(touchEvent); | ||||
|         if (touchEvent.type == Clutter.EventType.TOUCH_BEGIN) | ||||
|             this._setPopupTimeout(); | ||||
|  | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|         return ret; | ||||
|     } | ||||
|  | ||||
|     vfunc_clicked(button) { | ||||
| @@ -2339,7 +2401,17 @@ var AppIcon = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     _setHoveringByDnd(hovering) { | ||||
|         if (this._otherIconIsHovering == hovering) | ||||
|             return; | ||||
|  | ||||
|         this._otherIconIsHovering = hovering; | ||||
|  | ||||
|         if (hovering) { | ||||
|             this._dragMonitor = { | ||||
|                 dragMotion: this._onDragMotion.bind(this), | ||||
|             }; | ||||
|             DND.addDragMonitor(this._dragMonitor); | ||||
|  | ||||
|             if (this._folderPreviewId > 0) | ||||
|                 return; | ||||
|  | ||||
| @@ -2351,6 +2423,8 @@ var AppIcon = GObject.registerClass({ | ||||
|                     return GLib.SOURCE_REMOVE; | ||||
|                 }); | ||||
|         } else { | ||||
|             DND.removeDragMonitor(this._dragMonitor); | ||||
|  | ||||
|             if (this._folderPreviewId > 0) { | ||||
|                 GLib.source_remove(this._folderPreviewId); | ||||
|                 this._folderPreviewId = 0; | ||||
| @@ -2360,32 +2434,13 @@ var AppIcon = GObject.registerClass({ | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _onDragBegin() { | ||||
|         this._dragMonitor = { | ||||
|             dragMotion: this._onDragMotion.bind(this), | ||||
|         }; | ||||
|         DND.addDragMonitor(this._dragMonitor); | ||||
|     } | ||||
|  | ||||
|     _onDragMotion(dragEvent) { | ||||
|         let target = dragEvent.targetActor; | ||||
|         let isHovering = target == this || this.contains(target); | ||||
|         let canDrop = this._canAccept(dragEvent.source); | ||||
|         let hasDndHover = isHovering && canDrop; | ||||
|  | ||||
|         if (this._hasDndHover != hasDndHover) { | ||||
|             this._setHoveringByDnd(hasDndHover); | ||||
|             this._hasDndHover = hasDndHover; | ||||
|         } | ||||
|         if (!this.contains(dragEvent.targetActor)) | ||||
|             this._setHoveringByDnd(false); | ||||
|  | ||||
|         return DND.DragMotionResult.CONTINUE; | ||||
|     } | ||||
|  | ||||
|     _onDragEnd() { | ||||
|         this.remove_style_pseudo_class('drop'); | ||||
|         DND.removeDragMonitor(this._dragMonitor); | ||||
|     } | ||||
|  | ||||
|     handleDragOver(source) { | ||||
|         if (source == this) | ||||
|             return DND.DragMotionResult.NO_DROP; | ||||
| @@ -2393,6 +2448,8 @@ var AppIcon = GObject.registerClass({ | ||||
|         if (!this._canAccept(source)) | ||||
|             return DND.DragMotionResult.CONTINUE; | ||||
|  | ||||
|         this._setHoveringByDnd(true); | ||||
|  | ||||
|         return DND.DragMotionResult.MOVE_DROP; | ||||
|     } | ||||
|  | ||||
| @@ -2437,7 +2494,7 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu { | ||||
|         Main.uiGroup.add_actor(this.actor); | ||||
|     } | ||||
|  | ||||
|     _redisplay() { | ||||
|     _rebuildMenu() { | ||||
|         this.removeAll(); | ||||
|  | ||||
|         let windows = this._source.app.get_windows().filter( | ||||
| @@ -2523,19 +2580,18 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu { | ||||
|             if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) { | ||||
|                 this._appendSeparator(); | ||||
|                 let item = this._appendMenuItem(_("Show Details")); | ||||
|                 item.connect('activate', () => { | ||||
|                 item.connect('activate', async () => { | ||||
|                     let id = this._source.app.get_id(); | ||||
|                     let args = GLib.Variant.new('(ss)', [id, '']); | ||||
|                     Gio.DBus.get(Gio.BusType.SESSION, null, (o, res) => { | ||||
|                         let bus = Gio.DBus.get_finish(res); | ||||
|                         bus.call('org.gnome.Software', | ||||
|                                  '/org/gnome/Software', | ||||
|                                  'org.gtk.Actions', 'Activate', | ||||
|                                  GLib.Variant.new('(sava{sv})', | ||||
|                                                   ['details', [args], null]), | ||||
|                                  null, 0, -1, null, null); | ||||
|                         Main.overview.hide(); | ||||
|                     }); | ||||
|                     const bus = await Gio.DBus.get(Gio.BusType.SESSION, null); | ||||
|                     bus.call( | ||||
|                         'org.gnome.Software', | ||||
|                         '/org/gnome/Software', | ||||
|                         'org.gtk.Actions', 'Activate', | ||||
|                         new GLib.Variant.new( | ||||
|                             '(sava{sv})', ['details', [args], null]), | ||||
|                         null, 0, -1, null); | ||||
|                     Main.overview.hide(); | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
| @@ -2554,7 +2610,7 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu { | ||||
|     } | ||||
|  | ||||
|     popup(_activatingButton) { | ||||
|         this._redisplay(); | ||||
|         this._rebuildMenu(); | ||||
|         this.open(); | ||||
|     } | ||||
| }; | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
| /* exported getAppFavorites */ | ||||
|  | ||||
| const Shell = imports.gi.Shell; | ||||
| const ParentalControlsManager = imports.misc.parentalControlsManager; | ||||
| const Signals = imports.signals; | ||||
|  | ||||
| const Main = imports.ui.main; | ||||
| @@ -64,6 +65,13 @@ const RENAMED_DESKTOP_IDS = { | ||||
|  | ||||
| class AppFavorites { | ||||
|     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._favorites = {}; | ||||
|         global.settings.connect('changed::%s'.format(this.FAVORITE_APPS_KEY), this._onFavsChanged.bind(this)); | ||||
| @@ -95,7 +103,7 @@ class AppFavorites { | ||||
|             global.settings.set_strv(this.FAVORITE_APPS_KEY, ids); | ||||
|  | ||||
|         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 = {}; | ||||
|         for (let i = 0; i < apps.length; i++) { | ||||
|             let app = apps[i]; | ||||
| @@ -134,6 +142,9 @@ class AppFavorites { | ||||
|         if (!app) | ||||
|             return false; | ||||
|  | ||||
|         if (!this._parentalControlsManager.shouldShowApp(app.app_info)) | ||||
|             return false; | ||||
|  | ||||
|         let ids = this._getIds(); | ||||
|         if (pos == -1) | ||||
|             ids.push(appId); | ||||
|   | ||||
| @@ -199,46 +199,52 @@ class DBusEventSource extends EventSourceBase { | ||||
|  | ||||
|         this._initialized = false; | ||||
|         this._dbusProxy = new CalendarServer(); | ||||
|         this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, (object, result) => { | ||||
|             let loaded = false; | ||||
|         this._initProxy(); | ||||
|     } | ||||
|  | ||||
|             try { | ||||
|                 this._dbusProxy.init_finish(result); | ||||
|                 loaded = true; | ||||
|             } catch (e) { | ||||
|                 if (e.matches(Gio.DBusError, Gio.DBusError.TIMED_OUT)) { | ||||
|                     // Ignore timeouts and install signals as normal, because with high | ||||
|                     // probability the service will appear later on, and we will get a | ||||
|                     // NameOwnerChanged which will finish loading | ||||
|                     // | ||||
|                     // (But still _initialized to false, because the proxy does not know | ||||
|                     // about the HasCalendars property and would cause an exception trying | ||||
|                     // to read it) | ||||
|                 } else { | ||||
|                     log('Error loading calendars: %s'.format(e.message)); | ||||
|                     return; | ||||
|                 } | ||||
|     async _initProxy() { | ||||
|         let loaded = false; | ||||
|  | ||||
|         try { | ||||
|             await this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null); | ||||
|             loaded = true; | ||||
|         } catch (e) { | ||||
|             // Ignore timeouts and install signals as normal, because with high | ||||
|             // probability the service will appear later on, and we will get a | ||||
|             // NameOwnerChanged which will finish loading | ||||
|             // | ||||
|             // (But still _initialized to false, because the proxy does not know | ||||
|             // about the HasCalendars property and would cause an exception trying | ||||
|             // to read it) | ||||
|             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', () => { | ||||
|                 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._dbusProxy.connect('notify::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(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     destroy() { | ||||
| @@ -257,7 +263,7 @@ class DBusEventSource extends EventSourceBase { | ||||
|     } | ||||
|  | ||||
|     _resetCache() { | ||||
|         this._events = []; | ||||
|         this._events = new Map(); | ||||
|         this._lastRequestBegin = null; | ||||
|         this._lastRequestEnd = null; | ||||
|     } | ||||
| @@ -273,28 +279,47 @@ class DBusEventSource extends EventSourceBase { | ||||
|         this.emit('changed'); | ||||
|     } | ||||
|  | ||||
|     _onChanged() { | ||||
|         this._loadEvents(false); | ||||
|     _onEventsAddedOrUpdated(dbusProxy, nameOwner, argArray) { | ||||
|         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) { | ||||
|         let newEvents = []; | ||||
|         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()); | ||||
|     _onEventsRemoved(dbusProxy, nameOwner, argArray) { | ||||
|         const [ids = []] = argArray; | ||||
|  | ||||
|         this._events = newEvents; | ||||
|         this._isLoading = false; | ||||
|         this.emit('changed'); | ||||
|         let changed = false; | ||||
|         for (const id of ids) | ||||
|             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) { | ||||
| @@ -303,33 +328,38 @@ class DBusEventSource extends EventSourceBase { | ||||
|             return; | ||||
|  | ||||
|         if (this._curRequestBegin && this._curRequestEnd) { | ||||
|             this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000, | ||||
|                                             this._curRequestEnd.getTime() / 1000, | ||||
|                                             forceReload, | ||||
|                                             this._onEventsReceived.bind(this), | ||||
|                                             Gio.DBusCallFlags.NONE); | ||||
|             if (forceReload) { | ||||
|                 this._events.clear(); | ||||
|                 this.emit('changed'); | ||||
|             } | ||||
|             this._dbusProxy.SetTimeRangeRemote( | ||||
|                 this._curRequestBegin.getTime() / 1000, | ||||
|                 this._curRequestEnd.getTime() / 1000, | ||||
|                 forceReload, | ||||
|                 Gio.DBusCallFlags.NONE); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     requestRange(begin, end) { | ||||
|         if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) { | ||||
|             this._isLoading = true; | ||||
|             this._lastRequestBegin = begin; | ||||
|             this._lastRequestEnd = end; | ||||
|             this._curRequestBegin = begin; | ||||
|             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) { | ||||
|         let result = []; | ||||
|         for (let n = 0; n < this._events.length; n++) { | ||||
|             let event = this._events[n]; | ||||
|         let result = [...this._getFilteredEvents(begin, end)]; | ||||
|  | ||||
|             if (_dateIntervalsOverlap(event.date, event.end, begin, end)) | ||||
|                 result.push(event); | ||||
|         } | ||||
|         result.sort((event1, event2) => { | ||||
|             // sort events by end time on ending day | ||||
|             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 dayEnd = _getEndOfDay(day); | ||||
|  | ||||
|         let events = this.getEvents(dayBegin, dayEnd); | ||||
|  | ||||
|         if (events.length == 0) | ||||
|             return false; | ||||
|  | ||||
|         return true; | ||||
|         const { done } = this._getFilteredEvents(dayBegin, dayEnd).next(); | ||||
|         return !done; | ||||
|     } | ||||
| }); | ||||
|  | ||||
| @@ -700,12 +726,11 @@ var Calendar = GObject.registerClass({ | ||||
| var EventMessage = GObject.registerClass( | ||||
| class EventMessage extends MessageList.Message { | ||||
|     _init(event, date) { | ||||
|         super._init('', event.summary); | ||||
|         super._init('', ''); | ||||
|  | ||||
|         this._event = event; | ||||
|         this._date = date; | ||||
|  | ||||
|         this.setTitle(this._formatEventTime()); | ||||
|         this.update(event); | ||||
|  | ||||
|         this._icon = new St.Icon({ icon_name: 'x-office-calendar-symbolic' }); | ||||
|         this.setIcon(this._icon); | ||||
| @@ -717,6 +742,13 @@ class EventMessage extends MessageList.Message { | ||||
|         super.vfunc_style_changed(); | ||||
|     } | ||||
|  | ||||
|     update(event) { | ||||
|         this._event = event; | ||||
|  | ||||
|         this.setTitle(this._formatEventTime()); | ||||
|         this.setBody(event.summary); | ||||
|     } | ||||
|  | ||||
|     _formatEventTime() { | ||||
|         let periodBegin = _getBeginningOfDay(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('key-focus-in', this._onKeyFocusIn.bind(this)); | ||||
|  | ||||
|         Shell.AppSystem.get_default().connect('installed-changed', | ||||
|                                               this._appInstalledChanged.bind(this)); | ||||
|         this._appSys = Shell.AppSystem.get_default(); | ||||
|         this._appSys.connect('installed-changed', | ||||
|             this._appInstalledChanged.bind(this)); | ||||
|         this._appInstalledChanged(); | ||||
|     } | ||||
|  | ||||
| @@ -873,7 +906,7 @@ class EventsSection extends MessageList.MessageListSection { | ||||
|     } | ||||
|  | ||||
|     _reloadEvents() { | ||||
|         if (this._eventSource.isLoading) | ||||
|         if (this._eventSource.isLoading || this._reloading) | ||||
|             return; | ||||
|  | ||||
|         this._reloading = true; | ||||
| @@ -899,6 +932,7 @@ class EventsSection extends MessageList.MessageListSection { | ||||
|                 this._messageById.set(event.id, message); | ||||
|                 this.addMessage(message, false); | ||||
|             } else { | ||||
|                 message.update(event); | ||||
|                 this.moveMessage(message, i, false); | ||||
|             } | ||||
|         } | ||||
| @@ -931,10 +965,13 @@ class EventsSection extends MessageList.MessageListSection { | ||||
|         Main.overview.hide(); | ||||
|         Main.panel.closeCalendar(); | ||||
|  | ||||
|         let app = this._getCalendarApp(); | ||||
|         if (app.get_id() == 'evolution.desktop') | ||||
|             app = Gio.DesktopAppInfo.new('evolution-calendar.desktop'); | ||||
|         app.launch([], global.create_app_launch_context(0, -1)); | ||||
|         let appInfo = this._getCalendarApp(); | ||||
|         if (appInfo.get_id() === 'org.gnome.Evolution.desktop') { | ||||
|             let app = this._appSys.lookup_app('evolution-calendar.desktop'); | ||||
|             if (app) | ||||
|                 appInfo = app.app_info; | ||||
|         } | ||||
|         appInfo.launch([], global.create_app_launch_context(0, -1)); | ||||
|     } | ||||
|  | ||||
|     setDate(date) { | ||||
| @@ -1149,17 +1186,22 @@ class CalendarMessageList extends St.Widget { | ||||
|         let hbox = new St.BoxLayout({ style_class: 'message-list-controls' }); | ||||
|         box.add_child(hbox); | ||||
|  | ||||
|         hbox.add_child(new St.Label({ | ||||
|         const dndLabel = new St.Label({ | ||||
|             text: _('Do Not Disturb'), | ||||
|             y_align: Clutter.ActorAlign.CENTER, | ||||
|         })); | ||||
|         }); | ||||
|         hbox.add_child(dndLabel); | ||||
|  | ||||
|         this._dndSwitch = new DoNotDisturbSwitch(); | ||||
|         this._dndButton = new St.Button({ | ||||
|             can_focus: true, | ||||
|             toggle_mode: true, | ||||
|             child: this._dndSwitch, | ||||
|             label_actor: dndLabel, | ||||
|         }); | ||||
|         this._dndButton.connect('clicked', () => this._dndSwitch.toggle()); | ||||
|         this._dndButton.bind_property('checked', | ||||
|             this._dndSwitch, 'state', | ||||
|             GObject.BindingFlags.BIDIRECTIONAL | GObject.BindingFlags.SYNC_CREATE); | ||||
|         hbox.add_child(this._dndButton); | ||||
|  | ||||
|         this._clearButton = new St.Button({ | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /* exported CheckBox */ | ||||
| const { Clutter, GObject, Pango, St } = imports.gi; | ||||
| const { Atk, Clutter, GObject, Pango, St } = imports.gi; | ||||
|  | ||||
| var CheckBox = GObject.registerClass( | ||||
| class CheckBox extends St.Button { | ||||
| @@ -15,6 +15,7 @@ class CheckBox extends St.Button { | ||||
|             toggle_mode: true, | ||||
|             can_focus: true, | ||||
|         }); | ||||
|         this.set_accessible_role(Atk.Role.CHECK_BOX); | ||||
|  | ||||
|         this._box = new St.Bin({ y_align: Clutter.ActorAlign.START }); | ||||
|         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.clutter_text.set_line_wrap(true); | ||||
|         this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE); | ||||
|         this.set_label_actor(this._label); | ||||
|         container.add_actor(this._label); | ||||
|  | ||||
|         if (label) | ||||
|   | ||||
| @@ -188,6 +188,8 @@ var CloseDialog = GObject.registerClass({ | ||||
|         global.stage.disconnect(this._keyFocusChangedId); | ||||
|         this._keyFocusChangedId = 0; | ||||
|  | ||||
|         this._dialog._dialog.remove_all_transitions(); | ||||
|  | ||||
|         let dialog = this._dialog; | ||||
|         this._dialog = null; | ||||
|         this._removeWindowEffect(); | ||||
|   | ||||
| @@ -111,15 +111,11 @@ class KeyringDialog extends ModalDialog.ModalDialog { | ||||
|     } | ||||
|  | ||||
|     _updateSensitivity(sensitive) { | ||||
|         if (this._passwordEntry) { | ||||
|         if (this._passwordEntry) | ||||
|             this._passwordEntry.reactive = sensitive; | ||||
|             this._passwordEntry.clutter_text.editable = sensitive; | ||||
|         } | ||||
|  | ||||
|         if (this._confirmEntry) { | ||||
|         if (this._confirmEntry) | ||||
|             this._confirmEntry.reactive = sensitive; | ||||
|             this._confirmEntry.clutter_text.editable = sensitive; | ||||
|         } | ||||
|  | ||||
|         this._continueButton.can_focus = sensitive; | ||||
|         this._continueButton.reactive = sensitive; | ||||
|   | ||||
| @@ -4,13 +4,16 @@ | ||||
| const { Clutter, Gio, GLib, GObject, NM, Pango, Shell, St } = imports.gi; | ||||
| const Signals = imports.signals; | ||||
|  | ||||
| const Config = imports.misc.config; | ||||
| const Dialog = imports.ui.dialog; | ||||
| const Main = imports.ui.main; | ||||
| const MessageTray = imports.ui.messageTray; | ||||
| const ModalDialog = imports.ui.modalDialog; | ||||
| 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'; | ||||
|  | ||||
| var NetworkSecretDialog = GObject.registerClass( | ||||
| @@ -480,39 +483,37 @@ var VPNRequestHandler = class { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _readStdoutOldStyle() { | ||||
|         this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, (stream, result) => { | ||||
|             let [line, len_] = this._dataStdout.read_line_finish_utf8(result); | ||||
|     async _readStdoutOldStyle() { | ||||
|         const [line, len_] = | ||||
|             await this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null); | ||||
|  | ||||
|             if (line == null) { | ||||
|                 // end of file | ||||
|                 this._stdout.close(null); | ||||
|                 return; | ||||
|             } | ||||
|         if (line === null) { | ||||
|             // end of file | ||||
|             this._stdout.close(null); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|             this._vpnChildProcessLineOldStyle(line); | ||||
|         this._vpnChildProcessLineOldStyle(line); | ||||
|  | ||||
|             // try to read more! | ||||
|             this._readStdoutOldStyle(); | ||||
|         }); | ||||
|         // try to read more! | ||||
|         this._readStdoutOldStyle(); | ||||
|     } | ||||
|  | ||||
|     _readStdoutNewStyle() { | ||||
|         this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, (stream, result) => { | ||||
|             let cnt = this._dataStdout.fill_finish(result); | ||||
|     async _readStdoutNewStyle() { | ||||
|         const cnt = | ||||
|             await this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null); | ||||
|  | ||||
|             if (cnt == 0) { | ||||
|                 // end of file | ||||
|                 this._showNewStyleDialog(); | ||||
|         if (cnt === 0) { | ||||
|             // end of file | ||||
|             this._showNewStyleDialog(); | ||||
|  | ||||
|                 this._stdout.close(null); | ||||
|                 return; | ||||
|             } | ||||
|             this._stdout.close(null); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|             // Try to read more | ||||
|             this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size()); | ||||
|             this._readStdoutNewStyle(); | ||||
|         }); | ||||
|         // Try to read more | ||||
|         this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size()); | ||||
|         this._readStdoutNewStyle(); | ||||
|     } | ||||
|  | ||||
|     _showNewStyleDialog() { | ||||
| @@ -615,27 +616,21 @@ var NetworkAgent = class { | ||||
|         this._vpnRequests = { }; | ||||
|         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('cancel-request', this._cancelRequest.bind(this)); | ||||
|  | ||||
|         this._initialized = false; | ||||
|         this._native.init_async(GLib.PRIORITY_DEFAULT, null, (o, res) => { | ||||
|             try { | ||||
|                 this._native.init_finish(res); | ||||
|                 this._initialized = true; | ||||
|             } catch (e) { | ||||
|                 this._native = null; | ||||
|                 logError(e, 'error initializing the NetworkManager Agent'); | ||||
|             } | ||||
|         }); | ||||
|         this._initNative(); | ||||
|     } | ||||
|  | ||||
|     async _initNative() { | ||||
|         try { | ||||
|             await this._native.init_async(GLib.PRIORITY_DEFAULT, null); | ||||
|             this._initialized = true; | ||||
|         } catch (e) { | ||||
|             this._native = null; | ||||
|             logError(e, 'error initializing the NetworkManager Agent'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     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 serviceType = vpnSetting.service_type; | ||||
|  | ||||
|         this._buildVPNServiceCache(); | ||||
|  | ||||
|         let binary = this._vpnBinaries[serviceType]; | ||||
|         let binary = await this._findAuthBinary(serviceType); | ||||
|         if (!binary) { | ||||
|             log('Invalid VPN service type (cannot find authentication binary)'); | ||||
|  | ||||
| @@ -788,36 +781,30 @@ var NetworkAgent = class { | ||||
|         this._vpnRequests[requestId] = vpnRequest; | ||||
|     } | ||||
|  | ||||
|     _buildVPNServiceCache() { | ||||
|         if (this._vpnCacheBuilt) | ||||
|             return; | ||||
|     async _findAuthBinary(serviceType) { | ||||
|         let plugin; | ||||
|  | ||||
|         this._vpnCacheBuilt = true; | ||||
|         this._vpnBinaries = { }; | ||||
|         try { | ||||
|             plugin = await this._native.search_vpn_plugin(serviceType); | ||||
|         } catch (e) { | ||||
|             logError(e); | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         NM.VpnPluginInfo.list_load().forEach(plugin => { | ||||
|             let service = plugin.get_service(); | ||||
|             let fileName = plugin.get_auth_dialog(); | ||||
|             let supportsHints = plugin.supports_hints(); | ||||
|             let externalUIMode = false; | ||||
|         const fileName = plugin.get_auth_dialog(); | ||||
|         if (!GLib.file_test(fileName, GLib.FileTest.IS_EXECUTABLE)) { | ||||
|             log('VPN plugin at %s is not executable'.format(fileName)); | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|             let prop = plugin.lookup_property('GNOME', 'supports-external-ui-mode'); | ||||
|             if (prop) { | ||||
|                 prop = prop.trim().toLowerCase(); | ||||
|                 externalUIMode = ['true', 'yes', 'on', '1'].includes(prop); | ||||
|             } | ||||
|         const prop = plugin.lookup_property('GNOME', 'supports-external-ui-mode'); | ||||
|         const trimmedProp = prop ? prop.trim().toLowerCase() : ''; | ||||
|  | ||||
|             if (GLib.file_test(fileName, GLib.FileTest.IS_EXECUTABLE)) { | ||||
|                 let binary = { fileName, externalUIMode, supportsHints }; | ||||
|                 this._vpnBinaries[service] = binary; | ||||
|  | ||||
|                 plugin.get_aliases().forEach(alias => { | ||||
|                     this._vpnBinaries[alias] = binary; | ||||
|                 }); | ||||
|             } else { | ||||
|                 log('VPN plugin at %s is not executable'.format(fileName)); | ||||
|             } | ||||
|         }); | ||||
|         return { | ||||
|             fileName, | ||||
|             supportsHints: plugin.supports_hints(), | ||||
|             externalUIMode: ['true', 'yes', 'on', '1'].includes(trimmedProp), | ||||
|         }; | ||||
|     } | ||||
| }; | ||||
| var Component = NetworkAgent; | ||||
|   | ||||
| @@ -327,12 +327,16 @@ var AuthenticationDialog = GObject.registerClass({ | ||||
|         } | ||||
|  | ||||
|         let resetDialog = () => { | ||||
|             this._sessionRequestTimeoutId = 0; | ||||
|  | ||||
|             if (this.state != ModalDialog.State.OPENED) | ||||
|                 return; | ||||
|                 return GLib.SOURCE_REMOVE; | ||||
|  | ||||
|             this._passwordEntry.hide(); | ||||
|             this._cancelButton.grab_key_focus(); | ||||
|             this._okButton.reactive = false; | ||||
|  | ||||
|             return GLib.SOURCE_REMOVE; | ||||
|         }; | ||||
|  | ||||
|         if (delay) { | ||||
|   | ||||
| @@ -2,12 +2,19 @@ | ||||
| /* exported Component */ | ||||
|  | ||||
| const { Clutter, Gio, GLib, GObject, St } = imports.gi; | ||||
| const Lang = imports.lang; | ||||
|  | ||||
| var Tpl = null; | ||||
| var Tp = null; | ||||
| try { | ||||
|     ({ 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) { | ||||
|     log('Telepathy is not available, chat integration will be disabled.'); | ||||
| } | ||||
| @@ -40,36 +47,59 @@ var NotificationDirection = { | ||||
|     RECEIVED: 'chat-received', | ||||
| }; | ||||
|  | ||||
| function makeMessageFromTpMessage(tpMessage, direction) { | ||||
|     let [text, flags_] = tpMessage.to_text(); | ||||
| const ChatMessage = HAVE_TP ? GObject.registerClass({ | ||||
|     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(); | ||||
|     if (timestamp == 0) | ||||
|         timestamp = tpMessage.get_received_timestamp(); | ||||
|     static newFromTplTextEvent(tplTextEvent) { | ||||
|         let direction = | ||||
|             tplTextEvent.get_sender().get_entity_type() === Tpl.EntityType.SELF | ||||
|                 ? NotificationDirection.SENT : NotificationDirection.RECEIVED; | ||||
|  | ||||
|     return { | ||||
|         messageType: tpMessage.get_message_type(), | ||||
|         text, | ||||
|         sender: tpMessage.sender.alias, | ||||
|         timestamp, | ||||
|         direction, | ||||
|     }; | ||||
| } | ||||
|         return new ChatMessage({ | ||||
|             'message-type': tplTextEvent.get_message_type(), | ||||
|             'text': tplTextEvent.get_message(), | ||||
|             'sender': tplTextEvent.get_sender().get_alias(), | ||||
|             'timestamp': tplTextEvent.get_timestamp(), | ||||
|             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 { | ||||
|     constructor() { | ||||
|         this._client = null; | ||||
| @@ -193,7 +223,7 @@ class TelepathyClient extends Tp.BaseClient { | ||||
|  | ||||
|             // We can only handle text channel, so close any other channel | ||||
|             if (!(channel instanceof Tp.TextChannel)) { | ||||
|                 channel.close_async(null); | ||||
|                 channel.close_async(); | ||||
|                 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(); | ||||
|  | ||||
|         if (targetHandleType != Tp.HandleType.CONTACT) { | ||||
| @@ -248,17 +278,15 @@ class TelepathyClient extends Tp.BaseClient { | ||||
|             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(); | ||||
|  | ||||
|         // 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) { | ||||
| @@ -270,12 +298,12 @@ class TelepathyClient extends Tp.BaseClient { | ||||
| var ChatSource = HAVE_TP ? GObject.registerClass( | ||||
| class ChatSource extends MessageTray.Source { | ||||
|     _init(account, conn, channel, contact, client) { | ||||
|         super._init(contact.get_alias()); | ||||
|  | ||||
|         this._account = account; | ||||
|         this._contact = contact; | ||||
|         this._client = client; | ||||
|  | ||||
|         super._init(contact.get_alias()); | ||||
|  | ||||
|         this.isChat = true; | ||||
|         this._pendingMessages = []; | ||||
|  | ||||
| @@ -419,19 +447,16 @@ class ChatSource extends MessageTray.Source { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _getLogMessages() { | ||||
|     async _getLogMessages() { | ||||
|         let logManager = Tpl.LogManager.dup_singleton(); | ||||
|         let entity = Tpl.Entity.new_from_tp_contact(this._contact, Tpl.EntityType.CONTACT); | ||||
|  | ||||
|         logManager.get_filtered_events_async(this._account, entity, | ||||
|                                              Tpl.EventTypeMask.TEXT, SCROLLBACK_HISTORY_LINES, | ||||
|                                              null, this._displayPendingMessages.bind(this)); | ||||
|     } | ||||
|         const [events] = await logManager.get_filtered_events_async( | ||||
|             this._account, entity, | ||||
|             Tpl.EventTypeMask.TEXT, SCROLLBACK_HISTORY_LINES, | ||||
|             null); | ||||
|  | ||||
|     _displayPendingMessages(logManager, result) { | ||||
|         let [success_, events] = logManager.get_filtered_events_finish(result); | ||||
|  | ||||
|         let logMessages = events.map(makeMessageFromTplEvent); | ||||
|         let logMessages = events.map(e => ChatMessage.newFromTplTextEvent(e)); | ||||
|         this._ensureNotification(); | ||||
|  | ||||
|         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) | ||||
|                 continue; | ||||
|  | ||||
|             pendingMessages.push(makeMessageFromTpMessage(message, NotificationDirection.RECEIVED)); | ||||
|             pendingMessages.push(ChatMessage.newFromTpMessage(message, | ||||
|                 NotificationDirection.RECEIVED)); | ||||
|  | ||||
|             this._pendingMessages.push(message); | ||||
|         } | ||||
| @@ -486,9 +512,7 @@ class ChatSource extends MessageTray.Source { | ||||
|             this._ackMessages(); | ||||
|             // The chat box has been destroyed so it can't | ||||
|             // handle the channel any more. | ||||
|             this._channel.close_async((channel, result) => { | ||||
|                 channel.close_finish(result); | ||||
|             }); | ||||
|             this._channel.close_async(); | ||||
|         } else { | ||||
|             // Don't indicate any unread messages when the notification | ||||
|             // that represents them has been destroyed. | ||||
| @@ -541,7 +565,8 @@ class ChatSource extends MessageTray.Source { | ||||
|         this._pendingMessages.push(message); | ||||
|         this.countUpdated(); | ||||
|  | ||||
|         message = makeMessageFromTpMessage(message, NotificationDirection.RECEIVED); | ||||
|         message = ChatMessage.newFromTpMessage(message, | ||||
|             NotificationDirection.RECEIVED); | ||||
|         this._notification.appendMessage(message); | ||||
|  | ||||
|         // 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. | ||||
|     _messageSent(channel, message, _flags, _token) { | ||||
|         this._ensureNotification(); | ||||
|         message = makeMessageFromTpMessage(message, NotificationDirection.SENT); | ||||
|         message = ChatMessage.newFromTpMessage(message, | ||||
|             NotificationDirection.SENT); | ||||
|         this._notification.appendMessage(message); | ||||
|     } | ||||
|  | ||||
| @@ -584,9 +610,7 @@ class ChatSource extends MessageTray.Source { | ||||
|         } | ||||
|  | ||||
|         let msg = Tp.ClientMessage.new_text(type, text); | ||||
|         this._channel.send_message_async(msg, 0, (src, result) => { | ||||
|             this._channel.send_message_finish(result); | ||||
|         }); | ||||
|         this._channel.send_message_async(msg, 0); | ||||
|     } | ||||
|  | ||||
|     setChatState(state) { | ||||
| @@ -630,11 +654,19 @@ class ChatSource extends MessageTray.Source { | ||||
|     } | ||||
| }) : 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({ | ||||
|     Signals: { | ||||
|         'message-removed': { param_types: [Tp.Message.$gtype] }, | ||||
|         'message-added': { param_types: [Tp.Message.$gtype] }, | ||||
|         'timestamp-changed': { param_types: [Tp.Message.$gtype] }, | ||||
|         'message-removed': { param_types: [ChatNotificationMessage.$gtype] }, | ||||
|         'message-added': { param_types: [ChatNotificationMessage.$gtype] }, | ||||
|         'timestamp-changed': { param_types: [ChatNotificationMessage.$gtype] }, | ||||
|     }, | ||||
| }, class ChatNotification extends MessageTray.Notification { | ||||
|     _init(source) { | ||||
| @@ -735,21 +767,24 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({ | ||||
|                                       styles: [], | ||||
|                                       timestamp: currentTime, | ||||
|                                       noTimestamp: false }); | ||||
|         const { noTimestamp } = props; | ||||
|         delete props.noTimestamp; | ||||
|  | ||||
|         // Reset the old message timeout | ||||
|         if (this._timestampTimeoutId) | ||||
|             GLib.source_remove(this._timestampTimeoutId); | ||||
|         this._timestampTimeoutId = 0; | ||||
|  | ||||
|         let message = { realMessage: props.group != 'meta', | ||||
|                         showTimestamp: false }; | ||||
|         Lang.copyProperties(props, message); | ||||
|         delete message.noTimestamp; | ||||
|         let message = new ChatNotificationMessage({ | ||||
|             realMessage: props.group !== 'meta', | ||||
|             showTimestamp: false, | ||||
|             ...props, | ||||
|         }); | ||||
|  | ||||
|         this.messages.unshift(message); | ||||
|         this.emit('message-added', message); | ||||
|  | ||||
|         if (!props.noTimestamp) { | ||||
|         if (!noTimestamp) { | ||||
|             let timestamp = props.timestamp; | ||||
|             if (timestamp < currentTime - SCROLLBACK_IMMEDIATE_TIME) { | ||||
|                 this.appendTimestamp(); | ||||
|   | ||||
| @@ -180,14 +180,27 @@ class WorldClocksSection extends St.Button { | ||||
|  | ||||
|             let time = new St.Label({ style_class: 'world-clocks-time' }); | ||||
|  | ||||
|             let otherOffset = this._getTimeAtLocation(l).get_utc_offset(); | ||||
|             let offset = (otherOffset - localOffset) / GLib.TIME_SPAN_HOUR; | ||||
|             let fmt = Math.trunc(offset) == offset ? '%s%.0f' : '%s%.1f'; | ||||
|             let prefix = offset >= 0 ? '+' : '-'; | ||||
|             let tz = new St.Label({ style_class: 'world-clocks-timezone', | ||||
|                                     text: fmt.format(prefix, Math.abs(offset)), | ||||
|                                     x_align: Clutter.ActorAlign.END, | ||||
|                                     y_align: Clutter.ActorAlign.CENTER }); | ||||
|             const utcOffset = this._getTimeAtLocation(l).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); | ||||
|  | ||||
|             const tz = new St.Label({ | ||||
|                 style_class: 'world-clocks-timezone', | ||||
|                 text, | ||||
|                 x_align: Clutter.ActorAlign.END, | ||||
|                 y_align: Clutter.ActorAlign.CENTER, | ||||
|             }); | ||||
|  | ||||
|             time.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; | ||||
|             tz.clutter_text.ellipsize = Pango.EllipsizeMode.NONE; | ||||
|  | ||||
|             if (this._grid.text_direction == Clutter.TextDirection.RTL) { | ||||
|                 layout.attach(tz, 0, i + 1, 1, 1); | ||||
| @@ -268,13 +281,13 @@ class WeatherSection extends St.Button { | ||||
|         this.child = 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', | ||||
|             x_align: Clutter.ActorAlign.START, | ||||
|             x_expand: true, | ||||
|             y_align: Clutter.ActorAlign.END, | ||||
|             text: _('Weather'), | ||||
|         })); | ||||
|         }); | ||||
|         titleBox.add_child(this._titleLabel); | ||||
|         box.add_child(titleBox); | ||||
|  | ||||
|         this._titleLocation = new St.Label({ | ||||
| @@ -384,21 +397,28 @@ class WeatherSection extends St.Button { | ||||
|         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() { | ||||
|         this._forecastGrid.destroy_all_children(); | ||||
|  | ||||
|         if (!this._weatherClient.hasLocation) { | ||||
|             this._setStatusLabel(_("Select a location…")); | ||||
|         if (!this._weatherClient.hasLocation) | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         let info = this._weatherClient.info; | ||||
|         let loc = info.get_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(); | ||||
|         const { info } = this._weatherClient; | ||||
|         this._titleLocation.text = this._findBestLocationName(info.location); | ||||
|  | ||||
|         if (this._weatherClient.loading) { | ||||
|             this._setStatusLabel(_("Loading…")); | ||||
| @@ -422,6 +442,12 @@ class WeatherSection extends St.Button { | ||||
|         if (!this.visible) | ||||
|             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._updateForecasts(); | ||||
|   | ||||
| @@ -278,7 +278,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog { | ||||
|         this._dbusImpl.export(Gio.DBus.session, '/org/gnome/SessionManager/EndSessionDialog'); | ||||
|     } | ||||
|  | ||||
|     _onPkOfflineProxyCreated(proxy, error) { | ||||
|     async _onPkOfflineProxyCreated(proxy, error) { | ||||
|         if (error) { | ||||
|             log(error.message); | ||||
|             return; | ||||
| @@ -293,15 +293,12 @@ class EndSessionDialog extends ModalDialog.ModalDialog { | ||||
|         } | ||||
|  | ||||
|         // It only makes sense to check for this permission if PackageKit is available. | ||||
|         Polkit.Permission.new( | ||||
|             'org.freedesktop.packagekit.trigger-offline-update', null, null, | ||||
|             (source, res) => { | ||||
|                 try { | ||||
|                     this._updatesPermission = Polkit.Permission.new_finish(res); | ||||
|                 } catch (e) { | ||||
|                     log('No permission to trigger offline updates: %s'.format(e.toString())); | ||||
|                 } | ||||
|             }); | ||||
|         try { | ||||
|             this._updatesPermission = await Polkit.Permission.new( | ||||
|                 'org.freedesktop.packagekit.trigger-offline-update', null, null); | ||||
|         } catch (e) { | ||||
|             log('No permission to trigger offline updates: %s'.format(e.toString())); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _onDestroy() { | ||||
| @@ -346,10 +343,8 @@ class EndSessionDialog extends ModalDialog.ModalDialog { | ||||
|  | ||||
|         // Use a different description when we are installing a system upgrade | ||||
|         // if the PackageKit proxy is available (i.e. PackageKit is available). | ||||
|         if (this._pkOfflineProxy && dialogContent.upgradeDescription) { | ||||
|             let name = this._pkOfflineProxy.PreparedUpgrade['name'].deep_unpack(); | ||||
|             let version = this._pkOfflineProxy.PreparedUpgrade['version'].deep_unpack(); | ||||
|  | ||||
|         if (dialogContent.upgradeDescription) { | ||||
|             const { name, version } = this._updateInfo.PreparedUpgrade; | ||||
|             if (name != null && version != null) | ||||
|                 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; | ||||
|         this._totalSecondsToStayOpen = totalSecondsToStayOpen; | ||||
|         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. | ||||
|         if (this._pkOfflineProxy && this._type == DialogType.RESTART) { | ||||
|             if (this._pkOfflineProxy.UpdateTriggered) | ||||
|             if (this._updateInfo.UpdateTriggered) | ||||
|                 this._type = DialogType.UPDATE_RESTART; | ||||
|             else if (this._pkOfflineProxy.UpgradeTriggered) | ||||
|             else if (this._updateInfo.UpgradeTriggered) | ||||
|                 this._type = DialogType.UPGRADE_RESTART; | ||||
|         } | ||||
|  | ||||
| @@ -646,14 +671,13 @@ class EndSessionDialog extends ModalDialog.ModalDialog { | ||||
|         if (dialogContent.showOtherSessions) | ||||
|             this._loadSessions(); | ||||
|  | ||||
|         // Only consider updates and upgrades if PackageKit is available. | ||||
|         let updateTriggered = this._pkOfflineProxy ? this._pkOfflineProxy.UpdateTriggered : false; | ||||
|         let updatePrepared = this._pkOfflineProxy ? this._pkOfflineProxy.UpdatePrepared : false; | ||||
|         let updateTriggered = this._updateInfo.UpdateTriggered; | ||||
|         let updatePrepared = this._updateInfo.UpdatePrepared; | ||||
|         let updatesAllowed = this._updatesPermission && this._updatesPermission.allowed; | ||||
|  | ||||
|         _setCheckBoxLabel(this._checkBox, dialogContent.checkBoxText || ''); | ||||
|         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 | ||||
|         // 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.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 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 | ||||
| // variable initializations, etc, that depend on init() already having | ||||
| @@ -231,16 +245,15 @@ function _loggingFunc(...args) { | ||||
| } | ||||
|  | ||||
| function init() { | ||||
|     // Add some bindings to the global JS namespace; (gjs keeps the web | ||||
|     // browser convention of having that namespace be called 'window'.) | ||||
|     window.global = Shell.Global.get(); | ||||
|     // Add some bindings to the global JS namespace | ||||
|     globalThis.global = Shell.Global.get(); | ||||
|  | ||||
|     window.log = _loggingFunc; | ||||
|     globalThis.log = _loggingFunc; | ||||
|  | ||||
|     window._ = Gettext.gettext; | ||||
|     window.C_ = Gettext.pgettext; | ||||
|     window.ngettext = Gettext.ngettext; | ||||
|     window.N_ = s => s; | ||||
|     globalThis._ = Gettext.gettext; | ||||
|     globalThis.C_ = Gettext.pgettext; | ||||
|     globalThis.ngettext = Gettext.ngettext; | ||||
|     globalThis.N_ = s => s; | ||||
|  | ||||
|     GObject.gtypeNameBasedOnJSPath = true; | ||||
|  | ||||
| @@ -285,6 +298,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) { | ||||
|         let { stack } = new Error(); | ||||
|         log(`St.set_slow_down_factor() is deprecated, use St.Settings.slow_down_factor\n${stack}`); | ||||
| @@ -304,9 +324,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 | ||||
|     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) : ''; | ||||
|     }; | ||||
|  | ||||
| @@ -319,9 +355,7 @@ function init() { | ||||
|  | ||||
|     // OK, now things are initialized enough that we can import shell JS | ||||
|     const Format = imports.format; | ||||
|     const Tweener = imports.ui.tweener; | ||||
|  | ||||
|     Tweener.init(); | ||||
|     String.prototype.format = Format.format; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -56,6 +56,15 @@ function uninstallExtension(uuid) { | ||||
|         return false; | ||||
|  | ||||
|     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; | ||||
| } | ||||
|  | ||||
| @@ -99,6 +108,9 @@ function gotExtensionZipFile(session, message, uuid, dir, callback, errback) { | ||||
| } | ||||
|  | ||||
| function downloadExtensionUpdate(uuid) { | ||||
|     if (!Main.extensionManager.updatesSupported) | ||||
|         return; | ||||
|  | ||||
|     let dir = Gio.File.new_for_path( | ||||
|         GLib.build_filenamev([global.userdatadir, 'extension-updates', uuid])); | ||||
|  | ||||
| @@ -117,6 +129,9 @@ function downloadExtensionUpdate(uuid) { | ||||
| } | ||||
|  | ||||
| function checkForUpdates() { | ||||
|     if (!Main.extensionManager.updatesSupported) | ||||
|         return; | ||||
|  | ||||
|     let metadatas = {}; | ||||
|     Main.extensionManager.getUuids().forEach(uuid => { | ||||
|         let extension = Main.extensionManager.lookup(uuid); | ||||
| @@ -127,6 +142,9 @@ function checkForUpdates() { | ||||
|         metadatas[uuid] = extension.metadata; | ||||
|     }); | ||||
|  | ||||
|     if (Object.keys(metadatas).length === 0) | ||||
|         return; // nothing to update | ||||
|  | ||||
|     let versionCheck = global.settings.get_boolean( | ||||
|         'disable-extension-version-validation'); | ||||
|     let params = { | ||||
| @@ -144,9 +162,7 @@ function checkForUpdates() { | ||||
|         let operations = JSON.parse(message.response_body.data); | ||||
|         for (let uuid in operations) { | ||||
|             let operation = operations[uuid]; | ||||
|             if (operation == 'blacklist') | ||||
|                 uninstallExtension(uuid); | ||||
|             else if (operation == 'upgrade' || operation == 'downgrade') | ||||
|             if (operation === 'upgrade' || operation === 'downgrade') | ||||
|                 downloadExtensionUpdate(uuid); | ||||
|         } | ||||
|     }); | ||||
|   | ||||
| @@ -60,6 +60,11 @@ var ExtensionManager = class { | ||||
|         ExtensionDownloader.checkForUpdates(); | ||||
|     } | ||||
|  | ||||
|     get updatesSupported() { | ||||
|         const appSys = Shell.AppSystem.get_default(); | ||||
|         return appSys.lookup_app('org.gnome.Extensions.desktop') !== null; | ||||
|     } | ||||
|  | ||||
|     lookup(uuid) { | ||||
|         return this._extensions.get(uuid); | ||||
|     } | ||||
| @@ -210,6 +215,24 @@ var ExtensionManager = class { | ||||
|         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) { | ||||
|         let extension = this.lookup(uuid); | ||||
|         if (!extension) | ||||
| @@ -481,6 +504,9 @@ var ExtensionManager = class { | ||||
|     } | ||||
|  | ||||
|     _installExtensionUpdates() { | ||||
|         if (!this.updatesSupported) | ||||
|             return; | ||||
|  | ||||
|         FileUtils.collectFromDatadirs('extension-updates', true, (dir, info) => { | ||||
|             let fileType = info.get_file_type(); | ||||
|             if (fileType !== Gio.FileType.DIRECTORY) | ||||
| @@ -489,9 +515,14 @@ var ExtensionManager = class { | ||||
|             let extensionDir = Gio.File.new_for_path( | ||||
|                 GLib.build_filenamev([global.userdatadir, 'extensions', uuid])); | ||||
|  | ||||
|             FileUtils.recursivelyDeleteDir(extensionDir, false); | ||||
|             FileUtils.recursivelyMoveDir(dir, extensionDir); | ||||
|             FileUtils.recursivelyDeleteDir(dir, true); | ||||
|             try { | ||||
|                 FileUtils.recursivelyDeleteDir(extensionDir, false); | ||||
|                 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) { | ||||
|             size = this.iconSize; | ||||
|         } else { | ||||
|             const { scaleFactor } = | ||||
|                 St.ThemeContext.get_for_stage(global.stage); | ||||
|  | ||||
|             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) | ||||
|   | ||||
| @@ -498,7 +498,7 @@ var Key = GObject.registerClass({ | ||||
| var KeyboardModel = class { | ||||
|     constructor(groupName) { | ||||
|         let names = [groupName]; | ||||
|         if (names.includes('+')) | ||||
|         if (groupName.includes('+')) | ||||
|             names.push(groupName.replace(/\+.*/, '')); | ||||
|         names.push('us'); | ||||
|  | ||||
| @@ -1119,11 +1119,12 @@ var KeyboardManager = class KeyBoardManager { | ||||
|         this._seat.connect('notify::touch-mode', this._syncEnabled.bind(this)); | ||||
|  | ||||
|         this._lastDevice = null; | ||||
|         Meta.get_backend().connect('last-device-changed', (backend, device) => { | ||||
|             if (device.get_device_name().indexOf('XTEST') < 0) { | ||||
|                 this._lastDevice = device; | ||||
|                 this._syncEnabled(); | ||||
|             } | ||||
|         global.backend.connect('last-device-changed', (backend, device) => { | ||||
|             if (device.device_type === Clutter.InputDeviceType.KEYBOARD_DEVICE) | ||||
|                 return; | ||||
|  | ||||
|             this._lastDevice = device; | ||||
|             this._syncEnabled(); | ||||
|         }); | ||||
|         this._syncEnabled(); | ||||
|     } | ||||
| @@ -1148,9 +1149,9 @@ var KeyboardManager = class KeyBoardManager { | ||||
|             this._keyboard = new Keyboard(); | ||||
|         } else if (!enabled && this._keyboard) { | ||||
|             this._keyboard.setCursorLocation(null); | ||||
|             Main.layoutManager.hideKeyboard(true); | ||||
|             this._keyboard.destroy(); | ||||
|             this._keyboard = null; | ||||
|             Main.layoutManager.hideKeyboard(true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -1868,6 +1869,10 @@ var KeyboardController = class { | ||||
|         Main.inputMethod.disconnect(this._notifyContentPurposeId); | ||||
|         Main.inputMethod.disconnect(this._notifyContentHintsId); | ||||
|         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() { | ||||
|   | ||||
| @@ -612,10 +612,20 @@ var LayoutManager = GObject.registerClass({ | ||||
|  | ||||
|         let signalId = this._systemBackground.connect('loaded', () => { | ||||
|             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'); | ||||
|  | ||||
|         // 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 | ||||
|         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'); | ||||
|         this._startupAnimation(); | ||||
|     } | ||||
|  | ||||
|     _startupAnimation() { | ||||
| @@ -765,7 +765,7 @@ var LayoutManager = GObject.registerClass({ | ||||
|             this._keyboardHeightNotifyId = 0; | ||||
|         } | ||||
|         this.keyboardBox.ease({ | ||||
|             translation_y: this.keyboardBox.height, | ||||
|             translation_y: 0, | ||||
|             opacity: 0, | ||||
|             duration: immediate ? 0 : KEYBOARD_ANIMATION_TIME, | ||||
|             mode: Clutter.AnimationMode.EASE_IN_QUAD, | ||||
|   | ||||
| @@ -37,8 +37,8 @@ const LG_ANIMATION_TIME = 500; | ||||
|  | ||||
| function _getAutoCompleteGlobalKeywords() { | ||||
|     const keywords = ['true', 'false', 'null', 'new']; | ||||
|     // Don't add the private properties of window (i.e., ones starting with '_') | ||||
|     const windowProperties = Object.getOwnPropertyNames(window).filter( | ||||
|     // Don't add the private properties of globalThis (i.e., ones starting with '_') | ||||
|     const windowProperties = Object.getOwnPropertyNames(globalThis).filter( | ||||
|         a => a.charAt(0) != '_' | ||||
|     ); | ||||
|     const headerProperties = JsParse.getDeclaredConstants(commandHeader); | ||||
| @@ -1127,7 +1127,7 @@ class LookingGlass extends St.BoxLayout { | ||||
|             else if (symbol == Clutter.KEY_Page_Down) | ||||
|                 this._notebook.nextTab(); | ||||
|         } | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|         return super.vfunc_key_press_event(keyPressEvent); | ||||
|     } | ||||
|  | ||||
|     open() { | ||||
|   | ||||
| @@ -46,6 +46,7 @@ const XdndHandler = imports.ui.xdndHandler; | ||||
| const KbdA11yDialog = imports.ui.kbdA11yDialog; | ||||
| const LocatePointer = imports.ui.locatePointer; | ||||
| const PointerA11yTimeout = imports.ui.pointerA11yTimeout; | ||||
| const ParentalControlsManager = imports.misc.parentalControlsManager; | ||||
|  | ||||
| const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard'; | ||||
| const STICKY_KEYS_ENABLE = 'stickykeys-enable'; | ||||
| @@ -93,6 +94,11 @@ let _a11ySettings = null; | ||||
| let _themeResource = 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() { | ||||
|     if (sessionMode.isPrimary) | ||||
|         _loadDefaultStylesheet(); | ||||
| @@ -117,24 +123,41 @@ function _sessionUpdated() { | ||||
|         if (lookingGlass) | ||||
|             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() { | ||||
|     // These are here so we don't break compatibility. | ||||
|     global.logError = window.log; | ||||
|     global.log = window.log; | ||||
|     global.logError = globalThis.log; | ||||
|     global.log = globalThis.log; | ||||
|  | ||||
|     // Chain up async errors reported from C | ||||
|     global.connect('notify-error', (global, 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.connect('updated', _sessionUpdated); | ||||
|  | ||||
|     St.Settings.get().connect('notify::gtk-theme', _loadDefaultStylesheet); | ||||
|  | ||||
|     // Initialize ParentalControlsManager before the UI | ||||
|     ParentalControlsManager.getDefault(); | ||||
|  | ||||
|     _initializeUI(); | ||||
|  | ||||
|     shellAccessDialogDBusService = new AccessDialog.AccessDialogDBus(); | ||||
| @@ -142,6 +165,11 @@ function start() { | ||||
|     shellDBusService = new ShellDBus.GnomeShell(); | ||||
|     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(); | ||||
| } | ||||
|  | ||||
| @@ -271,11 +299,8 @@ function _initializeUI() { | ||||
|         } | ||||
|  | ||||
|         if (sessionMode.currentMode !== 'gdm' && | ||||
|             sessionMode.currentMode !== 'initial-setup' && | ||||
|             screenShield === null) { | ||||
|             notify(_('Screen Lock disabled'), | ||||
|                    _('Screen Locking requires the GNOME display manager.')); | ||||
|         } | ||||
|             sessionMode.currentMode !== 'initial-setup') | ||||
|             _handleLockScreenWarning(); | ||||
|  | ||||
|         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) { | ||||
|     let stylesheet; | ||||
|  | ||||
| @@ -361,7 +412,8 @@ function reloadThemeResource() { | ||||
|     if (_themeResource) | ||||
|         _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(); | ||||
| } | ||||
|  | ||||
| @@ -763,7 +815,7 @@ function showRestartMessage(message) { | ||||
|  | ||||
| var AnimationsSettings = class { | ||||
|     constructor() { | ||||
|         let backend = Meta.get_backend(); | ||||
|         let backend = global.backend; | ||||
|         if (!backend.is_rendering_hardware_accelerated()) { | ||||
|             St.Settings.get().inhibit_animations(); | ||||
|             return; | ||||
|   | ||||
| @@ -530,7 +530,7 @@ var Message = GObject.registerClass({ | ||||
|             this.close(); | ||||
|             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({ | ||||
|     Properties: { | ||||
|         'enable': GObject.ParamSpec.boolean( | ||||
|             'enable', 'enable', 'enable', | ||||
|             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, | ||||
|             true), | ||||
|             'enable', 'enable', 'enable', GObject.ParamFlags.READABLE, true), | ||||
|         'enable-sound': GObject.ParamSpec.boolean( | ||||
|             'enable-sound', 'enable-sound', 'enable-sound', | ||||
|             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, | ||||
|             true), | ||||
|             GObject.ParamFlags.READABLE, true), | ||||
|         'show-banners': GObject.ParamSpec.boolean( | ||||
|             'show-banners', 'show-banners', 'show-banners', | ||||
|             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, | ||||
|             true), | ||||
|             GObject.ParamFlags.READABLE, true), | ||||
|         'force-expanded': GObject.ParamSpec.boolean( | ||||
|             'force-expanded', 'force-expanded', 'force-expanded', | ||||
|             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, | ||||
|             false), | ||||
|             GObject.ParamFlags.READABLE, false), | ||||
|         'show-in-lock-screen': GObject.ParamSpec.boolean( | ||||
|             'show-in-lock-screen', 'show-in-lock-screen', 'show-in-lock-screen', | ||||
|             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, | ||||
|             false), | ||||
|             GObject.ParamFlags.READABLE, false), | ||||
|         'details-in-lock-screen': GObject.ParamSpec.boolean( | ||||
|             'details-in-lock-screen', 'details-in-lock-screen', 'details-in-lock-screen', | ||||
|             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY, | ||||
|             false), | ||||
|             GObject.ParamFlags.READABLE, false), | ||||
|     }, | ||||
| }, class NotificationPolicy extends GObject.Object { | ||||
|     // Do nothing for the default policy. These methods are only useful for the | ||||
| @@ -170,23 +163,23 @@ var NotificationPolicy = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     get enableSound() { | ||||
|         return this.enable_sound; | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     get showBanners() { | ||||
|         return this.show_banners; | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     get forceExpanded() { | ||||
|         return this.force_expanded; | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     get showInLockScreen() { | ||||
|         return this.show_in_lock_screen; | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     get detailsInLockScreen() { | ||||
|         return this.details_in_lock_screen; | ||||
|         return false; | ||||
|     } | ||||
| }); | ||||
|  | ||||
| @@ -762,12 +755,10 @@ var Source = GObject.registerClass({ | ||||
|  | ||||
|         this.notifications = []; | ||||
|  | ||||
|         this._policy = null; | ||||
|         this._policy = this._createPolicy(); | ||||
|     } | ||||
|  | ||||
|     get policy() { | ||||
|         if (!this._policy) | ||||
|             this._policy = this._createPolicy(); | ||||
|         return this._policy; | ||||
|     } | ||||
|  | ||||
| @@ -880,8 +871,6 @@ var Source = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     destroy(reason) { | ||||
|         this.policy.destroy(); | ||||
|  | ||||
|         let notifications = this.notifications; | ||||
|         this.notifications = []; | ||||
|  | ||||
| @@ -890,6 +879,7 @@ var Source = GObject.registerClass({ | ||||
|  | ||||
|         this.emit('destroy', reason); | ||||
|  | ||||
|         this.policy.destroy(); | ||||
|         this.run_dispose(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -251,6 +251,10 @@ class MediaSection extends MessageList.MessageListSection { | ||||
|         return !this.empty && Calendar.isToday(this._date); | ||||
|     } | ||||
|  | ||||
|     get allowed() { | ||||
|         return !Main.sessionMode.isGreeter; | ||||
|     } | ||||
|  | ||||
|     _addPlayer(busName) { | ||||
|         if (this._players.get(busName)) | ||||
|             return; | ||||
|   | ||||
| @@ -416,11 +416,11 @@ var FdoNotificationDaemon = class FdoNotificationDaemon { | ||||
| var FdoNotificationDaemonSource = GObject.registerClass( | ||||
| class FdoNotificationDaemonSource extends MessageTray.Source { | ||||
|     _init(title, pid, sender, appId) { | ||||
|         super._init(title); | ||||
|  | ||||
|         this.pid = pid; | ||||
|         this.app = this._getApp(appId); | ||||
|  | ||||
|         super._init(title); | ||||
|  | ||||
|         this.initialTitle = title; | ||||
|  | ||||
|         if (this.app) | ||||
| @@ -631,12 +631,12 @@ class GtkNotificationDaemonAppSource extends MessageTray.Source { | ||||
|         if (!app) | ||||
|             throw new InvalidAppError(); | ||||
|  | ||||
|         super._init(app.get_name()); | ||||
|  | ||||
|         this._appId = appId; | ||||
|         this._app = app; | ||||
|         this._objectPath = objectPath; | ||||
|  | ||||
|         super._init(app.get_name()); | ||||
|  | ||||
|         this._notifications = {}; | ||||
|         this._notificationPending = false; | ||||
|     } | ||||
|   | ||||
| @@ -89,7 +89,7 @@ var PadChooser = GObject.registerClass({ | ||||
| }); | ||||
|  | ||||
| var KeybindingEntry = GObject.registerClass({ | ||||
|     Signals: { 'keybinding-edited': {} }, | ||||
|     Signals: { 'keybinding-edited': { param_types: [GObject.TYPE_STRING] } }, | ||||
| }, class KeybindingEntry extends St.Entry { | ||||
|     _init() { | ||||
|         super._init({ hint_text: _("New shortcut…"), style: 'width: 10em' }); | ||||
|   | ||||
| @@ -90,18 +90,16 @@ class AppMenu extends PopupMenu.PopupMenu { | ||||
|  | ||||
|         this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); | ||||
|  | ||||
|         this._detailsItem = this.addAction(_("Show Details"), () => { | ||||
|         this._detailsItem = this.addAction(_('Show Details'), async () => { | ||||
|             let id = this._app.get_id(); | ||||
|             let args = GLib.Variant.new('(ss)', [id, '']); | ||||
|             Gio.DBus.get(Gio.BusType.SESSION, null, (o, res) => { | ||||
|                 let bus = Gio.DBus.get_finish(res); | ||||
|                 bus.call('org.gnome.Software', | ||||
|                          '/org/gnome/Software', | ||||
|                          'org.gtk.Actions', 'Activate', | ||||
|                          GLib.Variant.new('(sava{sv})', | ||||
|                                           ['details', [args], null]), | ||||
|                          null, 0, -1, null, null); | ||||
|             }); | ||||
|             const bus = await Gio.DBus.get(Gio.BusType.SESSION, null); | ||||
|             bus.call( | ||||
|                 'org.gnome.Software', | ||||
|                 '/org/gnome/Software', | ||||
|                 'org.gtk.Actions', 'Activate', | ||||
|                 new GLib.Variant('(sava{sv})', ['details', [args], null]), | ||||
|                 null, 0, -1, null); | ||||
|         }); | ||||
|  | ||||
|         this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); | ||||
| @@ -283,7 +281,7 @@ var AppMenuButton = GObject.registerClass({ | ||||
|         this.remove_all_transitions(); | ||||
|         this.ease({ | ||||
|             opacity: 0, | ||||
|             mode: Clutter.Animation.EASE_OUT_QUAD, | ||||
|             mode: Clutter.AnimationMode.EASE_OUT_QUAD, | ||||
|             duration: Overview.ANIMATION_TIME, | ||||
|             onComplete: () => this.hide(), | ||||
|         }); | ||||
| @@ -964,7 +962,7 @@ class Panel extends St.Widget { | ||||
|             return Clutter.EVENT_STOP; | ||||
|         } | ||||
|  | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|         return super.vfunc_key_press_event(keyEvent); | ||||
|     } | ||||
|  | ||||
|     _toggleMenu(indicator) { | ||||
|   | ||||
| @@ -204,7 +204,7 @@ var RemoteSearchProvider = class { | ||||
|                                          g_interface_info: proxyInfo, | ||||
|                                          g_interface_name: proxyInfo.name, | ||||
|                                          gFlags }); | ||||
|         this.proxy.init_async(GLib.PRIORITY_DEFAULT, null, null); | ||||
|         this.proxy.init_async(GLib.PRIORITY_DEFAULT, null); | ||||
|  | ||||
|         this.appInfo = appInfo; | ||||
|         this.id = appInfo.get_id(); | ||||
| @@ -247,7 +247,7 @@ var RemoteSearchProvider = class { | ||||
|             if (error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                 return; | ||||
|  | ||||
|             log('Received error from DBus search provider %s: %s'.format(this.id, String(error))); | ||||
|             log('Received error from D-Bus search provider %s: %s'.format(this.id, String(error))); | ||||
|             callback([]); | ||||
|             return; | ||||
|         } | ||||
| @@ -274,7 +274,7 @@ var RemoteSearchProvider = class { | ||||
|     _getResultMetasFinished(results, error, callback) { | ||||
|         if (error) { | ||||
|             if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) | ||||
|                 log('Received error from DBus search provider %s during GetResultMetas: %s'.format(this.id, String(error))); | ||||
|                 log('Received error from D-Bus search provider %s during GetResultMetas: %s'.format(this.id, String(error))); | ||||
|             callback([]); | ||||
|             return; | ||||
|         } | ||||
|   | ||||
| @@ -198,7 +198,7 @@ var ScreenShield = class { | ||||
|         let lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY); | ||||
|         let lockLocked = this._lockSettings.get_boolean(DISABLE_LOCK_KEY); | ||||
|         let inhibit = this._loginSession && this._loginSession.Active && | ||||
|                        !this._isActive && lockEnabled && !lockLocked; | ||||
|                        !this._isActive && lockEnabled && !lockLocked && Main.sessionMode.unlockDialog; | ||||
|         if (inhibit) { | ||||
|             this._loginManager.inhibit(_("GNOME needs to lock the screen"), | ||||
|                 inhibitor => { | ||||
| @@ -345,7 +345,7 @@ var ScreenShield = class { | ||||
|         this._lockDialogGroup.remove_all_transitions(); | ||||
|  | ||||
|         if (animate) { | ||||
|             // Tween the lock screen out of screen | ||||
|             // Animate the lock screen out of screen | ||||
|             // if velocity is not specified (i.e. we come here from pressing ESC), | ||||
|             // use the same speed regardless of original position | ||||
|             // if velocity is specified, it's in pixels per milliseconds | ||||
| @@ -498,6 +498,8 @@ var ScreenShield = class { | ||||
|         if (Main.sessionMode.currentMode == 'unlock-dialog') | ||||
|             Main.sessionMode.popMode('unlock-dialog'); | ||||
|  | ||||
|         this.emit('wake-up-screen'); | ||||
|  | ||||
|         if (this._isGreeter) { | ||||
|             // We don't want to "deactivate" any more than | ||||
|             // this. In particular, we don't want to drop | ||||
| @@ -519,6 +521,9 @@ var ScreenShield = class { | ||||
|             this._isModal = false; | ||||
|         } | ||||
|  | ||||
|         this._longLightbox.lightOff(); | ||||
|         this._shortLightbox.lightOff(); | ||||
|  | ||||
|         this._lockDialogGroup.ease({ | ||||
|             translation_y: -global.screen_height, | ||||
|             duration: Overview.ANIMATION_TIME, | ||||
| @@ -533,8 +538,6 @@ var ScreenShield = class { | ||||
|             this._dialog = null; | ||||
|         } | ||||
|  | ||||
|         this._longLightbox.lightOff(); | ||||
|         this._shortLightbox.lightOff(); | ||||
|         this.actor.hide(); | ||||
|  | ||||
|         if (this._becameActiveId != 0) { | ||||
| @@ -558,7 +561,8 @@ var ScreenShield = class { | ||||
|         if (this._activationTime == 0) | ||||
|             this._activationTime = GLib.get_monotonic_time(); | ||||
|  | ||||
|         this._ensureUnlockDialog(true); | ||||
|         if (!this._ensureUnlockDialog(true)) | ||||
|             return; | ||||
|  | ||||
|         this.actor.show(); | ||||
|  | ||||
|   | ||||
| @@ -7,6 +7,13 @@ const GrabHelper = imports.ui.grabHelper; | ||||
| const Lightbox = imports.ui.lightbox; | ||||
| const Main = imports.ui.main; | ||||
|  | ||||
| Gio._promisify(Shell.Screenshot.prototype, 'pick_color', 'pick_color_finish'); | ||||
| Gio._promisify(Shell.Screenshot.prototype, 'screenshot', 'screenshot_finish'); | ||||
| Gio._promisify(Shell.Screenshot.prototype, | ||||
|     'screenshot_window', 'screenshot_window_finish'); | ||||
| Gio._promisify(Shell.Screenshot.prototype, | ||||
|     'screenshot_area', 'screenshot_area_finish'); | ||||
|  | ||||
| const { loadInterfaceXML } = imports.misc.fileUtils; | ||||
|  | ||||
| const ScreenshotIface = loadInterfaceXML('org.gnome.Shell.Screenshot'); | ||||
| @@ -84,7 +91,7 @@ var ScreenshotService = class { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _createStream(filename) { | ||||
|     _createStream(filename, invocation) { | ||||
|         if (filename == '') | ||||
|             return [Gio.MemoryOutputStream.new_resizable(), null]; | ||||
|  | ||||
| @@ -94,6 +101,7 @@ var ScreenshotService = class { | ||||
|                 let stream = file.replace(null, false, Gio.FileCreateFlags.NONE, null); | ||||
|                 return [stream, file]; | ||||
|             } catch (e) { | ||||
|                 invocation.return_value(GLib.Variant.new('(bs)', [false, ''])); | ||||
|                 return [null, null]; | ||||
|             } | ||||
|         } | ||||
| @@ -104,23 +112,22 @@ var ScreenshotService = class { | ||||
|                 return [stream, file]; | ||||
|             } catch (e) { | ||||
|                 if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) | ||||
|                     return [null, null]; | ||||
|                     break; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         invocation.return_value(GLib.Variant.new('(bs)', [false, ''])); | ||||
|         return [null, null]; | ||||
|     } | ||||
|  | ||||
|     _onScreenshotComplete(result, area, stream, file, flash, invocation) { | ||||
|         if (result) { | ||||
|             if (flash) { | ||||
|                 let flashspot = new Flashspot(area); | ||||
|                 flashspot.fire(() => { | ||||
|                     this._removeShooterForSender(invocation.get_sender()); | ||||
|                 }); | ||||
|             } else { | ||||
|     _onScreenshotComplete(area, stream, file, flash, invocation) { | ||||
|         if (flash) { | ||||
|             let flashspot = new Flashspot(area); | ||||
|             flashspot.fire(() => { | ||||
|                 this._removeShooterForSender(invocation.get_sender()); | ||||
|             } | ||||
|             }); | ||||
|         } else { | ||||
|             this._removeShooterForSender(invocation.get_sender()); | ||||
|         } | ||||
|  | ||||
|         stream.close(null); | ||||
| @@ -134,7 +141,7 @@ var ScreenshotService = class { | ||||
|             clipboard.set_content(St.ClipboardType.CLIPBOARD, 'image/png', bytes); | ||||
|         } | ||||
|  | ||||
|         let retval = GLib.Variant.new('(bs)', [result, filenameUsed]); | ||||
|         let retval = GLib.Variant.new('(bs)', [true, filenameUsed]); | ||||
|         invocation.return_value(retval); | ||||
|     } | ||||
|  | ||||
| @@ -156,7 +163,7 @@ var ScreenshotService = class { | ||||
|         return [x, y, width, height]; | ||||
|     } | ||||
|  | ||||
|     ScreenshotAreaAsync(params, invocation) { | ||||
|     async ScreenshotAreaAsync(params, invocation) { | ||||
|         let [x, y, width, height, flash, filename] = params; | ||||
|         [x, y, width, height] = this._scaleArea(x, y, width, height); | ||||
|         if (!this._checkArea(x, y, width, height)) { | ||||
| @@ -169,61 +176,57 @@ var ScreenshotService = class { | ||||
|         if (!screenshot) | ||||
|             return; | ||||
|  | ||||
|         let [stream, file] = this._createStream(filename); | ||||
|         let [stream, file] = this._createStream(filename, invocation); | ||||
|         if (!stream) | ||||
|             return; | ||||
|  | ||||
|         screenshot.screenshot_area(x, y, width, height, stream, | ||||
|             (o, res) => { | ||||
|                 try { | ||||
|                     let [result, area] = | ||||
|                         screenshot.screenshot_area_finish(res); | ||||
|                     this._onScreenshotComplete( | ||||
|                         result, area, stream, file, flash, invocation); | ||||
|                 } catch (e) { | ||||
|                     invocation.return_gerror(e); | ||||
|                 } | ||||
|             }); | ||||
|         try { | ||||
|             let [area] = | ||||
|                 await screenshot.screenshot_area(x, y, width, height, stream); | ||||
|             this._onScreenshotComplete(area, stream, file, flash, invocation); | ||||
|         } catch (e) { | ||||
|             this._removeShooterForSender(invocation.get_sender()); | ||||
|             invocation.return_value(new GLib.Variant('(bs)', [false, ''])); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     ScreenshotWindowAsync(params, invocation) { | ||||
|     async ScreenshotWindowAsync(params, invocation) { | ||||
|         let [includeFrame, includeCursor, flash, filename] = params; | ||||
|         let screenshot = this._createScreenshot(invocation); | ||||
|         if (!screenshot) | ||||
|             return; | ||||
|  | ||||
|         let [stream, file] = this._createStream(filename); | ||||
|         let [stream, file] = this._createStream(filename, invocation); | ||||
|         if (!stream) | ||||
|             return; | ||||
|  | ||||
|         screenshot.screenshot_window(includeFrame, includeCursor, stream, | ||||
|             (o, res) => { | ||||
|                 try { | ||||
|                     let [result, area] = | ||||
|                         screenshot.screenshot_window_finish(res); | ||||
|                     this._onScreenshotComplete( | ||||
|                         result, area, stream, file, flash, invocation); | ||||
|                 } catch (e) { | ||||
|                     invocation.return_gerror(e); | ||||
|                 } | ||||
|             }); | ||||
|         try { | ||||
|             let [area] = | ||||
|                 await screenshot.screenshot_window(includeFrame, includeCursor, stream); | ||||
|             this._onScreenshotComplete(area, stream, file, flash, invocation); | ||||
|         } catch (e) { | ||||
|             this._removeShooterForSender(invocation.get_sender()); | ||||
|             invocation.return_value(new GLib.Variant('(bs)', [false, ''])); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     ScreenshotAsync(params, invocation) { | ||||
|     async ScreenshotAsync(params, invocation) { | ||||
|         let [includeCursor, flash, filename] = params; | ||||
|         let screenshot = this._createScreenshot(invocation); | ||||
|         if (!screenshot) | ||||
|             return; | ||||
|  | ||||
|         let [stream, file] = this._createStream(filename); | ||||
|         let [stream, file] = this._createStream(filename, invocation); | ||||
|         if (!stream) | ||||
|             return; | ||||
|  | ||||
|         screenshot.screenshot(includeCursor, stream, | ||||
|             (o, res) => { | ||||
|                 try { | ||||
|                     let [result, area] = | ||||
|                         screenshot.screenshot_finish(res); | ||||
|                     this._onScreenshotComplete( | ||||
|                         result, area, stream, file, flash, invocation); | ||||
|                 } catch (e) { | ||||
|                     invocation.return_gerror(e); | ||||
|                 } | ||||
|             }); | ||||
|         try { | ||||
|             let [area] = await screenshot.screenshot(includeCursor, stream); | ||||
|             this._onScreenshotComplete(area, stream, file, flash, invocation); | ||||
|         } catch (e) { | ||||
|             this._removeShooterForSender(invocation.get_sender()); | ||||
|             invocation.return_value(new GLib.Variant('(bs)', [false, ''])); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async SelectAreaAsync(params, invocation) { | ||||
| @@ -264,19 +267,17 @@ var ScreenshotService = class { | ||||
|             if (!screenshot) | ||||
|                 return; | ||||
|  | ||||
|             screenshot.pick_color(coords.x, coords.y, (_o, res) => { | ||||
|                 let [success_, color] = screenshot.pick_color_finish(res); | ||||
|                 let { red, green, blue } = color; | ||||
|                 let retval = GLib.Variant.new('(a{sv})', [{ | ||||
|                     color: GLib.Variant.new('(ddd)', [ | ||||
|                         red / 255.0, | ||||
|                         green / 255.0, | ||||
|                         blue / 255.0, | ||||
|                     ]), | ||||
|                 }]); | ||||
|                 this._removeShooterForSender(invocation.get_sender()); | ||||
|                 invocation.return_value(retval); | ||||
|             }); | ||||
|             const [color] = await screenshot.pick_color(coords.x, coords.y); | ||||
|             const { red, green, blue } = color; | ||||
|             const retval = GLib.Variant.new('(a{sv})', [{ | ||||
|                 color: GLib.Variant.new('(ddd)', [ | ||||
|                     red / 255.0, | ||||
|                     green / 255.0, | ||||
|                     blue / 255.0, | ||||
|                 ]), | ||||
|             }]); | ||||
|             this._removeShooterForSender(invocation.get_sender()); | ||||
|             invocation.return_value(retval); | ||||
|         } catch (e) { | ||||
|             invocation.return_error_literal( | ||||
|                 Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED, | ||||
|   | ||||
| @@ -6,6 +6,7 @@ const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; | ||||
| const AppDisplay = imports.ui.appDisplay; | ||||
| const IconGrid = imports.ui.iconGrid; | ||||
| const Main = imports.ui.main; | ||||
| const ParentalControlsManager = imports.misc.parentalControlsManager; | ||||
| const RemoteSearch = imports.ui.remoteSearch; | ||||
| const Util = imports.misc.util; | ||||
|  | ||||
| @@ -431,6 +432,9 @@ var SearchResultsView = GObject.registerClass({ | ||||
|     _init() { | ||||
|         super._init({ name: 'searchResults', vertical: true }); | ||||
|  | ||||
|         this._parentalControlsManager = ParentalControlsManager.getDefault(); | ||||
|         this._parentalControlsManager.connect('app-filter-changed', this._reloadRemoteProviders.bind(this)); | ||||
|  | ||||
|         this._content = new MaxWidthBox({ | ||||
|             name: 'searchResultsContent', | ||||
|             vertical: true, | ||||
| @@ -505,6 +509,11 @@ var SearchResultsView = GObject.registerClass({ | ||||
|  | ||||
|     _registerProvider(provider) { | ||||
|         provider.searchInProgress = false; | ||||
|  | ||||
|         // Filter out unwanted providers. | ||||
|         if (provider.appInfo && !this._parentalControlsManager.shouldShowApp(provider.appInfo)) | ||||
|             return; | ||||
|  | ||||
|         this._providers.push(provider); | ||||
|         this._ensureProviderDisplay(provider); | ||||
|     } | ||||
|   | ||||
| @@ -15,6 +15,7 @@ const _modes = { | ||||
|     'restrictive': { | ||||
|         parentMode: null, | ||||
|         stylesheetName: 'gnome-shell.css', | ||||
|         themeResourceName: 'gnome-shell-theme.gresource', | ||||
|         hasOverview: false, | ||||
|         showCalendarEvents: false, | ||||
|         allowSettings: false, | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- | ||||
| /* exported GnomeShell, ScreenSaverDBus */ | ||||
|  | ||||
| const { Gio, GLib, Meta, Shell } = imports.gi; | ||||
| const { Gio, GLib, Meta } = imports.gi; | ||||
|  | ||||
| const Config = imports.misc.config; | ||||
| const ExtensionDownloader = imports.ui.extensionDownloader; | ||||
| @@ -255,6 +255,17 @@ var GnomeShellExtensions = class { | ||||
|     constructor() { | ||||
|         this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellExtensionsIface, this); | ||||
|         this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell'); | ||||
|  | ||||
|         this._userExtensionsEnabled = this.UserExtensionsEnabled; | ||||
|         global.settings.connect('changed::disable-user-extensions', () => { | ||||
|             if (this._userExtensionsEnabled === this.UserExtensionsEnabled) | ||||
|                 return; | ||||
|  | ||||
|             this._userExtensionsEnabled = this.UserExtensionsEnabled; | ||||
|             this._dbusImpl.emit_property_changed('UserExtensionsEnabled', | ||||
|                 new GLib.Variant('b', this._userExtensionsEnabled)); | ||||
|         }); | ||||
|  | ||||
|         Main.extensionManager.connect('extension-state-changed', | ||||
|                                       this._extensionStateChanged.bind(this)); | ||||
|     } | ||||
| @@ -301,20 +312,18 @@ var GnomeShellExtensions = class { | ||||
|     } | ||||
|  | ||||
|     LaunchExtensionPrefs(uuid) { | ||||
|         let appSys = Shell.AppSystem.get_default(); | ||||
|         let app = appSys.lookup_app('org.gnome.Extensions.desktop'); | ||||
|         let info = app.get_app_info(); | ||||
|         let timestamp = global.display.get_current_time_roundtrip(); | ||||
|         info.launch_uris([`extension:///${uuid}`], | ||||
|                          global.create_app_launch_context(timestamp, -1)); | ||||
|         this.OpenExtensionPrefs(uuid, '', {}); | ||||
|     } | ||||
|  | ||||
|     ReloadExtension(uuid) { | ||||
|         let extension = Main.extensionManager.lookup(uuid); | ||||
|         if (!extension) | ||||
|             return; | ||||
|     OpenExtensionPrefs(uuid, parentWindow, options) { | ||||
|         Main.extensionManager.openExtensionPrefs(uuid, parentWindow, options); | ||||
|     } | ||||
|  | ||||
|         Main.extensionManager.reloadExtension(extension); | ||||
|     ReloadExtensionAsync(params, invocation) { | ||||
|         invocation.return_error_literal( | ||||
|             Gio.DBusError, | ||||
|             Gio.DBusError.NOT_SUPPORTED, | ||||
|             'ReloadExtension is deprecated and does not work'); | ||||
|     } | ||||
|  | ||||
|     CheckForUpdates() { | ||||
| @@ -325,6 +334,14 @@ var GnomeShellExtensions = class { | ||||
|         return Config.PACKAGE_VERSION; | ||||
|     } | ||||
|  | ||||
|     get UserExtensionsEnabled() { | ||||
|         return !global.settings.get_boolean('disable-user-extensions'); | ||||
|     } | ||||
|  | ||||
|     set UserExtensionsEnabled(enable) { | ||||
|         global.settings.set_boolean('disable-user-extensions', !enable); | ||||
|     } | ||||
|  | ||||
|     _extensionStateChanged(_, newState) { | ||||
|         let state = ExtensionUtils.serializeExtension(newState); | ||||
|         this._dbusImpl.emit_signal('ExtensionStateChanged', | ||||
|   | ||||
| @@ -447,12 +447,8 @@ var ShellMountPasswordDialog = GObject.registerClass({ | ||||
|         let useKeyfiles = this._keyfilesCheckbox.checked; | ||||
|         this._passwordEntry.reactive = !useKeyfiles; | ||||
|         this._passwordEntry.can_focus = !useKeyfiles; | ||||
|         this._passwordEntry.clutter_text.editable = !useKeyfiles; | ||||
|         this._passwordEntry.clutter_text.selectable = !useKeyfiles; | ||||
|         this._pimEntry.reactive = !useKeyfiles; | ||||
|         this._pimEntry.can_focus = !useKeyfiles; | ||||
|         this._pimEntry.clutter_text.editable = !useKeyfiles; | ||||
|         this._pimEntry.clutter_text.selectable = !useKeyfiles; | ||||
|         this._rememberChoice.reactive = !useKeyfiles; | ||||
|         this._rememberChoice.can_focus = !useKeyfiles; | ||||
|         this._keyfilesLabel.visible = useKeyfiles; | ||||
|   | ||||
| @@ -43,10 +43,10 @@ var Slider = GObject.registerClass({ | ||||
|         let [hasHandleColor, handleBorderColor] = | ||||
|             themeNode.lookup_color('-slider-handle-border-color', false); | ||||
|  | ||||
|         let wholeHandleRadius = Math.ceil(handleRadius); | ||||
|         let handleX = wholeHandleRadius + | ||||
|             (width - 2 * wholeHandleRadius) * this._value / this._maxValue; | ||||
|         let handleY = height / 2; | ||||
|         const ceiledHandleRadius = Math.ceil(handleRadius + handleBorderWidth); | ||||
|         const handleX = ceiledHandleRadius + | ||||
|             (width - 2 * ceiledHandleRadius) * this._value / this._maxValue; | ||||
|         const handleY = height / 2; | ||||
|  | ||||
|         let color = themeNode.get_foreground_color(); | ||||
|         Clutter.cairo_set_source_color(cr, color); | ||||
| @@ -186,7 +186,7 @@ var Slider = GObject.registerClass({ | ||||
|             this.value = Math.max(0, Math.min(this._value + delta, this._maxValue)); | ||||
|             return Clutter.EVENT_STOP; | ||||
|         } | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|         return super.vfunc_key_press_event(keyPressEvent); | ||||
|     } | ||||
|  | ||||
|     _moveHandle(absX, _absY) { | ||||
|   | ||||
| @@ -139,14 +139,14 @@ class ATIndicator extends PanelMenu.Button { | ||||
|             interfaceSettings.is_writable(KEY_ICON_THEME), | ||||
|             enabled => { | ||||
|                 if (enabled) { | ||||
|                     interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME); | ||||
|                     interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME); | ||||
|                     interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME); | ||||
|                 } else if (!hasHC) { | ||||
|                     interfaceSettings.set_string(KEY_GTK_THEME, gtkTheme); | ||||
|                     interfaceSettings.set_string(KEY_ICON_THEME, iconTheme); | ||||
|                     interfaceSettings.set_string(KEY_GTK_THEME, gtkTheme); | ||||
|                 } else { | ||||
|                     interfaceSettings.reset(KEY_GTK_THEME); | ||||
|                     interfaceSettings.reset(KEY_ICON_THEME); | ||||
|                     interfaceSettings.reset(KEY_GTK_THEME); | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- | ||||
| /* exported Indicator */ | ||||
|  | ||||
| const { Gio, GnomeBluetooth, GObject } = imports.gi; | ||||
| const { Gio, GLib, GnomeBluetooth, GObject } = imports.gi; | ||||
|  | ||||
| const Main = imports.ui.main; | ||||
| const PanelMenu = imports.ui.panelMenu; | ||||
| @@ -35,7 +35,7 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|  | ||||
|                                                  this._sync(); | ||||
|                                              }); | ||||
|         this._proxy.connect('g-properties-changed', this._sync.bind(this)); | ||||
|         this._proxy.connect('g-properties-changed', this._queueSync.bind(this)); | ||||
|  | ||||
|         this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true); | ||||
|         this._item.icon.icon_name = 'bluetooth-active-symbolic'; | ||||
| @@ -49,15 +49,27 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|         this._item.menu.addSettingsAction(_("Bluetooth Settings"), 'gnome-bluetooth-panel.desktop'); | ||||
|         this.menu.addMenuItem(this._item); | ||||
|  | ||||
|         this._syncId = 0; | ||||
|         this._adapter = null; | ||||
|  | ||||
|         this._client = new GnomeBluetooth.Client(); | ||||
|         this._model = this._client.get_model(); | ||||
|         this._model.connect('row-changed', this._sync.bind(this)); | ||||
|         this._model.connect('row-deleted', this._sync.bind(this)); | ||||
|         this._model.connect('row-deleted', this._queueSync.bind(this)); | ||||
|         this._model.connect('row-changed', this._queueSync.bind(this)); | ||||
|         this._model.connect('row-inserted', this._sync.bind(this)); | ||||
|         Main.sessionMode.connect('updated', this._sync.bind(this)); | ||||
|         this._sync(); | ||||
|     } | ||||
|  | ||||
|     _setHadSetupDevices(value) { | ||||
|         if (this._hadSetupDevices === value) | ||||
|             return; | ||||
|  | ||||
|         this._hadSetupDevices = value; | ||||
|         global.settings.set_boolean( | ||||
|             HAD_BLUETOOTH_DEVICES_SETUP, this._hadSetupDevices); | ||||
|     } | ||||
|  | ||||
|     _getDefaultAdapter() { | ||||
|         let [ret, iter] = this._model.get_iter_first(); | ||||
|         while (ret) { | ||||
| @@ -72,46 +84,53 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     // nDevices is the number of devices setup for the current default | ||||
|     // adapter if one exists and is powered. If unpowered or unavailable, | ||||
|     // nDevice is "1" if it had setup devices associated to it the last | ||||
|     // time it was seen, and "-1" if not. | ||||
|     // | ||||
|     // nConnectedDevices is the number of devices connected to the default | ||||
|     // adapter if one exists and is powered, or -1 if it's not available. | ||||
|     _getNDevices() { | ||||
|         let adapter = this._getDefaultAdapter(); | ||||
|     _getDeviceInfos(adapter) { | ||||
|         if (!adapter) | ||||
|             return [this._hadSetupDevices ? 1 : -1, -1]; | ||||
|             return []; | ||||
|  | ||||
|         let nConnectedDevices = 0; | ||||
|         let nDevices = 0; | ||||
|         let deviceInfos = []; | ||||
|         let [ret, iter] = this._model.iter_children(adapter); | ||||
|         while (ret) { | ||||
|             let isConnected = this._model.get_value(iter, | ||||
|                                                     GnomeBluetooth.Column.CONNECTED); | ||||
|             if (isConnected) | ||||
|                 nConnectedDevices++; | ||||
|             const isPaired = this._model.get_value(iter, | ||||
|                 GnomeBluetooth.Column.PAIRED); | ||||
|             const isTrusted = this._model.get_value(iter, | ||||
|                 GnomeBluetooth.Column.TRUSTED); | ||||
|  | ||||
|             if (isPaired || isTrusted) { | ||||
|                 deviceInfos.push({ | ||||
|                     connected: this._model.get_value(iter, | ||||
|                         GnomeBluetooth.Column.CONNECTED), | ||||
|                     name: this._model.get_value(iter, | ||||
|                         GnomeBluetooth.Column.ALIAS), | ||||
|                 }); | ||||
|             } | ||||
|  | ||||
|             let isPaired = this._model.get_value(iter, | ||||
|                                                  GnomeBluetooth.Column.PAIRED); | ||||
|             let isTrusted = this._model.get_value(iter, | ||||
|                                                   GnomeBluetooth.Column.TRUSTED); | ||||
|             if (isPaired || isTrusted) | ||||
|                 nDevices++; | ||||
|             ret = this._model.iter_next(iter); | ||||
|         } | ||||
|  | ||||
|         if (this._hadSetupDevices != (nDevices > 0)) { | ||||
|             this._hadSetupDevices = !this._hadSetupDevices; | ||||
|             global.settings.set_boolean(HAD_BLUETOOTH_DEVICES_SETUP, this._hadSetupDevices); | ||||
|         } | ||||
|         return deviceInfos; | ||||
|     } | ||||
|  | ||||
|         return [nDevices, nConnectedDevices]; | ||||
|     _queueSync() { | ||||
|         if (this._syncId) | ||||
|             return; | ||||
|         this._syncId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { | ||||
|             this._syncId = 0; | ||||
|             this._sync(); | ||||
|             return GLib.SOURCE_REMOVE; | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     _sync() { | ||||
|         let [nDevices, nConnectedDevices] = this._getNDevices(); | ||||
|         let adapter = this._getDefaultAdapter(); | ||||
|         let devices = this._getDeviceInfos(adapter); | ||||
|         const connectedDevices = devices.filter(dev => dev.connected); | ||||
|         const nConnectedDevices = connectedDevices.length; | ||||
|  | ||||
|         if (adapter && this._adapter) | ||||
|             this._setHadSetupDevices(devices.length > 0); | ||||
|         this._adapter = adapter; | ||||
|  | ||||
|         let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter; | ||||
|  | ||||
|         this.menu.setSensitive(sensitive); | ||||
| @@ -119,19 +138,21 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|  | ||||
|         // Remember if there were setup devices and show the menu | ||||
|         // if we've seen setup devices and we're not hard blocked | ||||
|         if (nDevices > 0) | ||||
|         if (this._hadSetupDevices) | ||||
|             this._item.visible = !this._proxy.BluetoothHardwareAirplaneMode; | ||||
|         else | ||||
|             this._item.visible = this._proxy.BluetoothHasAirplaneMode && !this._proxy.BluetoothAirplaneMode; | ||||
|  | ||||
|         if (nConnectedDevices > 0) | ||||
|         if (nConnectedDevices > 1) | ||||
|             /* Translators: this is the number of connected bluetooth devices */ | ||||
|             this._item.label.text = ngettext("%d Connected", "%d Connected", nConnectedDevices).format(nConnectedDevices); | ||||
|         else if (nConnectedDevices == -1) | ||||
|             this._item.label.text = _("Off"); | ||||
|             this._item.label.text = ngettext('%d Connected", "%d Connected', nConnectedDevices).format(nConnectedDevices); | ||||
|         else if (nConnectedDevices === 1) | ||||
|             this._item.label.text = connectedDevices[0].name; | ||||
|         else if (adapter === null) | ||||
|             this._item.label.text = _('Bluetooth Off'); | ||||
|         else | ||||
|             this._item.label.text = _("On"); | ||||
|             this._item.label.text = _('Bluetooth On'); | ||||
|  | ||||
|         this._toggleItem.label.text = this._proxy.BluetoothAirplaneMode ? _("Turn On") : _("Turn Off"); | ||||
|         this._toggleItem.label.text = this._proxy.BluetoothAirplaneMode ? _('Turn On') : _('Turn Off'); | ||||
|     } | ||||
| }); | ||||
|   | ||||
| @@ -199,36 +199,36 @@ var InputSourceSystemSettings = class extends InputSourceSettings { | ||||
|                                          this._reload.bind(this)); | ||||
|     } | ||||
|  | ||||
|     _reload() { | ||||
|         Gio.DBus.system.call(this._BUS_NAME, | ||||
|                              this._BUS_PATH, | ||||
|                              this._BUS_PROPS_IFACE, | ||||
|                              'GetAll', | ||||
|                              new GLib.Variant('(s)', [this._BUS_IFACE]), | ||||
|                              null, Gio.DBusCallFlags.NONE, -1, null, | ||||
|                              (conn, result) => { | ||||
|                                  let props; | ||||
|                                  try { | ||||
|                                      props = conn.call_finish(result).deep_unpack()[0]; | ||||
|                                  } catch (e) { | ||||
|                                      log('Could not get properties from %s'.format(this._BUS_NAME)); | ||||
|                                      return; | ||||
|                                  } | ||||
|                                  let layouts = props['X11Layout'].unpack(); | ||||
|                                  let variants = props['X11Variant'].unpack(); | ||||
|                                  let options = props['X11Options'].unpack(); | ||||
|     async _reload() { | ||||
|         let props; | ||||
|         try { | ||||
|             const result = await Gio.DBus.system.call( | ||||
|                 this._BUS_NAME, | ||||
|                 this._BUS_PATH, | ||||
|                 this._BUS_PROPS_IFACE, | ||||
|                 'GetAll', | ||||
|                 new GLib.Variant('(s)', [this._BUS_IFACE]), | ||||
|                 null, Gio.DBusCallFlags.NONE, -1, null); | ||||
|             [props] = result.deep_unpack(); | ||||
|         } catch (e) { | ||||
|             log('Could not get properties from %s'.format(this._BUS_NAME)); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|                                  if (layouts != this._layouts || | ||||
|                                      variants != this._variants) { | ||||
|                                      this._layouts = layouts; | ||||
|                                      this._variants = variants; | ||||
|                                      this._emitInputSourcesChanged(); | ||||
|                                  } | ||||
|                                  if (options != this._options) { | ||||
|                                      this._options = options; | ||||
|                                      this._emitKeyboardOptionsChanged(); | ||||
|                                  } | ||||
|                              }); | ||||
|         const layouts = props['X11Layout'].unpack(); | ||||
|         const variants = props['X11Variant'].unpack(); | ||||
|         const options = props['X11Options'].unpack(); | ||||
|  | ||||
|         if (layouts !== this._layouts || | ||||
|             variants !== this._variants) { | ||||
|             this._layouts = layouts; | ||||
|             this._variants = variants; | ||||
|             this._emitInputSourcesChanged(); | ||||
|         } | ||||
|         if (options !== this._options) { | ||||
|             this._options = options; | ||||
|             this._emitKeyboardOptionsChanged(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     get inputSources() { | ||||
|   | ||||
| @@ -64,7 +64,7 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|  | ||||
|         this._item.label.text = _("Location Enabled"); | ||||
|         this._onOffAction = this._item.menu.addAction(_("Disable"), this._onOnOffAction.bind(this)); | ||||
|         this._item.menu.addSettingsAction(_("Privacy Settings"), 'gnome-privacy-panel.desktop'); | ||||
|         this._item.menu.addSettingsAction(_('Privacy Settings'), 'gnome-location-panel.desktop'); | ||||
|  | ||||
|         this.menu.addMenuItem(this._item); | ||||
|  | ||||
|   | ||||
| @@ -15,6 +15,10 @@ const Util = imports.misc.util; | ||||
|  | ||||
| const { loadInterfaceXML } = imports.misc.fileUtils; | ||||
|  | ||||
| Gio._promisify(NM.Client, 'new_async', 'new_finish'); | ||||
| Gio._promisify(NM.Client.prototype, | ||||
|     'check_connectivity_async', 'check_connectivity_finish'); | ||||
|  | ||||
| const NMConnectionCategory = { | ||||
|     INVALID: 'invalid', | ||||
|     WIRED: 'wired', | ||||
| @@ -1627,11 +1631,11 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|         this._ctypes[NM.SETTING_GSM_SETTING_NAME] = NMConnectionCategory.WWAN; | ||||
|         this._ctypes[NM.SETTING_VPN_SETTING_NAME] = NMConnectionCategory.VPN; | ||||
|  | ||||
|         NM.Client.new_async(null, this._clientGot.bind(this)); | ||||
|         this._getClient(); | ||||
|     } | ||||
|  | ||||
|     _clientGot(obj, result) { | ||||
|         this._client = NM.Client.new_finish(result); | ||||
|     async _getClient() { | ||||
|         this._client = await NM.Client.new_async(null); | ||||
|  | ||||
|         this._activeConnections = []; | ||||
|         this._connections = []; | ||||
| @@ -1982,7 +1986,7 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _portalHelperDone(proxy, emitter, parameters) { | ||||
|     async _portalHelperDone(proxy, emitter, parameters) { | ||||
|         let [path, result] = parameters; | ||||
|  | ||||
|         if (result == PortalHelperResult.CANCELLED) { | ||||
| @@ -1993,13 +1997,11 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|         } else if (result == PortalHelperResult.COMPLETED) { | ||||
|             this._closeConnectivityCheck(path); | ||||
|         } else if (result == PortalHelperResult.RECHECK) { | ||||
|             this._client.check_connectivity_async(null, (client, res) => { | ||||
|                 try { | ||||
|                     let state = client.check_connectivity_finish(res); | ||||
|                     if (state >= NM.ConnectivityState.FULL) | ||||
|                         this._closeConnectivityCheck(path); | ||||
|                 } catch (e) { } | ||||
|             }); | ||||
|             try { | ||||
|                 const state = await this._client.check_connectivity_async(null); | ||||
|                 if (state >= NM.ConnectivityState.FULL) | ||||
|                     this._closeConnectivityCheck(path); | ||||
|             } catch (e) { } | ||||
|         } else { | ||||
|             log('Invalid result from portal helper: %s'.format(result)); | ||||
|         } | ||||
|   | ||||
| @@ -11,8 +11,7 @@ class RemoteAccessApplet extends PanelMenu.SystemIndicator { | ||||
|     _init() { | ||||
|         super._init(); | ||||
|  | ||||
|         let backend = Meta.get_backend(); | ||||
|         let controller = backend.get_remote_access_controller(); | ||||
|         let controller = global.backend.get_remote_access_controller(); | ||||
|  | ||||
|         if (!controller) | ||||
|             return; | ||||
|   | ||||
| @@ -52,22 +52,21 @@ const BOLT_DBUS_PATH = '/org/freedesktop/bolt'; | ||||
| var Client = class { | ||||
|     constructor() { | ||||
|         this._proxy = null; | ||||
|         let nodeInfo = Gio.DBusNodeInfo.new_for_xml(BoltClientInterface); | ||||
|         Gio.DBusProxy.new(Gio.DBus.system, | ||||
|                           Gio.DBusProxyFlags.DO_NOT_AUTO_START, | ||||
|                           nodeInfo.lookup_interface(BOLT_DBUS_CLIENT_IFACE), | ||||
|                           BOLT_DBUS_NAME, | ||||
|                           BOLT_DBUS_PATH, | ||||
|                           BOLT_DBUS_CLIENT_IFACE, | ||||
|                           null, | ||||
|                           this._onProxyReady.bind(this)); | ||||
|  | ||||
|         this.probing = false; | ||||
|         this._getProxy(); | ||||
|     } | ||||
|  | ||||
|     _onProxyReady(o, res) { | ||||
|     async _getProxy() { | ||||
|         let nodeInfo = Gio.DBusNodeInfo.new_for_xml(BoltClientInterface); | ||||
|         try { | ||||
|             this._proxy = Gio.DBusProxy.new_finish(res); | ||||
|             this._proxy = await Gio.DBusProxy.new( | ||||
|                 Gio.DBus.system, | ||||
|                 Gio.DBusProxyFlags.DO_NOT_AUTO_START, | ||||
|                 nodeInfo.lookup_interface(BOLT_DBUS_CLIENT_IFACE), | ||||
|                 BOLT_DBUS_NAME, | ||||
|                 BOLT_DBUS_PATH, | ||||
|                 BOLT_DBUS_CLIENT_IFACE, | ||||
|                 null); | ||||
|         } catch (e) { | ||||
|             log('error creating bolt proxy: %s'.format(e.message)); | ||||
|             return; | ||||
| @@ -243,14 +242,15 @@ class Indicator extends PanelMenu.SystemIndicator { | ||||
|  | ||||
|         this._source = null; | ||||
|         this._perm = null; | ||||
|         this._createPermission(); | ||||
|     } | ||||
|  | ||||
|         Polkit.Permission.new('org.freedesktop.bolt.enroll', null, null, (source, res) => { | ||||
|             try { | ||||
|                 this._perm = Polkit.Permission.new_finish(res); | ||||
|             } catch (e) { | ||||
|                 log('Failed to get PolKit permission: %s'.format(e.toString())); | ||||
|             } | ||||
|         }); | ||||
|     async _createPermission() { | ||||
|         try { | ||||
|             this._perm = await Polkit.Permission.new('org.freedesktop.bolt.enroll', null, null); | ||||
|         } catch (e) { | ||||
|             log('Failed to get PolKit permission: %s'.format(e.toString())); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     _onDestroy() { | ||||
|   | ||||
| @@ -138,11 +138,12 @@ var StreamSlider = class { | ||||
|     } | ||||
|  | ||||
|     _notifyVolumeChange() { | ||||
|         if (this._stream.state === Gvc.MixerStreamState.RUNNING) | ||||
|             return; // feedback not necessary while playing | ||||
|  | ||||
|         if (this._volumeCancellable) | ||||
|             this._volumeCancellable.cancel(); | ||||
|         this._volumeCancellable = null; | ||||
|  | ||||
|         if (this._stream.state === Gvc.MixerStreamState.RUNNING) | ||||
|             return; // feedback not necessary while playing | ||||
|  | ||||
|         this._volumeCancellable = new Gio.Cancellable(); | ||||
|         let player = global.display.get_sound_player(); | ||||
|   | ||||
| @@ -58,7 +58,7 @@ const TouchpadSwipeGesture = GObject.registerClass({ | ||||
|         this._orientation = Clutter.Orientation.VERTICAL; | ||||
|         this._enabled = true; | ||||
|  | ||||
|         global.stage.connect('captured-event', this._handleEvent.bind(this)); | ||||
|         global.stage.connect('captured-event::touchpad', this._handleEvent.bind(this)); | ||||
|     } | ||||
|  | ||||
|     get enabled() { | ||||
|   | ||||
| @@ -130,7 +130,7 @@ var SwitcherPopup = GObject.registerClass({ | ||||
|             let [x_, y_, mods] = global.get_pointer(); | ||||
|             if (!(mods & this._modifierMask)) { | ||||
|                 this._finish(global.get_current_time()); | ||||
|                 return false; | ||||
|                 return true; | ||||
|             } | ||||
|         } else { | ||||
|             this._resetNoModsTimeout(); | ||||
| @@ -228,7 +228,9 @@ var SwitcherPopup = GObject.registerClass({ | ||||
|     } | ||||
|  | ||||
|     vfunc_scroll_event(scrollEvent) { | ||||
|         this._scrollHandler(scrollEvent.scroll_direction); | ||||
|         this._disableHover(); | ||||
|  | ||||
|         this._scrollHandler(scrollEvent.direction); | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|     } | ||||
|  | ||||
| @@ -253,7 +255,15 @@ var SwitcherPopup = GObject.registerClass({ | ||||
|  | ||||
|     _itemRemovedHandler(n) { | ||||
|         if (this._items.length > 0) { | ||||
|             let newIndex = Math.min(n, this._items.length - 1); | ||||
|             let newIndex; | ||||
|  | ||||
|             if (n < this._selectedIndex) | ||||
|                 newIndex = this._selectedIndex - 1; | ||||
|             else if (n === this._selectedIndex) | ||||
|                 newIndex = Math.min(n, this._items.length - 1); | ||||
|             else if (n > this._selectedIndex) | ||||
|                 return; // No need to select something new in this case | ||||
|  | ||||
|             this._select(newIndex); | ||||
|         } else { | ||||
|             this.fadeAndDestroy(); | ||||
| @@ -307,7 +317,7 @@ var SwitcherPopup = GObject.registerClass({ | ||||
|             this.ease({ | ||||
|                 opacity: 0, | ||||
|                 duration: POPUP_FADE_OUT_TIME, | ||||
|                 mode: Clutter.Animation.EASE_OUT_QUAD, | ||||
|                 mode: Clutter.AnimationMode.EASE_OUT_QUAD, | ||||
|                 onComplete: () => this.destroy(), | ||||
|             }); | ||||
|         } else { | ||||
| @@ -417,9 +427,8 @@ var SwitcherList = GObject.registerClass({ | ||||
|         bbox.set_child(item); | ||||
|         this._list.add_actor(bbox); | ||||
|  | ||||
|         let n = this._items.length; | ||||
|         bbox.connect('clicked', () => this._onItemClicked(n)); | ||||
|         bbox.connect('motion-event', () => this._onItemEnter(n)); | ||||
|         bbox.connect('clicked', () => this._onItemClicked(bbox)); | ||||
|         bbox.connect('motion-event', () => this._onItemEnter(bbox)); | ||||
|  | ||||
|         bbox.label_actor = label; | ||||
|  | ||||
| @@ -434,16 +443,23 @@ var SwitcherList = GObject.registerClass({ | ||||
|         this.emit('item-removed', index); | ||||
|     } | ||||
|  | ||||
|     _onItemClicked(index) { | ||||
|         this._itemActivated(index); | ||||
|     addAccessibleState(index, state) { | ||||
|         this._items[index].add_accessible_state(state); | ||||
|     } | ||||
|  | ||||
|     _onItemEnter(index) { | ||||
|     removeAccessibleState(index, state) { | ||||
|         this._items[index].remove_accessible_state(state); | ||||
|     } | ||||
|  | ||||
|     _onItemClicked(item) { | ||||
|         this._itemActivated(this._items.indexOf(item)); | ||||
|     } | ||||
|  | ||||
|     _onItemEnter(item) { | ||||
|         // Avoid reentrancy | ||||
|         if (index != this._currentItemEntered) { | ||||
|             this._currentItemEntered = index; | ||||
|             this._itemEntered(index); | ||||
|         } | ||||
|         if (item !== this._items[this._highlighted]) | ||||
|             this._itemEntered(this._items.indexOf(item)); | ||||
|  | ||||
|         return Clutter.EVENT_PROPAGATE; | ||||
|     } | ||||
|  | ||||
| @@ -468,40 +484,40 @@ var SwitcherList = GObject.registerClass({ | ||||
|         let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0); | ||||
|         let [containerWidth] = this.get_transformed_size(); | ||||
|         if (posX + this._items[index].get_width() > containerWidth) | ||||
|             this._scrollToRight(); | ||||
|             this._scrollToRight(index); | ||||
|         else if (this._items[index].allocation.x1 - value < 0) | ||||
|             this._scrollToLeft(); | ||||
|             this._scrollToLeft(index); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     _scrollToLeft() { | ||||
|     _scrollToLeft(index) { | ||||
|         let adjustment = this._scrollView.hscroll.adjustment; | ||||
|         let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values(); | ||||
|  | ||||
|         let item = this._items[this._highlighted]; | ||||
|         let item = this._items[index]; | ||||
|  | ||||
|         if (item.allocation.x1 < value) | ||||
|             value = Math.min(0, item.allocation.x1); | ||||
|             value = Math.max(0, item.allocation.x1); | ||||
|         else if (item.allocation.x2 > value + pageSize) | ||||
|             value = Math.max(upper, item.allocation.x2 - pageSize); | ||||
|             value = Math.min(upper, item.allocation.x2 - pageSize); | ||||
|  | ||||
|         this._scrollableRight = true; | ||||
|         adjustment.ease(value, { | ||||
|             progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD, | ||||
|             duration: POPUP_SCROLL_TIME, | ||||
|             onComplete: () => { | ||||
|                 if (this._highlighted == 0) | ||||
|                 if (index === 0) | ||||
|                     this._scrollableLeft = false; | ||||
|                 this.queue_relayout(); | ||||
|             }, | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     _scrollToRight() { | ||||
|     _scrollToRight(index) { | ||||
|         let adjustment = this._scrollView.hscroll.adjustment; | ||||
|         let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values(); | ||||
|  | ||||
|         let item = this._items[this._highlighted]; | ||||
|         let item = this._items[index]; | ||||
|  | ||||
|         if (item.allocation.x1 < value) | ||||
|             value = Math.max(0, item.allocation.x1); | ||||
| @@ -513,7 +529,7 @@ var SwitcherList = GObject.registerClass({ | ||||
|             progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD, | ||||
|             duration: POPUP_SCROLL_TIME, | ||||
|             onComplete: () => { | ||||
|                 if (this._highlighted == this._items.length - 1) | ||||
|                 if (index === this._items.length - 1) | ||||
|                     this._scrollableRight = false; | ||||
|                 this.queue_relayout(); | ||||
|             }, | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user