Compare commits
810 Commits
3.2.1
...
wip/input-
Author | SHA1 | Date | |
---|---|---|---|
d4802861ed | |||
a8fa0b8146 | |||
cf0bb62f40 | |||
de8106967d | |||
1a24f061cf | |||
e038845458 | |||
b03273c765 | |||
915524e1ab | |||
d579cd1605 | |||
cb5941ec55 | |||
a5ac183d86 | |||
a36de92bb9 | |||
01f9d551f1 | |||
399df66b18 | |||
723a1c843a | |||
e333263fd6 | |||
507df9eea1 | |||
a9a3687ea0 | |||
f05c649c61 | |||
a2dfba1842 | |||
c199da4dfa | |||
ee9033e12f | |||
54788d750e | |||
78e894c6f2 | |||
32107ba8b5 | |||
6122f65e7a | |||
43fd29f9bf | |||
54c624b356 | |||
8c33adfd29 | |||
2e8881b77c | |||
64aa729edd | |||
ccf95b738d | |||
b2847fedd3 | |||
8befcb9bba | |||
988fc52303 | |||
7293ddb22c | |||
f23c118e81 | |||
f68b3be35a | |||
3d95e7bb11 | |||
337c484f01 | |||
5d98e2bf04 | |||
6f300d0cc6 | |||
3422e1dca7 | |||
963c6ae567 | |||
6304169926 | |||
221afde55e | |||
0ae87270ad | |||
9d33baec70 | |||
0f37b22cdb | |||
47afd87e84 | |||
700c06023e | |||
4fea5b5ca3 | |||
521bddc1cc | |||
bdfff20ec2 | |||
bdd05aba3b | |||
89c2538ff1 | |||
7680819108 | |||
d79e8b84c9 | |||
731317230a | |||
5046938913 | |||
0e8fd45559 | |||
6099a5dbc3 | |||
2daa98a694 | |||
5d2c6496fa | |||
817dbbe73f | |||
29c89c82f8 | |||
0b714bd479 | |||
8c94a5afb9 | |||
aeb117c9d1 | |||
a2d4f133b7 | |||
b833aff3c8 | |||
6601e4ddba | |||
815da2d0ec | |||
ddd35b3653 | |||
8a32894c83 | |||
49d8e6da40 | |||
8089f24c81 | |||
b6aab53d10 | |||
55a4517cd1 | |||
b095319a16 | |||
5ea5806730 | |||
bfbf812148 | |||
168e9eeac1 | |||
dd79c1a79a | |||
fe3402589b | |||
74dcaff21c | |||
0a7968a2e5 | |||
00091a2acb | |||
c5aa834b6a | |||
b1bde46694 | |||
49e4fa494e | |||
4622c52b71 | |||
e9ac5dd5f4 | |||
7570c43d11 | |||
4332e7ec49 | |||
9f26f1e225 | |||
0c0319c415 | |||
c16dbd7607 | |||
7b1f10a5fe | |||
dce74749b7 | |||
1ba88b8c42 | |||
9c50b57d46 | |||
900bd3ee97 | |||
b4affe00a7 | |||
ca49c84bc1 | |||
2cddf60226 | |||
d9c3951f02 | |||
aa5997d975 | |||
c51acf7c2a | |||
348044bc8a | |||
7dbdf2aa07 | |||
c933731ead | |||
e7da715994 | |||
6d82aefad4 | |||
8a11ab7d96 | |||
f465086405 | |||
70313a8b79 | |||
71679c38be | |||
addd943074 | |||
0b8470421c | |||
bcf7c0f006 | |||
2b87bb015c | |||
07e10fa03e | |||
bf992989c7 | |||
00400e354d | |||
19a49d34ce | |||
e8badac282 | |||
282a60fcab | |||
e76a28ded5 | |||
b22543ab66 | |||
d5165cdc08 | |||
1c0549f468 | |||
a7316b0594 | |||
634eeaf74c | |||
1299e196be | |||
92c325230d | |||
827a466a5c | |||
89b38b1361 | |||
140de6dd60 | |||
e64ff5832e | |||
17b1543d44 | |||
043e79a570 | |||
5d036e3d54 | |||
9d2a638988 | |||
7943993fcb | |||
026ddc2d9b | |||
384c7e2c17 | |||
700f706428 | |||
0a4deb2a9b | |||
5b8abe6809 | |||
2c5005c1ea | |||
c2b3022163 | |||
644abb2dc9 | |||
48b53c30f7 | |||
bf3818eb22 | |||
b3358aeed7 | |||
a7d4c7d8de | |||
369c1b0a41 | |||
21636f3f29 | |||
bf428312d7 | |||
6218209dcb | |||
1b7ead3455 | |||
3a252a1b41 | |||
fc7e6470b5 | |||
3813a03117 | |||
e59c29993c | |||
92d2ebc3f9 | |||
67ef448471 | |||
207abe9a2c | |||
05863227a6 | |||
ac05cb323c | |||
066d44636a | |||
3dbf06420d | |||
1983097d3a | |||
1c60aa58ae | |||
1626d9f9a4 | |||
c7182589d2 | |||
ceb17dc713 | |||
46c0360b03 | |||
0ebddfcf50 | |||
36d20eb1b8 | |||
db4b266874 | |||
63cf470e07 | |||
1f87eb4157 | |||
9bb9999b46 | |||
60e6349963 | |||
581d1c5db1 | |||
cf0b6dda25 | |||
8a5faa3d2e | |||
09607787cc | |||
0aad74a670 | |||
985f28bbea | |||
22e1abbaff | |||
21e8097b9c | |||
14d267c246 | |||
9420174477 | |||
fb4878bb7c | |||
c856cbb523 | |||
2e42eb6bad | |||
4f87e86603 | |||
3c6737f738 | |||
b2bc73c3fe | |||
30ca25e978 | |||
ecdd0875df | |||
d05d748fe2 | |||
8db193a172 | |||
c064973c9d | |||
01c66eaf0c | |||
c2fdec188e | |||
d7e2b0a771 | |||
06354a8c9a | |||
7c25dead17 | |||
f4d3153e91 | |||
7030d59b2f | |||
6eae036ac3 | |||
b6b6ed0e2f | |||
51b5825665 | |||
1c2629595e | |||
e91f4e88b5 | |||
bdb7dbdd00 | |||
7092521253 | |||
47f7fcd4fe | |||
93a004b016 | |||
2fad9d73d4 | |||
252eb24522 | |||
b7964e9efb | |||
23e7a9e710 | |||
36804a60c9 | |||
73270345f5 | |||
e1ffe06709 | |||
3dd240bdbb | |||
b58425d7d7 | |||
a197ce6f53 | |||
9dcdaf05b5 | |||
c827cccdf3 | |||
6805f2d71e | |||
0ea690a2f2 | |||
d68ff69c7a | |||
f1f2bc28a2 | |||
5f0389c07c | |||
c2f304f3bc | |||
ce9c1a1f7a | |||
203382e007 | |||
d2ba9eb967 | |||
59ebec25f3 | |||
b864b03a65 | |||
c7a37660ce | |||
02aae631d8 | |||
d542f63d3f | |||
74694a6e23 | |||
a5baeac428 | |||
e23e04953c | |||
fa9f923697 | |||
797e201946 | |||
156a642d28 | |||
96379b7517 | |||
9b5bb62aa7 | |||
895745ac14 | |||
6cde2d8db4 | |||
a277f8e0e1 | |||
cf5c5d06e1 | |||
722f45fa58 | |||
c97390b9c6 | |||
124c461a56 | |||
4ac352637c | |||
00cf62acfb | |||
ee0c2a1152 | |||
f32ab20267 | |||
1316f93b21 | |||
52d72fe8a1 | |||
0406aaa591 | |||
8f56660cfc | |||
402cc6b90c | |||
b8c14ad64e | |||
1f9c83d88b | |||
319667a25c | |||
b047a37a80 | |||
31af220483 | |||
40d51ea59f | |||
284cf83935 | |||
5ba04a7478 | |||
2b87051022 | |||
a901f2dc5d | |||
bd6f1f2c6d | |||
ca612872a6 | |||
feb33a6a28 | |||
ff92d962f3 | |||
79ca0d579c | |||
c61ac862ba | |||
64ce622f83 | |||
772638c78e | |||
24badb46fe | |||
87d54b37e4 | |||
98aa61e2a4 | |||
bea5c6f4e6 | |||
7d29e691a4 | |||
b0d161faad | |||
4c74fa81d1 | |||
556a3e08db | |||
e3fb77c051 | |||
3ee07d0e82 | |||
72c486cb3e | |||
e37574510e | |||
f4b58f35ba | |||
01696f19e8 | |||
1f5a27d5c5 | |||
81476dedcb | |||
90b08acbf1 | |||
f967fd21f8 | |||
8d854d5f1a | |||
fde5932b45 | |||
eb84227f78 | |||
550d595034 | |||
24cc4b49d6 | |||
5f130d1925 | |||
4f05787338 | |||
a98db33c18 | |||
a5d78f2943 | |||
46ebe9ffc5 | |||
e2b80658ca | |||
0a586c5c92 | |||
aa5d352a06 | |||
760da64a4c | |||
714ffc5ef1 | |||
fd4d645687 | |||
24ad59ea37 | |||
15f881f967 | |||
d5285674ae | |||
bb862e20c0 | |||
be3eb308b9 | |||
e7f0b1dc59 | |||
336cec8b2a | |||
fad0b96f24 | |||
d2aab9d6a6 | |||
4005863e3d | |||
70cdb67f31 | |||
a9aec6956d | |||
d871eda6be | |||
49d620a414 | |||
2e2e3281da | |||
37cbfe29cf | |||
a1f88fc17f | |||
0065da61bd | |||
d2b0706c40 | |||
a95e585e39 | |||
7d39fa76dd | |||
ddf27c1a84 | |||
87e46f3ff1 | |||
33a6fda6c3 | |||
7cc1bdb35d | |||
60557f4e0f | |||
914441218a | |||
e322d98886 | |||
ba1e5f8f71 | |||
517075c605 | |||
540e970170 | |||
d0fd5641c1 | |||
caaa21dec0 | |||
22c606326f | |||
00ed2973b2 | |||
3837fc0a87 | |||
07b95d3436 | |||
1f5dd9c397 | |||
007736a234 | |||
c2a9f7fbb2 | |||
b18cc8de86 | |||
30e4f80894 | |||
dd8a53d5e0 | |||
0f01928402 | |||
a8b081661c | |||
c892610f27 | |||
72dad591fa | |||
ea19790828 | |||
cc2f5d19c8 | |||
64b2c5d1b4 | |||
a9f728d2a7 | |||
3736d81d8f | |||
fbcea03ab3 | |||
f19ee78fb2 | |||
b47fd6df31 | |||
786beccca5 | |||
916c62a702 | |||
11234c7cfc | |||
80eac7370e | |||
ac78a1e1c0 | |||
34c6ff9645 | |||
f6749fb204 | |||
89fe43f70c | |||
e2c66ce48a | |||
eb0d803617 | |||
53d9ea7a2c | |||
0fbdd0b67f | |||
f248aa69dc | |||
9f1ed13a38 | |||
9400d8f6db | |||
c7a4b307af | |||
0bac3a5dd7 | |||
14b92a4897 | |||
66bd8b553f | |||
e80462a2c3 | |||
b990ed2c23 | |||
097e56f4ab | |||
7a4b6138c1 | |||
bc918d0d18 | |||
8b08d8bf2d | |||
d92c97f755 | |||
6a367917f7 | |||
b67138b5ae | |||
0e5177c329 | |||
c6ed3cdb61 | |||
fd99d13f04 | |||
36c3ce9333 | |||
aee28616a9 | |||
70830560ae | |||
df6cd46bd6 | |||
dce797f4d9 | |||
f3232901d8 | |||
d3e4f44d37 | |||
d81958a074 | |||
92ee17493c | |||
f9e456bb47 | |||
740388c778 | |||
1c0c42e8e7 | |||
e2726f3e38 | |||
ed465a6ffe | |||
fd8f3df2cd | |||
0c2037875a | |||
fbf6e032d0 | |||
c8020e6559 | |||
68b7e8437b | |||
6528f8366f | |||
88eb246b60 | |||
bed50688d2 | |||
44686bac3e | |||
ca575ef0ae | |||
c20503028a | |||
4516e4cc3b | |||
b2ec340f9e | |||
570a029f27 | |||
ebe72e197d | |||
ce629b09b2 | |||
97c2db1cfd | |||
c5804c1929 | |||
92276c5e70 | |||
62c0088dd8 | |||
e8498adaf1 | |||
c7fa719cc3 | |||
41f0e133a9 | |||
7705a65beb | |||
604e8f4f8a | |||
de0116d8c8 | |||
8d968e5c9b | |||
758e573483 | |||
eab4f4c963 | |||
245c58842b | |||
e508635c6e | |||
138b8cf874 | |||
d446b657f3 | |||
019dd2e1b0 | |||
602da771f6 | |||
5de8a0a84b | |||
d2198925e1 | |||
44e02003ad | |||
e8bfd990e4 | |||
d1fc87577a | |||
8b4c1a80d0 | |||
6ca0d4a5ef | |||
d0cd6ba47d | |||
aa2a63bd84 | |||
daa380fb0e | |||
61e2e04f13 | |||
db7e4ddc04 | |||
c4aa277b19 | |||
ab29ce872a | |||
57beb0ade1 | |||
e3d0b6f90f | |||
e2aa954cb5 | |||
05c285a945 | |||
27b34992c6 | |||
4886238761 | |||
42d46aed90 | |||
a622aba7eb | |||
831099cca5 | |||
b8a54faf94 | |||
80ff6ff797 | |||
2f27b94757 | |||
b2f33e2895 | |||
d1d4142052 | |||
46caf6d673 | |||
2864c360bc | |||
e5dfc6323a | |||
5bc042ba6f | |||
c63fe5ee24 | |||
ee6bc33cea | |||
5c730dc53d | |||
5a3de8d663 | |||
fad88dd517 | |||
39dd24310d | |||
b13809d0c7 | |||
87559414a3 | |||
b5b5759829 | |||
d254e2e1f2 | |||
458b0b22fc | |||
cd30128af8 | |||
d61cdd8cea | |||
0d0e545979 | |||
6c5e96c33a | |||
bae2359b54 | |||
8cbbb456f0 | |||
dfd39461cf | |||
60d8683ae7 | |||
f2cc5cf152 | |||
d4a26fbf4b | |||
025784fd83 | |||
4e89a5edde | |||
b3936ecadf | |||
2c9e6bb589 | |||
73261a4a66 | |||
3d0dd38045 | |||
8bcbf3030f | |||
1bc7edc5d8 | |||
0673720db9 | |||
730a0d4c5a | |||
9147dee0de | |||
12746a1949 | |||
bdd65fe755 | |||
21e2280825 | |||
e9d2a429eb | |||
b67dfb9edf | |||
55308917f9 | |||
1b64b09532 | |||
74dd298891 | |||
5a85fc0e55 | |||
26991988cb | |||
15563444cf | |||
3bcdba6e1d | |||
ef56a78544 | |||
049a561466 | |||
b40b19997a | |||
46505a8314 | |||
78fb102002 | |||
c6e924f788 | |||
f6508b51a2 | |||
b0ae596de8 | |||
1d311e7916 | |||
0c19f71c96 | |||
8d6ab32b9a | |||
6c1a2d531f | |||
c6e9f9742b | |||
d23aaf3cea | |||
017fde91ad | |||
31ffc5a85d | |||
62b65a25d8 | |||
882fe48d80 | |||
90a691ed25 | |||
eadb41b3bb | |||
6829590c8f | |||
29da720e6a | |||
c5932c0f07 | |||
6195386a06 | |||
0080440118 | |||
b5be62cd1b | |||
1bac40fbe3 | |||
11637bae43 | |||
301bacec9f | |||
8943b3b0e9 | |||
f59018f2d7 | |||
235cb9c505 | |||
3f328463a8 | |||
e58c82fc04 | |||
91ca86ffe4 | |||
33d4518e50 | |||
b087191d2b | |||
64baea1693 | |||
b88b743428 | |||
c606cf076d | |||
d205d7e7c2 | |||
efdd3375d0 | |||
abcca3d3bc | |||
f4d13b9801 | |||
7da39031e1 | |||
6cdb1bd60c | |||
7c108e267c | |||
5cf06fe9a7 | |||
41f6956197 | |||
417cbea79c | |||
225c807550 | |||
ff78d2655b | |||
bde15f7c61 | |||
30300f1aeb | |||
d42c3a15d6 | |||
14a65559af | |||
ba1e7bd095 | |||
951705a4b2 | |||
36bf63a5de | |||
66c4881fd2 | |||
c6b169cb33 | |||
0e753ed5a6 | |||
785969feb5 | |||
56036476a4 | |||
936b1b5638 | |||
bf3b94d654 | |||
90b4a0856f | |||
686190ce80 | |||
45495c2474 | |||
9caa88fecb | |||
25948f214e | |||
bea4faacd4 | |||
a7bd9f811b | |||
2b9561fcbb | |||
7b9c9b2f7d | |||
b47b82ed42 | |||
c4c2c11dca | |||
ce38293a0f | |||
6c4e9d23f2 | |||
4aa1fe9ca2 | |||
951fff5aa0 | |||
5ad8080cb9 | |||
e53e3cbb09 | |||
8a029f333f | |||
4debedb275 | |||
8764253861 | |||
bbdce159fa | |||
087d8e602e | |||
50aa15dec9 | |||
26580f8f2c | |||
875b6d131b | |||
77afd6782f | |||
09ab13cf04 | |||
56f312dc03 | |||
f2cbddc196 | |||
c7846e172f | |||
54afb7b25e | |||
f3cb9d0443 | |||
fcee7f2f3a | |||
faff0738eb | |||
69e26c6dee | |||
1acec65c5e | |||
8a6a3968c3 | |||
58e4870cb8 | |||
102099cadd | |||
efe6d06ddd | |||
f0d0e025dd | |||
fc2d0215f5 | |||
02af8eb824 | |||
102f2a91f9 | |||
2c649d5da5 | |||
7fa7d04ed0 | |||
aad9179373 | |||
d5b4e30eb7 | |||
34ba6f2f71 | |||
d845f40b98 | |||
80c16aa8f7 | |||
0cbaeaefed | |||
ab6a7773ce | |||
85e243982b | |||
6eb168bc68 | |||
47b55e29d4 | |||
2c243b678f | |||
a634f25d30 | |||
26df6cf35c | |||
84dde8e9bb | |||
f2c79be11a | |||
10df80b96a | |||
bbb83656bf | |||
ef49670ae4 | |||
e4df00c77d | |||
3d70662716 | |||
8d0638a187 | |||
06143396b7 | |||
17c46c2452 | |||
0996174b3d | |||
d6b6f814d3 | |||
987099ea55 | |||
b356aa8e3b | |||
566bdb50c2 | |||
2b57603271 | |||
c3528f5b6b | |||
4c7cc94cdc | |||
5ff2285707 | |||
d714dfd82e | |||
b1064cbe50 | |||
8d3e5ea507 | |||
001b6afc7e | |||
55d6c5ea8f | |||
fa2ff8158f | |||
97e7ea0b5d | |||
65dec2b72a | |||
5fd3ca8d09 | |||
dc9a8d505d | |||
fc8d13f4bd | |||
d1aa7de5d0 | |||
e279ef1c7c | |||
b88657ab83 | |||
d20e646ed6 | |||
8678b87120 | |||
960571a589 | |||
d856338f86 | |||
2b6b2d93a9 | |||
363bd04166 | |||
9bc1a68fe4 | |||
2c2729f7be | |||
9011959356 | |||
c79b8bbe7e | |||
da59eebf8e | |||
7854024326 | |||
a9ab8784c4 | |||
de5b00fd52 | |||
6547f75b12 | |||
827bf506a7 | |||
adc187c32e | |||
5350302b09 | |||
167ca75388 | |||
46cea67258 | |||
463e0919d4 | |||
98906c1da3 | |||
b71e66c335 | |||
2b6c5bb416 | |||
628e59894b | |||
703d2ead33 | |||
43f53a708f | |||
07e7331e7b | |||
c516af3130 | |||
39727d1156 | |||
85cd189a69 | |||
a8e35422f2 | |||
3941961f8b | |||
d9c6485cbf | |||
c52ccc76a3 | |||
be1c4f26b5 | |||
a6ee6739e0 | |||
54a8ad8bc6 | |||
2541bfcdf2 | |||
d7d5da0301 | |||
d2bd9efc25 | |||
779b18bf48 | |||
618a53b34f | |||
f4eaadb948 | |||
ea061b0f46 | |||
3652e42699 | |||
398489f661 | |||
70fc13500d | |||
18541c447e | |||
3294a6e1a7 | |||
38563c38e8 | |||
a465c5f996 | |||
1760ba1279 | |||
3d3c9546a2 | |||
203c5db5eb | |||
cf44234323 | |||
cc94076ffb | |||
8d137eae5b | |||
51fa9ae513 | |||
9951c92459 | |||
ee77e5d582 | |||
d74721f229 | |||
1aa97b19f7 | |||
95de48e986 | |||
a147d0428d | |||
90b3f7b7f6 | |||
c80acfda08 | |||
8a39145e3c | |||
b62f5ef07d | |||
bd5c6c5cd6 | |||
f874a57439 | |||
6a4525e554 | |||
d553a5bdc0 | |||
80076965a7 | |||
84e8d38d4c | |||
33f3f9d997 | |||
be72b1d066 | |||
dc5d2b83ef | |||
3dabe645c2 | |||
e9ede362dc | |||
01357aca35 | |||
c944dd6768 | |||
ff01ed5e4b | |||
d23c374326 | |||
a69ebc8a68 | |||
f4d8a35b9d | |||
2b140f8fb7 | |||
ab603bdbbf | |||
44e2f7f555 | |||
fd1b3b4fee | |||
4ae2a0b2a5 | |||
0cb415b3bd | |||
c1fa9a82e6 | |||
dde124ab5a | |||
668920cec4 | |||
9b38c5b304 | |||
e63c2da433 | |||
38c768fdb3 | |||
0dd4584157 | |||
b7bf712b97 | |||
615723d8df | |||
de352a309d | |||
c573e7f9a1 | |||
d59fd1a75d | |||
18d69d7032 | |||
5d25716cee | |||
840e79c18c | |||
ddf562e306 | |||
20a6ce7003 | |||
8c43298af0 | |||
4bb48e56d2 | |||
338ba10ca2 | |||
36eb745ecc | |||
b07e45e214 | |||
bba5198e63 | |||
9e2bab008a |
19
.gitignore
vendored
@ -18,9 +18,26 @@ config
|
|||||||
configure
|
configure
|
||||||
data/gnome-shell.desktop
|
data/gnome-shell.desktop
|
||||||
data/gnome-shell.desktop.in
|
data/gnome-shell.desktop.in
|
||||||
|
data/gnome-shell-extension-prefs.desktop
|
||||||
|
data/gnome-shell-extension-prefs.desktop.in
|
||||||
data/gschemas.compiled
|
data/gschemas.compiled
|
||||||
data/org.gnome.shell.gschema.xml
|
data/org.gnome.shell.gschema.xml
|
||||||
data/org.gnome.shell.gschema.valid
|
data/org.gnome.shell.gschema.valid
|
||||||
|
data/org.gnome.shell.evolution.calendar.gschema.xml
|
||||||
|
data/org.gnome.shell.evolution.calendar.gschema.valid
|
||||||
|
docs/reference/*/*.args
|
||||||
|
docs/reference/*/*.bak
|
||||||
|
docs/reference/*/*.hierarchy
|
||||||
|
docs/reference/*/*.interfaces
|
||||||
|
docs/reference/*/*.prerequisites
|
||||||
|
docs/reference/*/*.sgml
|
||||||
|
docs/reference/*/*.signals
|
||||||
|
docs/reference/*/*.stamp
|
||||||
|
docs/reference/*/*.txt
|
||||||
|
docs/reference/*/*.types
|
||||||
|
docs/reference/*/html/
|
||||||
|
docs/reference/*/xml/
|
||||||
|
gtk-doc.make
|
||||||
js/misc/config.js
|
js/misc/config.js
|
||||||
intltool-extract.in
|
intltool-extract.in
|
||||||
intltool-merge.in
|
intltool-merge.in
|
||||||
@ -49,9 +66,11 @@ src/calendar-server/org.gnome.Shell.CalendarServer.service
|
|||||||
src/gnome-shell
|
src/gnome-shell
|
||||||
src/gnome-shell-calendar-server
|
src/gnome-shell-calendar-server
|
||||||
src/gnome-shell-extension-tool
|
src/gnome-shell-extension-tool
|
||||||
|
src/gnome-shell-extension-prefs
|
||||||
src/gnome-shell-hotplug-sniffer
|
src/gnome-shell-hotplug-sniffer
|
||||||
src/gnome-shell-jhbuild
|
src/gnome-shell-jhbuild
|
||||||
src/gnome-shell-perf-helper
|
src/gnome-shell-perf-helper
|
||||||
|
src/gnome-shell-perf-tool
|
||||||
src/gnome-shell-real
|
src/gnome-shell-real
|
||||||
src/hotplug-sniffer/org.gnome.Shell.HotplugSniffer.service
|
src/hotplug-sniffer/org.gnome.Shell.HotplugSniffer.service
|
||||||
src/run-js-test
|
src/run-js-test
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Point to our macro directory and pick up user flags from the environment
|
# Point to our macro directory and pick up user flags from the environment
|
||||||
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
||||||
|
|
||||||
SUBDIRS = data js src browser-plugin tests po man
|
SUBDIRS = data js src browser-plugin tests po man docs
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
.project \
|
.project \
|
||||||
@ -19,3 +19,5 @@ DIST_EXCLUDE = \
|
|||||||
distcheck-hook:
|
distcheck-hook:
|
||||||
@echo "Checking disted files against files in git"
|
@echo "Checking disted files against files in git"
|
||||||
@$(srcdir)/tools/check-for-missing.py $(srcdir) $(distdir) $(DIST_EXCLUDE)
|
@$(srcdir)/tools/check-for-missing.py $(srcdir) $(distdir) $(DIST_EXCLUDE)
|
||||||
|
|
||||||
|
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
|
||||||
|
374
NEWS
@ -1,3 +1,375 @@
|
|||||||
|
3.4.1
|
||||||
|
=====
|
||||||
|
* Fix crash that occurred when an icon theme change caused unexpected
|
||||||
|
reentrancy in the icon loading code [Jasper; #673512]
|
||||||
|
* Don't show system and other disabled users in the GDM user list
|
||||||
|
[Adel; #673784]
|
||||||
|
* Make gnome-shell-calendar-server initialize GTK+ so it can display
|
||||||
|
password prompts if needed [#673608; Owen, Rico]
|
||||||
|
* Adapt to Mutter API change for keybinding addition [Florian; #673014]
|
||||||
|
* Fix crash when an extension was installed as both a user extension
|
||||||
|
and a system extension [#673613; Jasper]
|
||||||
|
* Fix bug where chat entry could end up partially offscreen [Joost, 661944]
|
||||||
|
* Fix problem where icons weren't updating when theme was changed
|
||||||
|
[#672941; Florian]
|
||||||
|
* Look for Evolution calendar settings in GSettings, not GConf [#673610; Owen]
|
||||||
|
* Add <super>F10 for the application menu [#672909; Florian]
|
||||||
|
* Fix %Id format characters to work in translations [#673106; Cosimo]
|
||||||
|
(were already used in fa translation)
|
||||||
|
* Fix error when NetworkManager restarts [#673043; Giovanni]
|
||||||
|
* Improve efficiency of overview redraws by working around Clutter issue
|
||||||
|
[Stefano; #670636]
|
||||||
|
* Misc bug fixes [Florian, Giovanni, Jasper, Rui, Stefano;
|
||||||
|
#672592, #672641, #672719, #673187, #673233, #673656]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Giovanni Campagna, Cosimo Cecchi, Stefano Facchini, Adel Gadllah, Rui Matos,
|
||||||
|
Florian Müllner, Jasper St. Pierre, Owen Taylor, Rico Tzschichholz,
|
||||||
|
Joost Verdoorn
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
Khaled Hosny [ar], Ihar Hrachyshka [be], Alexander Shopov [bg], Gil Forcada,
|
||||||
|
Jordi Serratosa [ca], Petr Kovar [cs], Bruce Cowan [en_GB],
|
||||||
|
Carles Ferrando [ca@valencia], Wolfgang Stöggl [de], Daniel Mustieles [es],
|
||||||
|
Arash Mousavi [fa], Bruno Brouard [fr], Fran Diéguez [gl],
|
||||||
|
Sweta Kothari [gu], Yaron Shahrabani [he], Gabor Kelemen [hu],
|
||||||
|
Shankar Prasad [kn], Žygimantas Beručka [lt], Rudolfs Mazurs [lv],
|
||||||
|
Sandeep Sheshrao Shedmake [mr], Kjartan Maraas [nb], Piotr Drąg [pl],
|
||||||
|
Yuri Myasoedov [ru], Daniel Nylander [se], Matej Urbančič [sl],
|
||||||
|
Miroslav Nikolić [sr], Sasi Bhushan, Praveen Illa [te], Yinghua Wang [zh_CN]
|
||||||
|
|
||||||
|
3.4.0
|
||||||
|
=====
|
||||||
|
* Don't crash when taking screenshots [Jasper; #672775]
|
||||||
|
* Fix dialog-resizing problem [Florian; #672543]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Florian Müllner, Jasper St. Pierre
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
Khaled Hosny, Abderrahim Kitouni [ar], Ihar Hrachyshka [be],
|
||||||
|
Alexander Shopov [bg], Marek Černocký [cs], Jiri Grönroos, Timo Jyrinki [fi],
|
||||||
|
Bruno Brouard [fr], Fran Diéguez [gl], Yaron Shahrabani [he],
|
||||||
|
Gabor Kelemen [hu], Jiro Matsuzawa [ja], Kenneth Nielsen [dk],
|
||||||
|
Mattias Põldaru [et], Changwoo Ryu [ko], Rudolfs Mazurs [lv],
|
||||||
|
Jonh Wendell [pt_BR], Yuri Myasoedov[ru], Daniel Korostil [uk],
|
||||||
|
Nguyễn Thái Ngọc Duy [vi], Chao-Hsiung Liao [zh_HK, zh_TW]
|
||||||
|
|
||||||
|
3.3.92
|
||||||
|
======
|
||||||
|
* Add shell-dialogs for GNOME Keyring prompts [Stef; #652459, #652460, #671034]
|
||||||
|
* When the user returns from idle, bring up the message tray if there were
|
||||||
|
messages while they were away [Marina; #643014]
|
||||||
|
* https://live.gnome.org/EveryDetailMatters
|
||||||
|
- Make the workspace thumbnails clickable all the way to the edge of the
|
||||||
|
screen [Stefano; #643319]
|
||||||
|
- Don't slide out the workspace thumbnails if the mouse is over them when
|
||||||
|
entering the overview [Joost, #651092]
|
||||||
|
- Fix placeholder jumps while dragging a dash item [Joost; #651842]
|
||||||
|
- Don't favorite apps if they are dropped back at the same position
|
||||||
|
[Jean-Philippe; #656333]
|
||||||
|
- To avoid confusion, don't allow removing running apps from favorites
|
||||||
|
[Florian; #644853]
|
||||||
|
- Fix creation of new workspaces by dragging application launchers
|
||||||
|
[Stefano; #664202]
|
||||||
|
- Make it easier to drag dash items without triggering the menu
|
||||||
|
[Florian; #637103]
|
||||||
|
* Accessibility [Alejandro]
|
||||||
|
- Add StWidget API for easily adding accessible states and setting roles,
|
||||||
|
names [#668366, #667432, #671378]
|
||||||
|
- Set accessibility information on UI elements
|
||||||
|
[#644255, #667432, #668361, #672047, #670308, #670312, #670719, #671404]
|
||||||
|
* Improve key-navigation in the overview [Rui, Florian; #663901]
|
||||||
|
* Key navigation bug fixes [Rui, Florian; #662493, #663437, #665215, #671998]
|
||||||
|
* Honor a 'org.gnome.shell.overrides.dynamic-workspaces' setting that
|
||||||
|
determines whether the workspace count is dynamic and unsaved in GSettings
|
||||||
|
or static and saved. [Florian; #671568]
|
||||||
|
* Avoid saving user presence to GSettings when not necessary
|
||||||
|
[Florian; #665701, #668214]
|
||||||
|
* Save screencasts in the users Videos/ directory [Adel; #670749]
|
||||||
|
Use a "human readable" filename [Florian, Adel, Ray; #670753]
|
||||||
|
* Allow dragging from the empty part of the top panel to unmaximize a window
|
||||||
|
[Florian; #666359]
|
||||||
|
* Fix hangs that could occur when switching away to a VT [Ray; #653833]
|
||||||
|
* Fix problems with installing from extensions.gnome.org [Giovanni; #671134]
|
||||||
|
* Fix locking the screen when suspending via menu [David, Gert; #670820]
|
||||||
|
* Fix browser plugin with Konqueror and Opera [Jasper]
|
||||||
|
* Fix shell restart not to bring up failure screen [Giovanni; #648384]
|
||||||
|
* Reorganize and clean up CSS theming [Allan; #668209]
|
||||||
|
* Improve appearance of modal dialogs [Allan, Florian; #670227, #668209]
|
||||||
|
* Update the calendar code to use ECalClient [Giovanni; #671177]
|
||||||
|
* Update jhbuild script to use the main moduleset [Owen, Will; #668440]
|
||||||
|
* StTextureCache: code cleanup, evict unused icons, merge together
|
||||||
|
simulataneous requests for the same icon [Jasper; #670771, #671656, #672273]
|
||||||
|
* Clean up St for recent Clutter changes and fix bugs. StContainer and
|
||||||
|
StGroup are removed [Jasper, Florian; #670034, #670640, #670904]
|
||||||
|
* Code cleanup [Adel, Jasper, Rui; #613194, #671086, #671103]
|
||||||
|
* Misc bug fixes
|
||||||
|
[Adel, Colin G, Cosimo, Florian, Giovanni, Jasper, Marius, Rui, Stefano;
|
||||||
|
#651130, #658946, #667552, #670076, #671001, #670979, #671410, #671411,
|
||||||
|
#671556, #671656, #671657, #672011, #672024, #672240, #672265, #672270,
|
||||||
|
#672321, #672326, #672413, #672471]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Jean-Philippe Braun, Giovanni Campagna, Cosimo Cecchi, Allan Day,
|
||||||
|
Stefano Facchini, David Foerster, Adel Gadllah, Marius Gedminas,
|
||||||
|
Colin Guthrie, Gert Michael Kulyk, William Lachance, Rui Matos,
|
||||||
|
Florian Müllner, Alejandro Piñeiro, Jan Alexander Steffens,
|
||||||
|
Jasper St. Pierre, Ray Strode, Owen Taylor, Joost Verdoorn, Stef Walter,
|
||||||
|
Marina Zhurakhinskaya
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
Nilamdyuti Goswami [as], Ihar Hrachyshka, Kasia Bondarava [be],
|
||||||
|
Alexander Shopov, Ivaylo Valkov [bg], Gil Forcada [ca], Marek Černocký [cs],
|
||||||
|
Mario Blättermann [de], Kris Thomsen [dk], Bruce Cowan [en_GB],
|
||||||
|
Kristjan Schmidt [eo], Daniel Mustieles [es], Mattias Põldaru [et],
|
||||||
|
Inaki Larranaga Murgoitio [eu], Arash Mousavi [fa], Timo Jyrinki [fi],
|
||||||
|
Bruno Brouard [fr], Fran Diéguez [gl], Sweta Kothari [gu],
|
||||||
|
Yaron Shahrabani [he], Gabor Kelemen [hu], Jiro Matsuzawa [ja],
|
||||||
|
Baurzhan Muftakhidinov [kk], Seong-ho Cho [ko], Žygimantas Beručka [lt],
|
||||||
|
Anita Reitere [lv], Anish A, Praveen Arimbrathodiyil, Mohammed Sadiq [ml],
|
||||||
|
fKjartan Maraas [nb], Wouter Bolsterlee [nl], A S Alam [pa], Piotr Drąg [pl],
|
||||||
|
Duarte Loreto [pt], Jonh Wendell [pt_BR], Yuri Myasoedov [ru],
|
||||||
|
Matej Urbančič [sl], Miroslav Nikolić [sr], Tirumurti Vasudevan [ta],
|
||||||
|
Sasi Bhushan, Krishnababu Krothapalli [te], Daniel Korostil [uk],
|
||||||
|
Nguyễn Thái Ngọc Duy [vi], YunQiang Su, Yinghua Wang [zh_CN],
|
||||||
|
Chao-Hsiung Liao [zh_HK, zh_TW]
|
||||||
|
|
||||||
|
3.3.90
|
||||||
|
======
|
||||||
|
|
||||||
|
* Allow other applications to implement search providers via D-Bus
|
||||||
|
[Florian; #663125, #670148]
|
||||||
|
* Remove "Recent Items" search, as replaced by Documents search
|
||||||
|
[Florian; #663125]
|
||||||
|
* Allow NetworkManager VPN plugins to use a shell-themed dialog
|
||||||
|
[Giovanni; #658484]
|
||||||
|
* Port away from deprecated Clutter API [Jasper, Florian, Adel; #670034]
|
||||||
|
- StTooltip is removed
|
||||||
|
- StWidget is now a concrete class and can be instantiated
|
||||||
|
- st_container_destroy_children(), st_box_layout_insert_actor(),
|
||||||
|
and other functions removed in favor of new replacements in Clutter.
|
||||||
|
* Use systemd for console/session handling when available [Lennart]
|
||||||
|
* Visual improvements to contact search, padding, top panel, checkboxes
|
||||||
|
[Allan, Florian, Jakub; #669489, #669811, #669993]
|
||||||
|
* Add a include_cursor parameter to Screenshot and ScreenshotWindow
|
||||||
|
D-Bus methods [Adel; #670086]
|
||||||
|
* Add a "FlashArea" D-Bus method to do the screenshot flash without a
|
||||||
|
screenshot [Adel; #669660]
|
||||||
|
* Build fixes [Adel, Giovanni, Jasper; #658484, #669637]
|
||||||
|
* Misc bug fixes [Adel, Florian, Giovanni, Guillaume, Jasper, Jeff,
|
||||||
|
Marc-Antoine, Stef, Stefano, Will; #642135, #658484, #658908, #667694,
|
||||||
|
#669098, #669921, #669662, #669694, #669776, #669887, #669921, #670005,
|
||||||
|
#670006, #670319, #670418, #670489]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Giovanni Campagna, Cosimo Cecchi, Allan Day, Guillaume Desmottes, Jeff Epler,
|
||||||
|
Stefano Facchini, Adel Gadllah, Florian Müllner, Marc-Antoine Perennou,
|
||||||
|
Jasper St. Pierre, Lennart Poettering, Jakub Steiner, Jasper St. Pierre,
|
||||||
|
Will Thompson, Stef Walter
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
Ihar Hrachyshka [be], Marek Černocký, Adam Matoušek [cs],
|
||||||
|
Kenneth Nielsen [dk], Daniel Mustieles [es], Mattias Põldaru [et],
|
||||||
|
Fran Diéguez [gl], Yaron Shahrabani [he], Luca Ferretti [it],
|
||||||
|
Baurzhan Muftakhidinov [kk], Aurimas Černius [lt], Kjartan Maraas [nb],
|
||||||
|
A S Alam [pa], Matej Urbančič [sl], Miroslav Nikolić [sr],
|
||||||
|
Praveen Illa [te], Chao-Hsiung Liao [zh_HK, zh_TW]
|
||||||
|
|
||||||
|
3.3.5
|
||||||
|
=====
|
||||||
|
|
||||||
|
* Extension system: [Jasper; #668429]
|
||||||
|
http://blog.mecheye.net/2012/02/more-extension-api-breaks/
|
||||||
|
- Add a 'gnome-shell-extension-prefs' application for displaying extension
|
||||||
|
preferences as provided by the extension in a prefs.js file.
|
||||||
|
- Allow launching gnome-shell-extension-prefs from extensions.gnome.org
|
||||||
|
throuhg the browser plugin.
|
||||||
|
- Add ExtensionUtils.getCurrentExtension() for an extension to get a
|
||||||
|
handle to an extension object, to get local imports or paths.
|
||||||
|
- Add an onshellrestart callback to the browser plugin [Jasper; #668517]
|
||||||
|
* Screenshots:
|
||||||
|
- Move the screenshot "flash" to the shell [Cosimo; #668618]
|
||||||
|
- Move saving screenshots to a thread [Adel; #652952]
|
||||||
|
- Correctly screenshot rounded decorations [Jasper; #662486]
|
||||||
|
* Screen recorder:
|
||||||
|
- Change the default pipeline to favor speed over quality [Owen; #669066]
|
||||||
|
- Drop frames to keep from running the user out of memory [Owen; #669066]
|
||||||
|
* Work around a slow implementation of glReadPixels() in the Intel drivers,
|
||||||
|
improving performance for screenshots and the screen recorder.
|
||||||
|
[Owen; #669065]
|
||||||
|
* Use Keywords: field in desktop files when search for applications
|
||||||
|
[Florian; #609702]
|
||||||
|
* Strip debian- when matching desktop file names [Jasper; #665647]
|
||||||
|
* Fix up various problems from CSS background size-addition
|
||||||
|
[Florian, Jasper; #668430, #633462]
|
||||||
|
* UI tweaks and behavior fixes
|
||||||
|
[Florian, Giovanni, Stefano; #643867, #666197, #664622]
|
||||||
|
* Some improvements to exported accessibility information [Alejando; #667376]
|
||||||
|
* Don't show contacts without IM information as offline [Florian; #662685]
|
||||||
|
* Don't change status from hidden to extended_away when going idle
|
||||||
|
[Florian; #642408]
|
||||||
|
* Cleanups [Emmanuele, Jasper; #662152, #669239]
|
||||||
|
* Misc bug fixes [Cosimo, Dan, Florian, Jasper, Rui, Stefano;
|
||||||
|
#633462, #643867, #662213, #662386, #662747, #665000, #665017, #665322,
|
||||||
|
#667371, #667860, #668020, #668517, #668541, #669236]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Emmanuele Bassi, Giovanni Campagna, Cosimo Cecchi, Stefano Facchini,
|
||||||
|
Adel Gadllah, Rui Matos, Florian Müllner, Alejandro Piñeiro,
|
||||||
|
Jasper St. Pierre, Owen Taylor, Dan Winship
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
Daniel Mustieles [es], Timo Jyrinki [fi], Seán de Búrca [ga],
|
||||||
|
Fran Diéguez [gl], Kjartan Maraas [nb], Wouter Bolsterlee [nl],
|
||||||
|
Danishka Navin [si], Yaron Shahrabani [he], Matej Urbančič [sl],
|
||||||
|
Chao-Hsiung Liao [zh_HK, zh_TW]
|
||||||
|
|
||||||
|
3.3.4
|
||||||
|
=====
|
||||||
|
* https://live.gnome.org/EveryDetailMatters
|
||||||
|
- Add "browse" for labels for dash items - once a tooltip is
|
||||||
|
showing, switch to other items without a delay [Seif; #666170]
|
||||||
|
- Always scale down windows in the overview at least to 70% [Vit; #646704]
|
||||||
|
- Fix the new-workspace drop indicator sometimes getting stuck
|
||||||
|
[Stefano; #664201]
|
||||||
|
- Delay rearranging windows in the overview as long as the pointer
|
||||||
|
is over a window [Vit; #645325]
|
||||||
|
* Add a GConf => DConf migration file for overriden Mutter settings
|
||||||
|
[Florian; #667636]
|
||||||
|
* When a VPN connection is active, show that as the network icon
|
||||||
|
[Giovanni; #665115]
|
||||||
|
* Handle the "ExtendedAway" IM status as away, not offline [Guillaume; #667813]
|
||||||
|
* Improve the appearance of the labels in "Applications" [Alex; #642392]
|
||||||
|
* Adjust for GTK+ and Mutter API changes for application menu [Ryan; #668118]
|
||||||
|
* Add section label support to the application menu [Giovanni; #666681]
|
||||||
|
* Fix screenshot methods to work again [Cosimo; #667662]
|
||||||
|
* Fix several crashers related to updating workspace thumbnails [Owen; #667652]
|
||||||
|
* Fix memory management error causing gnome-shell-hotplug-sniffer to crash
|
||||||
|
[Owen; #667378]
|
||||||
|
* Build fixes [Emmanuele, Rico; #667864]
|
||||||
|
* Code cleanups [Adel; #668087]
|
||||||
|
* Misc bug fixes [Colin, Florian, Giovanni, Owen, Xavier; #633028, #658817,
|
||||||
|
#664138, #667881, #668048, #668050]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Emmanuele Bassi, Giovanni Campagna, Cosimo Cecchi, Xavier Claessens,
|
||||||
|
Guillaume Desmottes, Stefano Facchini, Adel Gadllah, Alex Hultman,
|
||||||
|
Ryan Lortie, Seif Lotfy, Florian Müllner, Vit Stanislav, Owen Taylor,
|
||||||
|
Rico Tzschichholz, Colin Walters
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
Ihar Hrachyshka [be], Alexander Shopov [bg], Arash Mousavi [fa],
|
||||||
|
Jiri Grönroos, Timo Jyrinki [fi], Fran Diéguez [gl], Kjartan Maraas [nb],
|
||||||
|
Yuri Myasoedov [ru], Matej Urbančič [sl], Nguyễn Thái Ngọc Duy [vi]
|
||||||
|
|
||||||
|
3.3.3
|
||||||
|
=====
|
||||||
|
* https://live.gnome.org/EveryDetailMatters
|
||||||
|
- Stop flashing the window labels on actions in overview [Zan; #644861]
|
||||||
|
- Improve the look of window captions in the overview [Marc; #664487]
|
||||||
|
- Move dash tooltips beside the icon [Seif, Stefano; #666166]
|
||||||
|
* Support application menus exported from applications via new GLib API
|
||||||
|
and D-Bus protocol. [Giovanni, Colin, Matthias, Cosimo]
|
||||||
|
* For removable device prompts, show "Open with Rhythmbox], rather
|
||||||
|
than "Open with Rhythmbox Music Player' [Florian; #664561]
|
||||||
|
* Switch to activating the message tray only with a hot corner rather
|
||||||
|
than a full row of pixels, allowing mouse events to apps [Rui; #663366]
|
||||||
|
* Fully handle the case where the workspaces-only-on-primary
|
||||||
|
GSetting is set to false [Florian; #652580]
|
||||||
|
* Add support for background-size CSS property to St [Quentin; #633462]
|
||||||
|
* Port to new GJS Lang.Class framework [Giovanni; #664436]
|
||||||
|
* Finish port to GDBus [Giovanni; #664436]
|
||||||
|
* Stop using the deprecated Clutter default stage [Florian, Jasper; #664052]
|
||||||
|
* Fix bugs that kept browser plugin from working in WebKit-based browser
|
||||||
|
[Jasper; #666444]
|
||||||
|
* Fix typo that made uninstalling extensions not work [Jasper]
|
||||||
|
* Fix crash in browser plugin if shell is not run [Jürg]
|
||||||
|
* Reintroduce piscine paschal ovum [Giovanni; #666606]
|
||||||
|
* Network menu bug fixes
|
||||||
|
Giovanni; #664124, #665194, #665680, #666429, #666614]
|
||||||
|
* Misc bug fixes [Florian, Jasper, Jonny, Marina, Ron; #647587, #659272,
|
||||||
|
#664138, #665261, #666020, #666243]
|
||||||
|
* Build fixes [Owen]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Jürg Billeter, Giovanni Campagna, Stefano Candori, Cosimo Cecchi,
|
||||||
|
Matthias Clasen, Zan Dobersek, Quentin Glidic, Jonny Lamb, Ryan Lortie,
|
||||||
|
Seif Lotfy, Rui Matos, Florian Müllner, Bastien Nocera, Jasper St. Pierre,
|
||||||
|
Marc Plano-Lesay, Owen Taylor, Colin Walters, Ron Yorsten,
|
||||||
|
Marina Zhurakhinskaya
|
||||||
|
|
||||||
|
Translations:
|
||||||
|
Petr Kovar [cs], Kris Thomsen [dk], Daniel Mustieles [es],
|
||||||
|
Ville-Pekka Vainio [fi], Yaron Shahrabani [he], Luca Ferretti [it],
|
||||||
|
Hideki Yamane [ja], Žygimantas Beručka [lt], Jovan Naumovski [mk],
|
||||||
|
Kjartan Maraas [nb], "Andreas N" [nn], Lucian Adrian Grijincu [ro],
|
||||||
|
Matej Urbančič [sl], Praveen Illa [te], Muhammet Kara [tr],
|
||||||
|
Daniel Korostil [uk], Aron Xu [zh_CN]
|
||||||
|
|
||||||
|
3.3.2
|
||||||
|
=====
|
||||||
|
* Port D-Bus usage in the shell to GDBus [Giovanni, Marc-Antoine, Florian,
|
||||||
|
Jasper, Matthias; #648651, #658078, #663902, #663941]
|
||||||
|
* Message tray
|
||||||
|
- Add right-click option to chats to mute the conversation [Ana; #659962]
|
||||||
|
- Don't steal the focus when popping up under the pointer [Rui; #661358]
|
||||||
|
* Looking Glass
|
||||||
|
- Add alt-Tab completion [Jason; #661054]
|
||||||
|
- Show errors from extensions in the extensions tab [Jasper; #660546]
|
||||||
|
- Allow switching tabs with <Control>PageUp/PageDown
|
||||||
|
- Theme consistently with the rest of the shell [Jason; 650900]
|
||||||
|
* Extension system
|
||||||
|
- Don't try to load disabled extensions at all [Jasper; #661815, #662704]
|
||||||
|
- Enable and disable plugins in a consistent order [Jasper; #661815, #662704]
|
||||||
|
- Add options to enable/disable extensions to gnome-shell-extension-tool
|
||||||
|
[Jasper; #661815]
|
||||||
|
* Adapt to Mutter change to GSettings [Florian, Matthias; #663429]
|
||||||
|
* Allow creating a new workspace by dragging a window or launcher in the
|
||||||
|
middle of two existing ones [Jasper; #646409]
|
||||||
|
* Allow using Alt-Tab while during drag-and-drop and other operations
|
||||||
|
that grab the pointer [Adel; #660457]
|
||||||
|
* Do a better job of finding the right user to authenticate
|
||||||
|
as when showing a PolKit dialog [Matthias; #651547]
|
||||||
|
* Control the D-Bus Eval() method by the developer-tools GSetting which
|
||||||
|
is used for looking glass and screen recorder. [Jasper; #662891]
|
||||||
|
* Fix browser plugin to work under WebKit-based browser [Jasper; #663823]
|
||||||
|
* Fix certain stacking issues with alt-Tab [Jasper; #660650]
|
||||||
|
* Fixes for GLib deprecations [Jasper; #662011]p
|
||||||
|
* Fixes for GTK+ deprecations [Florian, Rico; #662245]p
|
||||||
|
* Fixes for Clutter deprecations [Jasper; #662627]
|
||||||
|
* Visual improvements and UI tweaks [Florian, Jakub, Jasper;
|
||||||
|
#662800, #658096, #662226]
|
||||||
|
* Hard-code "Home" as the name for the home dir, rather than looking
|
||||||
|
it up via GSettings; avoids schema dependency [Cosimo; #559895]
|
||||||
|
* Don't show "Switch User" on single user machines [Florian; #657011]
|
||||||
|
* Generate documentation for St toolkit [Florian]
|
||||||
|
* Improve marking of strings for translation [Matthias, Piotr; #658664]
|
||||||
|
* Networking menu bug fixes [Giovanni; #650007, #651378, #659277, #663278]
|
||||||
|
* Code cleanups and leak fixes to StTextureCache
|
||||||
|
[Jasper, Florian; #660968, #662998]
|
||||||
|
* Code cleanups [Adel, Florian, Jasper; #662238, #663584]
|
||||||
|
* Build fixes [Adel, Colin, Florian, Ming Han]
|
||||||
|
* Misc bug fixes [Adel, Florian, "Fry", Jasper, Giovanni, Ray, Rui, Stefan;
|
||||||
|
#660520, #661029, #661231, #661623, #661921, #662235, #662236, #662502,
|
||||||
|
#662394, #662799, #662969, #663175, #663277, #663815, #663891, #662967]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Giovanni Campagna, Cosimo Cecchi, Matthias Clasen, Piotr Drąg, Adel Gadllah,
|
||||||
|
Rui Matos, Florian Müllner, Marc-Antoine Perennou, Ana Risteska,
|
||||||
|
Jason Siefken, Jakub Steiner, Ray Strode, Jasper St. Pierre, Ming Han Teh,
|
||||||
|
Rico Tzschichholz, Colin Walters, Stefan Zwanenburg
|
||||||
|
|
||||||
|
Translation:
|
||||||
|
Alexander Shopov [bg], Marek Černocký [cs], Mario Blättermann [de],
|
||||||
|
Kostas Papadimas [el], Bruce Cowan [en_GB], Kristjan Schmidt [eo],
|
||||||
|
Jorge González, Daniel Mustieles, Benjamín Valero Espinosa [es],
|
||||||
|
Mattias Põldaru [et], Arash Mousavi [fa], Ville-Pekka Vainio [fi],
|
||||||
|
Fran Diéguez [gl], Yaron Shahrabani [he], Hideki Yamane [ja],
|
||||||
|
Algimantas Margevičius [lt], Kjartan Maraas [nb], Daniel Nylander [se],
|
||||||
|
Matej Urbančič [sl], Praveen Illa [te], Muhammet Kara [tr],
|
||||||
|
Nguyễn Thái Ngọc Duy [vi], Cheng-Chia Tseng [zh_HK, zh_TW]
|
||||||
|
|
||||||
3.2.1
|
3.2.1
|
||||||
=====
|
=====
|
||||||
* Restore the IM state on startup - if you were available in when you logged
|
* Restore the IM state on startup - if you were available in when you logged
|
||||||
@ -91,7 +463,7 @@ Contributors:
|
|||||||
Translations:
|
Translations:
|
||||||
Friedel Wolff [af], Nilamdyuti Goswami [as], Ihar Hrachyshka [be],
|
Friedel Wolff [af], Nilamdyuti Goswami [as], Ihar Hrachyshka [be],
|
||||||
Ivaylo Valkov [bg], Gil Forcada [ca], Carles Ferrando [ca@valencia],
|
Ivaylo Valkov [bg], Gil Forcada [ca], Carles Ferrando [ca@valencia],
|
||||||
Petr Kovar [cz], Mario Blättermann [de], Kris Thomsen [dk],
|
Petr Kovar [cs], Mario Blättermann [de], Kris Thomsen [dk],
|
||||||
Tiffany Antopolski, Kristjan Schmidt [eo], Daniel Mustieles [es],
|
Tiffany Antopolski, Kristjan Schmidt [eo], Daniel Mustieles [es],
|
||||||
Inaki Larranaga Murgoitio [eu], Tommi Vainikainen [fi], Bruno Brouard [fr],
|
Inaki Larranaga Murgoitio [eu], Tommi Vainikainen [fi], Bruno Brouard [fr],
|
||||||
Fran Dieguez [gl], Yaron Shahrabani [he], Gabor Kelemen [hu],
|
Fran Dieguez [gl], Yaron Shahrabani [he], Gabor Kelemen [hu],
|
||||||
|
@ -41,14 +41,12 @@
|
|||||||
"It can be used only by extensions.gnome.org"
|
"It can be used only by extensions.gnome.org"
|
||||||
#define PLUGIN_MIME_STRING "application/x-gnome-shell-integration::Gnome Shell Integration Dummy Content-Type";
|
#define PLUGIN_MIME_STRING "application/x-gnome-shell-integration::Gnome Shell Integration Dummy Content-Type";
|
||||||
|
|
||||||
#define PLUGIN_API_VERSION 1
|
#define PLUGIN_API_VERSION 3
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
} PluginData;
|
} PluginData;
|
||||||
|
|
||||||
/* =============== public entry points =================== */
|
|
||||||
|
|
||||||
static NPNetscapeFuncs funcs;
|
static NPNetscapeFuncs funcs;
|
||||||
|
|
||||||
static inline gchar *
|
static inline gchar *
|
||||||
@ -71,10 +69,7 @@ get_string_property (NPP instance,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
result_str = NPVARIANT_TO_STRING (result);
|
result_str = NPVARIANT_TO_STRING (result);
|
||||||
if (strlen (result_str.UTF8Characters) != result_str.UTF8Length)
|
result_copy = g_strndup (result_str.UTF8Characters, result_str.UTF8Length);
|
||||||
goto out;
|
|
||||||
|
|
||||||
result_copy = g_strdup (result_str.UTF8Characters);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
funcs.releasevariantvalue (&result);
|
funcs.releasevariantvalue (&result);
|
||||||
@ -109,7 +104,7 @@ check_origin_and_protocol (NPP instance)
|
|||||||
&location))
|
&location))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!NPVARIANT_IS_OBJECT (document))
|
if (!NPVARIANT_IS_OBJECT (location))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
hostname = get_string_property (instance,
|
hostname = get_string_property (instance,
|
||||||
@ -150,12 +145,16 @@ check_origin_and_protocol (NPP instance)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* =============== public entry points =================== */
|
||||||
|
|
||||||
NPError
|
NPError
|
||||||
NP_Initialize(NPNetscapeFuncs *pfuncs, NPPluginFuncs *plugin)
|
NP_Initialize(NPNetscapeFuncs *pfuncs, NPPluginFuncs *plugin)
|
||||||
{
|
{
|
||||||
/* global initialization routine, called once when plugin
|
/* global initialization routine, called once when plugin
|
||||||
is loaded */
|
is loaded */
|
||||||
|
|
||||||
|
g_type_init ();
|
||||||
|
|
||||||
g_debug ("plugin loaded");
|
g_debug ("plugin loaded");
|
||||||
|
|
||||||
memcpy (&funcs, pfuncs, sizeof (funcs));
|
memcpy (&funcs, pfuncs, sizeof (funcs));
|
||||||
@ -269,7 +268,9 @@ typedef struct {
|
|||||||
NPP instance;
|
NPP instance;
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
NPObject *listener;
|
NPObject *listener;
|
||||||
|
NPObject *restart_listener;
|
||||||
gint signal_id;
|
gint signal_id;
|
||||||
|
guint watch_name_id;
|
||||||
} PluginObject;
|
} PluginObject;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -287,7 +288,7 @@ on_shell_signal (GDBusProxy *proxy,
|
|||||||
gint32 status;
|
gint32 status;
|
||||||
gchar *error;
|
gchar *error;
|
||||||
NPVariant args[3];
|
NPVariant args[3];
|
||||||
NPVariant result;
|
NPVariant result = { NPVariantType_Void };
|
||||||
|
|
||||||
g_variant_get (parameters, "(sis)", &uuid, &status, &error);
|
g_variant_get (parameters, "(sis)", &uuid, &status, &error);
|
||||||
STRINGZ_TO_NPVARIANT (uuid, args[0]);
|
STRINGZ_TO_NPVARIANT (uuid, args[0]);
|
||||||
@ -303,6 +304,25 @@ on_shell_signal (GDBusProxy *proxy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_shell_appeared (GDBusConnection *connection,
|
||||||
|
const gchar *name,
|
||||||
|
const gchar *name_owner,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
PluginObject *obj = (PluginObject*) user_data;
|
||||||
|
|
||||||
|
if (obj->restart_listener)
|
||||||
|
{
|
||||||
|
NPVariant result = { NPVariantType_Void };
|
||||||
|
|
||||||
|
funcs.invokeDefault (obj->instance, obj->restart_listener,
|
||||||
|
NULL, 0, &result);
|
||||||
|
|
||||||
|
funcs.releasevariantvalue (&result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static NPObject *
|
static NPObject *
|
||||||
plugin_object_allocate (NPP instance,
|
plugin_object_allocate (NPP instance,
|
||||||
NPClass *klass)
|
NPClass *klass)
|
||||||
@ -315,6 +335,14 @@ plugin_object_allocate (NPP instance,
|
|||||||
obj->signal_id = g_signal_connect (obj->proxy, "g-signal",
|
obj->signal_id = g_signal_connect (obj->proxy, "g-signal",
|
||||||
G_CALLBACK (on_shell_signal), obj);
|
G_CALLBACK (on_shell_signal), obj);
|
||||||
|
|
||||||
|
obj->watch_name_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
|
||||||
|
"org.gnome.Shell",
|
||||||
|
G_BUS_NAME_WATCHER_FLAGS_NONE,
|
||||||
|
on_shell_appeared,
|
||||||
|
NULL,
|
||||||
|
obj,
|
||||||
|
NULL);
|
||||||
|
|
||||||
g_debug ("plugin object created");
|
g_debug ("plugin object created");
|
||||||
|
|
||||||
return (NPObject*)obj;
|
return (NPObject*)obj;
|
||||||
@ -331,6 +359,9 @@ plugin_object_deallocate (NPObject *npobj)
|
|||||||
if (obj->listener)
|
if (obj->listener)
|
||||||
funcs.releaseobject (obj->listener);
|
funcs.releaseobject (obj->listener);
|
||||||
|
|
||||||
|
if (obj->watch_name_id)
|
||||||
|
g_bus_unwatch_name (obj->watch_name_id);
|
||||||
|
|
||||||
g_debug ("plugin object destroyed");
|
g_debug ("plugin object destroyed");
|
||||||
|
|
||||||
g_slice_free (PluginObject, obj);
|
g_slice_free (PluginObject, obj);
|
||||||
@ -344,7 +375,9 @@ static NPIdentifier enable_extension_id;
|
|||||||
static NPIdentifier install_extension_id;
|
static NPIdentifier install_extension_id;
|
||||||
static NPIdentifier uninstall_extension_id;
|
static NPIdentifier uninstall_extension_id;
|
||||||
static NPIdentifier onextension_changed_id;
|
static NPIdentifier onextension_changed_id;
|
||||||
|
static NPIdentifier onrestart_id;
|
||||||
static NPIdentifier get_errors_id;
|
static NPIdentifier get_errors_id;
|
||||||
|
static NPIdentifier launch_extension_prefs_id;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
plugin_object_has_method (NPObject *npobj,
|
plugin_object_has_method (NPObject *npobj,
|
||||||
@ -355,7 +388,8 @@ plugin_object_has_method (NPObject *npobj,
|
|||||||
name == enable_extension_id ||
|
name == enable_extension_id ||
|
||||||
name == install_extension_id ||
|
name == install_extension_id ||
|
||||||
name == uninstall_extension_id ||
|
name == uninstall_extension_id ||
|
||||||
name == get_errors_id);
|
name == get_errors_id ||
|
||||||
|
name == launch_extension_prefs_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
@ -458,9 +492,12 @@ plugin_enable_extension (PluginObject *obj,
|
|||||||
NPString uuid,
|
NPString uuid,
|
||||||
gboolean enabled)
|
gboolean enabled)
|
||||||
{
|
{
|
||||||
const gchar *uuid_str = uuid.UTF8Characters;
|
gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
|
||||||
if (!uuid_is_valid (uuid_str))
|
if (!uuid_is_valid (uuid_str))
|
||||||
|
{
|
||||||
|
g_free (uuid_str);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
g_dbus_proxy_call (obj->proxy,
|
g_dbus_proxy_call (obj->proxy,
|
||||||
(enabled ? "EnableExtension" : "DisableExtension"),
|
(enabled ? "EnableExtension" : "DisableExtension"),
|
||||||
@ -471,6 +508,8 @@ plugin_enable_extension (PluginObject *obj,
|
|||||||
NULL, /* callback */
|
NULL, /* callback */
|
||||||
NULL /* user_data */);
|
NULL /* user_data */);
|
||||||
|
|
||||||
|
g_free (uuid_str);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,21 +518,32 @@ plugin_install_extension (PluginObject *obj,
|
|||||||
NPString uuid,
|
NPString uuid,
|
||||||
NPString version_tag)
|
NPString version_tag)
|
||||||
{
|
{
|
||||||
const gchar *uuid_str = uuid.UTF8Characters;
|
gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
|
||||||
|
gchar *version_tag_str;
|
||||||
|
|
||||||
if (!uuid_is_valid (uuid_str))
|
if (!uuid_is_valid (uuid_str))
|
||||||
|
{
|
||||||
|
g_free (uuid_str);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
version_tag_str = g_strndup (version_tag.UTF8Characters,
|
||||||
|
version_tag.UTF8Length);
|
||||||
|
|
||||||
g_dbus_proxy_call (obj->proxy,
|
g_dbus_proxy_call (obj->proxy,
|
||||||
"InstallRemoteExtension",
|
"InstallRemoteExtension",
|
||||||
g_variant_new ("(ss)",
|
g_variant_new ("(ss)",
|
||||||
uuid_str,
|
uuid_str,
|
||||||
version_tag.UTF8Characters),
|
version_tag_str),
|
||||||
G_DBUS_CALL_FLAGS_NONE,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
-1, /* timeout */
|
-1, /* timeout */
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
NULL, /* callback */
|
NULL, /* callback */
|
||||||
NULL /* user_data */);
|
NULL /* user_data */);
|
||||||
|
|
||||||
|
g_free (uuid_str);
|
||||||
|
g_free (version_tag_str);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,11 +554,14 @@ plugin_uninstall_extension (PluginObject *obj,
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *res;
|
GVariant *res;
|
||||||
const gchar *uuid_str;
|
gchar *uuid_str;
|
||||||
|
|
||||||
uuid_str = uuid.UTF8Characters;
|
uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
|
||||||
if (!uuid_is_valid (uuid_str))
|
if (!uuid_is_valid (uuid_str))
|
||||||
|
{
|
||||||
|
g_free (uuid_str);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
res = g_dbus_proxy_call_sync (obj->proxy,
|
res = g_dbus_proxy_call_sync (obj->proxy,
|
||||||
"UninstallExtension",
|
"UninstallExtension",
|
||||||
@ -519,6 +572,8 @@ plugin_uninstall_extension (PluginObject *obj,
|
|||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
&error);
|
&error);
|
||||||
|
|
||||||
|
g_free (uuid_str);
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
g_warning ("Failed to uninstall extension: %s", error->message);
|
g_warning ("Failed to uninstall extension: %s", error->message);
|
||||||
@ -536,11 +591,14 @@ plugin_get_info (PluginObject *obj,
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *res;
|
GVariant *res;
|
||||||
const gchar *uuid_str;
|
gchar *uuid_str;
|
||||||
|
|
||||||
uuid_str = uuid.UTF8Characters;
|
uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
|
||||||
if (!uuid_is_valid (uuid_str))
|
if (!uuid_is_valid (uuid_str))
|
||||||
|
{
|
||||||
|
g_free (uuid_str);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
res = g_dbus_proxy_call_sync (obj->proxy,
|
res = g_dbus_proxy_call_sync (obj->proxy,
|
||||||
"GetExtensionInfo",
|
"GetExtensionInfo",
|
||||||
@ -550,6 +608,8 @@ plugin_get_info (PluginObject *obj,
|
|||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
&error);
|
&error);
|
||||||
|
|
||||||
|
g_free (uuid_str);
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
g_warning ("Failed to retrieve extension metadata: %s", error->message);
|
g_warning ("Failed to retrieve extension metadata: %s", error->message);
|
||||||
@ -567,11 +627,14 @@ plugin_get_errors (PluginObject *obj,
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *res;
|
GVariant *res;
|
||||||
const gchar *uuid_str;
|
gchar *uuid_str;
|
||||||
|
|
||||||
uuid_str = uuid.UTF8Characters;
|
uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
|
||||||
if (!uuid_is_valid (uuid_str))
|
if (!uuid_is_valid (uuid_str))
|
||||||
|
{
|
||||||
|
g_free (uuid_str);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
res = g_dbus_proxy_call_sync (obj->proxy,
|
res = g_dbus_proxy_call_sync (obj->proxy,
|
||||||
"GetExtensionErrors",
|
"GetExtensionErrors",
|
||||||
@ -581,6 +644,8 @@ plugin_get_errors (PluginObject *obj,
|
|||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
&error);
|
&error);
|
||||||
|
|
||||||
|
g_free (uuid_str);
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
g_warning ("Failed to retrieve errors: %s", error->message);
|
g_warning ("Failed to retrieve errors: %s", error->message);
|
||||||
@ -591,6 +656,33 @@ plugin_get_errors (PluginObject *obj,
|
|||||||
return jsonify_variant (res, result);
|
return jsonify_variant (res, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
plugin_launch_extension_prefs (PluginObject *obj,
|
||||||
|
NPString uuid,
|
||||||
|
NPVariant *result)
|
||||||
|
{
|
||||||
|
gchar *uuid_str;
|
||||||
|
|
||||||
|
uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
|
||||||
|
if (!uuid_is_valid (uuid_str))
|
||||||
|
{
|
||||||
|
g_free (uuid_str);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_dbus_proxy_call (obj->proxy,
|
||||||
|
"LaunchExtensionPrefs",
|
||||||
|
g_variant_new ("(s)", uuid_str),
|
||||||
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
|
-1, /* timeout */
|
||||||
|
NULL, /* cancellable */
|
||||||
|
NULL, /* callback */
|
||||||
|
NULL /* user_data */);
|
||||||
|
|
||||||
|
g_free (uuid_str);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
plugin_get_api_version (PluginObject *obj,
|
plugin_get_api_version (PluginObject *obj,
|
||||||
NPVariant *result)
|
NPVariant *result)
|
||||||
@ -636,6 +728,7 @@ plugin_get_shell_version (PluginObject *obj,
|
|||||||
STRINGN_TO_NPVARIANT (buffer, length, *result);
|
STRINGN_TO_NPVARIANT (buffer, length, *result);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
if (res)
|
||||||
g_variant_unref (res);
|
g_variant_unref (res);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -700,6 +793,14 @@ plugin_object_invoke (NPObject *npobj,
|
|||||||
NPVARIANT_TO_STRING(args[0]),
|
NPVARIANT_TO_STRING(args[0]),
|
||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
|
else if (name == launch_extension_prefs_id)
|
||||||
|
{
|
||||||
|
if (!NPVARIANT_IS_STRING(args[0])) return FALSE;
|
||||||
|
|
||||||
|
return plugin_launch_extension_prefs (obj,
|
||||||
|
NPVARIANT_TO_STRING(args[0]),
|
||||||
|
result);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -709,6 +810,7 @@ plugin_object_has_property (NPObject *npobj,
|
|||||||
NPIdentifier name)
|
NPIdentifier name)
|
||||||
{
|
{
|
||||||
return (name == onextension_changed_id ||
|
return (name == onextension_changed_id ||
|
||||||
|
name == onrestart_id ||
|
||||||
name == api_version_id ||
|
name == api_version_id ||
|
||||||
name == shell_version_id);
|
name == shell_version_id);
|
||||||
}
|
}
|
||||||
@ -735,6 +837,33 @@ plugin_object_get_property (NPObject *npobj,
|
|||||||
else
|
else
|
||||||
NULL_TO_NPVARIANT (*result);
|
NULL_TO_NPVARIANT (*result);
|
||||||
}
|
}
|
||||||
|
else if (name == onrestart_id)
|
||||||
|
{
|
||||||
|
if (obj->restart_listener)
|
||||||
|
OBJECT_TO_NPVARIANT (obj->restart_listener, *result);
|
||||||
|
else
|
||||||
|
NULL_TO_NPVARIANT (*result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
plugin_object_set_callback (NPObject **listener,
|
||||||
|
const NPVariant *value)
|
||||||
|
{
|
||||||
|
if (!NPVARIANT_IS_OBJECT (*value) && !NPVARIANT_IS_NULL (*value))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (*listener)
|
||||||
|
funcs.releaseobject (*listener);
|
||||||
|
*listener = NULL;
|
||||||
|
|
||||||
|
if (NPVARIANT_IS_OBJECT (*value))
|
||||||
|
{
|
||||||
|
*listener = NPVARIANT_TO_OBJECT (*value);
|
||||||
|
funcs.retainobject (*listener);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -746,25 +875,13 @@ plugin_object_set_property (NPObject *npobj,
|
|||||||
{
|
{
|
||||||
PluginObject *obj;
|
PluginObject *obj;
|
||||||
|
|
||||||
if (!plugin_object_has_property (npobj, name))
|
obj = (PluginObject *)npobj;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (name == onextension_changed_id)
|
if (name == onextension_changed_id)
|
||||||
{
|
return plugin_object_set_callback (&obj->listener, value);
|
||||||
obj = (PluginObject*) npobj;
|
|
||||||
if (obj->listener)
|
|
||||||
funcs.releaseobject (obj->listener);
|
|
||||||
|
|
||||||
obj->listener = NULL;
|
if (name == onrestart_id)
|
||||||
if (NPVARIANT_IS_OBJECT (*value))
|
return plugin_object_set_callback (&obj->restart_listener, value);
|
||||||
{
|
|
||||||
obj->listener = NPVARIANT_TO_OBJECT (*value);
|
|
||||||
funcs.retainobject (obj->listener);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (NPVARIANT_IS_NULL (*value))
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -798,7 +915,9 @@ init_methods_and_properties (void)
|
|||||||
install_extension_id = funcs.getstringidentifier ("installExtension");
|
install_extension_id = funcs.getstringidentifier ("installExtension");
|
||||||
uninstall_extension_id = funcs.getstringidentifier ("uninstallExtension");
|
uninstall_extension_id = funcs.getstringidentifier ("uninstallExtension");
|
||||||
get_errors_id = funcs.getstringidentifier ("getExtensionErrors");
|
get_errors_id = funcs.getstringidentifier ("getExtensionErrors");
|
||||||
|
launch_extension_prefs_id = funcs.getstringidentifier ("launchExtensionPrefs");
|
||||||
|
|
||||||
|
onrestart_id = funcs.getstringidentifier ("onshellrestart");
|
||||||
onextension_changed_id = funcs.getstringidentifier ("onchange");
|
onextension_changed_id = funcs.getstringidentifier ("onchange");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,6 +935,11 @@ NPP_GetValue(NPP instance,
|
|||||||
|
|
||||||
*(NPObject**)value = funcs.createobject (instance, &plugin_class);
|
*(NPObject**)value = funcs.createobject (instance, &plugin_class);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case NPPVpluginNeedsXEmbed:
|
||||||
|
*(bool *)value = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
76
configure.ac
@ -1,5 +1,5 @@
|
|||||||
AC_PREREQ(2.63)
|
AC_PREREQ(2.63)
|
||||||
AC_INIT([gnome-shell],[3.2.1],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell],[gnome-shell])
|
AC_INIT([gnome-shell],[3.4.1],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell],[gnome-shell])
|
||||||
|
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_SRCDIR([src/shell-global.c])
|
AC_CONFIG_SRCDIR([src/shell-global.c])
|
||||||
@ -36,10 +36,6 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
|
|||||||
|
|
||||||
PKG_PROG_PKG_CONFIG([0.22])
|
PKG_PROG_PKG_CONFIG([0.22])
|
||||||
|
|
||||||
# GConf stuff
|
|
||||||
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
|
|
||||||
AM_GCONF_SOURCE_2
|
|
||||||
|
|
||||||
GLIB_GSETTINGS
|
GLIB_GSETTINGS
|
||||||
|
|
||||||
# Get a value to substitute into gnome-shell.in
|
# Get a value to substitute into gnome-shell.in
|
||||||
@ -57,37 +53,39 @@ if $PKG_CONFIG --exists gstreamer-0.10 '>=' $GSTREAMER_MIN_VERSION ; then
|
|||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
build_recorder=true
|
build_recorder=true
|
||||||
recorder_modules="gstreamer-0.10 gstreamer-base-0.10 x11"
|
recorder_modules="gstreamer-0.10 gstreamer-base-0.10 x11"
|
||||||
PKG_CHECK_MODULES(TEST_SHELL_RECORDER, $recorder_modules clutter-1.0 xfixes)
|
PKG_CHECK_MODULES(TEST_SHELL_RECORDER, $recorder_modules clutter-1.0 xfixes gl)
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(BUILD_RECORDER, $build_recorder)
|
AM_CONDITIONAL(BUILD_RECORDER, $build_recorder)
|
||||||
|
|
||||||
CLUTTER_MIN_VERSION=1.7.5
|
CLUTTER_MIN_VERSION=1.9.16
|
||||||
GOBJECT_INTROSPECTION_MIN_VERSION=0.10.1
|
GOBJECT_INTROSPECTION_MIN_VERSION=0.10.1
|
||||||
GJS_MIN_VERSION=1.29.18
|
GJS_MIN_VERSION=1.29.18
|
||||||
MUTTER_MIN_VERSION=3.2.1
|
MUTTER_MIN_VERSION=3.4.1
|
||||||
FOLKS_MIN_VERSION=0.5.2
|
FOLKS_MIN_VERSION=0.5.2
|
||||||
GTK_MIN_VERSION=3.0.0
|
GTK_MIN_VERSION=3.3.9
|
||||||
GIO_MIN_VERSION=2.29.10
|
GIO_MIN_VERSION=2.31.6
|
||||||
LIBECAL_MIN_VERSION=2.32.0
|
LIBECAL_MIN_VERSION=2.32.0
|
||||||
LIBEDATASERVER_MIN_VERSION=1.2.0
|
LIBEDATASERVER_MIN_VERSION=1.2.0
|
||||||
LIBEDATASERVERUI_MIN_VERSION=2.91.6
|
LIBEDATASERVERUI_MIN_VERSION=2.91.6
|
||||||
TELEPATHY_GLIB_MIN_VERSION=0.15.5
|
TELEPATHY_GLIB_MIN_VERSION=0.17.5
|
||||||
TELEPATHY_LOGGER_MIN_VERSION=0.2.4
|
TELEPATHY_LOGGER_MIN_VERSION=0.2.4
|
||||||
POLKIT_MIN_VERSION=0.100
|
POLKIT_MIN_VERSION=0.100
|
||||||
STARTUP_NOTIFICATION_MIN_VERSION=0.11
|
STARTUP_NOTIFICATION_MIN_VERSION=0.11
|
||||||
|
GCR_MIN_VERSION=3.3.90
|
||||||
|
|
||||||
# Collect more than 20 libraries for a prize!
|
# Collect more than 20 libraries for a prize!
|
||||||
PKG_CHECK_MODULES(GNOME_SHELL, gio-2.0 >= $GIO_MIN_VERSION
|
PKG_CHECK_MODULES(GNOME_SHELL, gio-unix-2.0 >= $GIO_MIN_VERSION
|
||||||
gio-unix-2.0 dbus-glib-1 libxml-2.0
|
libxml-2.0
|
||||||
gtk+-3.0 >= $GTK_MIN_VERSION
|
gtk+-3.0 >= $GTK_MIN_VERSION
|
||||||
folks >= $FOLKS_MIN_VERSION
|
folks >= $FOLKS_MIN_VERSION
|
||||||
libmutter >= $MUTTER_MIN_VERSION
|
libmutter >= $MUTTER_MIN_VERSION
|
||||||
gjs-internals-1.0 >= $GJS_MIN_VERSION
|
gjs-internals-1.0 >= $GJS_MIN_VERSION
|
||||||
libgnome-menu-3.0 $recorder_modules gconf-2.0
|
libgnome-menu-3.0 $recorder_modules
|
||||||
gdk-x11-3.0 libsoup-2.4
|
gdk-x11-3.0 libsoup-2.4
|
||||||
|
gl
|
||||||
clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
|
clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
|
||||||
clutter-glx-1.0 >= $CLUTTER_MIN_VERSION
|
clutter-glx-1.0 >= $CLUTTER_MIN_VERSION
|
||||||
libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_MIN_VERSION
|
libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_MIN_VERSION
|
||||||
@ -96,7 +94,8 @@ PKG_CHECK_MODULES(GNOME_SHELL, gio-2.0 >= $GIO_MIN_VERSION
|
|||||||
telepathy-glib >= $TELEPATHY_GLIB_MIN_VERSION
|
telepathy-glib >= $TELEPATHY_GLIB_MIN_VERSION
|
||||||
telepathy-logger-0.2 >= $TELEPATHY_LOGGER_MIN_VERSION
|
telepathy-logger-0.2 >= $TELEPATHY_LOGGER_MIN_VERSION
|
||||||
polkit-agent-1 >= $POLKIT_MIN_VERSION xfixes
|
polkit-agent-1 >= $POLKIT_MIN_VERSION xfixes
|
||||||
libnm-glib libnm-util gnome-keyring-1)
|
libnm-glib libnm-util gnome-keyring-1
|
||||||
|
gcr-3 >= $GCR_MIN_VERSION)
|
||||||
|
|
||||||
PKG_CHECK_MODULES(SHELL_PERF_HELPER, gtk+-3.0 gio-2.0)
|
PKG_CHECK_MODULES(SHELL_PERF_HELPER, gtk+-3.0 gio-2.0)
|
||||||
|
|
||||||
@ -109,8 +108,6 @@ AC_DEFINE_UNQUOTED([GJS_VERSION], ["$GJS_VERSION"], [The version of GJS we're li
|
|||||||
AC_SUBST([GJS_VERSION], ["$GJS_VERSION"])
|
AC_SUBST([GJS_VERSION], ["$GJS_VERSION"])
|
||||||
|
|
||||||
GOBJECT_INTROSPECTION_CHECK([$GOBJECT_INTROSPECTION_MIN_VERSION])
|
GOBJECT_INTROSPECTION_CHECK([$GOBJECT_INTROSPECTION_MIN_VERSION])
|
||||||
JHBUILD_TYPELIBDIR="$INTROSPECTION_TYPELIBDIR"
|
|
||||||
AC_SUBST(JHBUILD_TYPELIBDIR)
|
|
||||||
|
|
||||||
saved_CFLAGS=$CFLAGS
|
saved_CFLAGS=$CFLAGS
|
||||||
saved_LIBS=$LIBS
|
saved_LIBS=$LIBS
|
||||||
@ -120,8 +117,8 @@ AC_CHECK_FUNCS(JS_NewGlobalObject XFixesCreatePointerBarrier)
|
|||||||
CFLAGS=$saved_CFLAGS
|
CFLAGS=$saved_CFLAGS
|
||||||
LIBS=$saved_LIBS
|
LIBS=$saved_LIBS
|
||||||
|
|
||||||
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.2 gnome-desktop-3.0 >= 2.90.0 x11)
|
PKG_CHECK_MODULES(GNOME_SHELL_JS, gio-2.0 gjs-internals-1.0 >= $GJS_MIN_VERSION)
|
||||||
PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-3.0)
|
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.2 x11)
|
||||||
PKG_CHECK_MODULES(TRAY, gtk+-3.0)
|
PKG_CHECK_MODULES(TRAY, gtk+-3.0)
|
||||||
PKG_CHECK_MODULES(GVC, libpulse libpulse-mainloop-glib gobject-2.0)
|
PKG_CHECK_MODULES(GVC, libpulse libpulse-mainloop-glib gobject-2.0)
|
||||||
PKG_CHECK_MODULES(DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 0.1.7)
|
PKG_CHECK_MODULES(DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 0.1.7)
|
||||||
@ -131,6 +128,7 @@ PKG_CHECK_EXISTS([gnome-bluetooth-1.0 >= 3.1.0],
|
|||||||
[BLUETOOTH_DIR=`$PKG_CONFIG --variable=applet_libdir gnome-bluetooth-1.0`
|
[BLUETOOTH_DIR=`$PKG_CONFIG --variable=applet_libdir gnome-bluetooth-1.0`
|
||||||
BLUETOOTH_LIBS=`$PKG_CONFIG --variable=applet_libs gnome-bluetooth-1.0`
|
BLUETOOTH_LIBS=`$PKG_CONFIG --variable=applet_libs gnome-bluetooth-1.0`
|
||||||
AC_SUBST([BLUETOOTH_LIBS],["$BLUETOOTH_LIBS"])
|
AC_SUBST([BLUETOOTH_LIBS],["$BLUETOOTH_LIBS"])
|
||||||
|
AC_SUBST([BLUETOOTH_DIR],["$BLUETOOTH_DIR"])
|
||||||
AC_DEFINE_UNQUOTED([BLUETOOTH_DIR],["$BLUETOOTH_DIR"],[Path to installed GnomeBluetooth typelib and library])
|
AC_DEFINE_UNQUOTED([BLUETOOTH_DIR],["$BLUETOOTH_DIR"],[Path to installed GnomeBluetooth typelib and library])
|
||||||
AC_DEFINE([HAVE_BLUETOOTH],[1],[Define if you have libgnome-bluetooth-applet])
|
AC_DEFINE([HAVE_BLUETOOTH],[1],[Define if you have libgnome-bluetooth-applet])
|
||||||
AC_SUBST([HAVE_BLUETOOTH],[1])
|
AC_SUBST([HAVE_BLUETOOTH],[1])
|
||||||
@ -143,6 +141,33 @@ PKG_CHECK_MODULES(CALENDAR_SERVER, libecal-1.2 >= $LIBECAL_MIN_VERSION libedatas
|
|||||||
AC_SUBST(CALENDAR_SERVER_CFLAGS)
|
AC_SUBST(CALENDAR_SERVER_CFLAGS)
|
||||||
AC_SUBST(CALENDAR_SERVER_LIBS)
|
AC_SUBST(CALENDAR_SERVER_LIBS)
|
||||||
|
|
||||||
|
AC_ARG_WITH(systemd,
|
||||||
|
AS_HELP_STRING([--with-systemd],
|
||||||
|
[Add systemd support]),
|
||||||
|
[with_systemd=$withval], [with_systemd=auto])
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(SYSTEMD,
|
||||||
|
[libsystemd-login libsystemd-daemon],
|
||||||
|
[have_systemd=yes], [have_systemd=no])
|
||||||
|
|
||||||
|
if test "x$with_systemd" = "xauto" ; then
|
||||||
|
if test x$have_systemd = xno ; then
|
||||||
|
use_systemd=no
|
||||||
|
else
|
||||||
|
use_systemd=yes
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
use_systemd=$with_systemd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$use_systemd" = "xyes"; then
|
||||||
|
if test "x$have_systemd" = "xno"; then
|
||||||
|
AC_MSG_ERROR([Systemd support explicitly required, but systemd not found])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_DEFINE(WITH_SYSTEMD, 1, [systemd support])
|
||||||
|
fi
|
||||||
|
|
||||||
MUTTER_GIR_DIR=`$PKG_CONFIG --variable=girdir libmutter`
|
MUTTER_GIR_DIR=`$PKG_CONFIG --variable=girdir libmutter`
|
||||||
MUTTER_TYPELIB_DIR=`$PKG_CONFIG --variable=typelibdir libmutter`
|
MUTTER_TYPELIB_DIR=`$PKG_CONFIG --variable=typelibdir libmutter`
|
||||||
AC_SUBST(MUTTER_GIR_DIR)
|
AC_SUBST(MUTTER_GIR_DIR)
|
||||||
@ -179,6 +204,8 @@ AC_SUBST(GIRDIR)
|
|||||||
TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
|
TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
|
||||||
AC_SUBST(TYPELIBDIR)
|
AC_SUBST(TYPELIBDIR)
|
||||||
|
|
||||||
|
GTK_DOC_CHECK([1.15], [--flavour no-tmpl])
|
||||||
|
|
||||||
# Stay command-line compatible with the gnome-common configure option. Here
|
# Stay command-line compatible with the gnome-common configure option. Here
|
||||||
# minimum/yes/maximum are the same, however.
|
# minimum/yes/maximum are the same, however.
|
||||||
AC_ARG_ENABLE(compile_warnings,
|
AC_ARG_ENABLE(compile_warnings,
|
||||||
@ -199,7 +226,7 @@ if test "$enable_compile_warnings" != no ; then
|
|||||||
if test "$enable_compile_warnings" = error ; then
|
if test "$enable_compile_warnings" = error ; then
|
||||||
case " $CFLAGS " in
|
case " $CFLAGS " in
|
||||||
*[\ \ ]-Werror[\ \ ]*) ;;
|
*[\ \ ]-Werror[\ \ ]*) ;;
|
||||||
*) CFLAGS="$CFLAGS -Werror" ;;
|
*) CFLAGS="$CFLAGS -Werror -Wno-error=deprecated-declarations" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -207,7 +234,7 @@ fi
|
|||||||
changequote([,])dnl
|
changequote([,])dnl
|
||||||
|
|
||||||
AC_ARG_ENABLE(jhbuild-wrapper-script,
|
AC_ARG_ENABLE(jhbuild-wrapper-script,
|
||||||
AS_HELP_STRING([--jhbuild-wrapper-script=yes],[Make "gnome-shell" script work for jhbuild]),,enable_jhbuild_wrapper_script=no)
|
AS_HELP_STRING([--enable-jhbuild-wrapper-script],[Make "gnome-shell" script work for jhbuild]),,enable_jhbuild_wrapper_script=no)
|
||||||
AM_CONDITIONAL(USE_JHBUILD_WRAPPER_SCRIPT, test "x$enable_jhbuild_wrapper_script" = xyes)
|
AM_CONDITIONAL(USE_JHBUILD_WRAPPER_SCRIPT, test "x$enable_jhbuild_wrapper_script" = xyes)
|
||||||
|
|
||||||
AC_MSG_CHECKING([location of system Certificate Authority list])
|
AC_MSG_CHECKING([location of system Certificate Authority list])
|
||||||
@ -241,8 +268,13 @@ AC_ARG_VAR([BROWSER_PLUGIN_DIR],[Where to install the plugin to])
|
|||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
data/Makefile
|
data/Makefile
|
||||||
|
docs/Makefile
|
||||||
|
docs/reference/Makefile
|
||||||
|
docs/reference/shell/Makefile
|
||||||
|
docs/reference/shell/shell-docs.sgml
|
||||||
|
docs/reference/st/Makefile
|
||||||
|
docs/reference/st/st-docs.sgml
|
||||||
js/Makefile
|
js/Makefile
|
||||||
js/misc/config.js
|
|
||||||
src/Makefile
|
src/Makefile
|
||||||
browser-plugin/Makefile
|
browser-plugin/Makefile
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
desktopdir=$(datadir)/applications
|
desktopdir=$(datadir)/applications
|
||||||
desktop_DATA = gnome-shell.desktop
|
desktop_DATA = gnome-shell.desktop gnome-shell-extension-prefs.desktop
|
||||||
|
|
||||||
# We substitute in bindir so it works as an autostart
|
# We substitute in bindir so it works as an autostart
|
||||||
# file when built in a non-system prefix
|
# file when built in a non-system prefix
|
||||||
@ -12,16 +12,23 @@ desktop_DATA = gnome-shell.desktop
|
|||||||
%.desktop:%.desktop.in
|
%.desktop:%.desktop.in
|
||||||
$(AM_V_GEN) sed s/^_// < $< > $@ || rm $@
|
$(AM_V_GEN) sed s/^_// < $< > $@ || rm $@
|
||||||
|
|
||||||
searchprovidersdir = $(pkgdatadir)/search_providers
|
searchprovidersdir = $(pkgdatadir)/open-search-providers
|
||||||
dist_searchproviders_DATA = \
|
dist_searchproviders_DATA = \
|
||||||
search_providers/google.xml \
|
open-search-providers/google.xml \
|
||||||
search_providers/wikipedia.xml
|
open-search-providers/wikipedia.xml
|
||||||
|
|
||||||
|
introspectiondir = $(datadir)/dbus-1/interfaces
|
||||||
|
introspection_DATA = org.gnome.ShellSearchProvider.xml
|
||||||
|
|
||||||
themedir = $(pkgdatadir)/theme
|
themedir = $(pkgdatadir)/theme
|
||||||
dist_theme_DATA = \
|
dist_theme_DATA = \
|
||||||
theme/calendar-arrow-left.svg \
|
theme/calendar-arrow-left.svg \
|
||||||
theme/calendar-arrow-right.svg \
|
theme/calendar-arrow-right.svg \
|
||||||
theme/calendar-today.svg \
|
theme/calendar-today.svg \
|
||||||
|
theme/checkbox-focused.svg \
|
||||||
|
theme/checkbox-off-focused.svg \
|
||||||
|
theme/checkbox-off.svg \
|
||||||
|
theme/checkbox.svg \
|
||||||
theme/close-window.svg \
|
theme/close-window.svg \
|
||||||
theme/close.svg \
|
theme/close.svg \
|
||||||
theme/corner-ripple-ltr.png \
|
theme/corner-ripple-ltr.png \
|
||||||
@ -31,7 +38,6 @@ dist_theme_DATA = \
|
|||||||
theme/filter-selected-rtl.svg \
|
theme/filter-selected-rtl.svg \
|
||||||
theme/gdm.css \
|
theme/gdm.css \
|
||||||
theme/gnome-shell.css \
|
theme/gnome-shell.css \
|
||||||
theme/panel-border.svg \
|
|
||||||
theme/panel-button-border.svg \
|
theme/panel-button-border.svg \
|
||||||
theme/panel-button-highlight-narrow.svg \
|
theme/panel-button-highlight-narrow.svg \
|
||||||
theme/panel-button-highlight-wide.svg \
|
theme/panel-button-highlight-wide.svg \
|
||||||
@ -47,7 +53,7 @@ dist_theme_DATA = \
|
|||||||
theme/ws-switch-arrow-up.svg \
|
theme/ws-switch-arrow-up.svg \
|
||||||
theme/ws-switch-arrow-down.svg
|
theme/ws-switch-arrow-down.svg
|
||||||
|
|
||||||
gsettings_SCHEMAS = org.gnome.shell.gschema.xml
|
gsettings_SCHEMAS = org.gnome.shell.gschema.xml org.gnome.shell.evolution.calendar.gschema.xml
|
||||||
|
|
||||||
@INTLTOOL_XML_NOMERGE_RULE@
|
@INTLTOOL_XML_NOMERGE_RULE@
|
||||||
@GSETTINGS_RULES@
|
@GSETTINGS_RULES@
|
||||||
@ -59,29 +65,27 @@ gschemas.compiled: $(gsettings_SCHEMAS:.xml=.valid)
|
|||||||
|
|
||||||
all-local: gschemas.compiled
|
all-local: gschemas.compiled
|
||||||
|
|
||||||
|
convertdir = $(datadir)/GConf/gsettings
|
||||||
# GConf schemas: provide defaults for keys from Metacity we are overriding
|
convert_DATA = gnome-shell-overrides.convert
|
||||||
gconfschemadir = @GCONF_SCHEMA_FILE_DIR@
|
|
||||||
gconfschema_DATA = gnome-shell.schemas
|
|
||||||
|
|
||||||
shadersdir = $(pkgdatadir)/shaders
|
shadersdir = $(pkgdatadir)/shaders
|
||||||
shaders_DATA = \
|
shaders_DATA = \
|
||||||
shaders/dim-window.glsl
|
shaders/dim-window.glsl
|
||||||
|
|
||||||
install-data-local:
|
|
||||||
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(gconfschema_DATA)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
gnome-shell.desktop.in.in \
|
gnome-shell.desktop.in.in \
|
||||||
|
gnome-shell-extension-prefs.desktop.in.in \
|
||||||
|
$(introspection_DATA) \
|
||||||
$(menu_DATA) \
|
$(menu_DATA) \
|
||||||
$(gconfschema_DATA) \
|
|
||||||
$(shaders_DATA) \
|
$(shaders_DATA) \
|
||||||
|
$(convert_DATA) \
|
||||||
|
org.gnome.shell.evolution.calendar.gschema.xml.in \
|
||||||
org.gnome.shell.gschema.xml.in
|
org.gnome.shell.gschema.xml.in
|
||||||
|
|
||||||
CLEANFILES = \
|
CLEANFILES = \
|
||||||
gnome-shell.desktop.in \
|
gnome-shell.desktop.in \
|
||||||
|
gnome-shell-extension-prefs.in \
|
||||||
$(desktop_DATA) \
|
$(desktop_DATA) \
|
||||||
$(gsettings_SCHEMAS) \
|
$(gsettings_SCHEMAS) \
|
||||||
gschemas.compiled
|
gschemas.compiled
|
||||||
|
12
data/gnome-shell-extension-prefs.desktop.in.in
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
_Name=GNOME Shell Extension Preferences
|
||||||
|
_Comment=Configure GNOME Shell Extensions
|
||||||
|
Exec=@bindir@/gnome-shell-extension-prefs %u
|
||||||
|
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||||
|
X-GNOME-Bugzilla-Product=gnome-shell
|
||||||
|
X-GNOME-Bugzilla-Component=extensions
|
||||||
|
X-GNOME-Bugzilla-Version=@VERSION@
|
||||||
|
Categories=GNOME;GTK;
|
||||||
|
OnlyShowIn=GNOME;
|
||||||
|
NoDisplay=true
|
5
data/gnome-shell-overrides.convert
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[org.gnome.shell.overrides]
|
||||||
|
attach-modal-dialogs = /desktop/gnome/shell/windows/attach_modal_dialogs
|
||||||
|
button-layout = /desktop/gnome/shell/windows/button_layout
|
||||||
|
edge-tiling = /desktop/gnome/shell/windows/edge_tiling
|
||||||
|
workspaces-only-on-primary = /desktop/gnome/shell/windows/workspaces_only_on_primary
|
@ -13,4 +13,4 @@ NoDisplay=true
|
|||||||
X-GNOME-Autostart-Phase=WindowManager
|
X-GNOME-Autostart-Phase=WindowManager
|
||||||
X-GNOME-Provides=panel;windowmanager;
|
X-GNOME-Provides=panel;windowmanager;
|
||||||
X-GNOME-Autostart-Notify=true
|
X-GNOME-Autostart-Notify=true
|
||||||
X-GNOME-AutoRestart=true
|
X-GNOME-AutoRestart=false
|
||||||
|
@ -1,100 +0,0 @@
|
|||||||
<gconfschemafile>
|
|
||||||
<schemalist>
|
|
||||||
|
|
||||||
<!-- Metacity overrides -->
|
|
||||||
<schema>
|
|
||||||
<key>/schemas/desktop/gnome/shell/windows/attach_modal_dialogs</key>
|
|
||||||
<applyto>/desktop/gnome/shell/windows/attach_modal_dialogs</applyto>
|
|
||||||
<owner>gnome-shell</owner>
|
|
||||||
<type>bool</type>
|
|
||||||
<default>true</default>
|
|
||||||
<locale name="C">
|
|
||||||
<short>Attach modal dialog to the parent window</short>
|
|
||||||
<long>
|
|
||||||
This key overrides /apps/mutter/general/attach_modal_dialogs when
|
|
||||||
running GNOME Shell.
|
|
||||||
</long>
|
|
||||||
</locale>
|
|
||||||
</schema>
|
|
||||||
|
|
||||||
<schema>
|
|
||||||
<key>/schemas/desktop/gnome/shell/windows/button_layout</key>
|
|
||||||
<applyto>/desktop/gnome/shell/windows/button_layout</applyto>
|
|
||||||
<owner>gnome-shell</owner>
|
|
||||||
<type>string</type>
|
|
||||||
<default>:close</default>
|
|
||||||
<locale name="C">
|
|
||||||
<short>Arrangement of buttons on the titlebar</short>
|
|
||||||
<long>
|
|
||||||
Arrangement of buttons on the titlebar. The
|
|
||||||
value should be a string, such as
|
|
||||||
"menu:minimize,maximize,spacer,close"; the colon separates the
|
|
||||||
left corner of the window from the right corner, and
|
|
||||||
the button names are comma-separated. Duplicate buttons
|
|
||||||
are not allowed. Unknown button names are silently ignored
|
|
||||||
so that buttons can be added in future gnome-shell versions
|
|
||||||
without breaking older versions.
|
|
||||||
A special spacer tag can be used to insert some space between
|
|
||||||
two adjacent buttons.
|
|
||||||
|
|
||||||
This key overrides /apps/metacity/general/button_layout when
|
|
||||||
running GNOME Shell.
|
|
||||||
</long>
|
|
||||||
</locale>
|
|
||||||
</schema>
|
|
||||||
|
|
||||||
<schema>
|
|
||||||
<key>/schemas/desktop/gnome/shell/windows/edge_tiling</key>
|
|
||||||
<applyto>/desktop/gnome/shell/windows/edge_tiling</applyto>
|
|
||||||
<owner>gnome-shell</owner>
|
|
||||||
<type>bool</type>
|
|
||||||
<default>true</default>
|
|
||||||
<locale name="C">
|
|
||||||
<short>enable edge tiling when dropping windows on screen edges</short>
|
|
||||||
<long>
|
|
||||||
If enabled, dropping windows on vertical screen edges maximizes them
|
|
||||||
vertically and resizes them horizontally to cover half of the
|
|
||||||
available area. Dropping windows on the top screen edge maximizes them
|
|
||||||
completely.
|
|
||||||
|
|
||||||
This key overrides /apps/metacity/general/edge_tiling when
|
|
||||||
running GNOME Shell.
|
|
||||||
</long>
|
|
||||||
</locale>
|
|
||||||
</schema>
|
|
||||||
|
|
||||||
<schema>
|
|
||||||
<key>/schemas/desktop/gnome/shell/windows/theme</key>
|
|
||||||
<applyto>/desktop/gnome/shell/windows/theme</applyto>
|
|
||||||
<owner>gnome-shell</owner>
|
|
||||||
<type>string</type>
|
|
||||||
<default>Adwaita</default>
|
|
||||||
<locale name="C">
|
|
||||||
<short>Current theme</short>
|
|
||||||
<long>
|
|
||||||
The theme determines the appearance of window borders,
|
|
||||||
titlebar, and so forth.
|
|
||||||
|
|
||||||
This key overrides /apps/metacity/general/theme when
|
|
||||||
running GNOME Shell.
|
|
||||||
</long>
|
|
||||||
</locale>
|
|
||||||
</schema>
|
|
||||||
|
|
||||||
<schema>
|
|
||||||
<key>/schemas/desktop/gnome/shell/windows/workspaces_only_on_primary</key>
|
|
||||||
<applyto>/desktop/gnome/shell/windows/workspaces_only_on_primary</applyto>
|
|
||||||
<owner>gnome-shell</owner>
|
|
||||||
<type>bool</type>
|
|
||||||
<default>true</default>
|
|
||||||
<locale name="C">
|
|
||||||
<short>Workspaces only on primary monitor</short>
|
|
||||||
<long>
|
|
||||||
This key overrides /apps/mutter/general/workspaces_only_on_primary when
|
|
||||||
running GNOME Shell.
|
|
||||||
</long>
|
|
||||||
</locale>
|
|
||||||
</schema>
|
|
||||||
|
|
||||||
</schemalist>
|
|
||||||
</gconfschemafile>
|
|
147
data/org.gnome.ShellSearchProvider.xml
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<!DOCTYPE node PUBLIC
|
||||||
|
'-//freedesktop//DTD D-BUS Object Introspection 1.0//EN'
|
||||||
|
'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd'>
|
||||||
|
<node>
|
||||||
|
<interface name="org.gnome.Shell.SearchProvider">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
The interface used for integrating into GNOME Shell's search
|
||||||
|
interface.
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
|
||||||
|
<method name="GetInitialResultSet">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
Called when the user first begins a search.
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
<arg type="as" direction="in">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
Array of search terms, which the provider should treat as
|
||||||
|
logical AND.
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
<arg type="as" direction="out">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
An array of result identifier strings representing items which
|
||||||
|
match the given search terms. Identifiers must be unique within
|
||||||
|
the provider's domain, but other than that may be chosen freely
|
||||||
|
by the provider.
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="GetSubsearchResultSet">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
Called when a search is performed which is a "subsearch" of
|
||||||
|
the previous search, e.g. the method may return less results, but
|
||||||
|
not more or different results.
|
||||||
|
|
||||||
|
This allows search providers to only search through the previous
|
||||||
|
result set, rather than possibly performing a full re-query.
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
<arg type="as" direction="in">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
Array of item identifiers
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
<arg type="as" direction="in">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
Array of updated search terms, which the provider should treat as
|
||||||
|
logical AND.
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
<arg type="as" direction="out">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
An array of result identifier strings representing items which
|
||||||
|
match the given search terms. Identifiers must be unique within
|
||||||
|
the provider's domain, but other than that may be chosen freely
|
||||||
|
by the provider.
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="GetResultMetas">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
Return an array of meta data used to display each given result
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
<arg type="as" direction="in">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
An array of result identifiers as returned by
|
||||||
|
GetInitialResultSet() or GetSubsearchResultSet()
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
<arg type="a{sv}" direction="out">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
A dictionary describing the given search result, containing
|
||||||
|
'id', 'name' (both strings) and either 'icon' (a serialized
|
||||||
|
GIcon) or 'icon-data' (raw image data as (iiibiiay) - width,
|
||||||
|
height, rowstride, has-alpha, bits per sample, channels, data)
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="ActivateResult">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:description>
|
||||||
|
<doc:para>
|
||||||
|
Called when the users chooses a given result. The result should
|
||||||
|
be displayed in the application associated with the corresponding
|
||||||
|
provider.
|
||||||
|
</doc:para>
|
||||||
|
</doc:description>
|
||||||
|
</doc:doc>
|
||||||
|
<arg type="s" direction="in">
|
||||||
|
<doc:doc>
|
||||||
|
<doc:summary>
|
||||||
|
<doc:para>
|
||||||
|
A result identifier as returned by GetInitialResultSet() or
|
||||||
|
GetSubsearchResultSet()
|
||||||
|
</doc:para>
|
||||||
|
</doc:summary>
|
||||||
|
</doc:doc>
|
||||||
|
</arg>
|
||||||
|
</method>
|
||||||
|
</interface>
|
||||||
|
</node>
|
21
data/org.gnome.shell.evolution.calendar.gschema.xml.in
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- NOTE: This schema is a GNOME 3.4 workaround - it uses the same path
|
||||||
|
as org.gnome.evolution.calendar, but avoids us requiring Evolution
|
||||||
|
be installed. In GNOME 3.6 the selected state will become a flag
|
||||||
|
on the calendar. Because the translations are in Evolution,
|
||||||
|
this is untranslated and in POTFILES.skip.
|
||||||
|
-->
|
||||||
|
<schemalist>
|
||||||
|
<schema path="/org/gnome/evolution/calendar/" id="org.gnome.shell.evolution.calendar" gettext-domain="evolution">
|
||||||
|
<key type="as" name="selected-calendars">
|
||||||
|
<default>[]</default>
|
||||||
|
<summary>List of selected calendars</summary>
|
||||||
|
<description>List of calendars to load</description>
|
||||||
|
</key>
|
||||||
|
<key type="as" name="selected-tasks">
|
||||||
|
<default>[]</default>
|
||||||
|
<summary>List of selected task lists</summary>
|
||||||
|
<description>List of task lists to load</description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
</schemalist>
|
@ -16,8 +16,9 @@
|
|||||||
<_summary>Uuids of extensions to enable</_summary>
|
<_summary>Uuids of extensions to enable</_summary>
|
||||||
<_description>
|
<_description>
|
||||||
GNOME Shell extensions have a uuid property; this key lists extensions
|
GNOME Shell extensions have a uuid property; this key lists extensions
|
||||||
which should be loaded. disabled-extensions overrides this setting for
|
which should be loaded. Any extension that wants to be loaded needs
|
||||||
extensions that appear in both lists.
|
to be in this list. You can also manipulate this list with the
|
||||||
|
EnableExtension and DisableExtension DBus methods on org.gnome.Shell.
|
||||||
</_description>
|
</_description>
|
||||||
</key>
|
</key>
|
||||||
<key name="enable-app-monitoring" type="b">
|
<key name="enable-app-monitoring" type="b">
|
||||||
@ -52,15 +53,18 @@
|
|||||||
</key>
|
</key>
|
||||||
<key name="saved-im-presence" type="i">
|
<key name="saved-im-presence" type="i">
|
||||||
<default>1</default>
|
<default>1</default>
|
||||||
<_summary></_summary>
|
<_summary>Internally used to store the last IM presence explicitly set by the user. The
|
||||||
|
value here is from the TpConnectionPresenceType enumeration.</_summary>
|
||||||
</key>
|
</key>
|
||||||
<key name="saved-session-presence" type="i">
|
<key name="saved-session-presence" type="i">
|
||||||
<default>0</default>
|
<default>0</default>
|
||||||
<_summary></_summary>
|
<_summary>Internally used to store the last session presence status for the user. The
|
||||||
|
value here is from the GsmPresenceStatus enumeration.</_summary>
|
||||||
</key>
|
</key>
|
||||||
<child name="clock" schema="org.gnome.shell.clock"/>
|
<child name="clock" schema="org.gnome.shell.clock"/>
|
||||||
<child name="calendar" schema="org.gnome.shell.calendar"/>
|
<child name="calendar" schema="org.gnome.shell.calendar"/>
|
||||||
<child name="recorder" schema="org.gnome.shell.recorder"/>
|
<child name="recorder" schema="org.gnome.shell.recorder"/>
|
||||||
|
<child name="keybindings" schema="org.gnome.shell.keybindings"/>
|
||||||
<child name="keyboard" schema="org.gnome.shell.keyboard"/>
|
<child name="keyboard" schema="org.gnome.shell.keyboard"/>
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
@ -75,6 +79,24 @@
|
|||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
|
<schema id="org.gnome.shell.keybindings" path="/org/gnome/shell/keybindings/"
|
||||||
|
gettext-domain="@GETTEXT_PACKAGE@">
|
||||||
|
<key name="open-application-menu" type="as">
|
||||||
|
<default>["<Super>F10"]</default>
|
||||||
|
<_summary>Keybinding to open the application menu</_summary>
|
||||||
|
<_description>
|
||||||
|
Keybinding to open the application menu.
|
||||||
|
</_description>
|
||||||
|
</key>
|
||||||
|
<key name="toggle-recording" type="as">
|
||||||
|
<default><![CDATA[['<Control><Shift><Alt>r']]]></default>
|
||||||
|
<_summary>Keybinding to toggle the screen recorder</_summary>
|
||||||
|
<_description>
|
||||||
|
Keybinding to start/stop the builtin screen recorder.
|
||||||
|
</_description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
|
||||||
<schema id="org.gnome.shell.keyboard" path="/org/gnome/shell/keyboard/"
|
<schema id="org.gnome.shell.keyboard" path="/org/gnome/shell/keyboard/"
|
||||||
gettext-domain="@GETTEXT_PACKAGE@">
|
gettext-domain="@GETTEXT_PACKAGE@">
|
||||||
<key name="keyboard-type" type="s">
|
<key name="keyboard-type" type="s">
|
||||||
@ -107,7 +129,7 @@
|
|||||||
<schema id="org.gnome.shell.recorder" path="/org/gnome/shell/recorder/"
|
<schema id="org.gnome.shell.recorder" path="/org/gnome/shell/recorder/"
|
||||||
gettext-domain="@GETTEXT_PACKAGE@">
|
gettext-domain="@GETTEXT_PACKAGE@">
|
||||||
<key name="framerate" type="i">
|
<key name="framerate" type="i">
|
||||||
<default>15</default>
|
<default>30</default>
|
||||||
<_summary>Framerate used for recording screencasts.</_summary>
|
<_summary>Framerate used for recording screencasts.</_summary>
|
||||||
<_description>
|
<_description>
|
||||||
The framerate of the resulting screencast recordered
|
The framerate of the resulting screencast recordered
|
||||||
@ -126,7 +148,7 @@
|
|||||||
take care of its own output - this might be used to send the output
|
take care of its own output - this might be used to send the output
|
||||||
to an icecast server via shout2send or similar. When unset or set
|
to an icecast server via shout2send or similar. When unset or set
|
||||||
to an empty value, the default pipeline will be used. This is currently
|
to an empty value, the default pipeline will be used. This is currently
|
||||||
'videorate ! vp8enc quality=10 speed=2 threads=%T ! queue ! webmmux'
|
'vp8enc quality=8 speed=6 threads=%T ! queue ! webmmux'
|
||||||
and records to WEBM using the VP8 codec. %T is used as a placeholder
|
and records to WEBM using the VP8 codec. %T is used as a placeholder
|
||||||
for a guess at the optimal thread count on the system.
|
for a guess at the optimal thread count on the system.
|
||||||
</_description>
|
</_description>
|
||||||
@ -141,4 +163,48 @@
|
|||||||
</_description>
|
</_description>
|
||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
|
<schema id="org.gnome.shell.overrides" path="/org/gnome/shell/overrides/">
|
||||||
|
<key name="attach-modal-dialogs" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Attach modal dialog to the parent window</summary>
|
||||||
|
<description>
|
||||||
|
This key overrides the key in org.gnome.mutter when running
|
||||||
|
GNOME Shell.
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="button-layout" type="s">
|
||||||
|
<default>":close"</default>
|
||||||
|
<summary>Arrangement of buttons on the titlebar</summary>
|
||||||
|
<description>
|
||||||
|
This key overrides the key in org.gnome.desktop.wm.preferences when
|
||||||
|
running GNOME Shell.
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="edge-tiling" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Enable edge tiling when dropping windows on screen edges</summary>
|
||||||
|
<description>
|
||||||
|
This key overrides the key in org.gnome.mutter when running GNOME Shell.
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="dynamic-workspaces" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Workspaces are managed dynamically</summary>
|
||||||
|
<description>
|
||||||
|
This key overrides the key in org.gnome.mutter when running GNOME Shell.
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="workspaces-only-on-primary" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Workspaces only on primary monitor</summary>
|
||||||
|
<description>
|
||||||
|
This key overrides the key in org.gnome.mutter when running GNOME Shell.
|
||||||
|
</description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
289
data/theme/checkbox-focused.svg
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24"
|
||||||
|
height="22"
|
||||||
|
id="svg3199"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.1 r9760"
|
||||||
|
sodipodi:docname="checkbox.svg">
|
||||||
|
<defs
|
||||||
|
id="defs3201">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient15404"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<stop
|
||||||
|
id="stop15406"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#515151;stop-opacity:1" />
|
||||||
|
<stop
|
||||||
|
id="stop15408"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#292929;stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
id="perspective3207" />
|
||||||
|
<inkscape:perspective
|
||||||
|
id="perspective3187"
|
||||||
|
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||||
|
inkscape:vp_z="1 : 0.5 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_x="0 : 0.5 : 1"
|
||||||
|
sodipodi:type="inkscape:persp3d" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient5872-5-1"
|
||||||
|
id="linearGradient5891-0-4"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="205.84143"
|
||||||
|
y1="246.7094"
|
||||||
|
x2="206.74803"
|
||||||
|
y2="231.24142" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient5872-5-1">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#0b2e52;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop5874-4-4" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#1862af;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop5876-0-5" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5837-4-6"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect14768"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5884-4-7"
|
||||||
|
is_visible="true" />
|
||||||
|
<linearGradient
|
||||||
|
y2="-388.72955"
|
||||||
|
x2="-93.031357"
|
||||||
|
y1="-396.34738"
|
||||||
|
x1="-93.031357"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-256.56122,59.685418)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient14219"
|
||||||
|
xlink:href="#linearGradient15404"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10013-4-63-6">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#333333;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10015-2-76-1" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#292929;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10017-46-15-8" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10597-5">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#16191a;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10599-2" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#2b3133;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10601-5" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
y2="-322.16354"
|
||||||
|
x2="921.22498"
|
||||||
|
y1="-330.05121"
|
||||||
|
x1="921.32812"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-1456.5464,275.45191)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15374"
|
||||||
|
xlink:href="#linearGradient10013-4-63-6"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
gradientTransform="translate(-1199.9852,216.38048)"
|
||||||
|
y2="-227.07961"
|
||||||
|
x2="1203.9177"
|
||||||
|
y1="-217.56708"
|
||||||
|
x1="1203.9177"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15376"
|
||||||
|
xlink:href="#linearGradient10597-5"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
y2="-388.72955"
|
||||||
|
x2="-93.031357"
|
||||||
|
y1="-396.34738"
|
||||||
|
x1="-93.031357"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-256.56122,59.685418)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient14219-6"
|
||||||
|
xlink:href="#linearGradient15404-9"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient15404-9"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<stop
|
||||||
|
id="stop15406-6"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#515151;stop-opacity:1" />
|
||||||
|
<stop
|
||||||
|
id="stop15408-7"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#292929;stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#000000"
|
||||||
|
bordercolor="#2d2d2d"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageopacity="1"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="1"
|
||||||
|
inkscape:cx="71.516955"
|
||||||
|
inkscape:cy="5.8710559"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1412"
|
||||||
|
inkscape:window-height="1067"
|
||||||
|
inkscape:window-x="2635"
|
||||||
|
inkscape:window-y="226"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
borderlayer="true"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:snap-nodes="false"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
showborder="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid14843"
|
||||||
|
empspacing="5"
|
||||||
|
visible="true"
|
||||||
|
enabled="true"
|
||||||
|
snapvisiblegridlinesonly="true" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata3204">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-342.5,-521.36218)">
|
||||||
|
<g
|
||||||
|
transform="matrix(0.80230061,0,0,0.80230061,-87.624044,-453.10297)"
|
||||||
|
id="g14586-0"
|
||||||
|
style="stroke-width:2.3714385;stroke-miterlimit:4;stroke-dasharray:none">
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="matrix(1.9969286,0,0,1.9969286,-397.05491,877.00482)"
|
||||||
|
id="g15291-9-6"
|
||||||
|
style="stroke-width:1.18754292;stroke-miterlimit:4;stroke-dasharray:none;display:inline;enable-background:new">
|
||||||
|
<g
|
||||||
|
transform="translate(877.50354,-102.83507)"
|
||||||
|
id="g16853-4-9"
|
||||||
|
style="stroke-width:1.18754292;stroke-miterlimit:4;stroke-dasharray:none;enable-background:new">
|
||||||
|
<rect
|
||||||
|
transform="scale(1,-1)"
|
||||||
|
style="color:#000000;fill:url(#linearGradient14219-6);fill-opacity:1;fill-rule:nonzero;stroke:#3465a4;stroke-width:1.24833274;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
|
||||||
|
id="rect6506-6"
|
||||||
|
width="11.281681"
|
||||||
|
height="11.26221"
|
||||||
|
x="-409.59354"
|
||||||
|
y="-284.40115"
|
||||||
|
rx="1.0052766"
|
||||||
|
ry="1.0052764" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="translate(343.99999,987.99997)"
|
||||||
|
id="g5886-5"
|
||||||
|
style="stroke-width:2.3714385;stroke-miterlimit:4;stroke-dasharray:none;display:inline;enable-background:new" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
transform="matrix(0.84337,0,0,0.84337,-110.16632,-503.56182)"
|
||||||
|
id="g14586">
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="matrix(1.9969286,0,0,1.9969286,-397.05491,877.00482)"
|
||||||
|
id="g15291-9"
|
||||||
|
style="display:inline;enable-background:new">
|
||||||
|
<g
|
||||||
|
transform="translate(877.50354,-102.83507)"
|
||||||
|
id="g16853-4"
|
||||||
|
style="enable-background:new" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="translate(343.99999,987.99997)"
|
||||||
|
id="g5886"
|
||||||
|
style="display:inline;enable-background:new">
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:url(#linearGradient5891-0-4);stroke-width:7.11431503;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
d="m 198.5,240 5.25,5.25 13.98616,-14.43081"
|
||||||
|
id="path5835"
|
||||||
|
inkscape:path-effect="#path-effect5837-4-6"
|
||||||
|
inkscape:original-d="m 198.5,240 5.25,5.25 13.98616,-14.43081"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccc" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
inkscape:original-d="m 198.5,240 5.25,5.25 13.91205,-14.31964"
|
||||||
|
inkscape:path-effect="#path-effect5837-4-6"
|
||||||
|
id="path5880"
|
||||||
|
d="m 198.5,240 5.25,5.25 13.91205,-14.31964"
|
||||||
|
style="fill:none;stroke:#4787c8;stroke-width:3.55715752;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
sodipodi:nodetypes="ccc" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#7ea7d3;stroke-width:1.18571913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 197.45937,240.47455 c -0.17828,-0.29362 -0.20087,-0.67548 -0.0603,-0.98892 0.14055,-0.31344 0.43739,-0.54812 0.77144,-0.62817 0.33405,-0.08 0.69314,-0.01 0.99635,0.15175 0.30321,0.16144 0.55146,0.40727 0.79165,0.65284 l 3.66429,3.74643 12.87946,-12.98973 c 0.20796,-0.20974 0.42306,-0.41969 0.68548,-0.55522 0.26242,-0.13553 0.57293,-0.19052 0.85827,-0.11426 0.14267,0.0381 0.27708,0.10787 0.38874,0.20452 0.11167,0.0966 0.20021,0.22004 0.25479,0.35726 0.0546,0.13722 0.075,0.28793 0.0585,0.43468 -0.0165,0.14674 -0.07,0.28919 -0.15422,0.41052"
|
||||||
|
id="path5882"
|
||||||
|
inkscape:path-effect="#path-effect5884-4-7"
|
||||||
|
inkscape:original-d="m 197.45937,240.47455 c 0.65604,-0.56057 2.02485,-1.34847 2.49911,-0.8125 l 3.66429,3.74643 12.87946,-12.98973 c 0.6875,-0.6875 2.09152,0.7375 2.09152,0.7375"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="csccc" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 11 KiB |
198
data/theme/checkbox-off-focused.svg
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24"
|
||||||
|
height="22"
|
||||||
|
id="svg3199"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.1 r9760"
|
||||||
|
sodipodi:docname="checkbox-off.svg">
|
||||||
|
<defs
|
||||||
|
id="defs3201">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient15404"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<stop
|
||||||
|
id="stop15406"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#515151;stop-opacity:1" />
|
||||||
|
<stop
|
||||||
|
id="stop15408"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#292929;stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
id="perspective3207" />
|
||||||
|
<inkscape:perspective
|
||||||
|
id="perspective3187"
|
||||||
|
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||||
|
inkscape:vp_z="1 : 0.5 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_x="0 : 0.5 : 1"
|
||||||
|
sodipodi:type="inkscape:persp3d" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5837-4-6"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect14768"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5884-4-7"
|
||||||
|
is_visible="true" />
|
||||||
|
<linearGradient
|
||||||
|
y2="-388.72955"
|
||||||
|
x2="-93.031357"
|
||||||
|
y1="-396.34738"
|
||||||
|
x1="-93.031357"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-256.56122,59.685418)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient14219"
|
||||||
|
xlink:href="#linearGradient15404"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10013-4-63-6">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#333333;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10015-2-76-1" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#292929;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10017-46-15-8" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10597-5">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#16191a;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10599-2" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#2b3133;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10601-5" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
y2="-322.16354"
|
||||||
|
x2="921.22498"
|
||||||
|
y1="-330.05121"
|
||||||
|
x1="921.32812"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-1456.5464,275.45191)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15374"
|
||||||
|
xlink:href="#linearGradient10013-4-63-6"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
gradientTransform="translate(-1199.9852,216.38048)"
|
||||||
|
y2="-227.07961"
|
||||||
|
x2="1203.9177"
|
||||||
|
y1="-217.56708"
|
||||||
|
x1="1203.9177"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15376"
|
||||||
|
xlink:href="#linearGradient10597-5"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#000000"
|
||||||
|
bordercolor="#2d2d2d"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageopacity="1"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="1"
|
||||||
|
inkscape:cx="6.1225392"
|
||||||
|
inkscape:cy="3.6003241"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1412"
|
||||||
|
inkscape:window-height="1067"
|
||||||
|
inkscape:window-x="2116"
|
||||||
|
inkscape:window-y="261"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
borderlayer="true"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:snap-nodes="false"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
showborder="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid14843"
|
||||||
|
empspacing="5"
|
||||||
|
visible="true"
|
||||||
|
enabled="true"
|
||||||
|
snapvisiblegridlinesonly="true" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata3204">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-342.5,-521.36218)">
|
||||||
|
<g
|
||||||
|
transform="matrix(0.80230061,0,0,0.80230061,-87.624044,-453.10297)"
|
||||||
|
id="g14586"
|
||||||
|
style="stroke-width:2.3714385;stroke-miterlimit:4;stroke-dasharray:none">
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="matrix(1.9969286,0,0,1.9969286,-397.05491,877.00482)"
|
||||||
|
id="g15291-9"
|
||||||
|
style="stroke-width:1.18754292;stroke-miterlimit:4;stroke-dasharray:none;display:inline;enable-background:new">
|
||||||
|
<g
|
||||||
|
transform="translate(877.50354,-102.83507)"
|
||||||
|
id="g16853-4"
|
||||||
|
style="stroke-width:1.18754292;stroke-miterlimit:4;stroke-dasharray:none;enable-background:new">
|
||||||
|
<rect
|
||||||
|
transform="scale(1,-1)"
|
||||||
|
style="color:#000000;fill:url(#linearGradient14219);fill-opacity:1;fill-rule:nonzero;stroke:#3465a4;stroke-width:1.24833274;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
|
||||||
|
id="rect6506-6"
|
||||||
|
width="11.281681"
|
||||||
|
height="11.26221"
|
||||||
|
x="-409.59354"
|
||||||
|
y="-284.40115"
|
||||||
|
rx="1.0052766"
|
||||||
|
ry="1.0052764" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="translate(343.99999,987.99997)"
|
||||||
|
id="g5886"
|
||||||
|
style="stroke-width:2.3714385;stroke-miterlimit:4;stroke-dasharray:none;display:inline;enable-background:new" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 6.5 KiB |
218
data/theme/checkbox-off.svg
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24"
|
||||||
|
height="22"
|
||||||
|
id="svg3199"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.1 r9760"
|
||||||
|
sodipodi:docname="checkbox.svg">
|
||||||
|
<defs
|
||||||
|
id="defs3201">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient15404"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<stop
|
||||||
|
id="stop15406"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#515151;stop-opacity:1" />
|
||||||
|
<stop
|
||||||
|
id="stop15408"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#292929;stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
id="perspective3207" />
|
||||||
|
<inkscape:perspective
|
||||||
|
id="perspective3187"
|
||||||
|
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||||
|
inkscape:vp_z="1 : 0.5 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_x="0 : 0.5 : 1"
|
||||||
|
sodipodi:type="inkscape:persp3d" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient5872-5-1"
|
||||||
|
id="linearGradient5891-0-4"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="205.84143"
|
||||||
|
y1="246.7094"
|
||||||
|
x2="206.74803"
|
||||||
|
y2="231.24142" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient5872-5-1">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#0b2e52;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop5874-4-4" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#1862af;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop5876-0-5" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5837-4-6"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect14768"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5884-4-7"
|
||||||
|
is_visible="true" />
|
||||||
|
<linearGradient
|
||||||
|
y2="-388.72955"
|
||||||
|
x2="-93.031357"
|
||||||
|
y1="-396.34738"
|
||||||
|
x1="-93.031357"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-256.56122,59.685418)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient14219"
|
||||||
|
xlink:href="#linearGradient15404"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10013-4-63-6">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#333333;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10015-2-76-1" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#292929;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10017-46-15-8" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10597-5">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#16191a;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10599-2" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#2b3133;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10601-5" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
y2="-322.16354"
|
||||||
|
x2="921.22498"
|
||||||
|
y1="-330.05121"
|
||||||
|
x1="921.32812"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-1456.5464,275.45191)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15374"
|
||||||
|
xlink:href="#linearGradient10013-4-63-6"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
gradientTransform="translate(-1199.9852,216.38048)"
|
||||||
|
y2="-227.07961"
|
||||||
|
x2="1203.9177"
|
||||||
|
y1="-217.56708"
|
||||||
|
x1="1203.9177"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15376"
|
||||||
|
xlink:href="#linearGradient10597-5"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#000000"
|
||||||
|
bordercolor="#2d2d2d"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageopacity="1"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="4"
|
||||||
|
inkscape:cx="71.247925"
|
||||||
|
inkscape:cy="33.339093"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1412"
|
||||||
|
inkscape:window-height="1067"
|
||||||
|
inkscape:window-x="2116"
|
||||||
|
inkscape:window-y="261"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
borderlayer="true"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:snap-nodes="false"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
showborder="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid14843"
|
||||||
|
empspacing="5"
|
||||||
|
visible="true"
|
||||||
|
enabled="true"
|
||||||
|
snapvisiblegridlinesonly="true" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata3204">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-342.5,-521.36218)">
|
||||||
|
<g
|
||||||
|
transform="matrix(0.84337,0,0,0.84337,-110.16632,-503.56182)"
|
||||||
|
id="g14586">
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="matrix(1.9969286,0,0,1.9969286,-397.05491,877.00482)"
|
||||||
|
id="g15291-9"
|
||||||
|
style="display:inline;enable-background:new">
|
||||||
|
<g
|
||||||
|
transform="translate(877.50354,-102.83507)"
|
||||||
|
id="g16853-4"
|
||||||
|
style="enable-background:new">
|
||||||
|
<rect
|
||||||
|
transform="scale(1,-1)"
|
||||||
|
style="color:#000000;fill:url(#linearGradient14219);fill-opacity:1;fill-rule:nonzero;stroke:#868686;stroke-width:0.59377144999999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
|
||||||
|
id="rect6506-6"
|
||||||
|
width="11.281681"
|
||||||
|
height="11.26221"
|
||||||
|
x="-409.59354"
|
||||||
|
y="-284.40115"
|
||||||
|
rx="0.95632279"
|
||||||
|
ry="0.95632273" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="translate(343.99999,987.99997)"
|
||||||
|
id="g5886"
|
||||||
|
style="display:inline;enable-background:new" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 6.8 KiB |
243
data/theme/checkbox.svg
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24"
|
||||||
|
height="22"
|
||||||
|
id="svg3199"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.1 r9760"
|
||||||
|
sodipodi:docname="checkbox-focused.svg">
|
||||||
|
<defs
|
||||||
|
id="defs3201">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient15404"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<stop
|
||||||
|
id="stop15406"
|
||||||
|
offset="0"
|
||||||
|
style="stop-color:#515151;stop-opacity:1" />
|
||||||
|
<stop
|
||||||
|
id="stop15408"
|
||||||
|
offset="1"
|
||||||
|
style="stop-color:#292929;stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
id="perspective3207" />
|
||||||
|
<inkscape:perspective
|
||||||
|
id="perspective3187"
|
||||||
|
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||||
|
inkscape:vp_z="1 : 0.5 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_x="0 : 0.5 : 1"
|
||||||
|
sodipodi:type="inkscape:persp3d" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient5872-5-1"
|
||||||
|
id="linearGradient5891-0-4"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
x1="205.84143"
|
||||||
|
y1="246.7094"
|
||||||
|
x2="206.74803"
|
||||||
|
y2="231.24142" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient5872-5-1">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#0b2e52;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop5874-4-4" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#1862af;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop5876-0-5" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5837-4-6"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect14768"
|
||||||
|
is_visible="true" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="spiro"
|
||||||
|
id="path-effect5884-4-7"
|
||||||
|
is_visible="true" />
|
||||||
|
<linearGradient
|
||||||
|
y2="-388.72955"
|
||||||
|
x2="-93.031357"
|
||||||
|
y1="-396.34738"
|
||||||
|
x1="-93.031357"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-256.56122,59.685418)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient14219"
|
||||||
|
xlink:href="#linearGradient15404"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10013-4-63-6">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#333333;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10015-2-76-1" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#292929;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10017-46-15-8" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient10597-5">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#16191a;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop10599-2" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#2b3133;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop10601-5" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
y2="-322.16354"
|
||||||
|
x2="921.22498"
|
||||||
|
y1="-330.05121"
|
||||||
|
x1="921.32812"
|
||||||
|
gradientTransform="matrix(1.5918367,0,0,0.85714285,-1456.5464,275.45191)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15374"
|
||||||
|
xlink:href="#linearGradient10013-4-63-6"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
<linearGradient
|
||||||
|
gradientTransform="translate(-1199.9852,216.38048)"
|
||||||
|
y2="-227.07961"
|
||||||
|
x2="1203.9177"
|
||||||
|
y1="-217.56708"
|
||||||
|
x1="1203.9177"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
id="linearGradient15376"
|
||||||
|
xlink:href="#linearGradient10597-5"
|
||||||
|
inkscape:collect="always" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#000000"
|
||||||
|
bordercolor="#2d2d2d"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageopacity="1"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="1"
|
||||||
|
inkscape:cx="64.516955"
|
||||||
|
inkscape:cy="13.871056"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1412"
|
||||||
|
inkscape:window-height="1067"
|
||||||
|
inkscape:window-x="2635"
|
||||||
|
inkscape:window-y="226"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
borderlayer="true"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:snap-nodes="false"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
showborder="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid14843"
|
||||||
|
empspacing="5"
|
||||||
|
visible="true"
|
||||||
|
enabled="true"
|
||||||
|
snapvisiblegridlinesonly="true" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata3204">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-342.5,-521.36218)">
|
||||||
|
<g
|
||||||
|
transform="matrix(0.84337,0,0,0.84337,-110.16632,-503.56182)"
|
||||||
|
id="g14586">
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="matrix(1.9969286,0,0,1.9969286,-397.05491,877.00482)"
|
||||||
|
id="g15291-9"
|
||||||
|
style="display:inline;enable-background:new">
|
||||||
|
<g
|
||||||
|
transform="translate(877.50354,-102.83507)"
|
||||||
|
id="g16853-4"
|
||||||
|
style="enable-background:new">
|
||||||
|
<rect
|
||||||
|
transform="scale(1,-1)"
|
||||||
|
style="color:#000000;fill:url(#linearGradient14219);fill-opacity:1;fill-rule:nonzero;stroke:#868686;stroke-width:0.59377144999999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
|
||||||
|
id="rect6506-6"
|
||||||
|
width="11.281681"
|
||||||
|
height="11.26221"
|
||||||
|
x="-409.59354"
|
||||||
|
y="-284.40115"
|
||||||
|
rx="0.95632279"
|
||||||
|
ry="0.95632273" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:export-ydpi="90"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-filename="/home/jimmac/SparkleShare/gnome-mockups/boxes/interactive/img/checkbox-on.png"
|
||||||
|
transform="translate(343.99999,987.99997)"
|
||||||
|
id="g5886"
|
||||||
|
style="display:inline;enable-background:new">
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:url(#linearGradient5891-0-4);stroke-width:7.11431503;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
d="m 198.5,240 5.25,5.25 13.98616,-14.43081"
|
||||||
|
id="path5835"
|
||||||
|
inkscape:path-effect="#path-effect5837-4-6"
|
||||||
|
inkscape:original-d="m 198.5,240 5.25,5.25 13.98616,-14.43081"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="ccc" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
inkscape:original-d="m 198.5,240 5.25,5.25 13.91205,-14.31964"
|
||||||
|
inkscape:path-effect="#path-effect5837-4-6"
|
||||||
|
id="path5880"
|
||||||
|
d="m 198.5,240 5.25,5.25 13.91205,-14.31964"
|
||||||
|
style="fill:none;stroke:#4787c8;stroke-width:3.55715752;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
sodipodi:nodetypes="ccc" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#7ea7d3;stroke-width:1.18571913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 197.45937,240.47455 c -0.17828,-0.29362 -0.20087,-0.67548 -0.0603,-0.98892 0.14055,-0.31344 0.43739,-0.54812 0.77144,-0.62817 0.33405,-0.08 0.69314,-0.01 0.99635,0.15175 0.30321,0.16144 0.55146,0.40727 0.79165,0.65284 l 3.66429,3.74643 12.87946,-12.98973 c 0.20796,-0.20974 0.42306,-0.41969 0.68548,-0.55522 0.26242,-0.13553 0.57293,-0.19052 0.85827,-0.11426 0.14267,0.0381 0.27708,0.10787 0.38874,0.20452 0.11167,0.0966 0.20021,0.22004 0.25479,0.35726 0.0546,0.13722 0.075,0.28793 0.0585,0.43468 -0.0165,0.14674 -0.07,0.28919 -0.15422,0.41052"
|
||||||
|
id="path5882"
|
||||||
|
inkscape:path-effect="#path-effect5884-4-7"
|
||||||
|
inkscape:original-d="m 197.45937,240.47455 c 0.65604,-0.56057 2.02485,-1.34847 2.49911,-0.8125 l 3.66429,3.74643 12.87946,-12.98973 c 0.6875,-0.6875 2.09152,0.7375 2.09152,0.7375"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
sodipodi:nodetypes="csccc" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 8.8 KiB |
@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width="3"
|
|
||||||
height="10"
|
|
||||||
id="svg2"
|
|
||||||
version="1.1">
|
|
||||||
<defs
|
|
||||||
id="defs4" />
|
|
||||||
<metadata
|
|
||||||
id="metadata7">
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
id="layer1">
|
|
||||||
<rect
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke-width:0.43599999000000000;stroke-miterlimit:4;stroke-dasharray:none"
|
|
||||||
id="rect3779"
|
|
||||||
width="3"
|
|
||||||
height="10"
|
|
||||||
x="0"
|
|
||||||
y="0" />
|
|
||||||
<rect
|
|
||||||
style="fill:#536272;fill-opacity:1;stroke-width:0.43599999;stroke-miterlimit:4;stroke-dasharray:none"
|
|
||||||
id="rect3796"
|
|
||||||
width="3"
|
|
||||||
height="1"
|
|
||||||
x="0"
|
|
||||||
y="9" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 787 B |
@ -9,7 +9,7 @@
|
|||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
width="64"
|
width="65"
|
||||||
height="22"
|
height="22"
|
||||||
id="svg3273"
|
id="svg3273"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
@ -9,7 +9,7 @@
|
|||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
width="64"
|
width="65"
|
||||||
height="22"
|
height="22"
|
||||||
id="svg3012"
|
id="svg3012"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
1
docs/Makefile.am
Normal file
@ -0,0 +1 @@
|
|||||||
|
SUBDIRS = reference
|
1
docs/reference/Makefile.am
Normal file
@ -0,0 +1 @@
|
|||||||
|
SUBDIRS = shell st
|
113
docs/reference/shell/Makefile.am
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
# We require automake 1.6 at least.
|
||||||
|
AUTOMAKE_OPTIONS = 1.6
|
||||||
|
|
||||||
|
# This is a blank Makefile.am for using gtk-doc.
|
||||||
|
# Copy this to your project's API docs directory and modify the variables to
|
||||||
|
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
|
||||||
|
# of using the various options.
|
||||||
|
|
||||||
|
# The name of the module, e.g. 'glib'.
|
||||||
|
DOC_MODULE=shell
|
||||||
|
|
||||||
|
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
|
||||||
|
#DOC_MODULE_VERSION=2
|
||||||
|
|
||||||
|
|
||||||
|
# The top-level SGML file. You can change this if you want to.
|
||||||
|
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
|
||||||
|
|
||||||
|
# Directories containing the source code
|
||||||
|
# gtk-doc will search all .c and .h files beneath these paths
|
||||||
|
# for inline comments documenting functions and macros.
|
||||||
|
DOC_SOURCE_DIR=$(top_srcdir)/src
|
||||||
|
|
||||||
|
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
|
||||||
|
SCANGOBJ_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-scan.
|
||||||
|
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||||
|
SCAN_OPTIONS=--rebuild-types
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mkdb.
|
||||||
|
# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml
|
||||||
|
MKDB_OPTIONS=--xml-mode --output-format=xml
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mktmpl
|
||||||
|
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
|
||||||
|
MKTMPL_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mkhtml
|
||||||
|
MKHTML_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-fixref. Not normally needed.
|
||||||
|
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
|
||||||
|
FIXXREF_OPTIONS=
|
||||||
|
|
||||||
|
# Used for dependencies. The docs will be rebuilt if any of these change.
|
||||||
|
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
|
||||||
|
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
|
||||||
|
HFILE_GLOB=$(top_srcdir)/src/*.h
|
||||||
|
CFILE_GLOB=$(top_srcdir)/src/*.c
|
||||||
|
|
||||||
|
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
|
||||||
|
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
|
||||||
|
EXTRA_HFILES=
|
||||||
|
|
||||||
|
# Header files or dirs to ignore when scanning. Use base file/dir names
|
||||||
|
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
|
||||||
|
IGNORE_HFILES= \
|
||||||
|
calendar-server \
|
||||||
|
gvc \
|
||||||
|
hotplug-sniffer \
|
||||||
|
st \
|
||||||
|
tray \
|
||||||
|
gactionmuxer.h \
|
||||||
|
gactionobservable.h \
|
||||||
|
gactionobserver.h \
|
||||||
|
shell-recorder-src.h
|
||||||
|
|
||||||
|
# Images to copy into HTML directory.
|
||||||
|
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||||
|
HTML_IMAGES=
|
||||||
|
|
||||||
|
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
|
||||||
|
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
|
||||||
|
content_files=
|
||||||
|
|
||||||
|
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||||
|
# These files must be listed here *and* in content_files
|
||||||
|
# e.g. expand_content_files=running.sgml
|
||||||
|
expand_content_files=
|
||||||
|
|
||||||
|
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||||
|
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||||
|
# signals and properties.
|
||||||
|
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
|
||||||
|
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||||
|
GTKDOC_CFLAGS=$(GNOME_SHELL_CFLAGS)
|
||||||
|
GTKDOC_LIBS=$(GNOME_SHELL_LIBS) $(BLUETOOTH_LIBS) $(top_builddir)/src/libgnome-shell.la
|
||||||
|
|
||||||
|
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||||
|
include $(top_srcdir)/gtk-doc.make
|
||||||
|
|
||||||
|
# Other files to distribute
|
||||||
|
# e.g. EXTRA_DIST += version.xml.in
|
||||||
|
EXTRA_DIST +=
|
||||||
|
|
||||||
|
# Files not to distribute
|
||||||
|
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
|
||||||
|
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
|
||||||
|
DISTCLEANFILES = $(DOC_MODULES).types
|
||||||
|
|
||||||
|
# Comment this out if you want 'make check' to test you doc status
|
||||||
|
# and run some sanity checks
|
||||||
|
if ENABLE_GTK_DOC
|
||||||
|
TESTS_ENVIRONMENT = cd $(srcdir) && \
|
||||||
|
DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
|
||||||
|
SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
|
||||||
|
#TESTS = $(GTKDOC_CHECK)
|
||||||
|
endif
|
||||||
|
|
||||||
|
-include $(top_srcdir)/git.mk
|
73
docs/reference/shell/shell-docs.sgml.in
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
||||||
|
[
|
||||||
|
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
||||||
|
]>
|
||||||
|
<book id="index">
|
||||||
|
<bookinfo>
|
||||||
|
<title>Shell Reference Manual</title>
|
||||||
|
<releaseinfo>
|
||||||
|
for Shell @VERSION@.
|
||||||
|
<!--The latest version of this documentation can be found on-line at
|
||||||
|
<ulink role="online-location" url="http://[SERVER]/shell/index.html">http://[SERVER]/shell/</ulink>.-->
|
||||||
|
</releaseinfo>
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<chapter>
|
||||||
|
<title>Actors</title>
|
||||||
|
<xi:include href="xml/shell-generic-container.xml"/>
|
||||||
|
<xi:include href="xml/shell-slicer.xml"/>
|
||||||
|
<xi:include href="xml/shell-stack.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter>
|
||||||
|
<title>Application tracking</title>
|
||||||
|
<xi:include href="xml/shell-app.xml"/>
|
||||||
|
<xi:include href="xml/shell-app-usage.xml"/>
|
||||||
|
<xi:include href="xml/shell-window-tracker.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter>
|
||||||
|
<title>Search</title>
|
||||||
|
<xi:include href="xml/shell-app-system.xml"/>
|
||||||
|
<xi:include href="xml/shell-contact-system.xml"/>
|
||||||
|
<xi:include href="xml/shell-doc-system.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter>
|
||||||
|
<title>Tray Icons</title>
|
||||||
|
<xi:include href="xml/shell-embedded-window.xml"/>
|
||||||
|
<xi:include href="xml/shell-gtk-embed.xml"/>
|
||||||
|
<xi:include href="xml/shell-tray-icon.xml"/>
|
||||||
|
<xi:include href="xml/shell-tray-manager.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter>
|
||||||
|
<title>Recorder</title>
|
||||||
|
<xi:include href="xml/shell-recorder.xml"/>
|
||||||
|
<xi:include href="xml/shell-recorder-src.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter>
|
||||||
|
<title>Integration helpers and utilities</title>
|
||||||
|
<xi:include href="xml/shell-global.xml"/>
|
||||||
|
<xi:include href="xml/shell-wm.xml"/>
|
||||||
|
<xi:include href="xml/shell-xfixes-cursor.xml"/>
|
||||||
|
<xi:include href="xml/shell-util.xml"/>
|
||||||
|
<xi:include href="xml/shell-mount-operation.xml"/>
|
||||||
|
<xi:include href="xml/shell-mobile-providers.xml"/>
|
||||||
|
<xi:include href="xml/shell-network-agent.xml"/>
|
||||||
|
<xi:include href="xml/shell-polkit-authentication-agent.xml"/>
|
||||||
|
<xi:include href="xml/shell-tp-client.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter id="object-tree">
|
||||||
|
<title>Object Hierarchy</title>
|
||||||
|
<xi:include href="xml/tree_index.sgml"/>
|
||||||
|
</chapter>
|
||||||
|
<index id="api-index-full">
|
||||||
|
<title>API Index</title>
|
||||||
|
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
||||||
|
</index>
|
||||||
|
<index id="deprecated-api-index" role="deprecated">
|
||||||
|
<title>Index of deprecated API</title>
|
||||||
|
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
|
||||||
|
</index>
|
||||||
|
|
||||||
|
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||||
|
</book>
|
104
docs/reference/st/Makefile.am
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
# We require automake 1.6 at least.
|
||||||
|
AUTOMAKE_OPTIONS = 1.6
|
||||||
|
|
||||||
|
# This is a blank Makefile.am for using gtk-doc.
|
||||||
|
# Copy this to your project's API docs directory and modify the variables to
|
||||||
|
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
|
||||||
|
# of using the various options.
|
||||||
|
|
||||||
|
# The name of the module, e.g. 'glib'.
|
||||||
|
DOC_MODULE=st
|
||||||
|
|
||||||
|
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
|
||||||
|
#DOC_MODULE_VERSION=2
|
||||||
|
|
||||||
|
|
||||||
|
# The top-level SGML file. You can change this if you want to.
|
||||||
|
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
|
||||||
|
|
||||||
|
# Directories containing the source code
|
||||||
|
# gtk-doc will search all .c and .h files beneath these paths
|
||||||
|
# for inline comments documenting functions and macros.
|
||||||
|
DOC_SOURCE_DIR=$(top_srcdir)/src/st
|
||||||
|
|
||||||
|
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
|
||||||
|
SCANGOBJ_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-scan.
|
||||||
|
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||||
|
SCAN_OPTIONS=--rebuild-types --rebuild-sections
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mkdb.
|
||||||
|
# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml
|
||||||
|
MKDB_OPTIONS=--xml-mode --output-format=xml
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mktmpl
|
||||||
|
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
|
||||||
|
MKTMPL_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-mkhtml
|
||||||
|
MKHTML_OPTIONS=
|
||||||
|
|
||||||
|
# Extra options to supply to gtkdoc-fixref. Not normally needed.
|
||||||
|
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
|
||||||
|
FIXXREF_OPTIONS=
|
||||||
|
|
||||||
|
# Used for dependencies. The docs will be rebuilt if any of these change.
|
||||||
|
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
|
||||||
|
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
|
||||||
|
HFILE_GLOB=$(top_srcdir)/src/st/*.h
|
||||||
|
CFILE_GLOB=$(top_srcdir)/src/st/*.c
|
||||||
|
|
||||||
|
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
|
||||||
|
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
|
||||||
|
EXTRA_HFILES=
|
||||||
|
|
||||||
|
# Header files or dirs to ignore when scanning. Use base file/dir names
|
||||||
|
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
|
||||||
|
IGNORE_HFILES=st-private.h st-theme-node-private.h
|
||||||
|
|
||||||
|
# Images to copy into HTML directory.
|
||||||
|
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||||
|
HTML_IMAGES=
|
||||||
|
|
||||||
|
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
|
||||||
|
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
|
||||||
|
content_files=
|
||||||
|
|
||||||
|
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||||
|
# These files must be listed here *and* in content_files
|
||||||
|
# e.g. expand_content_files=running.sgml
|
||||||
|
expand_content_files=
|
||||||
|
|
||||||
|
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||||
|
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||||
|
# signals and properties.
|
||||||
|
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
|
||||||
|
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||||
|
GTKDOC_CFLAGS=
|
||||||
|
GTKDOC_LIBS=$(top_builddir)/src/libst-1.0.la
|
||||||
|
|
||||||
|
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||||
|
include $(top_srcdir)/gtk-doc.make
|
||||||
|
|
||||||
|
# Other files to distribute
|
||||||
|
# e.g. EXTRA_DIST += version.xml.in
|
||||||
|
EXTRA_DIST +=
|
||||||
|
|
||||||
|
# Files not to distribute
|
||||||
|
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
|
||||||
|
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
|
||||||
|
DISTCLEANFILES = $(DOC_MODULE).types $(DOC_MODULE)-sections.txt
|
||||||
|
|
||||||
|
# Comment this out if you want 'make check' to test you doc status
|
||||||
|
# and run some sanity checks
|
||||||
|
if ENABLE_GTK_DOC
|
||||||
|
TESTS_ENVIRONMENT = cd $(srcdir) && \
|
||||||
|
DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
|
||||||
|
SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
|
||||||
|
#TESTS = $(GTKDOC_CHECK)
|
||||||
|
endif
|
||||||
|
|
||||||
|
-include $(top_srcdir)/git.mk
|
64
docs/reference/st/st-docs.sgml.in
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
||||||
|
[
|
||||||
|
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
||||||
|
]>
|
||||||
|
<book id="index">
|
||||||
|
<bookinfo>
|
||||||
|
<title>St Reference Manual</title>
|
||||||
|
<releaseinfo>
|
||||||
|
for St @VERSION@.
|
||||||
|
<!--The latest version of this documentation can be found on-line at
|
||||||
|
<ulink role="online-location" url="http://[SERVER]/st/index.html">http://[SERVER]/st/</ulink>.-->
|
||||||
|
</releaseinfo>
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<part>
|
||||||
|
<title>API reference</title>
|
||||||
|
<chapter id="base">
|
||||||
|
<title>Abstract classes and Interfaces</title>
|
||||||
|
<xi:include href="xml/st-widget.xml"/>
|
||||||
|
<xi:include href="xml/st-widget-accessible.xml"/>
|
||||||
|
<xi:include href="xml/st-scrollable.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter id="widgets">
|
||||||
|
<title>Widgets</title>
|
||||||
|
<xi:include href="xml/st-button.xml"/>
|
||||||
|
<xi:include href="xml/st-drawing-area.xml"/>
|
||||||
|
<xi:include href="xml/st-entry.xml"/>
|
||||||
|
<xi:include href="xml/st-icon.xml"/>
|
||||||
|
<xi:include href="xml/st-label.xml"/>
|
||||||
|
</chapter>
|
||||||
|
<chapter id="containers">
|
||||||
|
<title>Containers</title>
|
||||||
|
<xi:include href="xml/st-bin.xml"/>
|
||||||
|
<xi:include href="xml/st-box-layout.xml"/>
|
||||||
|
<xi:include href="xml/st-scroll-view.xml"/>
|
||||||
|
<xi:include href="xml/st-table.xml"/>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="styling">
|
||||||
|
<title>Styling</title>
|
||||||
|
<xi:include href="xml/st-theme.xml"/>
|
||||||
|
<xi:include href="xml/st-theme-context.xml"/>
|
||||||
|
<xi:include href="xml/st-theme-node.xml"/>
|
||||||
|
<xi:include href="xml/st-theme-node-transition.xml"/>
|
||||||
|
<xi:include href="xml/st-texture-cache.xml"/>
|
||||||
|
</chapter>
|
||||||
|
</part>
|
||||||
|
<chapter id="object-tree">
|
||||||
|
<title>Object Hierarchy</title>
|
||||||
|
<xi:include href="xml/tree_index.sgml"/>
|
||||||
|
</chapter>
|
||||||
|
<index id="api-index-full">
|
||||||
|
<title>API Index</title>
|
||||||
|
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
||||||
|
</index>
|
||||||
|
<index id="deprecated-api-index" role="deprecated">
|
||||||
|
<title>Index of deprecated API</title>
|
||||||
|
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
|
||||||
|
</index>
|
||||||
|
|
||||||
|
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||||
|
</book>
|
@ -66,4 +66,11 @@ its dependencies to build from tarballs.</description>
|
|||||||
<gnome:userid>marinaz</gnome:userid>
|
<gnome:userid>marinaz</gnome:userid>
|
||||||
</foaf:Person>
|
</foaf:Person>
|
||||||
</maintainer>
|
</maintainer>
|
||||||
|
<maintainer>
|
||||||
|
<foaf:Person>
|
||||||
|
<foaf:name>Florian Müllner</foaf:name>
|
||||||
|
<foaf:mbox rdf:resource="mailto:fmuellner@gnome.org" />
|
||||||
|
<gnome:userid>fmuellner</gnome:userid>
|
||||||
|
</foaf:Person>
|
||||||
|
</maintainer>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,4 +1,20 @@
|
|||||||
|
|
||||||
|
EXTRA_DIST = misc/config.js.in
|
||||||
|
CLEANFILES = misc/config.js
|
||||||
|
|
||||||
|
misc/config.js: misc/config.js.in Makefile
|
||||||
|
[ -d $(@D) ] || $(mkdir_p) $(@D) ; \
|
||||||
|
sed -e "s|[@]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
|
||||||
|
-e "s|[@]PACKAGE_VERSION@|$(PACKAGE_VERSION)|g" \
|
||||||
|
-e "s|[@]GJS_VERSION@|$(GJS_VERSION)|g" \
|
||||||
|
-e "s|[@]HAVE_BLUETOOTH@|$(HAVE_BLUETOOTH)|g" \
|
||||||
|
-e "s|[@]SHELL_SYSTEM_CA_FILE@|$(SHELL_SYSTEM_CA_FILE)|g" \
|
||||||
|
-e "s|[@]GETTEXT_PACKAGE@|$(GETTEXT_PACKAGE)|g" \
|
||||||
|
-e "s|[@]datadir@|$(datadir)|g" \
|
||||||
|
-e "s|[@]libexecdir@|$(libexecdir)|g" \
|
||||||
|
-e "s|[@]sysconfdir@|$(sysconfdir)|g" \
|
||||||
|
$< > $@
|
||||||
|
|
||||||
jsdir = $(pkgdatadir)/js
|
jsdir = $(pkgdatadir)/js
|
||||||
|
|
||||||
nobase_dist_js_DATA = \
|
nobase_dist_js_DATA = \
|
||||||
@ -7,12 +23,15 @@ nobase_dist_js_DATA = \
|
|||||||
gdm/fingerprint.js \
|
gdm/fingerprint.js \
|
||||||
gdm/loginDialog.js \
|
gdm/loginDialog.js \
|
||||||
gdm/powerMenu.js \
|
gdm/powerMenu.js \
|
||||||
|
gdm/systemd.js \
|
||||||
|
extensionPrefs/main.js \
|
||||||
misc/config.js \
|
misc/config.js \
|
||||||
misc/docInfo.js \
|
misc/extensionUtils.js \
|
||||||
misc/fileUtils.js \
|
misc/fileUtils.js \
|
||||||
misc/format.js \
|
misc/format.js \
|
||||||
misc/gnomeSession.js \
|
misc/gnomeSession.js \
|
||||||
misc/history.js \
|
misc/history.js \
|
||||||
|
misc/jsParse.js \
|
||||||
misc/modemManager.js \
|
misc/modemManager.js \
|
||||||
misc/params.js \
|
misc/params.js \
|
||||||
misc/screenSaver.js \
|
misc/screenSaver.js \
|
||||||
@ -25,17 +44,19 @@ nobase_dist_js_DATA = \
|
|||||||
ui/autorunManager.js \
|
ui/autorunManager.js \
|
||||||
ui/boxpointer.js \
|
ui/boxpointer.js \
|
||||||
ui/calendar.js \
|
ui/calendar.js \
|
||||||
|
ui/checkBox.js \
|
||||||
ui/contactDisplay.js \
|
ui/contactDisplay.js \
|
||||||
ui/ctrlAltTab.js \
|
ui/ctrlAltTab.js \
|
||||||
ui/dash.js \
|
ui/dash.js \
|
||||||
ui/dateMenu.js \
|
ui/dateMenu.js \
|
||||||
ui/dnd.js \
|
ui/dnd.js \
|
||||||
ui/docDisplay.js \
|
|
||||||
ui/endSessionDialog.js \
|
ui/endSessionDialog.js \
|
||||||
ui/environment.js \
|
ui/environment.js \
|
||||||
ui/extensionSystem.js \
|
ui/extensionSystem.js \
|
||||||
|
ui/flashspot.js \
|
||||||
ui/iconGrid.js \
|
ui/iconGrid.js \
|
||||||
ui/keyboard.js \
|
ui/keyboard.js \
|
||||||
|
ui/keyringPrompt.js \
|
||||||
ui/layout.js \
|
ui/layout.js \
|
||||||
ui/lightbox.js \
|
ui/lightbox.js \
|
||||||
ui/link.js \
|
ui/link.js \
|
||||||
@ -55,6 +76,7 @@ nobase_dist_js_DATA = \
|
|||||||
ui/placeDisplay.js \
|
ui/placeDisplay.js \
|
||||||
ui/polkitAuthenticationAgent.js \
|
ui/polkitAuthenticationAgent.js \
|
||||||
ui/popupMenu.js \
|
ui/popupMenu.js \
|
||||||
|
ui/remoteSearch.js \
|
||||||
ui/runDialog.js \
|
ui/runDialog.js \
|
||||||
ui/scripting.js \
|
ui/scripting.js \
|
||||||
ui/search.js \
|
ui/search.js \
|
||||||
@ -62,6 +84,7 @@ nobase_dist_js_DATA = \
|
|||||||
ui/shellDBus.js \
|
ui/shellDBus.js \
|
||||||
ui/statusIconDispatcher.js \
|
ui/statusIconDispatcher.js \
|
||||||
ui/status/accessibility.js \
|
ui/status/accessibility.js \
|
||||||
|
ui/status/candidatePanel.js \
|
||||||
ui/status/keyboard.js \
|
ui/status/keyboard.js \
|
||||||
ui/status/network.js \
|
ui/status/network.js \
|
||||||
ui/status/power.js \
|
ui/status/power.js \
|
||||||
@ -71,6 +94,7 @@ nobase_dist_js_DATA = \
|
|||||||
ui/tweener.js \
|
ui/tweener.js \
|
||||||
ui/userMenu.js \
|
ui/userMenu.js \
|
||||||
ui/viewSelector.js \
|
ui/viewSelector.js \
|
||||||
|
ui/wanda.js \
|
||||||
ui/windowAttentionHandler.js \
|
ui/windowAttentionHandler.js \
|
||||||
ui/windowManager.js \
|
ui/windowManager.js \
|
||||||
ui/workspace.js \
|
ui/workspace.js \
|
||||||
|
278
js/extensionPrefs/main.js
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
|
||||||
|
const Lang = imports.lang;
|
||||||
|
const Gettext = imports.gettext;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const GObject = imports.gi.GObject;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
const Gtk = imports.gi.Gtk;
|
||||||
|
const Pango = imports.gi.Pango;
|
||||||
|
|
||||||
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
const Config = imports.misc.config;
|
||||||
|
const Format = imports.misc.format;
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
|
||||||
|
|
||||||
|
const GnomeShellIface = <interface name="org.gnome.Shell">
|
||||||
|
<signal name="ExtensionStatusChanged">
|
||||||
|
<arg type="s" name="uuid"/>
|
||||||
|
<arg type="i" name="state"/>
|
||||||
|
<arg type="s" name="error"/>
|
||||||
|
</signal>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
|
const GnomeShellProxy = Gio.DBusProxy.makeProxyWrapper(GnomeShellIface);
|
||||||
|
|
||||||
|
function stripPrefix(string, prefix) {
|
||||||
|
if (string.slice(0, prefix.length) == prefix)
|
||||||
|
return string.slice(prefix.length);
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Application = new Lang.Class({
|
||||||
|
Name: 'Application',
|
||||||
|
_init: function() {
|
||||||
|
GLib.set_prgname('gnome-shell-extension-prefs');
|
||||||
|
this.application = new Gtk.Application({
|
||||||
|
application_id: 'org.gnome.shell.ExtensionPrefs',
|
||||||
|
flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE
|
||||||
|
});
|
||||||
|
|
||||||
|
this.application.connect('activate', Lang.bind(this, this._onActivate));
|
||||||
|
this.application.connect('command-line', Lang.bind(this, this._onCommandLine));
|
||||||
|
this.application.connect('startup', Lang.bind(this, this._onStartup));
|
||||||
|
|
||||||
|
this._extensionPrefsModules = {};
|
||||||
|
|
||||||
|
this._extensionIters = {};
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildModel: function() {
|
||||||
|
this._model = new Gtk.ListStore();
|
||||||
|
this._model.set_column_types([GObject.TYPE_STRING, GObject.TYPE_STRING]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_extensionAvailable: function(uuid) {
|
||||||
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
|
|
||||||
|
if (!extension)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (ExtensionUtils.isOutOfDate(extension))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!extension.dir.get_child('prefs.js').query_exists(null))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
_setExtensionInsensitive: function(layout, cell, model, iter, data) {
|
||||||
|
let uuid = model.get_value(iter, 0);
|
||||||
|
cell.set_sensitive(this._extensionAvailable(uuid));
|
||||||
|
},
|
||||||
|
|
||||||
|
_getExtensionPrefsModule: function(extension) {
|
||||||
|
let uuid = extension.metadata.uuid;
|
||||||
|
|
||||||
|
if (this._extensionPrefsModules.hasOwnProperty(uuid))
|
||||||
|
return this._extensionPrefsModules[uuid];
|
||||||
|
|
||||||
|
ExtensionUtils.installImporter(extension);
|
||||||
|
|
||||||
|
let prefsModule = extension.imports.prefs;
|
||||||
|
prefsModule.init(extension.metadata);
|
||||||
|
|
||||||
|
this._extensionPrefsModules[uuid] = prefsModule;
|
||||||
|
return prefsModule;
|
||||||
|
},
|
||||||
|
|
||||||
|
_selectExtension: function(uuid) {
|
||||||
|
if (!this._extensionAvailable(uuid))
|
||||||
|
return;
|
||||||
|
|
||||||
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
|
let widget;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let prefsModule = this._getExtensionPrefsModule(extension);
|
||||||
|
widget = prefsModule.buildPrefsWidget();
|
||||||
|
} catch (e) {
|
||||||
|
widget = this._buildErrorUI(extension, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Destroy the current prefs widget, if it exists
|
||||||
|
if (this._extensionPrefsBin.get_child())
|
||||||
|
this._extensionPrefsBin.get_child().destroy();
|
||||||
|
|
||||||
|
this._extensionPrefsBin.add(widget);
|
||||||
|
this._extensionSelector.set_active_iter(this._extensionIters[uuid]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_extensionSelected: function() {
|
||||||
|
let [success, iter] = this._extensionSelector.get_active_iter();
|
||||||
|
if (!success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
let uuid = this._model.get_value(iter, 0);
|
||||||
|
this._selectExtension(uuid);
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildErrorUI: function(extension, exc) {
|
||||||
|
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
|
||||||
|
let label = new Gtk.Label({
|
||||||
|
label: _("There was an error loading the preferences dialog for %s:").format(extension.metadata.name)
|
||||||
|
});
|
||||||
|
box.add(label);
|
||||||
|
|
||||||
|
let errortext = '';
|
||||||
|
errortext += exc;
|
||||||
|
errortext += '\n\n';
|
||||||
|
errortext += 'Stack trace:\n';
|
||||||
|
|
||||||
|
// Indent stack trace.
|
||||||
|
errortext += exc.stack.split('\n').map(function(line) {
|
||||||
|
return ' ' + line;
|
||||||
|
}).join('\n');
|
||||||
|
|
||||||
|
let scroll = new Gtk.ScrolledWindow({ vexpand: true });
|
||||||
|
let buffer = new Gtk.TextBuffer({ text: errortext });
|
||||||
|
let textview = new Gtk.TextView({ buffer: buffer });
|
||||||
|
textview.override_font(Pango.font_description_from_string('monospace'));
|
||||||
|
scroll.add(textview);
|
||||||
|
box.add(scroll);
|
||||||
|
|
||||||
|
box.show_all();
|
||||||
|
return box;
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildUI: function(app) {
|
||||||
|
this._window = new Gtk.ApplicationWindow({ application: app,
|
||||||
|
window_position: Gtk.WindowPosition.CENTER,
|
||||||
|
title: _("GNOME Shell Extension Preferences") });
|
||||||
|
|
||||||
|
this._window.set_size_request(600, 400);
|
||||||
|
|
||||||
|
let vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
|
||||||
|
this._window.add(vbox);
|
||||||
|
|
||||||
|
let toolbar = new Gtk.Toolbar();
|
||||||
|
toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR);
|
||||||
|
vbox.add(toolbar);
|
||||||
|
let toolitem;
|
||||||
|
|
||||||
|
let label = new Gtk.Label({ label: _("<b>Extension</b>"),
|
||||||
|
use_markup: true });
|
||||||
|
toolitem = new Gtk.ToolItem({ child: label });
|
||||||
|
toolbar.add(toolitem);
|
||||||
|
|
||||||
|
this._extensionSelector = new Gtk.ComboBox({ model: this._model,
|
||||||
|
margin_left: 8,
|
||||||
|
hexpand: true });
|
||||||
|
this._extensionSelector.get_style_context().add_class(Gtk.STYLE_CLASS_RAISED);
|
||||||
|
|
||||||
|
let renderer = new Gtk.CellRendererText();
|
||||||
|
this._extensionSelector.pack_start(renderer, true);
|
||||||
|
this._extensionSelector.add_attribute(renderer, 'text', 1);
|
||||||
|
this._extensionSelector.set_cell_data_func(renderer, Lang.bind(this, this._setExtensionInsensitive), null);
|
||||||
|
this._extensionSelector.connect('changed', Lang.bind(this, this._extensionSelected));
|
||||||
|
|
||||||
|
toolitem = new Gtk.ToolItem({ child: this._extensionSelector });
|
||||||
|
toolitem.set_expand(true);
|
||||||
|
toolbar.add(toolitem);
|
||||||
|
|
||||||
|
this._extensionPrefsBin = new Gtk.Frame();
|
||||||
|
vbox.add(this._extensionPrefsBin);
|
||||||
|
|
||||||
|
let label = new Gtk.Label({
|
||||||
|
label: _("Select an extension to configure using the combobox above."),
|
||||||
|
vexpand: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this._extensionPrefsBin.add(label);
|
||||||
|
|
||||||
|
this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell');
|
||||||
|
this._shellProxy.connectSignal('ExtensionStatusChanged', Lang.bind(this, function(proxy, senderName, [uuid, state, error]) {
|
||||||
|
if (ExtensionUtils.extensions[uuid] !== undefined)
|
||||||
|
this._scanExtensions();
|
||||||
|
}));
|
||||||
|
|
||||||
|
this._window.show_all();
|
||||||
|
},
|
||||||
|
|
||||||
|
_scanExtensions: function() {
|
||||||
|
ExtensionUtils.scanExtensions(Lang.bind(this, function(uuid, dir, type) {
|
||||||
|
if (ExtensionUtils.extensions[uuid] !== undefined)
|
||||||
|
return;
|
||||||
|
|
||||||
|
let extension;
|
||||||
|
try {
|
||||||
|
extension = ExtensionUtils.createExtensionObject(uuid, dir, type);
|
||||||
|
} catch(e) {
|
||||||
|
global.logError('' + e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let iter = this._model.append();
|
||||||
|
this._model.set(iter, [0, 1], [uuid, extension.metadata.name]);
|
||||||
|
this._extensionIters[uuid] = iter;
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
_onActivate: function() {
|
||||||
|
this._window.present();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onStartup: function(app) {
|
||||||
|
this._buildModel();
|
||||||
|
this._buildUI(app);
|
||||||
|
this._scanExtensions();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onCommandLine: function(app, commandLine) {
|
||||||
|
app.activate();
|
||||||
|
let args = commandLine.get_arguments();
|
||||||
|
if (args.length) {
|
||||||
|
let uuid = args[0];
|
||||||
|
|
||||||
|
// Strip off "extension:///" prefix which fakes a URI, if it exists
|
||||||
|
uuid = stripPrefix(uuid, "extension:///");
|
||||||
|
|
||||||
|
if (!this._extensionAvailable(uuid))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
this._selectExtension(uuid);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function initEnvironment() {
|
||||||
|
// Monkey-patch in a "global" object that fakes some Shell utilities
|
||||||
|
// that ExtensionUtils depends on.
|
||||||
|
window.global = {
|
||||||
|
log: function() {
|
||||||
|
print([].join.call(arguments, ', '));
|
||||||
|
},
|
||||||
|
|
||||||
|
logError: function(s) {
|
||||||
|
global.log('ERROR: ' + s);
|
||||||
|
},
|
||||||
|
|
||||||
|
userdatadir: GLib.build_filenamev([GLib.get_user_data_dir(), 'gnome-shell'])
|
||||||
|
};
|
||||||
|
|
||||||
|
String.prototype.format = Format.format;
|
||||||
|
}
|
||||||
|
|
||||||
|
function main(argv) {
|
||||||
|
initEnvironment();
|
||||||
|
ExtensionUtils.init();
|
||||||
|
|
||||||
|
Gettext.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
||||||
|
Gettext.textdomain(Config.GETTEXT_PACKAGE);
|
||||||
|
|
||||||
|
let app = new Application();
|
||||||
|
app.application.run(argv);
|
||||||
|
}
|
@ -21,11 +21,9 @@
|
|||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
function Task() {
|
const Task = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'Task',
|
||||||
}
|
|
||||||
|
|
||||||
Task.prototype = {
|
|
||||||
_init: function(scope, handler) {
|
_init: function(scope, handler) {
|
||||||
if (scope)
|
if (scope)
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
@ -41,20 +39,15 @@ Task.prototype = {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(Task.prototype);
|
Signals.addSignalMethods(Task.prototype);
|
||||||
|
|
||||||
function Hold() {
|
const Hold = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'Hold',
|
||||||
}
|
Extends: Task,
|
||||||
|
|
||||||
Hold.prototype = {
|
|
||||||
__proto__: Task.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Task.prototype._init.call(this,
|
this.parent(this, function () {
|
||||||
this,
|
|
||||||
function () {
|
|
||||||
return this;
|
return this;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,18 +81,15 @@ Hold.prototype = {
|
|||||||
isAcquired: function() {
|
isAcquired: function() {
|
||||||
return this._acquisitions > 0;
|
return this._acquisitions > 0;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Signals.addSignalMethods(Hold.prototype);
|
Signals.addSignalMethods(Hold.prototype);
|
||||||
|
|
||||||
function Batch() {
|
const Batch = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'Batch',
|
||||||
}
|
Extends: Task,
|
||||||
|
|
||||||
Batch.prototype = {
|
|
||||||
__proto__: Task.prototype,
|
|
||||||
|
|
||||||
_init: function(scope, tasks) {
|
_init: function(scope, tasks) {
|
||||||
Task.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this.tasks = [];
|
this.tasks = [];
|
||||||
|
|
||||||
@ -166,20 +156,12 @@ Batch.prototype = {
|
|||||||
cancel: function() {
|
cancel: function() {
|
||||||
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
|
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
|
||||||
Signals.addSignalMethods(Batch.prototype);
|
Signals.addSignalMethods(Batch.prototype);
|
||||||
|
|
||||||
function ConcurrentBatch() {
|
const ConcurrentBatch = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ConcurrentBatch',
|
||||||
}
|
Extends: Batch,
|
||||||
|
|
||||||
ConcurrentBatch.prototype = {
|
|
||||||
__proto__: Batch.prototype,
|
|
||||||
|
|
||||||
_init: function(scope, tasks) {
|
|
||||||
Batch.prototype._init.call(this, scope, tasks);
|
|
||||||
},
|
|
||||||
|
|
||||||
process: function() {
|
process: function() {
|
||||||
let hold = this.runTask();
|
let hold = this.runTask();
|
||||||
@ -193,19 +175,12 @@ ConcurrentBatch.prototype = {
|
|||||||
// concurrently.
|
// concurrently.
|
||||||
this.nextTask();
|
this.nextTask();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(ConcurrentBatch.prototype);
|
Signals.addSignalMethods(ConcurrentBatch.prototype);
|
||||||
|
|
||||||
function ConsecutiveBatch() {
|
const ConsecutiveBatch = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ConsecutiveBatch',
|
||||||
}
|
Extends: Batch,
|
||||||
|
|
||||||
ConsecutiveBatch.prototype = {
|
|
||||||
__proto__: Batch.prototype,
|
|
||||||
|
|
||||||
_init: function(scope, tasks) {
|
|
||||||
Batch.prototype._init.call(this, scope, tasks);
|
|
||||||
},
|
|
||||||
|
|
||||||
process: function() {
|
process: function() {
|
||||||
let hold = this.runTask();
|
let hold = this.runTask();
|
||||||
@ -224,5 +199,5 @@ ConsecutiveBatch.prototype = {
|
|||||||
this.nextTask();
|
this.nextTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(ConsecutiveBatch.prototype);
|
Signals.addSignalMethods(ConsecutiveBatch.prototype);
|
||||||
|
@ -1,32 +1,22 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
const Gio = imports.gi.Gio;
|
||||||
|
|
||||||
const ConsoleKitManagerIface = {
|
const ConsoleKitManagerIface = <interface name='org.freedesktop.ConsoleKit.Manager'>
|
||||||
name: 'org.freedesktop.ConsoleKit.Manager',
|
<method name='CanRestart'>
|
||||||
methods: [{ name: 'CanRestart',
|
<arg type='b' direction='out'/>
|
||||||
inSignature: '',
|
</method>
|
||||||
outSignature: 'b' },
|
<method name='CanStop'>
|
||||||
{ name: 'CanStop',
|
<arg type='b' direction='out'/>
|
||||||
inSignature: '',
|
</method>
|
||||||
outSignature: 'b' },
|
<method name='Restart' />
|
||||||
{ name: 'Restart',
|
<method name='Stop' />
|
||||||
inSignature: '',
|
</interface>;
|
||||||
outSignature: '' },
|
|
||||||
{ name: 'Stop',
|
const ConsoleKitProxy = Gio.DBusProxy.makeProxyWrapper(ConsoleKitManagerIface);
|
||||||
inSignature: '',
|
|
||||||
outSignature: '' }]
|
|
||||||
};
|
|
||||||
|
|
||||||
function ConsoleKitManager() {
|
function ConsoleKitManager() {
|
||||||
this._init();
|
return new ConsoleKitProxy(Gio.DBus.system,
|
||||||
};
|
|
||||||
|
|
||||||
ConsoleKitManager.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
DBus.system.proxifyObject(this,
|
|
||||||
'org.freedesktop.ConsoleKit',
|
'org.freedesktop.ConsoleKit',
|
||||||
'/org/freedesktop/ConsoleKit/Manager');
|
'/org/freedesktop/ConsoleKit/Manager');
|
||||||
}
|
|
||||||
};
|
};
|
||||||
DBus.proxifyPrototype(ConsoleKitManager.prototype, ConsoleKitManagerIface);
|
|
||||||
|
@ -1,26 +1,27 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
const Gio = imports.gi.Gio;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const FprintManagerIface = {
|
const FprintManagerIface = <interface name='net.reactivated.Fprint.Manager'>
|
||||||
name: 'net.reactivated.Fprint.Manager',
|
<method name='GetDefaultDevice'>
|
||||||
methods: [{ name: 'GetDefaultDevice',
|
<arg type='o' direction='out' />
|
||||||
inSignature: '',
|
</method>
|
||||||
outSignature: 'o' }]
|
</interface>;
|
||||||
};
|
|
||||||
|
const FprintManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(FprintManagerIface);
|
||||||
|
|
||||||
function FprintManager() {
|
function FprintManager() {
|
||||||
this._init();
|
var self = new Gio.DBusProxy({ g_connection: Gio.DBus.system,
|
||||||
};
|
g_interface_name: FprintManagerInfo.name,
|
||||||
|
g_interface_info: FprintManagerInfo,
|
||||||
|
g_name: 'net.reactivated.Fprint',
|
||||||
|
g_object_path: '/net/reactivated/Fprint/Manager',
|
||||||
|
g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
|
||||||
|
Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
|
||||||
|
|
||||||
FprintManager.prototype = {
|
self.init(null);
|
||||||
_init: function() {
|
return self;
|
||||||
DBus.system.proxifyObject(this,
|
|
||||||
'net.reactivated.Fprint',
|
|
||||||
'/net/reactivated/Fprint/Manager');
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
DBus.proxifyPrototype(FprintManager.prototype, FprintManagerIface);
|
|
||||||
|
@ -33,7 +33,6 @@ const St = imports.gi.St;
|
|||||||
const GdmGreeter = imports.gi.GdmGreeter;
|
const GdmGreeter = imports.gi.GdmGreeter;
|
||||||
|
|
||||||
const Batch = imports.gdm.batch;
|
const Batch = imports.gdm.batch;
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Fprint = imports.gdm.fingerprint;
|
const Fprint = imports.gdm.fingerprint;
|
||||||
const Lightbox = imports.ui.lightbox;
|
const Lightbox = imports.ui.lightbox;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
@ -141,11 +140,9 @@ function _smoothlyResizeActor(actor, width, height) {
|
|||||||
return hold;
|
return hold;
|
||||||
}
|
}
|
||||||
|
|
||||||
function UserListItem(user, reason) {
|
const UserListItem = new Lang.Class({
|
||||||
this._init(user, reason);
|
Name: 'UserListItem',
|
||||||
}
|
|
||||||
|
|
||||||
UserListItem.prototype = {
|
|
||||||
_init: function(user) {
|
_init: function(user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this._userChangedId = this.user.connect('changed',
|
this._userChangedId = this.user.connect('changed',
|
||||||
@ -208,7 +205,8 @@ UserListItem.prototype = {
|
|||||||
// We use background-image instead of, say, St.TextureCache
|
// We use background-image instead of, say, St.TextureCache
|
||||||
// so the theme writers can add a rounded frame around the image
|
// so the theme writers can add a rounded frame around the image
|
||||||
// and so theme writers can pick the icon size.
|
// and so theme writers can pick the icon size.
|
||||||
this._iconBin.set_style('background-image: url("' + iconFile + '");');
|
this._iconBin.set_style('background-image: url("' + iconFile + '");' +
|
||||||
|
'background-size: contain;');
|
||||||
} else {
|
} else {
|
||||||
this._iconBin.hide();
|
this._iconBin.hide();
|
||||||
}
|
}
|
||||||
@ -274,15 +272,12 @@ UserListItem.prototype = {
|
|||||||
});
|
});
|
||||||
return hold;
|
return hold;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
|
||||||
Signals.addSignalMethods(UserListItem.prototype);
|
Signals.addSignalMethods(UserListItem.prototype);
|
||||||
|
|
||||||
function UserList() {
|
const UserList = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'UserList',
|
||||||
}
|
|
||||||
|
|
||||||
UserList.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
|
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
|
||||||
this.actor.set_policy(Gtk.PolicyType.NEVER,
|
this.actor.set_policy(Gtk.PolicyType.NEVER,
|
||||||
@ -493,6 +488,9 @@ UserList.prototype = {
|
|||||||
if (user.is_system_account())
|
if (user.is_system_account())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (user.locked)
|
||||||
|
return;
|
||||||
|
|
||||||
let userName = user.get_user_name();
|
let userName = user.get_user_name();
|
||||||
|
|
||||||
if (!userName)
|
if (!userName)
|
||||||
@ -538,14 +536,12 @@ UserList.prototype = {
|
|||||||
item.actor.destroy();
|
item.actor.destroy();
|
||||||
delete this._items[userName];
|
delete this._items[userName];
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(UserList.prototype);
|
Signals.addSignalMethods(UserList.prototype);
|
||||||
|
|
||||||
function SessionListItem(id, name) {
|
const SessionListItem = new Lang.Class({
|
||||||
this._init(id, name);
|
Name: 'SessionListItem',
|
||||||
}
|
|
||||||
|
|
||||||
SessionListItem.prototype = {
|
|
||||||
_init: function(id, name) {
|
_init: function(id, name) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
@ -600,14 +596,12 @@ SessionListItem.prototype = {
|
|||||||
_onClicked: function() {
|
_onClicked: function() {
|
||||||
this.emit('activate');
|
this.emit('activate');
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(SessionListItem.prototype);
|
Signals.addSignalMethods(SessionListItem.prototype);
|
||||||
|
|
||||||
function SessionList() {
|
const SessionList = new Lang.Class({
|
||||||
this._init();
|
Name: 'SessionList',
|
||||||
}
|
|
||||||
|
|
||||||
SessionList.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new St.Bin();
|
this.actor = new St.Bin();
|
||||||
|
|
||||||
@ -703,7 +697,7 @@ SessionList.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_populate: function() {
|
_populate: function() {
|
||||||
this._itemList.destroy_children();
|
this._itemList.destroy_all_children();
|
||||||
this._activeSessionId = null;
|
this._activeSessionId = null;
|
||||||
this._items = {};
|
this._items = {};
|
||||||
|
|
||||||
@ -738,24 +732,15 @@ SessionList.prototype = {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(SessionList.prototype);
|
Signals.addSignalMethods(SessionList.prototype);
|
||||||
|
|
||||||
function LoginDialog() {
|
const LoginDialog = new Lang.Class({
|
||||||
if (_loginDialog == null) {
|
Name: 'LoginDialog',
|
||||||
this._init();
|
Extends: ModalDialog.ModalDialog,
|
||||||
_loginDialog = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _loginDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginDialog.prototype = {
|
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { shellReactive: true,
|
this.parent({ shellReactive: true, styleClass: 'login-dialog' });
|
||||||
styleClass: 'login-dialog' });
|
|
||||||
this.connect('destroy',
|
this.connect('destroy',
|
||||||
Lang.bind(this, this._onDestroy));
|
Lang.bind(this, this._onDestroy));
|
||||||
this.connect('opened',
|
this.connect('opened',
|
||||||
@ -844,7 +829,7 @@ LoginDialog.prototype = {
|
|||||||
x_fill: true,
|
x_fill: true,
|
||||||
y_fill: false,
|
y_fill: false,
|
||||||
x_align: St.Align.START });
|
x_align: St.Align.START });
|
||||||
// translators: this message is shown below the password entry field
|
// Translators: this message is shown below the password entry field
|
||||||
// to indicate the user can swipe their finger instead
|
// to indicate the user can swipe their finger instead
|
||||||
this._promptFingerprintMessage = new St.Label({ text: _("(or swipe finger)"),
|
this._promptFingerprintMessage = new St.Label({ text: _("(or swipe finger)"),
|
||||||
style_class: 'login-dialog-prompt-fingerprint-message' });
|
style_class: 'login-dialog-prompt-fingerprint-message' });
|
||||||
@ -864,6 +849,9 @@ LoginDialog.prototype = {
|
|||||||
x_align: St.Align.START });
|
x_align: St.Align.START });
|
||||||
this._promptBox.hide();
|
this._promptBox.hide();
|
||||||
|
|
||||||
|
// translators: this message is shown below the user list on the
|
||||||
|
// login screen. It can be activated to reveal an entry for
|
||||||
|
// manually entering the username.
|
||||||
let notListedLabel = new St.Label({ text: _("Not listed?"),
|
let notListedLabel = new St.Label({ text: _("Not listed?"),
|
||||||
style_class: 'login-dialog-not-listed-label' });
|
style_class: 'login-dialog-not-listed-label' });
|
||||||
this._notListedButton = new St.Button({ style_class: 'login-dialog-not-listed-button',
|
this._notListedButton = new St.Button({ style_class: 'login-dialog-not-listed-button',
|
||||||
@ -905,7 +893,7 @@ LoginDialog.prototype = {
|
|||||||
if (!this._settings.get_boolean(_FINGERPRINT_AUTHENTICATION_KEY))
|
if (!this._settings.get_boolean(_FINGERPRINT_AUTHENTICATION_KEY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._fprintManager.GetDefaultDeviceRemote(DBus.CALL_FLAG_START, Lang.bind(this,
|
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, Lang.bind(this,
|
||||||
function(device, error) {
|
function(device, error) {
|
||||||
if (!error && device)
|
if (!error && device)
|
||||||
this._haveFingerprintReader = true;
|
this._haveFingerprintReader = true;
|
||||||
@ -1396,8 +1384,8 @@ LoginDialog.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close: function() {
|
||||||
ModalDialog.ModalDialog.prototype.close.call(this);
|
this.parent();
|
||||||
|
|
||||||
Main.ctrlAltTabManager.removeGroup(this._group);
|
Main.ctrlAltTabManager.removeGroup(this._group);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -22,21 +22,24 @@ const Lang = imports.lang;
|
|||||||
const UPowerGlib = imports.gi.UPowerGlib;
|
const UPowerGlib = imports.gi.UPowerGlib;
|
||||||
|
|
||||||
const ConsoleKit = imports.gdm.consoleKit;
|
const ConsoleKit = imports.gdm.consoleKit;
|
||||||
|
const Systemd = imports.gdm.systemd;
|
||||||
|
|
||||||
const PanelMenu = imports.ui.panelMenu;
|
const PanelMenu = imports.ui.panelMenu;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
|
|
||||||
function PowerMenuButton() {
|
const PowerMenuButton = new Lang.Class({
|
||||||
this._init();
|
Name: 'PowerMenuButton',
|
||||||
}
|
Extends: PanelMenu.SystemStatusButton,
|
||||||
|
|
||||||
PowerMenuButton.prototype = {
|
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'system-shutdown', null);
|
this.parent('system-shutdown', null);
|
||||||
this._consoleKitManager = new ConsoleKit.ConsoleKitManager();
|
|
||||||
this._upClient = new UPowerGlib.Client();
|
this._upClient = new UPowerGlib.Client();
|
||||||
|
|
||||||
|
if (Systemd.haveSystemd())
|
||||||
|
this._systemdLoginManager = new Systemd.SystemdLoginManager();
|
||||||
|
else
|
||||||
|
this._consoleKitManager = new ConsoleKit.ConsoleKitManager();
|
||||||
|
|
||||||
this._createSubMenu();
|
this._createSubMenu();
|
||||||
|
|
||||||
this._upClient.connect('notify::can-suspend',
|
this._upClient.connect('notify::can-suspend',
|
||||||
@ -57,13 +60,24 @@ PowerMenuButton.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_updateVisibility: function() {
|
_updateVisibility: function() {
|
||||||
if (!this._haveSuspend && !this._haveShutdown && !this._haveRestart)
|
let shouldBeVisible = (this._haveSuspend || this._haveShutdown || this._haveRestart);
|
||||||
this.actor.hide();
|
this.actor.visible = shouldBeVisible;
|
||||||
else
|
|
||||||
this.actor.show();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateHaveShutdown: function() {
|
_updateHaveShutdown: function() {
|
||||||
|
|
||||||
|
if (Systemd.haveSystemd()) {
|
||||||
|
this._systemdLoginManager.CanPowerOffRemote(Lang.bind(this,
|
||||||
|
function(result, error) {
|
||||||
|
if (!error)
|
||||||
|
this._haveShutdown = result != 'no';
|
||||||
|
else
|
||||||
|
this._haveShutdown = false;
|
||||||
|
|
||||||
|
this._powerOffItem.actor.visible = this._haveShutdown;
|
||||||
|
this._updateVisibility();
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
this._consoleKitManager.CanStopRemote(Lang.bind(this,
|
this._consoleKitManager.CanStopRemote(Lang.bind(this,
|
||||||
function(result, error) {
|
function(result, error) {
|
||||||
if (!error)
|
if (!error)
|
||||||
@ -71,17 +85,26 @@ PowerMenuButton.prototype = {
|
|||||||
else
|
else
|
||||||
this._haveShutdown = false;
|
this._haveShutdown = false;
|
||||||
|
|
||||||
if (this._haveShutdown) {
|
this._powerOffItem.actor.visible = this._haveShutdown;
|
||||||
this._powerOffItem.actor.show();
|
|
||||||
} else {
|
|
||||||
this._powerOffItem.actor.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateHaveRestart: function() {
|
_updateHaveRestart: function() {
|
||||||
|
|
||||||
|
if (Systemd.haveSystemd()) {
|
||||||
|
this._systemdLoginManager.CanRebootRemote(Lang.bind(this,
|
||||||
|
function(result, error) {
|
||||||
|
if (!error)
|
||||||
|
this._haveRestart = result != 'no';
|
||||||
|
else
|
||||||
|
this._haveRestart = false;
|
||||||
|
|
||||||
|
this._restartItem.actor.visible = this._haveRestart;
|
||||||
|
this._updateVisibility();
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
this._consoleKitManager.CanRestartRemote(Lang.bind(this,
|
this._consoleKitManager.CanRestartRemote(Lang.bind(this,
|
||||||
function(result, error) {
|
function(result, error) {
|
||||||
if (!error)
|
if (!error)
|
||||||
@ -89,24 +112,15 @@ PowerMenuButton.prototype = {
|
|||||||
else
|
else
|
||||||
this._haveRestart = false;
|
this._haveRestart = false;
|
||||||
|
|
||||||
if (this._haveRestart) {
|
this._restartItem.actor.visible = this._haveRestart;
|
||||||
this._restartItem.actor.show();
|
|
||||||
} else {
|
|
||||||
this._restartItem.actor.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateHaveSuspend: function() {
|
_updateHaveSuspend: function() {
|
||||||
this._haveSuspend = this._upClient.get_can_suspend();
|
this._haveSuspend = this._upClient.get_can_suspend();
|
||||||
|
this._suspendItem.actor.visible = this._haveSuspend;
|
||||||
if (this._haveSuspend)
|
|
||||||
this._suspendItem.actor.show();
|
|
||||||
else
|
|
||||||
this._suspendItem.actor.hide();
|
|
||||||
|
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -135,12 +149,22 @@ PowerMenuButton.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onActivateRestart: function() {
|
_onActivateRestart: function() {
|
||||||
if (this._haveRestart)
|
if (!this._haveRestart)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Systemd.haveSystemd())
|
||||||
|
this._systemdLoginManager.RebootRemote(true);
|
||||||
|
else
|
||||||
this._consoleKitManager.RestartRemote();
|
this._consoleKitManager.RestartRemote();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onActivatePowerOff: function() {
|
_onActivatePowerOff: function() {
|
||||||
if (this._haveShutdown)
|
if (!this._haveShutdown)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Systemd.haveSystemd())
|
||||||
|
this._systemdLoginManager.PowerOffRemote(true);
|
||||||
|
else
|
||||||
this._consoleKitManager.StopRemote();
|
this._consoleKitManager.StopRemote();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
31
js/gdm/systemd.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
|
||||||
|
const SystemdLoginManagerIface = <interface name='org.freedesktop.login1.Manager'>
|
||||||
|
<method name='PowerOff'>
|
||||||
|
<arg type='b' direction='in'/>
|
||||||
|
</method>
|
||||||
|
<method name='Reboot'>
|
||||||
|
<arg type='b' direction='in'/>
|
||||||
|
</method>
|
||||||
|
<method name='CanPowerOff'>
|
||||||
|
<arg type='s' direction='out'/>
|
||||||
|
</method>
|
||||||
|
<method name='CanReboot'>
|
||||||
|
<arg type='s' direction='out'/>
|
||||||
|
</method>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
|
const SystemdLoginManagerProxy = Gio.DBusProxy.makeProxyWrapper(SystemdLoginManagerIface);
|
||||||
|
|
||||||
|
function SystemdLoginManager() {
|
||||||
|
return new SystemdLoginManagerProxy(Gio.DBus.system,
|
||||||
|
'org.freedesktop.login1',
|
||||||
|
'/org/freedesktop/login1');
|
||||||
|
};
|
||||||
|
|
||||||
|
function haveSystemd() {
|
||||||
|
return GLib.access("/sys/fs/cgroup/systemd", 0) >= 0;
|
||||||
|
}
|
@ -10,3 +10,10 @@ const GJS_VERSION = '@GJS_VERSION@';
|
|||||||
const HAVE_BLUETOOTH = @HAVE_BLUETOOTH@;
|
const HAVE_BLUETOOTH = @HAVE_BLUETOOTH@;
|
||||||
/* The system TLS CA list */
|
/* The system TLS CA list */
|
||||||
const SHELL_SYSTEM_CA_FILE = '@SHELL_SYSTEM_CA_FILE@';
|
const SHELL_SYSTEM_CA_FILE = '@SHELL_SYSTEM_CA_FILE@';
|
||||||
|
/* gettext package */
|
||||||
|
const GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@';
|
||||||
|
/* locale dir */
|
||||||
|
const LOCALEDIR = '@datadir@/locale';
|
||||||
|
/* other standard directories */
|
||||||
|
const LIBEXECDIR = '@libexecdir@';
|
||||||
|
const SYSCONFDIR = '@sysconfdir@';
|
||||||
|
@ -1,140 +0,0 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
||||||
|
|
||||||
const St = imports.gi.St;
|
|
||||||
const Shell = imports.gi.Shell;
|
|
||||||
const Lang = imports.lang;
|
|
||||||
const Signals = imports.signals;
|
|
||||||
const Search = imports.ui.search;
|
|
||||||
|
|
||||||
const THUMBNAIL_ICON_MARGIN = 2;
|
|
||||||
|
|
||||||
function DocInfo(recentInfo) {
|
|
||||||
this._init(recentInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
DocInfo.prototype = {
|
|
||||||
_init : function(recentInfo) {
|
|
||||||
this.recentInfo = recentInfo;
|
|
||||||
// We actually used get_modified() instead of get_visited()
|
|
||||||
// here, as GtkRecentInfo doesn't updated get_visited()
|
|
||||||
// correctly. See http://bugzilla.gnome.org/show_bug.cgi?id=567094
|
|
||||||
this.timestamp = recentInfo.get_modified();
|
|
||||||
this.name = recentInfo.get_display_name();
|
|
||||||
this._lowerName = this.name.toLowerCase();
|
|
||||||
this.uri = recentInfo.get_uri();
|
|
||||||
this.mimeType = recentInfo.get_mime_type();
|
|
||||||
},
|
|
||||||
|
|
||||||
createIcon : function(size) {
|
|
||||||
return St.TextureCache.get_default().load_recent_thumbnail(size, this.recentInfo);
|
|
||||||
},
|
|
||||||
|
|
||||||
launch : function(workspaceIndex) {
|
|
||||||
Shell.DocSystem.get_default().open(this.recentInfo, workspaceIndex);
|
|
||||||
},
|
|
||||||
|
|
||||||
matchTerms: function(terms) {
|
|
||||||
let mtype = Search.MatchType.NONE;
|
|
||||||
for (let i = 0; i < terms.length; i++) {
|
|
||||||
let term = terms[i];
|
|
||||||
let idx = this._lowerName.indexOf(term);
|
|
||||||
if (idx == 0) {
|
|
||||||
mtype = Search.MatchType.PREFIX;
|
|
||||||
} else if (idx > 0) {
|
|
||||||
if (mtype == Search.MatchType.NONE)
|
|
||||||
mtype = Search.MatchType.SUBSTRING;
|
|
||||||
} else {
|
|
||||||
return Search.MatchType.NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mtype;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var docManagerInstance = null;
|
|
||||||
|
|
||||||
function getDocManager() {
|
|
||||||
if (docManagerInstance == null)
|
|
||||||
docManagerInstance = new DocManager();
|
|
||||||
return docManagerInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DocManager wraps the DocSystem, primarily to expose DocInfo objects.
|
|
||||||
*/
|
|
||||||
function DocManager() {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
|
|
||||||
DocManager.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
this._docSystem = Shell.DocSystem.get_default();
|
|
||||||
this._infosByTimestamp = [];
|
|
||||||
this._infosByUri = {};
|
|
||||||
this._docSystem.connect('changed', Lang.bind(this, this._reload));
|
|
||||||
this._reload();
|
|
||||||
},
|
|
||||||
|
|
||||||
_reload: function() {
|
|
||||||
let docs = this._docSystem.get_all();
|
|
||||||
this._infosByTimestamp = [];
|
|
||||||
this._infosByUri = {};
|
|
||||||
for (let i = 0; i < docs.length; i++) {
|
|
||||||
let recentInfo = docs[i];
|
|
||||||
|
|
||||||
let docInfo = new DocInfo(recentInfo);
|
|
||||||
this._infosByTimestamp.push(docInfo);
|
|
||||||
this._infosByUri[docInfo.uri] = docInfo;
|
|
||||||
}
|
|
||||||
this.emit('changed');
|
|
||||||
},
|
|
||||||
|
|
||||||
getTimestampOrderedInfos: function() {
|
|
||||||
return this._infosByTimestamp;
|
|
||||||
},
|
|
||||||
|
|
||||||
getInfosByUri: function() {
|
|
||||||
return this._infosByUri;
|
|
||||||
},
|
|
||||||
|
|
||||||
lookupByUri: function(uri) {
|
|
||||||
return this._infosByUri[uri];
|
|
||||||
},
|
|
||||||
|
|
||||||
queueExistenceCheck: function(count) {
|
|
||||||
return this._docSystem.queue_existence_check(count);
|
|
||||||
},
|
|
||||||
|
|
||||||
_searchDocs: function(items, terms) {
|
|
||||||
let multiplePrefixMatches = [];
|
|
||||||
let prefixMatches = [];
|
|
||||||
let multipleSubtringMatches = [];
|
|
||||||
let substringMatches = [];
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
|
||||||
let item = items[i];
|
|
||||||
let mtype = item.matchTerms(terms);
|
|
||||||
if (mtype == Search.MatchType.MULTIPLE_PREFIX)
|
|
||||||
multiplePrefixMatches.push(item.uri);
|
|
||||||
else if (mtype == Search.MatchType.PREFIX)
|
|
||||||
prefixMatches.push(item.uri);
|
|
||||||
else if (mtype == Search.MatchType.MULTIPLE_SUBSTRING)
|
|
||||||
multipleSubtringMatches.push(item.uri);
|
|
||||||
else if (mtype == Search.MatchType.SUBSTRING)
|
|
||||||
substringMatches.push(item.uri);
|
|
||||||
}
|
|
||||||
return multiplePrefixMatches.concat(prefixMatches.concat(multipleSubtringMatches.concat(substringMatches)));
|
|
||||||
},
|
|
||||||
|
|
||||||
initialSearch: function(terms) {
|
|
||||||
return this._searchDocs(this._infosByTimestamp, terms);
|
|
||||||
},
|
|
||||||
|
|
||||||
subsearch: function(previousResults, terms) {
|
|
||||||
return this._searchDocs(previousResults.map(Lang.bind(this,
|
|
||||||
function(url) {
|
|
||||||
return this._infosByUri[url];
|
|
||||||
})), terms);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Signals.addSignalMethods(DocManager.prototype);
|
|
194
js/misc/extensionUtils.js
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
|
// Common utils for the extension system and the extension
|
||||||
|
// preferences tool
|
||||||
|
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
const ShellJS = imports.gi.ShellJS;
|
||||||
|
|
||||||
|
const Config = imports.misc.config;
|
||||||
|
|
||||||
|
const ExtensionType = {
|
||||||
|
SYSTEM: 1,
|
||||||
|
PER_USER: 2
|
||||||
|
};
|
||||||
|
|
||||||
|
// GFile for user extensions
|
||||||
|
var userExtensionsDir = null;
|
||||||
|
|
||||||
|
// Maps uuid -> metadata object
|
||||||
|
const extensions = {};
|
||||||
|
|
||||||
|
function getCurrentExtension() {
|
||||||
|
let stack = (new Error()).stack;
|
||||||
|
|
||||||
|
// Assuming we're importing this directly from an extension (and we shouldn't
|
||||||
|
// ever not be), its UUID should be directly in the path here.
|
||||||
|
let extensionStackLine = stack.split('\n')[1];
|
||||||
|
if (!extensionStackLine)
|
||||||
|
throw new Error('Could not find current extension');
|
||||||
|
|
||||||
|
// The stack line is like:
|
||||||
|
// init([object Object])@/home/user/data/gnome-shell/extensions/u@u.id/prefs.js:8
|
||||||
|
//
|
||||||
|
// In the case that we're importing from
|
||||||
|
// module scope, the first field is blank:
|
||||||
|
// @/home/user/data/gnome-shell/extensions/u@u.id/prefs.js:8
|
||||||
|
let match = new RegExp('@(.+):\\d+').exec(extensionStackLine);
|
||||||
|
if (!match)
|
||||||
|
throw new Error('Could not find current extension');
|
||||||
|
|
||||||
|
let path = match[1];
|
||||||
|
let uuid = GLib.path_get_basename(GLib.path_get_dirname(path));
|
||||||
|
|
||||||
|
let extension = extensions[uuid];
|
||||||
|
if (extension === undefined)
|
||||||
|
throw new Error('Could not find current extension');
|
||||||
|
|
||||||
|
return extension;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* versionCheck:
|
||||||
|
* @required: an array of versions we're compatible with
|
||||||
|
* @current: the version we have
|
||||||
|
*
|
||||||
|
* Check if a component is compatible for an extension.
|
||||||
|
* @required is an array, and at least one version must match.
|
||||||
|
* @current must be in the format <major>.<minor>.<point>.<micro>
|
||||||
|
* <micro> is always ignored
|
||||||
|
* <point> is ignored if <minor> is even (so you can target the
|
||||||
|
* whole stable release)
|
||||||
|
* <minor> and <major> must match
|
||||||
|
* Each target version must be at least <major> and <minor>
|
||||||
|
*/
|
||||||
|
function versionCheck(required, current) {
|
||||||
|
let currentArray = current.split('.');
|
||||||
|
let major = currentArray[0];
|
||||||
|
let minor = currentArray[1];
|
||||||
|
let point = currentArray[2];
|
||||||
|
for (let i = 0; i < required.length; i++) {
|
||||||
|
let requiredArray = required[i].split('.');
|
||||||
|
if (requiredArray[0] == major &&
|
||||||
|
requiredArray[1] == minor &&
|
||||||
|
(requiredArray[2] == point ||
|
||||||
|
(requiredArray[2] == undefined && parseInt(minor) % 2 == 0)))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isOutOfDate(extension) {
|
||||||
|
if (!versionCheck(extension.metadata['shell-version'], Config.PACKAGE_VERSION))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (extension.metadata['js-version'] && !versionCheck(extension.metadata['js-version'], Config.GJS_VERSION))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createExtensionObject(uuid, dir, type) {
|
||||||
|
let info;
|
||||||
|
|
||||||
|
let metadataFile = dir.get_child('metadata.json');
|
||||||
|
if (!metadataFile.query_exists(null)) {
|
||||||
|
throw new Error('Missing metadata.json');
|
||||||
|
}
|
||||||
|
|
||||||
|
let metadataContents, success, tag;
|
||||||
|
try {
|
||||||
|
[success, metadataContents, tag] = metadataFile.load_contents(null);
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('Failed to load metadata.json: ' + e);
|
||||||
|
}
|
||||||
|
let meta;
|
||||||
|
try {
|
||||||
|
meta = JSON.parse(metadataContents);
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('Failed to parse metadata.json: ' + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
let requiredProperties = ['uuid', 'name', 'description', 'shell-version'];
|
||||||
|
for (let i = 0; i < requiredProperties.length; i++) {
|
||||||
|
let prop = requiredProperties[i];
|
||||||
|
if (!meta[prop]) {
|
||||||
|
throw new Error('missing "' + prop + '" property in metadata.json');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encourage people to add this
|
||||||
|
if (!meta.url) {
|
||||||
|
global.log('Warning: Missing "url" property in metadata.json');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uuid != meta.uuid) {
|
||||||
|
throw new Error('uuid "' + meta.uuid + '" from metadata.json does not match directory name "' + uuid + '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
let extension = {};
|
||||||
|
|
||||||
|
extension.metadata = meta;
|
||||||
|
extension.uuid = meta.uuid;
|
||||||
|
extension.type = type;
|
||||||
|
extension.dir = dir;
|
||||||
|
extension.path = dir.get_path();
|
||||||
|
extension.error = '';
|
||||||
|
extension.hasPrefs = dir.get_child('prefs.js').query_exists(null);
|
||||||
|
|
||||||
|
extensions[uuid] = extension;
|
||||||
|
|
||||||
|
return extension;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _extension = null;
|
||||||
|
|
||||||
|
function installImporter(extension) {
|
||||||
|
_extension = extension;
|
||||||
|
ShellJS.add_extension_importer('imports.misc.extensionUtils._extension', 'imports', extension.path);
|
||||||
|
_extension = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
|
||||||
|
userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
|
||||||
|
try {
|
||||||
|
if (!userExtensionsDir.query_exists(null))
|
||||||
|
userExtensionsDir.make_directory_with_parents(null);
|
||||||
|
} catch (e) {
|
||||||
|
global.logError('' + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanExtensionsInDirectory(callback, dir, type) {
|
||||||
|
let fileEnum;
|
||||||
|
let file, info;
|
||||||
|
try {
|
||||||
|
fileEnum = dir.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NONE, null);
|
||||||
|
} catch(e) {
|
||||||
|
global.logError('' + e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((info = fileEnum.next_file(null)) != null) {
|
||||||
|
let fileType = info.get_file_type();
|
||||||
|
if (fileType != Gio.FileType.DIRECTORY)
|
||||||
|
continue;
|
||||||
|
let uuid = info.get_name();
|
||||||
|
let extensionDir = dir.get_child(uuid);
|
||||||
|
callback(uuid, extensionDir, type);
|
||||||
|
}
|
||||||
|
fileEnum.close(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanExtensions(callback) {
|
||||||
|
let systemDataDirs = GLib.get_system_data_dirs();
|
||||||
|
scanExtensionsInDirectory(callback, userExtensionsDir, ExtensionType.PER_USER);
|
||||||
|
for (let i = 0; i < systemDataDirs.length; i++) {
|
||||||
|
let dirPath = GLib.build_filenamev([systemDataDirs[i], 'gnome-shell', 'extensions']);
|
||||||
|
let dir = Gio.file_new_for_path(dirPath);
|
||||||
|
if (dir.query_exists(null))
|
||||||
|
scanExtensionsInDirectory(callback, dir, ExtensionType.SYSTEM);
|
||||||
|
}
|
||||||
|
}
|
@ -38,7 +38,7 @@ function recursivelyDeleteDir(dir) {
|
|||||||
let child = dir.get_child(info.get_name());
|
let child = dir.get_child(info.get_name());
|
||||||
if (type == Gio.FileType.REGULAR)
|
if (type == Gio.FileType.REGULAR)
|
||||||
deleteGFile(child);
|
deleteGFile(child);
|
||||||
else if (type == Gio.TypeType.DIRECTORY)
|
else if (type == Gio.FileType.DIRECTORY)
|
||||||
recursivelyDeleteDir(child);
|
recursivelyDeleteDir(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
|
const ShellJS = imports.gi.ShellJS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is intended to extend the String object and provide
|
* This function is intended to extend the String object and provide
|
||||||
* an String.format API for string formatting.
|
* an String.format API for string formatting.
|
||||||
@ -17,11 +19,16 @@ function format() {
|
|||||||
let i = 0;
|
let i = 0;
|
||||||
let args = arguments;
|
let args = arguments;
|
||||||
|
|
||||||
return str.replace(/%([0-9]+)?(?:\.([0-9]+))?(.)/g, function (str, widthGroup, precisionGroup, genericGroup) {
|
return str.replace(/%(I+)?([0-9]+)?(?:\.([0-9]+))?(.)/g, function (str, flagsGroup, widthGroup, precisionGroup, genericGroup) {
|
||||||
|
|
||||||
if (precisionGroup != '' && genericGroup != 'f')
|
if (precisionGroup != '' && genericGroup != 'f')
|
||||||
throw new Error("Precision can only be specified for 'f'");
|
throw new Error("Precision can only be specified for 'f'");
|
||||||
|
|
||||||
|
let hasAlternativeIntFlag = (flagsGroup.indexOf('I') != -1);
|
||||||
|
|
||||||
|
if (hasAlternativeIntFlag && genericGroup != 'd')
|
||||||
|
throw new Error("Alternative output digits can only be specfied for 'd'");
|
||||||
|
|
||||||
let fillChar = (widthGroup[0] == '0') ? '0' : ' ';
|
let fillChar = (widthGroup[0] == '0') ? '0' : ' ';
|
||||||
let width = parseInt(widthGroup, 10) || 0;
|
let width = parseInt(widthGroup, 10) || 0;
|
||||||
|
|
||||||
@ -41,7 +48,11 @@ function format() {
|
|||||||
s = args[i++].toString();
|
s = args[i++].toString();
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
s = parseInt(args[i++]).toString();
|
let intV = parseInt(args[i++]);
|
||||||
|
if (hasAlternativeIntFlag)
|
||||||
|
s = ShellJS.format_int_alternative_output(intV);
|
||||||
|
else
|
||||||
|
s = intV.toString();
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
s = parseInt(args[i++]).toString(16);
|
s = parseInt(args[i++]).toString(16);
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
const Gio = imports.gi.Gio;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const PresenceIface = {
|
const PresenceIface = <interface name="org.gnome.SessionManager.Presence">
|
||||||
name: 'org.gnome.SessionManager.Presence',
|
<method name="SetStatus">
|
||||||
methods: [{ name: 'SetStatus',
|
<arg type="u" direction="in"/>
|
||||||
inSignature: 'u',
|
</method>
|
||||||
outSignature: '' }],
|
<property name="status" type="u" access="readwrite"/>
|
||||||
properties: [{ name: 'status',
|
<signal name="StatusChanged">
|
||||||
signature: 'u',
|
<arg type="u" direction="out"/>
|
||||||
access: 'readwrite' }],
|
</signal>
|
||||||
signals: [{ name: 'StatusChanged',
|
</interface>;
|
||||||
inSignature: 'u' }]
|
|
||||||
};
|
|
||||||
|
|
||||||
const PresenceStatus = {
|
const PresenceStatus = {
|
||||||
AVAILABLE: 0,
|
AVAILABLE: 0,
|
||||||
@ -23,104 +21,41 @@ const PresenceStatus = {
|
|||||||
IDLE: 3
|
IDLE: 3
|
||||||
};
|
};
|
||||||
|
|
||||||
function Presence() {
|
var PresenceProxy = Gio.DBusProxy.makeProxyWrapper(PresenceIface);
|
||||||
this._init();
|
function Presence(initCallback, cancellable) {
|
||||||
|
return new PresenceProxy(Gio.DBus.session, 'org.gnome.SessionManager',
|
||||||
|
'/org/gnome/SessionManager/Presence', initCallback, cancellable);
|
||||||
}
|
}
|
||||||
|
|
||||||
Presence.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
DBus.session.proxifyObject(this, 'org.gnome.SessionManager', '/org/gnome/SessionManager/Presence', this);
|
|
||||||
},
|
|
||||||
|
|
||||||
getStatus: function(callback) {
|
|
||||||
this.GetRemote('status', Lang.bind(this,
|
|
||||||
function(status, ex) {
|
|
||||||
if (!ex)
|
|
||||||
callback(this, status);
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
|
|
||||||
setStatus: function(status) {
|
|
||||||
this.SetStatusRemote(status);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
DBus.proxifyPrototype(Presence.prototype, PresenceIface);
|
|
||||||
|
|
||||||
// Note inhibitors are immutable objects, so they don't
|
// Note inhibitors are immutable objects, so they don't
|
||||||
// change at runtime (changes always come in the form
|
// change at runtime (changes always come in the form
|
||||||
// of new inhibitors)
|
// of new inhibitors)
|
||||||
const InhibitorIface = {
|
const InhibitorIface = <interface name="org.gnome.SessionManager.Inhibitor">
|
||||||
name: 'org.gnome.SessionManager.Inhibitor',
|
<method name="GetAppId">
|
||||||
properties: [{ name: 'app_id',
|
<arg type="s" direction="out" />
|
||||||
signature: 's',
|
</method>
|
||||||
access: 'readonly' },
|
<method name="GetReason">
|
||||||
{ name: 'client_id',
|
<arg type="s" direction="out" />
|
||||||
signature: 's',
|
</method>
|
||||||
access: 'readonly' },
|
</interface>;
|
||||||
{ name: 'reason',
|
|
||||||
signature: 's',
|
|
||||||
access: 'readonly' },
|
|
||||||
{ name: 'flags',
|
|
||||||
signature: 'u',
|
|
||||||
access: 'readonly' },
|
|
||||||
{ name: 'toplevel_xid',
|
|
||||||
signature: 'u',
|
|
||||||
access: 'readonly' },
|
|
||||||
{ name: 'cookie',
|
|
||||||
signature: 'u',
|
|
||||||
access: 'readonly' }],
|
|
||||||
};
|
|
||||||
|
|
||||||
function Inhibitor(objectPath) {
|
var InhibitorProxy = Gio.DBusProxy.makeProxyWrapper(InhibitorIface);
|
||||||
this._init(objectPath);
|
function Inhibitor(objectPath, initCallback, cancellable) {
|
||||||
|
return new InhibitorProxy(Gio.DBus.session, 'org.gnome.SessionManager', objectPath, initCallback, cancellable);
|
||||||
}
|
}
|
||||||
|
|
||||||
Inhibitor.prototype = {
|
|
||||||
_init: function(objectPath) {
|
|
||||||
DBus.session.proxifyObject(this,
|
|
||||||
'org.gnome.SessionManager',
|
|
||||||
objectPath);
|
|
||||||
this.isLoaded = false;
|
|
||||||
this._loadingPropertiesCount = InhibitorIface.properties.length;
|
|
||||||
for (let i = 0; i < InhibitorIface.properties.length; i++) {
|
|
||||||
let propertyName = InhibitorIface.properties[i].name;
|
|
||||||
this.GetRemote(propertyName, Lang.bind(this,
|
|
||||||
function(value, exception) {
|
|
||||||
if (exception)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this[propertyName] = value;
|
|
||||||
this._loadingPropertiesCount--;
|
|
||||||
|
|
||||||
if (this._loadingPropertiesCount == 0) {
|
|
||||||
this.isLoaded = true;
|
|
||||||
this.emit('is-loaded');
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
DBus.proxifyPrototype(Inhibitor.prototype, InhibitorIface);
|
|
||||||
Signals.addSignalMethods(Inhibitor.prototype);
|
|
||||||
|
|
||||||
|
|
||||||
// Not the full interface, only the methods we use
|
// Not the full interface, only the methods we use
|
||||||
const SessionManagerIface = {
|
const SessionManagerIface = <interface name="org.gnome.SessionManager">
|
||||||
name: 'org.gnome.SessionManager',
|
<method name="Logout">
|
||||||
methods: [
|
<arg type="u" direction="in" />
|
||||||
{ name: 'Logout', inSignature: 'u', outSignature: '' },
|
</method>
|
||||||
{ name: 'Shutdown', inSignature: '', outSignature: '' },
|
<method name="Shutdown" />
|
||||||
{ name: 'CanShutdown', inSignature: '', outSignature: 'b' }
|
<method name="CanShutdown">
|
||||||
]
|
<arg type="b" direction="out" />
|
||||||
};
|
</method>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
function SessionManager() {
|
var SessionManagerProxy = Gio.DBusProxy.makeProxyWrapper(SessionManagerIface);
|
||||||
this._init();
|
function SessionManager(initCallback, cancellable) {
|
||||||
|
return new SessionManagerProxy(Gio.DBus.session, 'org.gnome.SessionManager', '/org/gnome/SessionManager', initCallback, cancellable);
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionManager.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
DBus.session.proxifyObject(this, 'org.gnome.SessionManager', '/org/gnome/SessionManager');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
DBus.proxifyPrototype(SessionManager.prototype, SessionManagerIface);
|
|
@ -7,11 +7,9 @@ const Params = imports.misc.params;
|
|||||||
|
|
||||||
const DEFAULT_LIMIT = 512;
|
const DEFAULT_LIMIT = 512;
|
||||||
|
|
||||||
function HistoryManager(params) {
|
const HistoryManager = new Lang.Class({
|
||||||
this._init(params);
|
Name: 'HistoryManager',
|
||||||
}
|
|
||||||
|
|
||||||
HistoryManager.prototype = {
|
|
||||||
_init: function(params) {
|
_init: function(params) {
|
||||||
params = Params.parse(params, { gsettingsKey: null,
|
params = Params.parse(params, { gsettingsKey: null,
|
||||||
limit: DEFAULT_LIMIT,
|
limit: DEFAULT_LIMIT,
|
||||||
@ -111,5 +109,5 @@ HistoryManager.prototype = {
|
|||||||
if (this._key)
|
if (this._key)
|
||||||
global.settings.set_strv(this._key, this._history);
|
global.settings.set_strv(this._key, this._history);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(HistoryManager.prototype);
|
Signals.addSignalMethods(HistoryManager.prototype);
|
||||||
|
246
js/misc/jsParse.js
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||||
|
|
||||||
|
// Returns a list of potential completions for text. Completions either
|
||||||
|
// follow a dot (e.g. foo.ba -> bar) or they are picked from globalCompletionList (e.g. fo -> foo)
|
||||||
|
// commandHeader is prefixed on any expression before it is eval'ed. It will most likely
|
||||||
|
// consist of global constants that might not carry over from the calling environment.
|
||||||
|
//
|
||||||
|
// This function is likely the one you want to call from external modules
|
||||||
|
function getCompletions(text, commandHeader, globalCompletionList) {
|
||||||
|
let methods = [];
|
||||||
|
let expr, base;
|
||||||
|
let attrHead = '';
|
||||||
|
if (globalCompletionList == null) {
|
||||||
|
globalCompletionList = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
let offset = getExpressionOffset(text, text.length - 1);
|
||||||
|
if (offset >= 0) {
|
||||||
|
text = text.slice(offset);
|
||||||
|
|
||||||
|
// Look for expressions like "Main.panel.foo" and match Main.panel and foo
|
||||||
|
let matches = text.match(/(.*)\.(.*)/);
|
||||||
|
if (matches) {
|
||||||
|
[expr, base, attrHead] = matches;
|
||||||
|
|
||||||
|
methods = getPropertyNamesFromExpression(base, commandHeader).filter(function(attr) {
|
||||||
|
return attr.slice(0, attrHead.length) == attrHead;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for the empty expression or partially entered words
|
||||||
|
// not proceeded by a dot and match them against global constants
|
||||||
|
matches = text.match(/^(\w*)$/);
|
||||||
|
if (text == '' || matches) {
|
||||||
|
[expr, attrHead] = matches;
|
||||||
|
methods = globalCompletionList.filter(function(attr) {
|
||||||
|
return attr.slice(0, attrHead.length) == attrHead;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [methods, attrHead];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// A few functions for parsing strings of javascript code.
|
||||||
|
//
|
||||||
|
|
||||||
|
// Identify characters that delimit an expression. That is,
|
||||||
|
// if we encounter anything that isn't a letter, '.', ')', or ']',
|
||||||
|
// we should stop parsing.
|
||||||
|
function isStopChar(c) {
|
||||||
|
return !c.match(/[\w\.\)\]]/);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given the ending position of a quoted string, find where it starts
|
||||||
|
function findMatchingQuote(expr, offset) {
|
||||||
|
let quoteChar = expr.charAt(offset);
|
||||||
|
for (let i = offset - 1; i >= 0; --i) {
|
||||||
|
if (expr.charAt(i) == quoteChar && expr.charAt(i-1) != '\\'){
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given the ending position of a regex, find where it starts
|
||||||
|
function findMatchingSlash(expr, offset) {
|
||||||
|
for (let i = offset - 1; i >= 0; --i) {
|
||||||
|
if (expr.charAt(i) == '/' && expr.charAt(i-1) != '\\'){
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If expr.charAt(offset) is ')' or ']',
|
||||||
|
// return the position of the corresponding '(' or '[' bracket.
|
||||||
|
// This function does not check for syntactic correctness. e.g.,
|
||||||
|
// findMatchingBrace("[(])", 3) returns 1.
|
||||||
|
function findMatchingBrace(expr, offset) {
|
||||||
|
let closeBrace = expr.charAt(offset);
|
||||||
|
let openBrace = ({')': '(', ']': '['})[closeBrace];
|
||||||
|
|
||||||
|
function findTheBrace(expr, offset) {
|
||||||
|
if (offset < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expr.charAt(offset) == openBrace) {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
if (expr.charAt(offset).match(/['"]/)) {
|
||||||
|
return findTheBrace(expr, findMatchingQuote(expr, offset) - 1);
|
||||||
|
}
|
||||||
|
if (expr.charAt(offset) == '/') {
|
||||||
|
return findTheBrace(expr, findMatchingSlash(expr, offset) - 1);
|
||||||
|
}
|
||||||
|
if (expr.charAt(offset) == closeBrace) {
|
||||||
|
return findTheBrace(expr, findTheBrace(expr, offset - 1) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return findTheBrace(expr, offset - 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return findTheBrace(expr, offset - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Walk expr backwards from offset looking for the beginning of an
|
||||||
|
// expression suitable for passing to eval.
|
||||||
|
// There is no guarantee of correct javascript syntax between the return
|
||||||
|
// value and offset. This function is meant to take a string like
|
||||||
|
// "foo(Obj.We.Are.Completing" and allow you to extract "Obj.We.Are.Completing"
|
||||||
|
function getExpressionOffset(expr, offset) {
|
||||||
|
while (offset >= 0) {
|
||||||
|
let currChar = expr.charAt(offset);
|
||||||
|
|
||||||
|
if (isStopChar(currChar)){
|
||||||
|
return offset + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currChar.match(/[\)\]]/)) {
|
||||||
|
offset = findMatchingBrace(expr, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
--offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return offset + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Things with non-word characters or that start with a number
|
||||||
|
// are not accessible via .foo notation and so aren't returned
|
||||||
|
function isValidPropertyName(w) {
|
||||||
|
return !(w.match(/\W/) || w.match(/^\d/));
|
||||||
|
}
|
||||||
|
|
||||||
|
// To get all properties (enumerable and not), we need to walk
|
||||||
|
// the prototype chain ourselves
|
||||||
|
function getAllProps(obj) {
|
||||||
|
if (obj === null || obj === undefined) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return Object.getOwnPropertyNames(obj).concat( getAllProps(Object.getPrototypeOf(obj)) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given a string _expr_, returns all methods
|
||||||
|
// that can be accessed via '.' notation.
|
||||||
|
// e.g., expr="({ foo: null, bar: null, 4: null })" will
|
||||||
|
// return ["foo", "bar", ...] but the list will not include "4",
|
||||||
|
// since methods accessed with '.' notation must star with a letter or _.
|
||||||
|
function getPropertyNamesFromExpression(expr, commandHeader) {
|
||||||
|
if (commandHeader == null) {
|
||||||
|
commandHeader = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
let obj = {};
|
||||||
|
if (!isUnsafeExpression(expr)) {
|
||||||
|
try {
|
||||||
|
obj = eval(commandHeader + expr);
|
||||||
|
} catch (e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
let propsUnique = {};
|
||||||
|
if (typeof obj === 'object'){
|
||||||
|
let allProps = getAllProps(obj);
|
||||||
|
// Get only things we are allowed to complete following a '.'
|
||||||
|
allProps = allProps.filter( isValidPropertyName );
|
||||||
|
|
||||||
|
// Make sure propsUnique contains one key for every
|
||||||
|
// property so we end up with a unique list of properties
|
||||||
|
allProps.map(function(p){ propsUnique[p] = null; });
|
||||||
|
}
|
||||||
|
return Object.keys(propsUnique).sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given a list of words, returns the longest prefix they all have in common
|
||||||
|
function getCommonPrefix(words) {
|
||||||
|
let word = words[0];
|
||||||
|
for (let i = 0; i < word.length; i++) {
|
||||||
|
for (let w = 1; w < words.length; w++) {
|
||||||
|
if (words[w].charAt(i) != word.charAt(i))
|
||||||
|
return word.slice(0, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if there is reason to think that eval(str)
|
||||||
|
// will modify the global scope
|
||||||
|
function isUnsafeExpression(str) {
|
||||||
|
// Remove any blocks that are quoted or are in a regex
|
||||||
|
function removeLiterals(str) {
|
||||||
|
if (str.length == 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
let currChar = str.charAt(str.length - 1);
|
||||||
|
if (currChar == '"' || currChar == '\'') {
|
||||||
|
return removeLiterals(str.slice(0, findMatchingQuote(str, str.length - 1)));
|
||||||
|
} else if (currChar == '/') {
|
||||||
|
return removeLiterals(str.slice(0, findMatchingSlash(str, str.length - 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return removeLiterals(str.slice(0, str.length - 1)) + currChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for any sort of assignment
|
||||||
|
// The strategy used is dumb: remove any quotes
|
||||||
|
// or regexs and comparison operators and see if there is an '=' character.
|
||||||
|
// If there is, it might be an unsafe assignment.
|
||||||
|
|
||||||
|
let prunedStr = removeLiterals(str);
|
||||||
|
prunedStr = prunedStr.replace(/[=!]==/g, ''); //replace === and !== with nothing
|
||||||
|
prunedStr = prunedStr.replace(/[=<>!]=/g, ''); //replace ==, <=, >=, != with nothing
|
||||||
|
|
||||||
|
if (prunedStr.match(/=/)) {
|
||||||
|
return true;
|
||||||
|
} else if (prunedStr.match(/;/)) {
|
||||||
|
// If we contain a semicolon not inside of a quote/regex, assume we're unsafe as well
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a list of global keywords derived from str
|
||||||
|
function getDeclaredConstants(str) {
|
||||||
|
let ret = [];
|
||||||
|
str.split(';').forEach(function(s) {
|
||||||
|
let base, keyword;
|
||||||
|
let match = s.match(/const\s+(\w+)\s*=/);
|
||||||
|
if (match) {
|
||||||
|
[base, keyword] = match;
|
||||||
|
ret.push(keyword);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
const Gio = imports.gi.Gio;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
@ -8,33 +8,39 @@ const Signals = imports.signals;
|
|||||||
// The following are not the complete interfaces, just the methods we need
|
// The following are not the complete interfaces, just the methods we need
|
||||||
// (or may need in the future)
|
// (or may need in the future)
|
||||||
|
|
||||||
const ModemGsmNetworkInterface = {
|
const ModemGsmNetworkInterface = <interface name="org.freedesktop.ModemManager.Modem.Gsm.Network">
|
||||||
name: 'org.freedesktop.ModemManager.Modem.Gsm.Network',
|
<method name="GetRegistrationInfo">
|
||||||
methods: [
|
<arg type="(uss)" direction="out" />
|
||||||
{ name: 'GetRegistrationInfo', inSignature: '', outSignature: 'uss' },
|
</method>
|
||||||
{ name: 'GetSignalQuality', inSignature: '', outSignature: 'u' }
|
<method name="GetSignalQuality">
|
||||||
],
|
<arg type="u" direction="out" />
|
||||||
properties: [
|
</method>
|
||||||
{ name: 'AccessTechnology', signature: 'u', access: 'read' }
|
<property name="AccessTechnology" type="u" access="read" />
|
||||||
],
|
<signal name="SignalQuality">
|
||||||
signals: [
|
<arg type="u" direction="out" />
|
||||||
{ name: 'SignalQuality', inSignature: 'u' },
|
</signal>
|
||||||
{ name: 'RegistrationInfo', inSignature: 'uss' }
|
<signal name="RegistrationInfo">
|
||||||
]
|
<arg type="u" direction="out" />
|
||||||
};
|
<arg type="s" direction="out" />
|
||||||
const ModemGsmNetworkProxy = DBus.makeProxyClass(ModemGsmNetworkInterface);
|
<arg type="s" direction="out" />
|
||||||
|
</signal>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
const ModemCdmaInterface = {
|
const ModemGsmNetworkProxy = Gio.DBusProxy.makeProxyWrapper(ModemGsmNetworkInterface);
|
||||||
name: 'org.freedesktop.ModemManager.Modem.Cdma',
|
|
||||||
methods: [
|
const ModemCdmaInterface = <interface name="org.freedesktop.ModemManager.Modem.Cdma">
|
||||||
{ name: 'GetSignalQuality', inSignature: '', outSignature: 'u' },
|
<method name="GetSignalQuality">
|
||||||
{ name: 'GetServingSystem', inSignature: '', outSignature: 'usu' }
|
<arg type="u" direction="out" />
|
||||||
],
|
</method>
|
||||||
signals: [
|
<method name="GetServingSystem">
|
||||||
{ name: 'SignalQuality', inSignature: 'u' }
|
<arg type="(usu)" direction="out" />
|
||||||
]
|
</method>
|
||||||
};
|
<signal name="SignalQuality">
|
||||||
const ModemCdmaProxy = DBus.makeProxyClass(ModemCdmaInterface);
|
<arg type="u" direction="out" />
|
||||||
|
</signal>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
|
const ModemCdmaProxy = Gio.DBusProxy.makeProxyWrapper(ModemCdmaInterface);
|
||||||
|
|
||||||
let _providersTable;
|
let _providersTable;
|
||||||
function _getProvidersTable() {
|
function _getProvidersTable() {
|
||||||
@ -44,27 +50,25 @@ function _getProvidersTable() {
|
|||||||
return _providersTable = providers;
|
return _providersTable = providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ModemGsm() {
|
const ModemGsm = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ModemGsm',
|
||||||
}
|
|
||||||
|
|
||||||
ModemGsm.prototype = {
|
|
||||||
_init: function(path) {
|
_init: function(path) {
|
||||||
this._proxy = new ModemGsmNetworkProxy(DBus.system, 'org.freedesktop.ModemManager', path);
|
this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
||||||
|
|
||||||
this.signal_quality = 0;
|
this.signal_quality = 0;
|
||||||
this.operator_name = null;
|
this.operator_name = null;
|
||||||
|
|
||||||
// Code is duplicated because the function have different signatures
|
// Code is duplicated because the function have different signatures
|
||||||
this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, quality) {
|
this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, [quality]) {
|
||||||
this.signal_quality = quality;
|
this.signal_quality = quality;
|
||||||
this.emit('notify::signal-quality');
|
this.emit('notify::signal-quality');
|
||||||
}));
|
}));
|
||||||
this._proxy.connect('RegistrationInfo', Lang.bind(this, function(proxy, status, code, name) {
|
this._proxy.connectSignal('RegistrationInfo', Lang.bind(this, function(proxy, sender, [status, code, name]) {
|
||||||
this.operator_name = this._findOperatorName(name, code);
|
this.operator_name = this._findOperatorName(name, code);
|
||||||
this.emit('notify::operator-name');
|
this.emit('notify::operator-name');
|
||||||
}));
|
}));
|
||||||
this._proxy.GetRegistrationInfoRemote(Lang.bind(this, function(result, err) {
|
this._proxy.GetRegistrationInfoRemote(Lang.bind(this, function([result], err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
log(err);
|
log(err);
|
||||||
return;
|
return;
|
||||||
@ -146,21 +150,19 @@ ModemGsm.prototype = {
|
|||||||
|
|
||||||
return name3 || name2 || null;
|
return name3 || name2 || null;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Signals.addSignalMethods(ModemGsm.prototype);
|
Signals.addSignalMethods(ModemGsm.prototype);
|
||||||
|
|
||||||
function ModemCdma() {
|
const ModemCdma = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ModemCdma',
|
||||||
}
|
|
||||||
|
|
||||||
ModemCdma.prototype = {
|
|
||||||
_init: function(path) {
|
_init: function(path) {
|
||||||
this._proxy = new ModemCdmaProxy(DBus.system, 'org.freedesktop.ModemManager', path);
|
this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
||||||
|
|
||||||
this.signal_quality = 0;
|
this.signal_quality = 0;
|
||||||
this.operator_name = null;
|
this.operator_name = null;
|
||||||
this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, quality) {
|
this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, params) {
|
||||||
this.signal_quality = quality;
|
this.signal_quality = params[0];
|
||||||
this.emit('notify::signal-quality');
|
this.emit('notify::signal-quality');
|
||||||
|
|
||||||
// receiving this signal means the device got activated
|
// receiving this signal means the device got activated
|
||||||
@ -181,7 +183,7 @@ ModemCdma.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_refreshServingSystem: function() {
|
_refreshServingSystem: function() {
|
||||||
this._proxy.GetServingSystemRemote(Lang.bind(this, function(result, err) {
|
this._proxy.GetServingSystemRemote(Lang.bind(this, function([result], err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// it will return an error if the device is not connected
|
// it will return an error if the device is not connected
|
||||||
this.operator_name = null;
|
this.operator_name = null;
|
||||||
@ -221,5 +223,5 @@ ModemCdma.prototype = {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(ModemCdma.prototype);
|
Signals.addSignalMethods(ModemCdma.prototype);
|
||||||
|
@ -1,53 +1,48 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
const Gio = imports.gi.Gio;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
|
|
||||||
const ScreenSaverIface = {
|
const ScreenSaverIface = <interface name="org.gnome.ScreenSaver">
|
||||||
name: 'org.gnome.ScreenSaver',
|
<method name="GetActive">
|
||||||
methods: [{ name: 'GetActive',
|
<arg type="b" direction="out" />
|
||||||
inSignature: '',
|
</method>
|
||||||
outSignature: 'b' },
|
<method name="Lock" />
|
||||||
{ name: 'Lock',
|
<method name="SetActive">
|
||||||
inSignature: '' },
|
<arg type="b" direction="in" />
|
||||||
{ name: 'SetActive',
|
</method>
|
||||||
inSignature: 'b' }],
|
<signal name="ActiveChanged">
|
||||||
signals: [{ name: 'ActiveChanged',
|
<arg type="b" direction="out" />
|
||||||
inSignature: 'b' }]
|
</signal>
|
||||||
};
|
</interface>;
|
||||||
|
|
||||||
|
const ScreenSaverInfo = Gio.DBusInterfaceInfo.new_for_xml(ScreenSaverIface);
|
||||||
|
|
||||||
function ScreenSaverProxy() {
|
function ScreenSaverProxy() {
|
||||||
this._init();
|
var self = new Gio.DBusProxy({ g_connection: Gio.DBus.session,
|
||||||
|
g_interface_name: ScreenSaverInfo.name,
|
||||||
|
g_interface_info: ScreenSaverInfo,
|
||||||
|
g_name: 'org.gnome.ScreenSaver',
|
||||||
|
g_object_path: '/org/gnome/ScreenSaver',
|
||||||
|
g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
|
||||||
|
Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
|
||||||
|
self.init(null);
|
||||||
|
self.screenSaverActive = false;
|
||||||
|
|
||||||
|
self.connectSignal('ActiveChanged', function(proxy, senderName, [isActive]) {
|
||||||
|
self.screenSaverActive = isActive;
|
||||||
|
});
|
||||||
|
self.connect('notify::g-name-owner', function() {
|
||||||
|
if (self.g_name_owner) {
|
||||||
|
self.GetActiveRemote(function(result, excp) {
|
||||||
|
if (result) {
|
||||||
|
let [isActive] = result;
|
||||||
|
self.screenSaverActive = isActive;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else
|
||||||
|
self.screenSaverActive = false;
|
||||||
|
});
|
||||||
|
|
||||||
ScreenSaverProxy.prototype = {
|
return self;
|
||||||
_init: function() {
|
|
||||||
DBus.session.proxifyObject(this,
|
|
||||||
'org.gnome.ScreenSaver',
|
|
||||||
'/org/gnome/ScreenSaver');
|
|
||||||
|
|
||||||
DBus.session.watch_name('org.gnome.ScreenSaver',
|
|
||||||
false, // do not launch a name-owner if none exists
|
|
||||||
Lang.bind(this, this._onSSAppeared),
|
|
||||||
Lang.bind(this, this._onSSVanished));
|
|
||||||
|
|
||||||
this.screenSaverActive = false;
|
|
||||||
this.connect('ActiveChanged',
|
|
||||||
Lang.bind(this, this._onActiveChanged));
|
|
||||||
},
|
|
||||||
|
|
||||||
_onSSAppeared: function(owner) {
|
|
||||||
this.GetActiveRemote(Lang.bind(this, function(isActive) {
|
|
||||||
this.screenSaverActive = isActive;
|
|
||||||
}))
|
|
||||||
},
|
|
||||||
|
|
||||||
_onSSVanished: function(oldOwner) {
|
|
||||||
this.screenSaverActive = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
_onActiveChanged: function(object, isActive) {
|
|
||||||
this.screenSaverActive = isActive;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
DBus.proxifyPrototype(ScreenSaverProxy.prototype, ScreenSaverIface);
|
|
||||||
|
@ -232,3 +232,53 @@ function fixupPCIDescription(desc) {
|
|||||||
|
|
||||||
return out.join(' ');
|
return out.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lowerBound:
|
||||||
|
// @array: an array or array-like object, already sorted
|
||||||
|
// according to @cmp
|
||||||
|
// @val: the value to add
|
||||||
|
// @cmp: a comparator (or undefined to compare as numbers)
|
||||||
|
//
|
||||||
|
// Returns the position of the first element that is not
|
||||||
|
// lower than @val, according to @cmp.
|
||||||
|
// That is, returns the first position at which it
|
||||||
|
// is possible to insert @val without violating the
|
||||||
|
// order.
|
||||||
|
// This is quite like an ordinary binary search, except
|
||||||
|
// that it doesn't stop at first element comparing equal.
|
||||||
|
|
||||||
|
function lowerBound(array, val, cmp) {
|
||||||
|
let min, max, mid, v;
|
||||||
|
cmp = cmp || function(a, b) { return a - b; };
|
||||||
|
|
||||||
|
if (array.length == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
min = 0; max = array.length;
|
||||||
|
while (min < (max - 1)) {
|
||||||
|
mid = Math.floor((min + max) / 2);
|
||||||
|
v = cmp(array[mid], val);
|
||||||
|
|
||||||
|
if (v < 0)
|
||||||
|
min = mid + 1;
|
||||||
|
else
|
||||||
|
max = mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (min == max || cmp(array[min], val) < 0) ? max : min;
|
||||||
|
}
|
||||||
|
|
||||||
|
// insertSorted:
|
||||||
|
// @array: an array sorted according to @cmp
|
||||||
|
// @val: a value to insert
|
||||||
|
// @cmp: the sorting function
|
||||||
|
//
|
||||||
|
// Inserts @val into @array, preserving the
|
||||||
|
// sorting invariants.
|
||||||
|
// Returns the position at which it was inserted
|
||||||
|
function insertSorted(array, val, cmp) {
|
||||||
|
let pos = lowerBound(array, val, cmp);
|
||||||
|
array.splice(pos, 0, val);
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
170
js/ui/altTab.js
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gdk = imports.gi.Gdk;
|
const Gdk = imports.gi.Gdk;
|
||||||
|
const Gtk = imports.gi.Gtk;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Tweener = imports.ui.tweener;
|
const Tweener = imports.ui.tweener;
|
||||||
@ -43,11 +45,9 @@ function primaryModifier(mask) {
|
|||||||
return primary;
|
return primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AltTabPopup() {
|
const AltTabPopup = new Lang.Class({
|
||||||
this._init();
|
Name: 'AltTabPopup',
|
||||||
}
|
|
||||||
|
|
||||||
AltTabPopup.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
|
this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
@ -127,7 +127,7 @@ AltTabPopup.prototype = {
|
|||||||
if (childBox.x2 > primary.x + primary.width - rightPadding)
|
if (childBox.x2 > primary.x + primary.width - rightPadding)
|
||||||
childBox.x2 = primary.x + primary.width - rightPadding;
|
childBox.x2 = primary.x + primary.width - rightPadding;
|
||||||
childBox.y1 = this._appSwitcher.actor.allocation.y2 + spacing;
|
childBox.y1 = this._appSwitcher.actor.allocation.y2 + spacing;
|
||||||
this._thumbnails.addClones(primary.height - bottomPadding - childBox.y1);
|
this._thumbnails.addClones(primary.y + primary.height - bottomPadding - childBox.y1);
|
||||||
let [childMinHeight, childNaturalHeight] = this._thumbnails.actor.get_preferred_height(-1);
|
let [childMinHeight, childNaturalHeight] = this._thumbnails.actor.get_preferred_height(-1);
|
||||||
childBox.y2 = childBox.y1 + childNaturalHeight;
|
childBox.y2 = childBox.y1 + childNaturalHeight;
|
||||||
this._thumbnails.actor.allocate(childBox, flags);
|
this._thumbnails.actor.allocate(childBox, flags);
|
||||||
@ -141,7 +141,7 @@ AltTabPopup.prototype = {
|
|||||||
|
|
||||||
let screen = global.screen;
|
let screen = global.screen;
|
||||||
let display = screen.get_display();
|
let display = screen.get_display();
|
||||||
let windows = display.get_tab_list(Meta.TabList.NORMAL, screen,
|
let windows = display.get_tab_list(Meta.TabList.NORMAL_ALL, screen,
|
||||||
screen.get_active_workspace());
|
screen.get_active_workspace());
|
||||||
|
|
||||||
// windows is only the windows on the current workspace. For
|
// windows is only the windows on the current workspace. For
|
||||||
@ -170,8 +170,12 @@ AltTabPopup.prototype = {
|
|||||||
if (localApps.length == 0 && otherApps.length == 0)
|
if (localApps.length == 0 && otherApps.length == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Main.pushModal(this.actor))
|
if (!Main.pushModal(this.actor)) {
|
||||||
|
// Probably someone else has a pointer grab, try again with keyboard only
|
||||||
|
if (!Main.pushModal(this.actor, global.get_current_time(), Meta.ModalOptions.POINTER_ALREADY_GRABBED)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
this._haveModal = true;
|
this._haveModal = true;
|
||||||
this._modifierMask = primaryModifier(mask);
|
this._modifierMask = primaryModifier(mask);
|
||||||
|
|
||||||
@ -195,7 +199,7 @@ AltTabPopup.prototype = {
|
|||||||
this.actor.get_allocation_box();
|
this.actor.get_allocation_box();
|
||||||
|
|
||||||
// Make the initial selection
|
// Make the initial selection
|
||||||
if (binding == 'switch_group') {
|
if (binding == 'switch-group') {
|
||||||
if (backward) {
|
if (backward) {
|
||||||
this._select(0, this._appIcons[0].cachedWindows.length - 1);
|
this._select(0, this._appIcons[0].cachedWindows.length - 1);
|
||||||
} else {
|
} else {
|
||||||
@ -204,9 +208,9 @@ AltTabPopup.prototype = {
|
|||||||
else
|
else
|
||||||
this._select(0, 0);
|
this._select(0, 0);
|
||||||
}
|
}
|
||||||
} else if (binding == 'switch_group_backward') {
|
} else if (binding == 'switch-group-backward') {
|
||||||
this._select(0, this._appIcons[0].cachedWindows.length - 1);
|
this._select(0, this._appIcons[0].cachedWindows.length - 1);
|
||||||
} else if (binding == 'switch_windows_backward') {
|
} else if (binding == 'switch-windows-backward') {
|
||||||
this._select(this._appIcons.length - 1);
|
this._select(this._appIcons.length - 1);
|
||||||
} else if (this._appIcons.length == 1) {
|
} else if (this._appIcons.length == 1) {
|
||||||
this._select(0);
|
this._select(0);
|
||||||
@ -262,7 +266,7 @@ AltTabPopup.prototype = {
|
|||||||
|
|
||||||
_keyPressEvent : function(actor, event) {
|
_keyPressEvent : function(actor, event) {
|
||||||
let keysym = event.get_key_symbol();
|
let keysym = event.get_key_symbol();
|
||||||
let event_state = Shell.get_event_state(event);
|
let event_state = event.get_state();
|
||||||
let backwards = event_state & Clutter.ModifierType.SHIFT_MASK;
|
let backwards = event_state & Clutter.ModifierType.SHIFT_MASK;
|
||||||
let action = global.display.get_keybinding_action(event.get_key_code(), event_state);
|
let action = global.display.get_keybinding_action(event.get_key_code(), event_state);
|
||||||
|
|
||||||
@ -515,6 +519,7 @@ AltTabPopup.prototype = {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
this._thumbnails = null;
|
this._thumbnails = null;
|
||||||
|
this._appSwitcher._items[this._currentApp].remove_accessible_state (Atk.StateType.EXPANDED);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createThumbnails : function() {
|
_createThumbnails : function() {
|
||||||
@ -535,14 +540,14 @@ AltTabPopup.prototype = {
|
|||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
|
onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
|
||||||
});
|
});
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function SwitcherList(squareItems) {
|
this._appSwitcher._items[this._currentApp].add_accessible_state (Atk.StateType.EXPANDED);
|
||||||
this._init(squareItems);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const SwitcherList = new Lang.Class({
|
||||||
|
Name: 'SwitcherList',
|
||||||
|
|
||||||
SwitcherList.prototype = {
|
|
||||||
_init : function(squareItems) {
|
_init : function(squareItems) {
|
||||||
this.actor = new Shell.GenericContainer({ style_class: 'switcher-list' });
|
this.actor = new Shell.GenericContainer({ style_class: 'switcher-list' });
|
||||||
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||||
@ -561,14 +566,14 @@ SwitcherList.prototype = {
|
|||||||
this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||||
this._list.connect('allocate', Lang.bind(this, this._allocate));
|
this._list.connect('allocate', Lang.bind(this, this._allocate));
|
||||||
|
|
||||||
this._clipBin = new St.Bin({style_class: 'cbin'});
|
this._scrollView = new St.ScrollView({ style_class: 'hfade',
|
||||||
this._clipBin.child = this._list;
|
enable_mouse_scrolling: false });
|
||||||
this.actor.add_actor(this._clipBin);
|
this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
|
||||||
|
|
||||||
this._leftGradient = new St.BoxLayout({style_class: 'thumbnail-scroll-gradient-left', vertical: true});
|
let scrollBox = new St.BoxLayout();
|
||||||
this._rightGradient = new St.BoxLayout({style_class: 'thumbnail-scroll-gradient-right', vertical: true});
|
scrollBox.add_actor(this._list);
|
||||||
this.actor.add_actor(this._leftGradient);
|
this._scrollView.add_actor(scrollBox);
|
||||||
this.actor.add_actor(this._rightGradient);
|
this.actor.add_actor(this._scrollView);
|
||||||
|
|
||||||
// Those arrows indicate whether scrolling in one direction is possible
|
// Those arrows indicate whether scrolling in one direction is possible
|
||||||
this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
|
this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
|
||||||
@ -599,21 +604,9 @@ SwitcherList.prototype = {
|
|||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
let scrollable = this._minSize > box.x2 - box.x1;
|
let scrollable = this._minSize > box.x2 - box.x1;
|
||||||
|
|
||||||
this._clipBin.allocate(box, flags);
|
box.y1 -= this.actor.get_theme_node().get_padding(St.Side.TOP);
|
||||||
|
box.y2 += this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
|
||||||
childBox.x1 = 0;
|
this._scrollView.allocate(box, flags);
|
||||||
childBox.y1 = 0;
|
|
||||||
childBox.x2 = this._leftGradient.width;
|
|
||||||
childBox.y2 = this.actor.height;
|
|
||||||
this._leftGradient.allocate(childBox, flags);
|
|
||||||
this._leftGradient.opacity = (this._scrollableLeft && scrollable) ? 255 : 0;
|
|
||||||
|
|
||||||
childBox.x1 = (this.actor.allocation.x2 - this.actor.allocation.x1) - this._rightGradient.width;
|
|
||||||
childBox.y1 = 0;
|
|
||||||
childBox.x2 = childBox.x1 + this._rightGradient.width;
|
|
||||||
childBox.y2 = this.actor.height;
|
|
||||||
this._rightGradient.allocate(childBox, flags);
|
|
||||||
this._rightGradient.opacity = (this._scrollableRight && scrollable) ? 255 : 0;
|
|
||||||
|
|
||||||
let arrowWidth = Math.floor(leftPadding / 3);
|
let arrowWidth = Math.floor(leftPadding / 3);
|
||||||
let arrowHeight = arrowWidth * 2;
|
let arrowHeight = arrowWidth * 2;
|
||||||
@ -622,7 +615,7 @@ SwitcherList.prototype = {
|
|||||||
childBox.x2 = childBox.x1 + arrowWidth;
|
childBox.x2 = childBox.x1 + arrowWidth;
|
||||||
childBox.y2 = childBox.y1 + arrowHeight;
|
childBox.y2 = childBox.y1 + arrowHeight;
|
||||||
this._leftArrow.allocate(childBox, flags);
|
this._leftArrow.allocate(childBox, flags);
|
||||||
this._leftArrow.opacity = this._leftGradient.opacity;
|
this._leftArrow.opacity = (this._scrollableLeft && scrollable) ? 255 : 0;
|
||||||
|
|
||||||
arrowWidth = Math.floor(rightPadding / 3);
|
arrowWidth = Math.floor(rightPadding / 3);
|
||||||
arrowHeight = arrowWidth * 2;
|
arrowHeight = arrowWidth * 2;
|
||||||
@ -631,7 +624,7 @@ SwitcherList.prototype = {
|
|||||||
childBox.x2 = childBox.x1 + arrowWidth;
|
childBox.x2 = childBox.x1 + arrowWidth;
|
||||||
childBox.y2 = childBox.y1 + arrowHeight;
|
childBox.y2 = childBox.y1 + arrowHeight;
|
||||||
this._rightArrow.allocate(childBox, flags);
|
this._rightArrow.allocate(childBox, flags);
|
||||||
this._rightArrow.opacity = this._rightGradient.opacity;
|
this._rightArrow.opacity = (this._scrollableRight && scrollable) ? 255 : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
addItem : function(item, label) {
|
addItem : function(item, label) {
|
||||||
@ -648,6 +641,8 @@ SwitcherList.prototype = {
|
|||||||
bbox.label_actor = label;
|
bbox.label_actor = label;
|
||||||
|
|
||||||
this._items.push(bbox);
|
this._items.push(bbox);
|
||||||
|
|
||||||
|
return bbox;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onItemClicked: function (index) {
|
_onItemClicked: function (index) {
|
||||||
@ -679,20 +674,32 @@ SwitcherList.prototype = {
|
|||||||
this._items[this._highlighted].add_style_pseudo_class('selected');
|
this._items[this._highlighted].add_style_pseudo_class('selected');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let adjustment = this._scrollView.hscroll.adjustment;
|
||||||
|
let [value, lower, upper, stepIncrement, pageIncrement, pageSize] = adjustment.get_values();
|
||||||
let [absItemX, absItemY] = this._items[index].get_transformed_position();
|
let [absItemX, absItemY] = this._items[index].get_transformed_position();
|
||||||
let [result, posX, posY] = this.actor.transform_stage_point(absItemX, 0);
|
let [result, posX, posY] = this.actor.transform_stage_point(absItemX, 0);
|
||||||
let [containerWidth, containerHeight] = this.actor.get_transformed_size();
|
let [containerWidth, containerHeight] = this.actor.get_transformed_size();
|
||||||
if (posX + this._items[index].get_width() > containerWidth)
|
if (posX + this._items[index].get_width() > containerWidth)
|
||||||
this._scrollToRight();
|
this._scrollToRight();
|
||||||
else if (posX < 0)
|
else if (this._items[index].allocation.x1 - value < 0)
|
||||||
this._scrollToLeft();
|
this._scrollToLeft();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_scrollToLeft : function() {
|
_scrollToLeft : function() {
|
||||||
let x = this._items[this._highlighted].allocation.x1;
|
let adjustment = this._scrollView.hscroll.adjustment;
|
||||||
|
let [value, lower, upper, stepIncrement, pageIncrement, pageSize] = adjustment.get_values();
|
||||||
|
|
||||||
|
let item = this._items[this._highlighted];
|
||||||
|
|
||||||
|
if (item.allocation.x1 < value)
|
||||||
|
value = Math.min(0, item.allocation.x1);
|
||||||
|
else if (item.allocation.x2 > value + pageSize)
|
||||||
|
value = Math.max(upper, item.allocation.x2 - pageSize);
|
||||||
|
|
||||||
this._scrollableRight = true;
|
this._scrollableRight = true;
|
||||||
Tweener.addTween(this._list, { anchor_x: x,
|
Tweener.addTween(adjustment,
|
||||||
|
{ value: value,
|
||||||
time: POPUP_SCROLL_TIME,
|
time: POPUP_SCROLL_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: Lang.bind(this, function () {
|
onComplete: Lang.bind(this, function () {
|
||||||
@ -705,12 +712,19 @@ SwitcherList.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_scrollToRight : function() {
|
_scrollToRight : function() {
|
||||||
|
let adjustment = this._scrollView.hscroll.adjustment;
|
||||||
|
let [value, lower, upper, stepIncrement, pageIncrement, pageSize] = adjustment.get_values();
|
||||||
|
|
||||||
|
let item = this._items[this._highlighted];
|
||||||
|
|
||||||
|
if (item.allocation.x1 < value)
|
||||||
|
value = Math.max(0, item.allocation.x1);
|
||||||
|
else if (item.allocation.x2 > value + pageSize)
|
||||||
|
value = Math.min(upper, item.allocation.x2 - pageSize);
|
||||||
|
|
||||||
this._scrollableLeft = true;
|
this._scrollableLeft = true;
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
Tweener.addTween(adjustment,
|
||||||
let padding = this.actor.get_theme_node().get_horizontal_padding();
|
{ value: value,
|
||||||
let parentPadding = this.actor.get_parent().get_theme_node().get_horizontal_padding();
|
|
||||||
let x = this._items[this._highlighted].allocation.x2 - monitor.width + padding + parentPadding;
|
|
||||||
Tweener.addTween(this._list, { anchor_x: x,
|
|
||||||
time: POPUP_SCROLL_TIME,
|
time: POPUP_SCROLL_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: Lang.bind(this, function () {
|
onComplete: Lang.bind(this, function () {
|
||||||
@ -805,14 +819,6 @@ SwitcherList.prototype = {
|
|||||||
|
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
let primary = Main.layoutManager.primaryMonitor;
|
||||||
let parentRightPadding = this.actor.get_parent().get_theme_node().get_padding(St.Side.RIGHT);
|
let parentRightPadding = this.actor.get_parent().get_theme_node().get_padding(St.Side.RIGHT);
|
||||||
if (this.actor.allocation.x2 == primary.x + primary.width - parentRightPadding) {
|
|
||||||
if (this._squareItems)
|
|
||||||
childWidth = childHeight;
|
|
||||||
else {
|
|
||||||
let [childMin, childNat] = children[0].get_preferred_width(childHeight);
|
|
||||||
childWidth = childMin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < children.length; i++) {
|
for (let i = 0; i < children.length; i++) {
|
||||||
if (this._items.indexOf(children[i]) != -1) {
|
if (this._items.indexOf(children[i]) != -1) {
|
||||||
@ -838,24 +844,14 @@ SwitcherList.prototype = {
|
|||||||
// we don't allocate it.
|
// we don't allocate it.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let leftPadding = this.actor.get_theme_node().get_padding(St.Side.LEFT);
|
|
||||||
let rightPadding = this.actor.get_theme_node().get_padding(St.Side.RIGHT);
|
|
||||||
let topPadding = this.actor.get_theme_node().get_padding(St.Side.TOP);
|
|
||||||
let bottomPadding = this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
|
|
||||||
|
|
||||||
// Clip the area for scrolling
|
|
||||||
this._clipBin.set_clip(0, -topPadding, (this.actor.allocation.x2 - this.actor.allocation.x1) - leftPadding - rightPadding, this.actor.height + bottomPadding);
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
Signals.addSignalMethods(SwitcherList.prototype);
|
Signals.addSignalMethods(SwitcherList.prototype);
|
||||||
|
|
||||||
function AppIcon(app) {
|
const AppIcon = new Lang.Class({
|
||||||
this._init(app);
|
Name: 'AppIcon',
|
||||||
}
|
|
||||||
|
|
||||||
AppIcon.prototype = {
|
|
||||||
_init: function(app) {
|
_init: function(app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
||||||
@ -873,17 +869,14 @@ AppIcon.prototype = {
|
|||||||
this._iconBin.set_size(size, size);
|
this._iconBin.set_size(size, size);
|
||||||
this._iconBin.child = this.icon;
|
this._iconBin.child = this.icon;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function AppSwitcher() {
|
const AppSwitcher = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'AppSwitcher',
|
||||||
}
|
Extends: SwitcherList,
|
||||||
|
|
||||||
AppSwitcher.prototype = {
|
|
||||||
__proto__ : SwitcherList.prototype,
|
|
||||||
|
|
||||||
_init : function(localApps, otherApps, altTabPopup) {
|
_init : function(localApps, otherApps, altTabPopup) {
|
||||||
SwitcherList.prototype._init.call(this, true);
|
this.parent(true);
|
||||||
|
|
||||||
// Construct the AppIcons, add to the popup
|
// Construct the AppIcons, add to the popup
|
||||||
let activeWorkspace = global.screen.get_active_workspace();
|
let activeWorkspace = global.screen.get_active_workspace();
|
||||||
@ -962,7 +955,7 @@ AppSwitcher.prototype = {
|
|||||||
|
|
||||||
_allocate: function (actor, box, flags) {
|
_allocate: function (actor, box, flags) {
|
||||||
// Allocate the main list items
|
// Allocate the main list items
|
||||||
SwitcherList.prototype._allocate.call(this, actor, box, flags);
|
this.parent(actor, box, flags);
|
||||||
|
|
||||||
let arrowHeight = Math.floor(this.actor.get_theme_node().get_padding(St.Side.BOTTOM) / 3);
|
let arrowHeight = Math.floor(this.actor.get_theme_node().get_padding(St.Side.BOTTOM) / 3);
|
||||||
let arrowWidth = arrowHeight * 2;
|
let arrowWidth = arrowHeight * 2;
|
||||||
@ -1017,7 +1010,7 @@ AppSwitcher.prototype = {
|
|||||||
this._arrows[this._curApp].remove_style_pseudo_class('highlighted');
|
this._arrows[this._curApp].remove_style_pseudo_class('highlighted');
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitcherList.prototype.highlight.call(this, n, justOutline);
|
this.parent(n, justOutline);
|
||||||
this._curApp = n;
|
this._curApp = n;
|
||||||
|
|
||||||
if (this._curApp != -1) {
|
if (this._curApp != -1) {
|
||||||
@ -1030,7 +1023,7 @@ AppSwitcher.prototype = {
|
|||||||
|
|
||||||
_addIcon : function(appIcon) {
|
_addIcon : function(appIcon) {
|
||||||
this.icons.push(appIcon);
|
this.icons.push(appIcon);
|
||||||
this.addItem(appIcon.actor, appIcon.label);
|
let item = this.addItem(appIcon.actor, appIcon.label);
|
||||||
|
|
||||||
let n = this._arrows.length;
|
let n = this._arrows.length;
|
||||||
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
|
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
|
||||||
@ -1040,18 +1033,17 @@ AppSwitcher.prototype = {
|
|||||||
|
|
||||||
if (appIcon.cachedWindows.length == 1)
|
if (appIcon.cachedWindows.length == 1)
|
||||||
arrow.hide();
|
arrow.hide();
|
||||||
|
else
|
||||||
|
item.add_accessible_state (Atk.StateType.EXPANDABLE);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function ThumbnailList(windows) {
|
const ThumbnailList = new Lang.Class({
|
||||||
this._init(windows);
|
Name: 'ThumbnailList',
|
||||||
}
|
Extends: SwitcherList,
|
||||||
|
|
||||||
ThumbnailList.prototype = {
|
|
||||||
__proto__ : SwitcherList.prototype,
|
|
||||||
|
|
||||||
_init : function(windows) {
|
_init : function(windows) {
|
||||||
SwitcherList.prototype._init.call(this);
|
this.parent(false);
|
||||||
|
|
||||||
let activeWorkspace = global.screen.get_active_workspace();
|
let activeWorkspace = global.screen.get_active_workspace();
|
||||||
|
|
||||||
@ -1129,7 +1121,7 @@ ThumbnailList.prototype = {
|
|||||||
// Make sure we only do this once
|
// Make sure we only do this once
|
||||||
this._thumbnailBins = new Array();
|
this._thumbnailBins = new Array();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function _drawArrow(area, side) {
|
function _drawArrow(area, side) {
|
||||||
let themeNode = area.get_theme_node();
|
let themeNode = area.get_theme_node();
|
||||||
|
@ -10,6 +10,7 @@ const Signals = imports.signals;
|
|||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const AppFavorites = imports.ui.appFavorites;
|
const AppFavorites = imports.ui.appFavorites;
|
||||||
const DND = imports.ui.dnd;
|
const DND = imports.ui.dnd;
|
||||||
@ -26,11 +27,9 @@ const MAX_APPLICATION_WORK_MILLIS = 75;
|
|||||||
const MENU_POPUP_TIMEOUT = 600;
|
const MENU_POPUP_TIMEOUT = 600;
|
||||||
const SCROLL_TIME = 0.1;
|
const SCROLL_TIME = 0.1;
|
||||||
|
|
||||||
function AlphabeticalView() {
|
const AlphabeticalView = new Lang.Class({
|
||||||
this._init();
|
Name: 'AlphabeticalView',
|
||||||
}
|
|
||||||
|
|
||||||
AlphabeticalView.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._grid = new IconGrid.IconGrid({ xAlign: St.Align.START });
|
this._grid = new IconGrid.IconGrid({ xAlign: St.Align.START });
|
||||||
this._appSystem = Shell.AppSystem.get_default();
|
this._appSystem = Shell.AppSystem.get_default();
|
||||||
@ -130,13 +129,11 @@ AlphabeticalView.prototype = {
|
|||||||
this._addApp(app);
|
this._addApp(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function ViewByCategories() {
|
const ViewByCategories = new Lang.Class({
|
||||||
this._init();
|
Name: 'ViewByCategories',
|
||||||
}
|
|
||||||
|
|
||||||
ViewByCategories.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._appSystem = Shell.AppSystem.get_default();
|
this._appSystem = Shell.AppSystem.get_default();
|
||||||
this.actor = new St.BoxLayout({ style_class: 'all-app' });
|
this.actor = new St.BoxLayout({ style_class: 'all-app' });
|
||||||
@ -152,7 +149,9 @@ ViewByCategories.prototype = {
|
|||||||
this._categories = [];
|
this._categories = [];
|
||||||
this._apps = null;
|
this._apps = null;
|
||||||
|
|
||||||
this._categoryBox = new St.BoxLayout({ vertical: true, reactive: true });
|
this._categoryBox = new St.BoxLayout({ vertical: true,
|
||||||
|
reactive: true,
|
||||||
|
accessible_role: Atk.Role.LIST });
|
||||||
this._categoryScroll = new St.ScrollView({ x_fill: false,
|
this._categoryScroll = new St.ScrollView({ x_fill: false,
|
||||||
y_fill: false,
|
y_fill: false,
|
||||||
style_class: 'vfade' });
|
style_class: 'vfade' });
|
||||||
@ -218,7 +217,8 @@ ViewByCategories.prototype = {
|
|||||||
let button = new St.Button({ label: GLib.markup_escape_text (name, -1),
|
let button = new St.Button({ label: GLib.markup_escape_text (name, -1),
|
||||||
style_class: 'app-filter',
|
style_class: 'app-filter',
|
||||||
x_align: St.Align.START,
|
x_align: St.Align.START,
|
||||||
can_focus: true });
|
can_focus: true ,
|
||||||
|
accessible_role: Atk.Role.LIST_ITEM });
|
||||||
button.connect('clicked', Lang.bind(this, function() {
|
button.connect('clicked', Lang.bind(this, function() {
|
||||||
this._selectCategory(index);
|
this._selectCategory(index);
|
||||||
}));
|
}));
|
||||||
@ -240,7 +240,7 @@ ViewByCategories.prototype = {
|
|||||||
|
|
||||||
_removeAll: function() {
|
_removeAll: function() {
|
||||||
this._categories = [];
|
this._categories = [];
|
||||||
this._categoryBox.destroy_children();
|
this._categoryBox.destroy_all_children();
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
@ -281,16 +281,14 @@ ViewByCategories.prototype = {
|
|||||||
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
/* This class represents a display containing a collection of application items.
|
/* This class represents a display containing a collection of application items.
|
||||||
* The applications are sorted based on their name.
|
* The applications are sorted based on their name.
|
||||||
*/
|
*/
|
||||||
function AllAppDisplay() {
|
const AllAppDisplay = new Lang.Class({
|
||||||
this._init();
|
Name: 'AllAppDisplay',
|
||||||
}
|
|
||||||
|
|
||||||
AllAppDisplay.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._appSystem = Shell.AppSystem.get_default();
|
this._appSystem = Shell.AppSystem.get_default();
|
||||||
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
||||||
@ -306,27 +304,30 @@ AllAppDisplay.prototype = {
|
|||||||
_redisplay: function() {
|
_redisplay: function() {
|
||||||
this._appView.refresh();
|
this._appView.refresh();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function AppSearchProvider() {
|
const AppSearchProvider = new Lang.Class({
|
||||||
this._init();
|
Name: 'AppSearchProvider',
|
||||||
}
|
Extends: Search.SearchProvider,
|
||||||
|
|
||||||
AppSearchProvider.prototype = {
|
|
||||||
__proto__: Search.SearchProvider.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Search.SearchProvider.prototype._init.call(this, _("APPLICATIONS"));
|
this.parent(_("APPLICATIONS"));
|
||||||
|
|
||||||
this._appSys = Shell.AppSystem.get_default();
|
this._appSys = Shell.AppSystem.get_default();
|
||||||
},
|
},
|
||||||
|
|
||||||
getResultMeta: function(app) {
|
getResultMetas: function(apps) {
|
||||||
return { 'id': app,
|
let metas = [];
|
||||||
|
for (let i = 0; i < apps.length; i++) {
|
||||||
|
let app = apps[i];
|
||||||
|
metas.push({ 'id': app,
|
||||||
'name': app.get_name(),
|
'name': app.get_name(),
|
||||||
'createIcon': function(size) {
|
'createIcon': function(size) {
|
||||||
return app.create_icon_texture(size);
|
return app.create_icon_texture(size);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
return metas;
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialResultSet: function(terms) {
|
getInitialResultSet: function(terms) {
|
||||||
@ -342,7 +343,7 @@ AppSearchProvider.prototype = {
|
|||||||
timestamp: 0 });
|
timestamp: 0 });
|
||||||
|
|
||||||
let event = Clutter.get_current_event();
|
let event = Clutter.get_current_event();
|
||||||
let modifiers = event ? Shell.get_event_state(event) : 0;
|
let modifiers = event ? event.get_state() : 0;
|
||||||
let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK;
|
let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK;
|
||||||
|
|
||||||
if (openNewWindow)
|
if (openNewWindow)
|
||||||
@ -364,28 +365,31 @@ AppSearchProvider.prototype = {
|
|||||||
let icon = new AppWellIcon(app);
|
let icon = new AppWellIcon(app);
|
||||||
return icon.actor;
|
return icon.actor;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function SettingsSearchProvider() {
|
const SettingsSearchProvider = new Lang.Class({
|
||||||
this._init();
|
Name: 'SettingsSearchProvider',
|
||||||
}
|
Extends: Search.SearchProvider,
|
||||||
|
|
||||||
SettingsSearchProvider.prototype = {
|
|
||||||
__proto__: Search.SearchProvider.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Search.SearchProvider.prototype._init.call(this, _("SETTINGS"));
|
this.parent(_("SETTINGS"));
|
||||||
|
|
||||||
this._appSys = Shell.AppSystem.get_default();
|
this._appSys = Shell.AppSystem.get_default();
|
||||||
this._gnomecc = this._appSys.lookup_app('gnome-control-center.desktop');
|
this._gnomecc = this._appSys.lookup_app('gnome-control-center.desktop');
|
||||||
},
|
},
|
||||||
|
|
||||||
getResultMeta: function(pref) {
|
getResultMetas: function(prefs) {
|
||||||
return { 'id': pref,
|
let metas = [];
|
||||||
|
for (let i = 0; i < prefs.length; i++) {
|
||||||
|
let pref = prefs[i];
|
||||||
|
metas.push({ 'id': pref,
|
||||||
'name': pref.get_name(),
|
'name': pref.get_name(),
|
||||||
'createIcon': function(size) {
|
'createIcon': function(size) {
|
||||||
return pref.create_icon_texture(size);
|
return pref.create_icon_texture(size);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
return metas;
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialResultSet: function(terms) {
|
getInitialResultSet: function(terms) {
|
||||||
@ -412,35 +416,28 @@ SettingsSearchProvider.prototype = {
|
|||||||
let icon = new AppWellIcon(app);
|
let icon = new AppWellIcon(app);
|
||||||
return icon.actor;
|
return icon.actor;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function AppIcon(app, params) {
|
const AppIcon = new Lang.Class({
|
||||||
this._init(app, params);
|
Name: 'AppIcon',
|
||||||
}
|
Extends: IconGrid.BaseIcon,
|
||||||
|
|
||||||
AppIcon.prototype = {
|
|
||||||
__proto__: IconGrid.BaseIcon.prototype,
|
|
||||||
|
|
||||||
_init : function(app, params) {
|
_init : function(app, params) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
let label = this.app.get_name();
|
let label = this.app.get_name();
|
||||||
|
|
||||||
IconGrid.BaseIcon.prototype._init.call(this,
|
this.parent(label, params);
|
||||||
label,
|
|
||||||
params);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createIcon: function(iconSize) {
|
createIcon: function(iconSize) {
|
||||||
return this.app.create_icon_texture(iconSize);
|
return this.app.create_icon_texture(iconSize);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function AppWellIcon(app, iconParams, onActivateOverride) {
|
const AppWellIcon = new Lang.Class({
|
||||||
this._init(app, iconParams, onActivateOverride);
|
Name: 'AppWellIcon',
|
||||||
}
|
|
||||||
|
|
||||||
AppWellIcon.prototype = {
|
|
||||||
_init : function(app, iconParams, onActivateOverride) {
|
_init : function(app, iconParams, onActivateOverride) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.actor = new St.Button({ style_class: 'app-well-app',
|
this.actor = new St.Button({ style_class: 'app-well-app',
|
||||||
@ -487,6 +484,7 @@ AppWellIcon.prototype = {
|
|||||||
Lang.bind(this,
|
Lang.bind(this,
|
||||||
this._onStateChanged));
|
this._onStateChanged));
|
||||||
this._onStateChanged();
|
this._onStateChanged();
|
||||||
|
this.isMenuUp = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy: function() {
|
||||||
@ -568,8 +566,8 @@ AppWellIcon.prototype = {
|
|||||||
this._menuManager.addMenu(this._menu);
|
this._menuManager.addMenu(this._menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.isMenuUp = true;
|
||||||
this.actor.set_hover(true);
|
this.actor.set_hover(true);
|
||||||
this.actor.show_tooltip();
|
|
||||||
this._menu.popup();
|
this._menu.popup();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -585,11 +583,12 @@ AppWellIcon.prototype = {
|
|||||||
|
|
||||||
_onMenuPoppedDown: function() {
|
_onMenuPoppedDown: function() {
|
||||||
this.actor.sync_hover();
|
this.actor.sync_hover();
|
||||||
|
this.isMenuUp = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onActivate: function (event) {
|
_onActivate: function (event) {
|
||||||
this.emit('launching');
|
this.emit('launching');
|
||||||
let modifiers = Shell.get_event_state(event);
|
let modifiers = event.get_state();
|
||||||
|
|
||||||
if (this._onActivateOverride) {
|
if (this._onActivateOverride) {
|
||||||
this._onActivateOverride(event);
|
this._onActivateOverride(event);
|
||||||
@ -620,22 +619,19 @@ AppWellIcon.prototype = {
|
|||||||
getDragActorSource: function() {
|
getDragActorSource: function() {
|
||||||
return this.icon.icon;
|
return this.icon.icon;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(AppWellIcon.prototype);
|
Signals.addSignalMethods(AppWellIcon.prototype);
|
||||||
|
|
||||||
function AppIconMenu(source) {
|
const AppIconMenu = new Lang.Class({
|
||||||
this._init(source);
|
Name: 'AppIconMenu',
|
||||||
}
|
Extends: PopupMenu.PopupMenu,
|
||||||
|
|
||||||
AppIconMenu.prototype = {
|
|
||||||
__proto__: PopupMenu.PopupMenu.prototype,
|
|
||||||
|
|
||||||
_init: function(source) {
|
_init: function(source) {
|
||||||
let side = St.Side.LEFT;
|
let side = St.Side.LEFT;
|
||||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
side = St.Side.RIGHT;
|
side = St.Side.RIGHT;
|
||||||
|
|
||||||
PopupMenu.PopupMenu.prototype._init.call(this, source.actor, 0.5, side);
|
this.parent(source.actor, 0.5, side);
|
||||||
|
|
||||||
// We want to keep the item hovered while the menu is up
|
// We want to keep the item hovered while the menu is up
|
||||||
this.blockSourceEvents = true;
|
this.blockSourceEvents = true;
|
||||||
@ -723,5 +719,5 @@ AppIconMenu.prototype = {
|
|||||||
}
|
}
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(AppIconMenu.prototype);
|
Signals.addSignalMethods(AppIconMenu.prototype);
|
||||||
|
@ -6,11 +6,9 @@ const Signals = imports.signals;
|
|||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
function AppFavorites() {
|
const AppFavorites = new Lang.Class({
|
||||||
this._init();
|
Name: 'AppFavorites',
|
||||||
}
|
|
||||||
|
|
||||||
AppFavorites.prototype = {
|
|
||||||
FAVORITE_APPS_KEY: 'favorite-apps',
|
FAVORITE_APPS_KEY: 'favorite-apps',
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
@ -122,7 +120,7 @@ AppFavorites.prototype = {
|
|||||||
this._addFavorite(appId, pos);
|
this._addFavorite(appId, pos);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(AppFavorites.prototype);
|
Signals.addSignalMethods(AppFavorites.prototype);
|
||||||
|
|
||||||
var appFavoritesInstance = null;
|
var appFavoritesInstance = null;
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const ShellMountOperation = imports.ui.shellMountOperation;
|
const ShellMountOperation = imports.ui.shellMountOperation;
|
||||||
const ScreenSaver = imports.misc.screenSaver;
|
const ScreenSaver = imports.misc.screenSaver;
|
||||||
@ -16,79 +17,75 @@ const SETTING_ENABLE_AUTOMOUNT = 'automount';
|
|||||||
|
|
||||||
const AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
|
const AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
|
||||||
|
|
||||||
const ConsoleKitSessionIface = {
|
const ConsoleKitSessionIface = <interface name="org.freedesktop.ConsoleKit.Session">
|
||||||
name: 'org.freedesktop.ConsoleKit.Session',
|
<method name="IsActive">
|
||||||
methods: [{ name: 'IsActive',
|
<arg type="b" direction="out" />
|
||||||
inSignature: '',
|
</method>
|
||||||
outSignature: 'b' }],
|
<signal name="ActiveChanged">
|
||||||
signals: [{ name: 'ActiveChanged',
|
<arg type="b" direction="out" />
|
||||||
inSignature: 'b' }]
|
</signal>
|
||||||
};
|
</interface>;
|
||||||
|
|
||||||
const ConsoleKitSessionProxy = DBus.makeProxyClass(ConsoleKitSessionIface);
|
const ConsoleKitSessionProxy = Gio.DBusProxy.makeProxyWrapper(ConsoleKitSessionIface);
|
||||||
|
|
||||||
const ConsoleKitManagerIface = {
|
const ConsoleKitManagerIface = <interface name="org.freedesktop.ConsoleKit.Manager">
|
||||||
name: 'org.freedesktop.ConsoleKit.Manager',
|
<method name="GetCurrentSession">
|
||||||
methods: [{ name: 'GetCurrentSession',
|
<arg type="o" direction="out" />
|
||||||
inSignature: '',
|
</method>
|
||||||
outSignature: 'o' }]
|
</interface>;
|
||||||
};
|
|
||||||
|
const ConsoleKitManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(ConsoleKitManagerIface);
|
||||||
|
|
||||||
function ConsoleKitManager() {
|
function ConsoleKitManager() {
|
||||||
this._init();
|
var self = new Gio.DBusProxy({ g_connection: Gio.DBus.system,
|
||||||
};
|
g_interface_name: ConsoleKitManagerInfo.name,
|
||||||
|
g_interface_info: ConsoleKitManagerInfo,
|
||||||
|
g_name: 'org.freedesktop.ConsoleKit',
|
||||||
|
g_object_path: '/org/freedesktop/ConsoleKit/Manager',
|
||||||
|
g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
|
||||||
|
Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
|
||||||
|
|
||||||
ConsoleKitManager.prototype = {
|
self._updateSessionActive = function() {
|
||||||
_init: function() {
|
if (self.g_name_owner) {
|
||||||
this.sessionActive = true;
|
self.GetCurrentSessionRemote(function([session]) {
|
||||||
|
self._ckSession = new ConsoleKitSessionProxy(Gio.DBus.system, 'org.freedesktop.ConsoleKit', session);
|
||||||
|
|
||||||
DBus.system.proxifyObject(this,
|
self._ckSession.connectSignal('ActiveChanged', function(object, senderName, [isActive]) {
|
||||||
'org.freedesktop.ConsoleKit',
|
self.sessionActive = isActive;
|
||||||
'/org/freedesktop/ConsoleKit/Manager');
|
});
|
||||||
|
self._ckSession.IsActiveRemote(function([isActive]) {
|
||||||
DBus.system.watch_name('org.freedesktop.ConsoleKit',
|
self.sessionActive = isActive;
|
||||||
false, // do not launch a name-owner if none exists
|
});
|
||||||
Lang.bind(this, this._onManagerAppeared),
|
});
|
||||||
Lang.bind(this, this._onManagerVanished));
|
} else {
|
||||||
},
|
self.sessionActive = true;
|
||||||
|
|
||||||
_onManagerAppeared: function(owner) {
|
|
||||||
this.GetCurrentSessionRemote(Lang.bind(this, this._onCurrentSession));
|
|
||||||
},
|
|
||||||
|
|
||||||
_onManagerVanished: function(oldOwner) {
|
|
||||||
this.sessionActive = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
_onCurrentSession: function(session) {
|
|
||||||
this._ckSession = new ConsoleKitSessionProxy(DBus.system, 'org.freedesktop.ConsoleKit', session);
|
|
||||||
|
|
||||||
this._ckSession.connect
|
|
||||||
('ActiveChanged', Lang.bind(this, function(object, isActive) {
|
|
||||||
this.sessionActive = isActive;
|
|
||||||
}));
|
|
||||||
this._ckSession.IsActiveRemote(Lang.bind(this, function(isActive) {
|
|
||||||
this.sessionActive = isActive;
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
DBus.proxifyPrototype(ConsoleKitManager.prototype, ConsoleKitManagerIface);
|
self.connect('notify::g-name-owner',
|
||||||
|
Lang.bind(self, self._updateSessionActive));
|
||||||
|
|
||||||
function AutomountManager() {
|
self._updateSessionActive();
|
||||||
this._init();
|
self.init(null);
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutomountManager.prototype = {
|
function haveSystemd() {
|
||||||
|
return GLib.access("/sys/fs/cgroup/systemd", 0) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AutomountManager = new Lang.Class({
|
||||||
|
Name: 'AutomountManager',
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
|
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
|
||||||
this._volumeQueue = [];
|
this._volumeQueue = [];
|
||||||
|
|
||||||
|
if (!haveSystemd())
|
||||||
this.ckListener = new ConsoleKitManager();
|
this.ckListener = new ConsoleKitManager();
|
||||||
|
|
||||||
this._ssProxy = new ScreenSaver.ScreenSaverProxy();
|
this._ssProxy = new ScreenSaver.ScreenSaverProxy();
|
||||||
this._ssProxy.connect('ActiveChanged',
|
this._ssProxy.connectSignal('ActiveChanged',
|
||||||
Lang.bind(this,
|
Lang.bind(this, this._screenSaverActiveChanged));
|
||||||
this._screenSaverActiveChanged));
|
|
||||||
|
|
||||||
this._volumeMonitor = Gio.VolumeMonitor.get();
|
this._volumeMonitor = Gio.VolumeMonitor.get();
|
||||||
|
|
||||||
@ -111,7 +108,7 @@ AutomountManager.prototype = {
|
|||||||
Mainloop.idle_add(Lang.bind(this, this._startupMountAll));
|
Mainloop.idle_add(Lang.bind(this, this._startupMountAll));
|
||||||
},
|
},
|
||||||
|
|
||||||
_screenSaverActiveChanged: function(object, isActive) {
|
_screenSaverActiveChanged: function(object, senderName, [isActive]) {
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
this._volumeQueue.forEach(Lang.bind(this, function(volume) {
|
this._volumeQueue.forEach(Lang.bind(this, function(volume) {
|
||||||
this._checkAndMountVolume(volume);
|
this._checkAndMountVolume(volume);
|
||||||
@ -132,10 +129,21 @@ AutomountManager.prototype = {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isSessionActive: function() {
|
||||||
|
// Return whether the current session is active, using the
|
||||||
|
// right mechanism: either systemd if available or ConsoleKit
|
||||||
|
// as fallback.
|
||||||
|
|
||||||
|
if (haveSystemd())
|
||||||
|
return Shell.session_is_active_for_systemd();
|
||||||
|
|
||||||
|
return this.ckListener.sessionActive;
|
||||||
|
},
|
||||||
|
|
||||||
_onDriveConnected: function() {
|
_onDriveConnected: function() {
|
||||||
// if we're not in the current ConsoleKit session,
|
// if we're not in the current ConsoleKit session,
|
||||||
// or screensaver is active, don't play sounds
|
// or screensaver is active, don't play sounds
|
||||||
if (!this.ckListener.sessionActive)
|
if (!this.isSessionActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this._ssProxy.screenSaverActive)
|
if (this._ssProxy.screenSaverActive)
|
||||||
@ -147,7 +155,7 @@ AutomountManager.prototype = {
|
|||||||
_onDriveDisconnected: function() {
|
_onDriveDisconnected: function() {
|
||||||
// if we're not in the current ConsoleKit session,
|
// if we're not in the current ConsoleKit session,
|
||||||
// or screensaver is active, don't play sounds
|
// or screensaver is active, don't play sounds
|
||||||
if (!this.ckListener.sessionActive)
|
if (!this.isSessionActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this._ssProxy.screenSaverActive)
|
if (this._ssProxy.screenSaverActive)
|
||||||
@ -159,7 +167,7 @@ AutomountManager.prototype = {
|
|||||||
_onDriveEjectButton: function(monitor, drive) {
|
_onDriveEjectButton: function(monitor, drive) {
|
||||||
// TODO: this code path is not tested, as the GVfs volume monitor
|
// TODO: this code path is not tested, as the GVfs volume monitor
|
||||||
// doesn't emit this signal just yet.
|
// doesn't emit this signal just yet.
|
||||||
if (!this.ckListener.sessionActive)
|
if (!this.isSessionActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// we force stop/eject in this case, so we don't have to pass a
|
// we force stop/eject in this case, so we don't have to pass a
|
||||||
@ -198,7 +206,7 @@ AutomountManager.prototype = {
|
|||||||
if (params.checkSession) {
|
if (params.checkSession) {
|
||||||
// if we're not in the current ConsoleKit session,
|
// if we're not in the current ConsoleKit session,
|
||||||
// don't attempt automount
|
// don't attempt automount
|
||||||
if (!this.ckListener.sessionActive)
|
if (!this.isSessionActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this._ssProxy.screenSaverActive) {
|
if (this._ssProxy.screenSaverActive) {
|
||||||
@ -279,4 +287,4 @@ AutomountManager.prototype = {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
|
||||||
@ -62,31 +61,23 @@ function startAppForMount(app, mount) {
|
|||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
const HotplugSnifferIface = {
|
const HotplugSnifferIface = <interface name="org.gnome.Shell.HotplugSniffer">
|
||||||
name: 'org.gnome.Shell.HotplugSniffer',
|
<method name="SniffURI">
|
||||||
methods: [{ name: 'SniffURI',
|
<arg type="s" direction="in" />
|
||||||
inSignature: 's',
|
<arg type="as" direction="out" />
|
||||||
outSignature: 'as' }]
|
</method>
|
||||||
};
|
</interface>;
|
||||||
|
|
||||||
const HotplugSniffer = function() {
|
const HotplugSnifferProxy = Gio.DBusProxy.makeProxyWrapper(HotplugSnifferIface);
|
||||||
this._init();
|
function HotplugSniffer() {
|
||||||
};
|
return new HotplugSnifferProxy(Gio.DBus.session,
|
||||||
|
|
||||||
HotplugSniffer.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
DBus.session.proxifyObject(this,
|
|
||||||
'org.gnome.Shell.HotplugSniffer',
|
'org.gnome.Shell.HotplugSniffer',
|
||||||
'/org/gnome/Shell/HotplugSniffer');
|
'/org/gnome/Shell/HotplugSniffer');
|
||||||
},
|
|
||||||
};
|
|
||||||
DBus.proxifyPrototype(HotplugSniffer.prototype, HotplugSnifferIface);
|
|
||||||
|
|
||||||
function ContentTypeDiscoverer(callback) {
|
|
||||||
this._init(callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentTypeDiscoverer.prototype = {
|
const ContentTypeDiscoverer = new Lang.Class({
|
||||||
|
Name: 'ContentTypeDiscoverer',
|
||||||
|
|
||||||
_init: function(callback) {
|
_init: function(callback) {
|
||||||
this._callback = callback;
|
this._callback = callback;
|
||||||
},
|
},
|
||||||
@ -114,9 +105,8 @@ ContentTypeDiscoverer.prototype = {
|
|||||||
let root = mount.get_root();
|
let root = mount.get_root();
|
||||||
|
|
||||||
let hotplugSniffer = new HotplugSniffer();
|
let hotplugSniffer = new HotplugSniffer();
|
||||||
hotplugSniffer.SniffURIRemote
|
hotplugSniffer.SniffURIRemote(root.get_uri(),
|
||||||
(root.get_uri(), DBus.CALL_FLAG_START,
|
Lang.bind(this, function([contentTypes]) {
|
||||||
Lang.bind(this, function(contentTypes) {
|
|
||||||
this._emitCallback(mount, contentTypes);
|
this._emitCallback(mount, contentTypes);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -144,13 +134,11 @@ ContentTypeDiscoverer.prototype = {
|
|||||||
|
|
||||||
this._callback(mount, apps, contentTypes);
|
this._callback(mount, apps, contentTypes);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function AutorunManager() {
|
const AutorunManager = new Lang.Class({
|
||||||
this._init();
|
Name: 'AutorunManager',
|
||||||
}
|
|
||||||
|
|
||||||
AutorunManager.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._volumeMonitor = Gio.VolumeMonitor.get();
|
this._volumeMonitor = Gio.VolumeMonitor.get();
|
||||||
|
|
||||||
@ -186,7 +174,7 @@ AutorunManager.prototype = {
|
|||||||
_onMountAdded: function(monitor, mount) {
|
_onMountAdded: function(monitor, mount) {
|
||||||
// don't do anything if our session is not the currently
|
// don't do anything if our session is not the currently
|
||||||
// active one
|
// active one
|
||||||
if (!Main.automountManager.ckListener.sessionActive)
|
if (!Main.automountManager.isSessionActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let discoverer = new ContentTypeDiscoverer(Lang.bind (this,
|
let discoverer = new ContentTypeDiscoverer(Lang.bind (this,
|
||||||
@ -267,17 +255,14 @@ AutorunManager.prototype = {
|
|||||||
+ ': ' + e.toString());
|
+ ': ' + e.toString());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
|
|
||||||
function AutorunResidentSource() {
|
const AutorunResidentSource = new Lang.Class({
|
||||||
this._init();
|
Name: 'AutorunResidentSource',
|
||||||
}
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
AutorunResidentSource.prototype = {
|
|
||||||
__proto__: MessageTray.Source.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
MessageTray.Source.prototype._init.call(this, _("Removable Devices"));
|
this.parent(_("Removable Devices"));
|
||||||
|
|
||||||
this._mounts = [];
|
this._mounts = [];
|
||||||
|
|
||||||
@ -332,19 +317,14 @@ AutorunResidentSource.prototype = {
|
|||||||
icon_type: St.IconType.FULLCOLOR,
|
icon_type: St.IconType.FULLCOLOR,
|
||||||
icon_size: this.ICON_SIZE });
|
icon_size: this.ICON_SIZE });
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function AutorunResidentNotification(source) {
|
const AutorunResidentNotification = new Lang.Class({
|
||||||
this._init(source);
|
Name: 'AutorunResidentNotification',
|
||||||
}
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
AutorunResidentNotification.prototype = {
|
|
||||||
__proto__: MessageTray.Notification.prototype,
|
|
||||||
|
|
||||||
_init: function(source) {
|
_init: function(source) {
|
||||||
MessageTray.Notification.prototype._init.call(this, source,
|
this.parent(source, source.title, null, { customContent: true });
|
||||||
source.title, null,
|
|
||||||
{ customContent: true });
|
|
||||||
|
|
||||||
// set the notification as resident
|
// set the notification as resident
|
||||||
this.setResident(true);
|
this.setResident(true);
|
||||||
@ -359,7 +339,7 @@ AutorunResidentNotification.prototype = {
|
|||||||
|
|
||||||
updateForMounts: function(mounts) {
|
updateForMounts: function(mounts) {
|
||||||
// remove all the layout content
|
// remove all the layout content
|
||||||
this._layout.destroy_children();
|
this._layout.destroy_all_children();
|
||||||
|
|
||||||
for (let idx = 0; idx < mounts.length; idx++) {
|
for (let idx = 0; idx < mounts.length; idx++) {
|
||||||
let element = mounts[idx];
|
let element = mounts[idx];
|
||||||
@ -418,13 +398,11 @@ AutorunResidentNotification.prototype = {
|
|||||||
|
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
|
|
||||||
function AutorunTransientDispatcher() {
|
const AutorunTransientDispatcher = new Lang.Class({
|
||||||
this._init();
|
Name: 'AutorunTransientDispatcher',
|
||||||
}
|
|
||||||
|
|
||||||
AutorunTransientDispatcher.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._sources = [];
|
this._sources = [];
|
||||||
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
|
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
|
||||||
@ -515,17 +493,14 @@ AutorunTransientDispatcher.prototype = {
|
|||||||
// destroy the notification source
|
// destroy the notification source
|
||||||
source.destroy();
|
source.destroy();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function AutorunTransientSource(mount, apps) {
|
const AutorunTransientSource = new Lang.Class({
|
||||||
this._init(mount, apps);
|
Name: 'AutorunTransientSource',
|
||||||
}
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
AutorunTransientSource.prototype = {
|
|
||||||
__proto__: MessageTray.Source.prototype,
|
|
||||||
|
|
||||||
_init: function(mount, apps) {
|
_init: function(mount, apps) {
|
||||||
MessageTray.Source.prototype._init.call(this, mount.get_name());
|
this.parent(mount.get_name());
|
||||||
|
|
||||||
this.mount = mount;
|
this.mount = mount;
|
||||||
this.apps = apps;
|
this.apps = apps;
|
||||||
@ -542,19 +517,14 @@ AutorunTransientSource.prototype = {
|
|||||||
return new St.Icon({ gicon: this.mount.get_icon(),
|
return new St.Icon({ gicon: this.mount.get_icon(),
|
||||||
icon_size: this.ICON_SIZE });
|
icon_size: this.ICON_SIZE });
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function AutorunTransientNotification(source) {
|
const AutorunTransientNotification = new Lang.Class({
|
||||||
this._init(source);
|
Name: 'AutorunTransientNotification',
|
||||||
}
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
AutorunTransientNotification.prototype = {
|
|
||||||
__proto__: MessageTray.Notification.prototype,
|
|
||||||
|
|
||||||
_init: function(source) {
|
_init: function(source) {
|
||||||
MessageTray.Notification.prototype._init.call(this, source,
|
this.parent(source, source.title, null, { customContent: true });
|
||||||
source.title, null,
|
|
||||||
{ customContent: true });
|
|
||||||
|
|
||||||
this._box = new St.BoxLayout({ style_class: 'hotplug-transient-box',
|
this._box = new St.BoxLayout({ style_class: 'hotplug-transient-box',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
@ -587,7 +557,7 @@ AutorunTransientNotification.prototype = {
|
|||||||
|
|
||||||
let label = new St.Bin({ y_align: St.Align.MIDDLE,
|
let label = new St.Bin({ y_align: St.Align.MIDDLE,
|
||||||
child: new St.Label
|
child: new St.Label
|
||||||
({ text: _("Open with %s").format(app.get_display_name()) })
|
({ text: _("Open with %s").format(app.get_name()) })
|
||||||
});
|
});
|
||||||
box.add(label);
|
box.add(label);
|
||||||
|
|
||||||
@ -629,5 +599,5 @@ AutorunTransientNotification.prototype = {
|
|||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
@ -21,11 +21,9 @@ const POPUP_ANIMATION_TIME = 0.15;
|
|||||||
* placed. The arrow position may be controlled via setArrowOrigin().
|
* placed. The arrow position may be controlled via setArrowOrigin().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function BoxPointer(side, binProperties) {
|
const BoxPointer = new Lang.Class({
|
||||||
this._init(side, binProperties);
|
Name: 'BoxPointer',
|
||||||
}
|
|
||||||
|
|
||||||
BoxPointer.prototype = {
|
|
||||||
_init: function(arrowSide, binProperties) {
|
_init: function(arrowSide, binProperties) {
|
||||||
this._arrowSide = arrowSide;
|
this._arrowSide = arrowSide;
|
||||||
this._arrowOrigin = 0;
|
this._arrowOrigin = 0;
|
||||||
@ -47,6 +45,21 @@ BoxPointer.prototype = {
|
|||||||
this._xPosition = 0;
|
this._xPosition = 0;
|
||||||
this._yPosition = 0;
|
this._yPosition = 0;
|
||||||
this._sourceAlignment = 0.5;
|
this._sourceAlignment = 0.5;
|
||||||
|
this._capturedEventId = 0;
|
||||||
|
this._muteInput();
|
||||||
|
},
|
||||||
|
|
||||||
|
_muteInput: function() {
|
||||||
|
if (this._capturedEventId == 0)
|
||||||
|
this._capturedEventId = this.actor.connect('captured-event',
|
||||||
|
function() { return true; });
|
||||||
|
},
|
||||||
|
|
||||||
|
_unmuteInput: function() {
|
||||||
|
if (this._capturedEventId != 0) {
|
||||||
|
this.actor.disconnect(this._capturedEventId);
|
||||||
|
this._capturedEventId = 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(animate, onComplete) {
|
show: function(animate, onComplete) {
|
||||||
@ -77,7 +90,11 @@ BoxPointer.prototype = {
|
|||||||
xOffset: 0,
|
xOffset: 0,
|
||||||
yOffset: 0,
|
yOffset: 0,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onComplete: onComplete,
|
onComplete: Lang.bind(this, function() {
|
||||||
|
this._unmuteInput();
|
||||||
|
if (onComplete)
|
||||||
|
onComplete();
|
||||||
|
}),
|
||||||
time: POPUP_ANIMATION_TIME });
|
time: POPUP_ANIMATION_TIME });
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -104,6 +121,8 @@ BoxPointer.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._muteInput();
|
||||||
|
|
||||||
Tweener.addTween(this, { opacity: 0,
|
Tweener.addTween(this, { opacity: 0,
|
||||||
xOffset: xOffset,
|
xOffset: xOffset,
|
||||||
yOffset: yOffset,
|
yOffset: yOffset,
|
||||||
@ -452,4 +471,4 @@ BoxPointer.prototype = {
|
|||||||
get opacity() {
|
get opacity() {
|
||||||
return this.actor.opacity;
|
return this.actor.opacity;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
@ -156,28 +155,24 @@ function _getEventDayAbbreviation(dayNumber) {
|
|||||||
|
|
||||||
// Abstraction for an appointment/event in a calendar
|
// Abstraction for an appointment/event in a calendar
|
||||||
|
|
||||||
function CalendarEvent(date, end, summary, allDay) {
|
const CalendarEvent = new Lang.Class({
|
||||||
this._init(date, end, summary, allDay);
|
Name: 'CalendarEvent',
|
||||||
}
|
|
||||||
|
|
||||||
CalendarEvent.prototype = {
|
|
||||||
_init: function(date, end, summary, allDay) {
|
_init: function(date, end, summary, allDay) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
this.allDay = allDay;
|
this.allDay = allDay;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
// Interface for appointments/events - e.g. the contents of a calendar
|
// Interface for appointments/events - e.g. the contents of a calendar
|
||||||
//
|
//
|
||||||
|
|
||||||
// First, an implementation with no events
|
// First, an implementation with no events
|
||||||
function EmptyEventSource() {
|
const EmptyEventSource = new Lang.Class({
|
||||||
this._init();
|
Name: 'EmptyEventSource',
|
||||||
}
|
|
||||||
|
|
||||||
EmptyEventSource.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -192,33 +187,32 @@ EmptyEventSource.prototype = {
|
|||||||
hasEvents: function(day) {
|
hasEvents: function(day) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(EmptyEventSource.prototype);
|
Signals.addSignalMethods(EmptyEventSource.prototype);
|
||||||
|
|
||||||
const CalendarServerIface = {
|
const CalendarServerIface = <interface name="org.gnome.Shell.CalendarServer">
|
||||||
name: 'org.gnome.Shell.CalendarServer',
|
<method name="GetEvents">
|
||||||
methods: [{ name: 'GetEvents',
|
<arg type="x" direction="in" />
|
||||||
inSignature: 'xxb',
|
<arg type="x" direction="in" />
|
||||||
outSignature: 'a(sssbxxa{sv})' }],
|
<arg type="b" direction="in" />
|
||||||
signals: [{ name: 'Changed',
|
<arg type="a(sssbxxa{sv})" direction="out" />
|
||||||
inSignature: '' }]
|
</method>
|
||||||
};
|
<signal name="Changed" />
|
||||||
|
</interface>;
|
||||||
|
|
||||||
const CalendarServer = function () {
|
const CalendarServerInfo = Gio.DBusInterfaceInfo.new_for_xml(CalendarServerIface);
|
||||||
this._init();
|
|
||||||
};
|
|
||||||
|
|
||||||
CalendarServer.prototype = {
|
function CalendarServer() {
|
||||||
_init: function() {
|
var self = new Gio.DBusProxy({ g_connection: Gio.DBus.session,
|
||||||
DBus.session.proxifyObject(this, 'org.gnome.Shell.CalendarServer', '/org/gnome/Shell/CalendarServer');
|
g_interface_name: CalendarServerInfo.name,
|
||||||
}
|
g_interface_info: CalendarServerInfo,
|
||||||
};
|
g_name: 'org.gnome.Shell.CalendarServer',
|
||||||
|
g_object_path: '/org/gnome/Shell/CalendarServer',
|
||||||
|
g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
|
||||||
|
Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
|
||||||
|
|
||||||
DBus.proxifyPrototype(CalendarServer.prototype, CalendarServerIface);
|
self.init(null);
|
||||||
|
return self;
|
||||||
// an implementation that reads data from a session bus service
|
|
||||||
function DBusEventSource(owner) {
|
|
||||||
this._init(owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _datesEqual(a, b) {
|
function _datesEqual(a, b) {
|
||||||
@ -239,18 +233,22 @@ function _dateIntervalsOverlap(a0, a1, b0, b1)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// an implementation that reads data from a session bus service
|
||||||
|
const DBusEventSource = new Lang.Class({
|
||||||
|
Name: 'DBusEventSource',
|
||||||
|
|
||||||
DBusEventSource.prototype = {
|
_init: function() {
|
||||||
_init: function(owner) {
|
|
||||||
this._resetCache();
|
this._resetCache();
|
||||||
|
|
||||||
this._dbusProxy = new CalendarServer(owner);
|
this._dbusProxy = new CalendarServer();
|
||||||
this._dbusProxy.connect('Changed', Lang.bind(this, this._onChanged));
|
this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
|
||||||
|
|
||||||
DBus.session.watch_name('org.gnome.Shell.CalendarServer',
|
this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
|
||||||
false, // do not launch a name-owner if none exists
|
if (this._dbusProxy.g_name_owner)
|
||||||
Lang.bind(this, this._onNameAppeared),
|
this._onNameAppeared();
|
||||||
Lang.bind(this, this._onNameVanished));
|
else
|
||||||
|
this._onNameVanished();
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetCache: function() {
|
_resetCache: function() {
|
||||||
@ -273,7 +271,7 @@ DBusEventSource.prototype = {
|
|||||||
this._loadEvents(false);
|
this._loadEvents(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEventsReceived: function(appointments) {
|
_onEventsReceived: function([appointments]) {
|
||||||
let newEvents = [];
|
let newEvents = [];
|
||||||
if (appointments != null) {
|
if (appointments != null) {
|
||||||
for (let n = 0; n < appointments.length; n++) {
|
for (let n = 0; n < appointments.length; n++) {
|
||||||
@ -296,9 +294,9 @@ DBusEventSource.prototype = {
|
|||||||
|
|
||||||
_loadEvents: function(forceReload) {
|
_loadEvents: function(forceReload) {
|
||||||
if (this._curRequestBegin && this._curRequestEnd){
|
if (this._curRequestBegin && this._curRequestEnd){
|
||||||
let callFlags = 0;
|
let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
|
||||||
if (forceReload)
|
if (forceReload)
|
||||||
callFlags |= DBus.CALL_FLAG_START;
|
callFlags = Gio.DBusCallFlags.NONE;
|
||||||
this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
|
this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
|
||||||
this._curRequestEnd.getTime() / 1000,
|
this._curRequestEnd.getTime() / 1000,
|
||||||
forceReload,
|
forceReload,
|
||||||
@ -339,17 +337,15 @@ DBusEventSource.prototype = {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(DBusEventSource.prototype);
|
Signals.addSignalMethods(DBusEventSource.prototype);
|
||||||
|
|
||||||
// Calendar:
|
// Calendar:
|
||||||
// @eventSource: is an object implementing the EventSource API, e.g. the
|
// @eventSource: is an object implementing the EventSource API, e.g. the
|
||||||
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
|
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
|
||||||
function Calendar(eventSource) {
|
const Calendar = new Lang.Class({
|
||||||
this._init(eventSource);
|
Name: 'Calendar',
|
||||||
}
|
|
||||||
|
|
||||||
Calendar.prototype = {
|
|
||||||
_init: function(eventSource) {
|
_init: function(eventSource) {
|
||||||
if (eventSource) {
|
if (eventSource) {
|
||||||
this._eventSource = eventSource;
|
this._eventSource = eventSource;
|
||||||
@ -410,7 +406,7 @@ Calendar.prototype = {
|
|||||||
|
|
||||||
_buildHeader: function() {
|
_buildHeader: function() {
|
||||||
let offsetCols = this._useWeekdate ? 1 : 0;
|
let offsetCols = this._useWeekdate ? 1 : 0;
|
||||||
this.actor.destroy_children();
|
this.actor.destroy_all_children();
|
||||||
|
|
||||||
// Top line of the calendar '<| September 2009 |>'
|
// Top line of the calendar '<| September 2009 |>'
|
||||||
this._topBox = new St.BoxLayout();
|
this._topBox = new St.BoxLayout();
|
||||||
@ -615,15 +611,13 @@ Calendar.prototype = {
|
|||||||
if (this._eventSource)
|
if (this._eventSource)
|
||||||
this._eventSource.requestRange(beginDate, iter, forceReload);
|
this._eventSource.requestRange(beginDate, iter, forceReload);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
Signals.addSignalMethods(Calendar.prototype);
|
Signals.addSignalMethods(Calendar.prototype);
|
||||||
|
|
||||||
function EventsList(eventSource) {
|
const EventsList = new Lang.Class({
|
||||||
this._init(eventSource);
|
Name: 'EventsList',
|
||||||
}
|
|
||||||
|
|
||||||
EventsList.prototype = {
|
|
||||||
_init: function(eventSource) {
|
_init: function(eventSource) {
|
||||||
this.actor = new St.BoxLayout({ vertical: true, style_class: 'events-header-vbox'});
|
this.actor = new St.BoxLayout({ vertical: true, style_class: 'events-header-vbox'});
|
||||||
this._date = new Date();
|
this._date = new Date();
|
||||||
@ -691,7 +685,7 @@ EventsList.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_showOtherDay: function(day) {
|
_showOtherDay: function(day) {
|
||||||
this.actor.destroy_children();
|
this.actor.destroy_all_children();
|
||||||
|
|
||||||
let dayBegin = _getBeginningOfDay(day);
|
let dayBegin = _getBeginningOfDay(day);
|
||||||
let dayEnd = _getEndOfDay(day);
|
let dayEnd = _getEndOfDay(day);
|
||||||
@ -708,7 +702,7 @@ EventsList.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_showToday: function() {
|
_showToday: function() {
|
||||||
this.actor.destroy_children();
|
this.actor.destroy_all_children();
|
||||||
|
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
let dayBegin = _getBeginningOfDay(now);
|
let dayBegin = _getBeginningOfDay(now);
|
||||||
@ -754,4 +748,4 @@ EventsList.prototype = {
|
|||||||
this._showOtherDay(this._date);
|
this._showOtherDay(this._date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
115
js/ui/checkBox.js
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const Pango = imports.gi.Pango;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
|
const St = imports.gi.St;
|
||||||
|
|
||||||
|
const Lang = imports.lang;
|
||||||
|
|
||||||
|
const CheckBoxContainer = new Lang.Class({
|
||||||
|
Name: 'CheckBoxContainer',
|
||||||
|
|
||||||
|
_init: function() {
|
||||||
|
this.actor = new Shell.GenericContainer();
|
||||||
|
this.actor.connect('get-preferred-width',
|
||||||
|
Lang.bind(this, this._getPreferredWidth));
|
||||||
|
this.actor.connect('get-preferred-height',
|
||||||
|
Lang.bind(this, this._getPreferredHeight));
|
||||||
|
this.actor.connect('allocate',
|
||||||
|
Lang.bind(this, this._allocate));
|
||||||
|
this.actor.connect('style-changed', Lang.bind(this,
|
||||||
|
function() {
|
||||||
|
let node = this.actor.get_theme_node();
|
||||||
|
this._spacing = node.get_length('spacing');
|
||||||
|
}));
|
||||||
|
this.actor.request_mode = Clutter.RequestMode.HEIGHT_FOR_WIDTH;
|
||||||
|
|
||||||
|
this._box = new St.Bin();
|
||||||
|
this.actor.add_actor(this._box);
|
||||||
|
|
||||||
|
this.label = new St.Label();
|
||||||
|
this.label.clutter_text.set_line_wrap(true);
|
||||||
|
this.label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
|
||||||
|
this.actor.add_actor(this.label);
|
||||||
|
|
||||||
|
this._spacing = 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
_getPreferredWidth: function(actor, forHeight, alloc) {
|
||||||
|
let [minWidth, natWidth] = this._box.get_preferred_width(forHeight);
|
||||||
|
|
||||||
|
alloc.min_size = minWidth + this._spacing;
|
||||||
|
alloc.natural_size = natWidth + this._spacing;
|
||||||
|
},
|
||||||
|
|
||||||
|
_getPreferredHeight: function(actor, forWidth, alloc) {
|
||||||
|
/* FIXME: StBoxlayout currently does not handle
|
||||||
|
height-for-width children correctly, so hard-code
|
||||||
|
two lines for the label until that problem is fixed.
|
||||||
|
|
||||||
|
https://bugzilla.gnome.org/show_bug.cgi?id=672543 */
|
||||||
|
/*
|
||||||
|
let [minBoxHeight, natBoxHeight] =
|
||||||
|
this._box.get_preferred_height(forWidth);
|
||||||
|
let [minLabelHeight, natLabelHeight] =
|
||||||
|
this.label.get_preferred_height(forWidth);
|
||||||
|
|
||||||
|
alloc.min_size = Math.max(minBoxHeight, minLabelHeight);
|
||||||
|
alloc.natural_size = Math.max(natBoxHeight, natLabelHeight);
|
||||||
|
*/
|
||||||
|
let [minBoxHeight, natBoxHeight] =
|
||||||
|
this._box.get_preferred_height(-1);
|
||||||
|
let [minLabelHeight, natLabelHeight] =
|
||||||
|
this.label.get_preferred_height(-1);
|
||||||
|
|
||||||
|
alloc.min_size = Math.max(minBoxHeight, 2 * minLabelHeight);
|
||||||
|
alloc.natural_size = Math.max(natBoxHeight, 2 * natLabelHeight);
|
||||||
|
},
|
||||||
|
|
||||||
|
_allocate: function(actor, box, flags) {
|
||||||
|
let availWidth = box.x2 - box.x1;
|
||||||
|
let availHeight = box.y2 - box.y1;
|
||||||
|
|
||||||
|
let childBox = new Clutter.ActorBox();
|
||||||
|
let [minBoxWidth, natBoxWidth] =
|
||||||
|
this._box.get_preferred_width(-1);
|
||||||
|
let [minBoxHeight, natBoxHeight] =
|
||||||
|
this._box.get_preferred_height(-1);
|
||||||
|
childBox.x1 = box.x1;
|
||||||
|
childBox.x2 = box.x1 + natBoxWidth;
|
||||||
|
childBox.y1 = box.y1;
|
||||||
|
childBox.y2 = box.y1 + natBoxHeight;
|
||||||
|
this._box.allocate(childBox, flags);
|
||||||
|
|
||||||
|
childBox.x1 = box.x1 + natBoxWidth + this._spacing;
|
||||||
|
childBox.x2 = availWidth - childBox.x1;
|
||||||
|
childBox.y1 = box.y1;
|
||||||
|
childBox.y2 = box.y2;
|
||||||
|
this.label.allocate(childBox, flags);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const CheckBox = new Lang.Class({
|
||||||
|
Name: 'CheckBox',
|
||||||
|
|
||||||
|
_init: function(label) {
|
||||||
|
this.actor = new St.Button({ style_class: 'check-box',
|
||||||
|
button_mask: St.ButtonMask.ONE,
|
||||||
|
toggle_mode: true,
|
||||||
|
can_focus: true,
|
||||||
|
x_fill: true,
|
||||||
|
y_fill: true });
|
||||||
|
this._container = new CheckBoxContainer();
|
||||||
|
this.actor.set_child(this._container.actor);
|
||||||
|
|
||||||
|
if (label)
|
||||||
|
this.setLabel(label);
|
||||||
|
},
|
||||||
|
|
||||||
|
setLabel: function(label) {
|
||||||
|
this._container.label.set_text(label);
|
||||||
|
},
|
||||||
|
|
||||||
|
getLabelActor: function() {
|
||||||
|
return this._container.label;
|
||||||
|
}
|
||||||
|
});
|
@ -5,6 +5,7 @@ const Lang = imports.lang;
|
|||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
const IconGrid = imports.ui.iconGrid;
|
const IconGrid = imports.ui.iconGrid;
|
||||||
@ -20,18 +21,18 @@ function launchContact(id) {
|
|||||||
|
|
||||||
|
|
||||||
/* This class represents a shown contact search result in the overview */
|
/* This class represents a shown contact search result in the overview */
|
||||||
function Contact(id) {
|
const Contact = new Lang.Class({
|
||||||
this._init(id);
|
Name: 'Contact',
|
||||||
}
|
|
||||||
|
|
||||||
Contact.prototype = {
|
|
||||||
_init: function(id) {
|
_init: function(id) {
|
||||||
this._contactSys = Shell.ContactSystem.get_default();
|
this._contactSys = Shell.ContactSystem.get_default();
|
||||||
this.individual = this._contactSys.get_individual(id);
|
this.individual = this._contactSys.get_individual(id);
|
||||||
|
|
||||||
this.actor = new St.Bin({ style_class: 'contact',
|
this.actor = new St.Bin({ style_class: 'contact',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
track_hover: true });
|
can_focus: true,
|
||||||
|
track_hover: true,
|
||||||
|
accessible_role: Atk.Role.PUSH_BUTTON });
|
||||||
|
|
||||||
let content = new St.BoxLayout( { style_class: 'contact-content',
|
let content = new St.BoxLayout( { style_class: 'contact-content',
|
||||||
vertical: false });
|
vertical: false });
|
||||||
@ -70,6 +71,8 @@ Contact.prototype = {
|
|||||||
x_align: St.Align.START,
|
x_align: St.Align.START,
|
||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
|
|
||||||
|
this.actor.label_actor = aliasLabel;
|
||||||
|
|
||||||
let presence = this._createPresence(this.individual.presence_type);
|
let presence = this._createPresence(this.individual.presence_type);
|
||||||
details.add(presence, { x_fill: false,
|
details.add(presence, { x_fill: false,
|
||||||
y_fill: true,
|
y_fill: true,
|
||||||
@ -95,23 +98,30 @@ Contact.prototype = {
|
|||||||
text = _("Busy");
|
text = _("Busy");
|
||||||
iconName = 'user-busy';
|
iconName = 'user-busy';
|
||||||
break;
|
break;
|
||||||
default:
|
case Folks.PresenceType.OFFLINE:
|
||||||
text = _("Offline");
|
text = _("Offline");
|
||||||
iconName = 'user-offline';
|
iconName = 'user-offline';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
text = '';
|
||||||
|
iconName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let box = new St.BoxLayout({ vertical: false,
|
||||||
|
style_class: 'contact-details-status' });
|
||||||
|
|
||||||
|
if (iconName) {
|
||||||
let icon = new St.Icon({ icon_name: iconName,
|
let icon = new St.Icon({ icon_name: iconName,
|
||||||
icon_type: St.IconType.FULLCOLOR,
|
icon_type: St.IconType.FULLCOLOR,
|
||||||
icon_size: 16,
|
icon_size: 16,
|
||||||
style_class: 'contact-details-status-icon' });
|
style_class: 'contact-details-status-icon' });
|
||||||
let label = new St.Label({ text: text });
|
|
||||||
|
|
||||||
let box = new St.BoxLayout({ vertical: false,
|
|
||||||
style_class: 'contact-details-status' });
|
|
||||||
box.add(icon, { x_fill: true,
|
box.add(icon, { x_fill: true,
|
||||||
y_fill: false,
|
y_fill: false,
|
||||||
x_align: St.Align.START,
|
x_align: St.Align.START,
|
||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
|
}
|
||||||
|
|
||||||
|
let label = new St.Label({ text: text });
|
||||||
|
|
||||||
box.add(label, { x_fill: true,
|
box.add(label, { x_fill: true,
|
||||||
y_fill: false,
|
y_fill: false,
|
||||||
@ -131,30 +141,31 @@ Contact.prototype = {
|
|||||||
return tc.load_icon_name(null, 'avatar-default', St.IconType.FULLCOLOR, size);
|
return tc.load_icon_name(null, 'avatar-default', St.IconType.FULLCOLOR, size);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
/* Searches for and returns contacts */
|
/* Searches for and returns contacts */
|
||||||
function ContactSearchProvider() {
|
const ContactSearchProvider = new Lang.Class({
|
||||||
this._init();
|
Name: 'ContactSearchProvider',
|
||||||
}
|
Extends: Search.SearchProvider,
|
||||||
|
|
||||||
ContactSearchProvider.prototype = {
|
|
||||||
__proto__: Search.SearchProvider.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Search.SearchProvider.prototype._init.call(this, _("CONTACTS"));
|
this.parent(_("CONTACTS"));
|
||||||
this._contactSys = Shell.ContactSystem.get_default();
|
this._contactSys = Shell.ContactSystem.get_default();
|
||||||
},
|
},
|
||||||
|
|
||||||
getResultMeta: function(id) {
|
getResultMetas: function(ids) {
|
||||||
let contact = new Contact(id);
|
let metas = [];
|
||||||
return { 'id': id,
|
for (let i = 0; i < ids.length; i++) {
|
||||||
|
let contact = new Contact(ids[i]);
|
||||||
|
metas.push({ 'id': ids[i],
|
||||||
'name': contact.alias,
|
'name': contact.alias,
|
||||||
'createIcon': function(size) {
|
'createIcon': function(size) {
|
||||||
return contact.createIcon(size);
|
return contact.createIcon(size);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
return metas;
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialResultSet: function(terms) {
|
getInitialResultSet: function(terms) {
|
||||||
@ -182,4 +193,4 @@ ContactSearchProvider.prototype = {
|
|||||||
activateResult: function(id, params) {
|
activateResult: function(id, params) {
|
||||||
launchContact(id);
|
launchContact(id);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -22,11 +22,9 @@ const SortGroup = {
|
|||||||
BOTTOM: 2
|
BOTTOM: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
function CtrlAltTabManager() {
|
const CtrlAltTabManager = new Lang.Class({
|
||||||
this._init();
|
Name: 'CtrlAltTabManager',
|
||||||
}
|
|
||||||
|
|
||||||
CtrlAltTabManager.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._items = [];
|
this._items = [];
|
||||||
this._focusManager = St.FocusManager.get_for_stage(global.stage);
|
this._focusManager = St.FocusManager.get_for_stage(global.stage);
|
||||||
@ -134,17 +132,15 @@ CtrlAltTabManager.prototype = {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function mod(a, b) {
|
function mod(a, b) {
|
||||||
return (a + b) % b;
|
return (a + b) % b;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CtrlAltTabPopup() {
|
const CtrlAltTabPopup = new Lang.Class({
|
||||||
this._init();
|
Name: 'CtrlAltTabPopup',
|
||||||
}
|
|
||||||
|
|
||||||
CtrlAltTabPopup.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this.actor = new Shell.GenericContainer({ name: 'ctrlAltTabPopup',
|
this.actor = new Shell.GenericContainer({ name: 'ctrlAltTabPopup',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
@ -187,7 +183,7 @@ CtrlAltTabPopup.prototype = {
|
|||||||
let [childMinHeight, childNaturalHeight] = this._switcher.actor.get_preferred_height(primary.width - hPadding);
|
let [childMinHeight, childNaturalHeight] = this._switcher.actor.get_preferred_height(primary.width - hPadding);
|
||||||
let [childMinWidth, childNaturalWidth] = this._switcher.actor.get_preferred_width(childNaturalHeight);
|
let [childMinWidth, childNaturalWidth] = this._switcher.actor.get_preferred_width(childNaturalHeight);
|
||||||
childBox.x1 = Math.max(primary.x + leftPadding, primary.x + Math.floor((primary.width - childNaturalWidth) / 2));
|
childBox.x1 = Math.max(primary.x + leftPadding, primary.x + Math.floor((primary.width - childNaturalWidth) / 2));
|
||||||
childBox.x2 = Math.min(primary.width - hPadding, childBox.x1 + childNaturalWidth);
|
childBox.x2 = Math.min(primary.x + primary.width - hPadding, childBox.x1 + childNaturalWidth);
|
||||||
childBox.y1 = primary.y + Math.floor((primary.height - childNaturalHeight) / 2);
|
childBox.y1 = primary.y + Math.floor((primary.height - childNaturalHeight) / 2);
|
||||||
childBox.y2 = childBox.y1 + childNaturalHeight;
|
childBox.y2 = childBox.y1 + childNaturalHeight;
|
||||||
this._switcher.actor.allocate(childBox, flags);
|
this._switcher.actor.allocate(childBox, flags);
|
||||||
@ -237,7 +233,7 @@ CtrlAltTabPopup.prototype = {
|
|||||||
|
|
||||||
_keyPressEvent : function(actor, event) {
|
_keyPressEvent : function(actor, event) {
|
||||||
let keysym = event.get_key_symbol();
|
let keysym = event.get_key_symbol();
|
||||||
let shift = (Shell.get_event_state(event) & Clutter.ModifierType.SHIFT_MASK);
|
let shift = (event.get_state() & Clutter.ModifierType.SHIFT_MASK);
|
||||||
if (shift && keysym == Clutter.KEY_Tab)
|
if (shift && keysym == Clutter.KEY_Tab)
|
||||||
keysym = Clutter.ISO_Left_Tab;
|
keysym = Clutter.ISO_Left_Tab;
|
||||||
|
|
||||||
@ -303,17 +299,14 @@ CtrlAltTabPopup.prototype = {
|
|||||||
this._selection = num;
|
this._selection = num;
|
||||||
this._switcher.highlight(num);
|
this._switcher.highlight(num);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function CtrlAltTabSwitcher(items) {
|
const CtrlAltTabSwitcher = new Lang.Class({
|
||||||
this._init(items);
|
Name: 'CtrlAltTabSwitcher',
|
||||||
}
|
Extends: AltTab.SwitcherList,
|
||||||
|
|
||||||
CtrlAltTabSwitcher.prototype = {
|
|
||||||
__proto__ : AltTab.SwitcherList.prototype,
|
|
||||||
|
|
||||||
_init : function(items) {
|
_init : function(items) {
|
||||||
AltTab.SwitcherList.prototype._init.call(this, true);
|
this.parent(true);
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++)
|
for (let i = 0; i < items.length; i++)
|
||||||
this._addIcon(items[i]);
|
this._addIcon(items[i]);
|
||||||
@ -336,4 +329,4 @@ CtrlAltTabSwitcher.prototype = {
|
|||||||
|
|
||||||
this.addItem(box, text);
|
this.addItem(box, text);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
198
js/ui/dash.js
@ -6,6 +6,7 @@ const Lang = imports.lang;
|
|||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
const Mainloop = imports.mainloop;
|
||||||
|
|
||||||
const AppDisplay = imports.ui.appDisplay;
|
const AppDisplay = imports.ui.appDisplay;
|
||||||
const AppFavorites = imports.ui.appFavorites;
|
const AppFavorites = imports.ui.appFavorites;
|
||||||
@ -16,14 +17,15 @@ const Tweener = imports.ui.tweener;
|
|||||||
const Workspace = imports.ui.workspace;
|
const Workspace = imports.ui.workspace;
|
||||||
|
|
||||||
const DASH_ANIMATION_TIME = 0.2;
|
const DASH_ANIMATION_TIME = 0.2;
|
||||||
|
const DASH_ITEM_LABEL_SHOW_TIME = 0.15;
|
||||||
|
const DASH_ITEM_LABEL_HIDE_TIME = 0.1;
|
||||||
|
const DASH_ITEM_HOVER_TIMEOUT = 300;
|
||||||
|
|
||||||
// A container like StBin, but taking the child's scale into account
|
// A container like StBin, but taking the child's scale into account
|
||||||
// when requesting a size
|
// when requesting a size
|
||||||
function DashItemContainer() {
|
const DashItemContainer = new Lang.Class({
|
||||||
this._init();
|
Name: 'DashItemContainer',
|
||||||
}
|
|
||||||
|
|
||||||
DashItemContainer.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new Shell.GenericContainer({ style_class: 'dash-item-container' });
|
this.actor = new Shell.GenericContainer({ style_class: 'dash-item-container' });
|
||||||
this.actor.connect('get-preferred-width',
|
this.actor.connect('get-preferred-width',
|
||||||
@ -34,6 +36,8 @@ DashItemContainer.prototype = {
|
|||||||
Lang.bind(this, this._allocate));
|
Lang.bind(this, this._allocate));
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
|
|
||||||
|
this.label = null;
|
||||||
|
|
||||||
this.child = null;
|
this.child = null;
|
||||||
this._childScale = 1;
|
this._childScale = 1;
|
||||||
this._childOpacity = 255;
|
this._childOpacity = 255;
|
||||||
@ -86,11 +90,65 @@ DashItemContainer.prototype = {
|
|||||||
alloc.natural_size = natWidth * this.child.scale_y;
|
alloc.natural_size = natWidth * this.child.scale_y;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showLabel: function() {
|
||||||
|
if (this.label == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.label.opacity = 0;
|
||||||
|
this.label.show();
|
||||||
|
|
||||||
|
let [stageX, stageY] = this.actor.get_transformed_position();
|
||||||
|
|
||||||
|
let itemHeight = this.actor.allocation.y2 - this.actor.allocation.y1;
|
||||||
|
|
||||||
|
let labelHeight = this.label.get_height();
|
||||||
|
let yOffset = Math.floor((itemHeight - labelHeight) / 2)
|
||||||
|
|
||||||
|
let y = stageY + yOffset;
|
||||||
|
|
||||||
|
let node = this.label.get_theme_node();
|
||||||
|
let xOffset = node.get_length('-x-offset');
|
||||||
|
|
||||||
|
let x;
|
||||||
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
|
x = stageX - this.label.get_width() - xOffset;
|
||||||
|
else
|
||||||
|
x = stageX + this.actor.get_width() + xOffset;
|
||||||
|
|
||||||
|
this.label.set_position(x, y);
|
||||||
|
Tweener.addTween(this.label,
|
||||||
|
{ opacity: 255,
|
||||||
|
time: DASH_ITEM_LABEL_SHOW_TIME,
|
||||||
|
transition: 'easeOutQuad',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
setLabelText: function(text) {
|
||||||
|
if (this.label == null)
|
||||||
|
this.label = new St.Label({ style_class: 'dash-label'});
|
||||||
|
|
||||||
|
this.label.set_text(text);
|
||||||
|
Main.layoutManager.addChrome(this.label);
|
||||||
|
this.label.hide();
|
||||||
|
},
|
||||||
|
|
||||||
|
hideLabel: function () {
|
||||||
|
this.label.opacity = 255;
|
||||||
|
Tweener.addTween(this.label,
|
||||||
|
{ opacity: 0,
|
||||||
|
time: DASH_ITEM_LABEL_HIDE_TIME,
|
||||||
|
transition: 'easeOutQuad',
|
||||||
|
onComplete: Lang.bind(this, function() {
|
||||||
|
this.label.hide();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
setChild: function(actor) {
|
setChild: function(actor) {
|
||||||
if (this.child == actor)
|
if (this.child == actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.actor.destroy_children();
|
this.actor.destroy_all_children();
|
||||||
|
|
||||||
this.child = actor;
|
this.child = actor;
|
||||||
this.actor.add_actor(this.child);
|
this.actor.add_actor(this.child);
|
||||||
@ -110,7 +168,17 @@ DashItemContainer.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
if (this.label)
|
||||||
|
this.label.destroy();
|
||||||
|
|
||||||
|
this.actor.destroy();
|
||||||
|
},
|
||||||
|
|
||||||
animateOutAndDestroy: function() {
|
animateOutAndDestroy: function() {
|
||||||
|
if (this.label)
|
||||||
|
this.label.destroy();
|
||||||
|
|
||||||
if (this.child == null) {
|
if (this.child == null) {
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
return;
|
return;
|
||||||
@ -157,17 +225,14 @@ DashItemContainer.prototype = {
|
|||||||
get childOpacity() {
|
get childOpacity() {
|
||||||
return this._childOpacity;
|
return this._childOpacity;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function RemoveFavoriteIcon() {
|
const RemoveFavoriteIcon = new Lang.Class({
|
||||||
this._init();
|
Name: 'RemoveFavoriteIcon',
|
||||||
}
|
Extends: DashItemContainer,
|
||||||
|
|
||||||
RemoveFavoriteIcon.prototype = {
|
|
||||||
__proto__: DashItemContainer.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
DashItemContainer.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this._iconBin = new St.Bin({ style_class: 'remove-favorite' });
|
this._iconBin = new St.Bin({ style_class: 'remove-favorite' });
|
||||||
this._iconActor = null;
|
this._iconActor = null;
|
||||||
@ -219,28 +284,21 @@ RemoveFavoriteIcon.prototype = {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
const DragPlaceholderItem = new Lang.Class({
|
||||||
function DragPlaceholderItem() {
|
Name: 'DragPlaceholderItem',
|
||||||
this._init();
|
Extends: DashItemContainer,
|
||||||
}
|
|
||||||
|
|
||||||
DragPlaceholderItem.prototype = {
|
|
||||||
__proto__: DashItemContainer.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
DashItemContainer.prototype._init.call(this);
|
this.parent();
|
||||||
this.setChild(new St.Bin({ style_class: 'dash-placeholder' }));
|
this.setChild(new St.Bin({ style_class: 'placeholder' }));
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
const Dash = new Lang.Class({
|
||||||
|
Name: 'Dash',
|
||||||
|
|
||||||
function Dash() {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
|
|
||||||
Dash.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this._maxHeight = -1;
|
this._maxHeight = -1;
|
||||||
this.iconSize = 64;
|
this.iconSize = 64;
|
||||||
@ -250,6 +308,9 @@ Dash.prototype = {
|
|||||||
this._dragPlaceholderPos = -1;
|
this._dragPlaceholderPos = -1;
|
||||||
this._animatingPlaceholdersCount = 0;
|
this._animatingPlaceholdersCount = 0;
|
||||||
this._favRemoveTarget = null;
|
this._favRemoveTarget = null;
|
||||||
|
this._showLabelTimeoutId = 0;
|
||||||
|
this._resetHoverTimeoutId = 0;
|
||||||
|
this._labelShowing = false;
|
||||||
|
|
||||||
this._box = new St.BoxLayout({ name: 'dash',
|
this._box = new St.BoxLayout({ name: 'dash',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
@ -336,6 +397,7 @@ Dash.prototype = {
|
|||||||
let srcIsFavorite = (id in favorites);
|
let srcIsFavorite = (id in favorites);
|
||||||
|
|
||||||
if (srcIsFavorite &&
|
if (srcIsFavorite &&
|
||||||
|
app.get_state() != Shell.AppState.RUNNING &&
|
||||||
dragEvent.source.actor &&
|
dragEvent.source.actor &&
|
||||||
this.actor.contains (dragEvent.source.actor) &&
|
this.actor.contains (dragEvent.source.actor) &&
|
||||||
this._favRemoveTarget == null) {
|
this._favRemoveTarget == null) {
|
||||||
@ -383,16 +445,53 @@ Dash.prototype = {
|
|||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
display.actor.opacity = 255;
|
display.actor.opacity = 255;
|
||||||
}));
|
}));
|
||||||
display.actor.set_tooltip_text(app.get_name());
|
|
||||||
|
|
||||||
let item = new DashItemContainer();
|
let item = new DashItemContainer();
|
||||||
item.setChild(display.actor);
|
item.setChild(display.actor);
|
||||||
|
|
||||||
display.icon.setIconSize(this.iconSize);
|
item.setLabelText(app.get_name());
|
||||||
|
// Override default AppWellIcon label_actor
|
||||||
|
display.actor.label_actor = item.label;
|
||||||
|
|
||||||
|
|
||||||
|
display.icon.setIconSize(this.iconSize);
|
||||||
|
display.actor.connect('notify::hover',
|
||||||
|
Lang.bind(this, function() {
|
||||||
|
this._onHover(item, display)
|
||||||
|
}));
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onHover: function (item, display) {
|
||||||
|
if (display.actor.get_hover() && !display.isMenuUp) {
|
||||||
|
if (this._showLabelTimeoutId == 0) {
|
||||||
|
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
|
||||||
|
this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
|
||||||
|
Lang.bind(this, function() {
|
||||||
|
this._labelShowing = true;
|
||||||
|
item.showLabel();
|
||||||
|
return false;
|
||||||
|
}));
|
||||||
|
if (this._resetHoverTimeoutId > 0) {
|
||||||
|
Mainloop.source_remove(this._resetHoverTimeoutId);
|
||||||
|
this._resetHoverTimeoutId = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this._showLabelTimeoutId > 0)
|
||||||
|
Mainloop.source_remove(this._showLabelTimeoutId);
|
||||||
|
this._showLabelTimeoutId = 0;
|
||||||
|
item.hideLabel();
|
||||||
|
if (this._labelShowing) {
|
||||||
|
this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
|
||||||
|
Lang.bind(this, function() {
|
||||||
|
this._labelShowing = false;
|
||||||
|
return false;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_adjustIconSize: function() {
|
_adjustIconSize: function() {
|
||||||
// For the icon size, we only consider children which are "proper"
|
// For the icon size, we only consider children which are "proper"
|
||||||
// icons (i.e. ignoring drag placeholders) and which are not
|
// icons (i.e. ignoring drag placeholders) and which are not
|
||||||
@ -416,7 +515,7 @@ Dash.prototype = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this._box.get_theme_node();
|
||||||
let maxAllocation = new Clutter.ActorBox({ x1: 0, y1: 0,
|
let maxAllocation = new Clutter.ActorBox({ x1: 0, y1: 0,
|
||||||
x2: 42 /* whatever */,
|
x2: 42 /* whatever */,
|
||||||
y2: this._maxHeight });
|
y2: this._maxHeight });
|
||||||
@ -592,7 +691,7 @@ Dash.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < addedItems.length; i++)
|
for (let i = 0; i < addedItems.length; i++)
|
||||||
this._box.insert_actor(addedItems[i].item.actor,
|
this._box.insert_child_at_index(addedItems[i].item.actor,
|
||||||
addedItems[i].pos);
|
addedItems[i].pos);
|
||||||
|
|
||||||
for (let i = 0; i < removedActors.length; i++) {
|
for (let i = 0; i < removedActors.length; i++) {
|
||||||
@ -602,7 +701,7 @@ Dash.prototype = {
|
|||||||
if (Main.overview.visible)
|
if (Main.overview.visible)
|
||||||
item.animateOutAndDestroy();
|
item.animateOutAndDestroy();
|
||||||
else
|
else
|
||||||
item.actor.destroy();
|
item.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._adjustIconSize();
|
this._adjustIconSize();
|
||||||
@ -658,20 +757,10 @@ Dash.prototype = {
|
|||||||
numChildren--;
|
numChildren--;
|
||||||
}
|
}
|
||||||
|
|
||||||
let pos = Math.round(y * numChildren / boxHeight);
|
let pos = Math.floor(y * numChildren / boxHeight);
|
||||||
|
|
||||||
if (pos != this._dragPlaceholderPos && pos <= numFavorites) {
|
if (pos != this._dragPlaceholderPos && pos <= numFavorites && this._animatingPlaceholdersCount == 0) {
|
||||||
if (this._animatingPlaceholdersCount > 0) {
|
|
||||||
let appChildren = children.filter(function(actor) {
|
|
||||||
return actor._delegate &&
|
|
||||||
actor._delegate.child &&
|
|
||||||
actor._delegate.child._delegate &&
|
|
||||||
actor._delegate.child._delegate.app;
|
|
||||||
});
|
|
||||||
this._dragPlaceholderPos = children.indexOf(appChildren[pos]);
|
|
||||||
} else {
|
|
||||||
this._dragPlaceholderPos = pos;
|
this._dragPlaceholderPos = pos;
|
||||||
}
|
|
||||||
|
|
||||||
// Don't allow positioning before or after self
|
// Don't allow positioning before or after self
|
||||||
if (favPos != -1 && (pos == favPos || pos == favPos + 1)) {
|
if (favPos != -1 && (pos == favPos || pos == favPos + 1)) {
|
||||||
@ -702,12 +791,20 @@ Dash.prototype = {
|
|||||||
this._dragPlaceholder = new DragPlaceholderItem();
|
this._dragPlaceholder = new DragPlaceholderItem();
|
||||||
this._dragPlaceholder.child.set_width (this.iconSize);
|
this._dragPlaceholder.child.set_width (this.iconSize);
|
||||||
this._dragPlaceholder.child.set_height (this.iconSize / 2);
|
this._dragPlaceholder.child.set_height (this.iconSize / 2);
|
||||||
this._box.insert_actor(this._dragPlaceholder.actor,
|
this._box.insert_child_at_index(this._dragPlaceholder.actor,
|
||||||
this._dragPlaceholderPos);
|
this._dragPlaceholderPos);
|
||||||
if (fadeIn)
|
if (fadeIn)
|
||||||
this._dragPlaceholder.animateIn();
|
this._dragPlaceholder.animateIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the drag placeholder if we are not in the
|
||||||
|
// "favorites zone"
|
||||||
|
if (pos > numFavorites && this._dragPlaceholder) {
|
||||||
|
this._clearDragPlaceholder();
|
||||||
|
}
|
||||||
|
if (!this._dragPlaceholder)
|
||||||
|
return DND.DragMotionResult.NO_DROP;
|
||||||
|
|
||||||
let srcIsFavorite = (favPos != -1);
|
let srcIsFavorite = (favPos != -1);
|
||||||
|
|
||||||
if (srcIsFavorite)
|
if (srcIsFavorite)
|
||||||
@ -750,6 +847,11 @@ Dash.prototype = {
|
|||||||
favPos++;
|
favPos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No drag placeholder means we don't wan't to favorite the app
|
||||||
|
// and we are dragging it to its original position
|
||||||
|
if (!this._dragPlaceholder)
|
||||||
|
return true;
|
||||||
|
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||||
function () {
|
function () {
|
||||||
let appFavorites = AppFavorites.getAppFavorites();
|
let appFavorites = AppFavorites.getAppFavorites();
|
||||||
@ -762,6 +864,6 @@ Dash.prototype = {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
Signals.addSignalMethods(Dash.prototype);
|
Signals.addSignalMethods(Dash.prototype);
|
||||||
|
@ -8,6 +8,7 @@ const Cairo = imports.cairo;
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
@ -40,12 +41,9 @@ function _onVertSepRepaint (area)
|
|||||||
cr.stroke();
|
cr.stroke();
|
||||||
};
|
};
|
||||||
|
|
||||||
function DateMenuButton() {
|
const DateMenuButton = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'DateMenuButton',
|
||||||
}
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
DateMenuButton.prototype = {
|
|
||||||
__proto__: PanelMenu.Button.prototype,
|
|
||||||
|
|
||||||
_init: function(params) {
|
_init: function(params) {
|
||||||
params = Params.parse(params, { showEvents: true });
|
params = Params.parse(params, { showEvents: true });
|
||||||
@ -55,9 +53,14 @@ DateMenuButton.prototype = {
|
|||||||
let vbox;
|
let vbox;
|
||||||
|
|
||||||
let menuAlignment = 0.25;
|
let menuAlignment = 0.25;
|
||||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
menuAlignment = 1.0 - menuAlignment;
|
menuAlignment = 1.0 - menuAlignment;
|
||||||
PanelMenu.Button.prototype._init.call(this, menuAlignment);
|
this.parent(menuAlignment);
|
||||||
|
|
||||||
|
// At this moment calendar menu is not keyboard navigable at
|
||||||
|
// all (so not accessible), so it doesn't make sense to set as
|
||||||
|
// role ATK_ROLE_MENU like other elements of the panel.
|
||||||
|
this.actor.accessible_role = Atk.Role.LABEL;
|
||||||
|
|
||||||
this._clock = new St.Label();
|
this._clock = new St.Label();
|
||||||
this.actor.add_actor(this._clock);
|
this.actor.add_actor(this._clock);
|
||||||
@ -72,6 +75,7 @@ DateMenuButton.prototype = {
|
|||||||
|
|
||||||
// Date
|
// Date
|
||||||
this._date = new St.Label();
|
this._date = new St.Label();
|
||||||
|
this.actor.label_actor = this._date;
|
||||||
this._date.style_class = 'datemenu-date-label';
|
this._date.style_class = 'datemenu-date-label';
|
||||||
vbox.add(this._date);
|
vbox.add(this._date);
|
||||||
|
|
||||||
@ -239,4 +243,4 @@ DateMenuButton.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
34
js/ui/dnd.js
@ -69,11 +69,9 @@ function removeDragMonitor(monitor) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _Draggable(actor, params) {
|
const _Draggable = new Lang.Class({
|
||||||
this._init(actor, params);
|
Name: 'Draggable',
|
||||||
}
|
|
||||||
|
|
||||||
_Draggable.prototype = {
|
|
||||||
_init : function(actor, params) {
|
_init : function(actor, params) {
|
||||||
params = Params.parse(params, { manualMode: false,
|
params = Params.parse(params, { manualMode: false,
|
||||||
restoreOnSuccess: false,
|
restoreOnSuccess: false,
|
||||||
@ -105,8 +103,8 @@ _Draggable.prototype = {
|
|||||||
this._dragInProgress = false; // The drag has been started, and has not been dropped or cancelled yet.
|
this._dragInProgress = false; // The drag has been started, and has not been dropped or cancelled yet.
|
||||||
this._animationInProgress = false; // The drag is over and the item is in the process of animating to its original position (snapping back or reverting).
|
this._animationInProgress = false; // The drag is over and the item is in the process of animating to its original position (snapping back or reverting).
|
||||||
|
|
||||||
// During the drag, we eat enter/leave events so that actors don't prelight or show
|
// During the drag, we eat enter/leave events so that actors don't prelight.
|
||||||
// tooltips. But we remember the actors that we first left/last entered so we can
|
// But we remember the actors that we first left/last entered so we can
|
||||||
// fix up the hover state after the drag ends.
|
// fix up the hover state after the drag ends.
|
||||||
this._firstLeaveActor = null;
|
this._firstLeaveActor = null;
|
||||||
this._lastEnterActor = null;
|
this._lastEnterActor = null;
|
||||||
@ -122,12 +120,6 @@ _Draggable.prototype = {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
this._buttonDown = true;
|
this._buttonDown = true;
|
||||||
// special case St.Button: grabbing the pointer would mess up the
|
|
||||||
// internal state, so we start the drag manually on hover change
|
|
||||||
if (this.actor instanceof St.Button)
|
|
||||||
this.actor.connect('notify::hover',
|
|
||||||
Lang.bind(this, this._onButtonHoverChanged));
|
|
||||||
else
|
|
||||||
this._grabActor();
|
this._grabActor();
|
||||||
|
|
||||||
let [stageX, stageY] = event.get_coords();
|
let [stageX, stageY] = event.get_coords();
|
||||||
@ -137,15 +129,6 @@ _Draggable.prototype = {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonHoverChanged: function(button) {
|
|
||||||
if (button.hover || !button.pressed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
button.fake_release();
|
|
||||||
this.startDrag(this._dragStartX, this._dragStartY,
|
|
||||||
global.get_current_time());
|
|
||||||
},
|
|
||||||
|
|
||||||
_grabActor: function() {
|
_grabActor: function() {
|
||||||
Clutter.grab_pointer(this.actor);
|
Clutter.grab_pointer(this.actor);
|
||||||
this._onEventId = this.actor.connect('event',
|
this._onEventId = this.actor.connect('event',
|
||||||
@ -234,6 +217,13 @@ _Draggable.prototype = {
|
|||||||
currentDraggable = this;
|
currentDraggable = this;
|
||||||
this._dragInProgress = true;
|
this._dragInProgress = true;
|
||||||
|
|
||||||
|
// Special-case St.Button: the pointer grab messes with the internal
|
||||||
|
// state, so force a reset to a reasonable state here
|
||||||
|
if (this.actor instanceof St.Button) {
|
||||||
|
this.actor.fake_release();
|
||||||
|
this.actor.hover = false;
|
||||||
|
}
|
||||||
|
|
||||||
this.emit('drag-begin', time);
|
this.emit('drag-begin', time);
|
||||||
if (this._onEventId)
|
if (this._onEventId)
|
||||||
this._ungrabActor();
|
this._ungrabActor();
|
||||||
@ -596,7 +586,7 @@ _Draggable.prototype = {
|
|||||||
this._dragActor = undefined;
|
this._dragActor = undefined;
|
||||||
currentDraggable = null;
|
currentDraggable = null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
Signals.addSignalMethods(_Draggable.prototype);
|
Signals.addSignalMethods(_Draggable.prototype);
|
||||||
|
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
||||||
|
|
||||||
const DocInfo = imports.misc.docInfo;
|
|
||||||
const Params = imports.misc.params;
|
|
||||||
const Search = imports.ui.search;
|
|
||||||
|
|
||||||
|
|
||||||
function DocSearchProvider() {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
|
|
||||||
DocSearchProvider.prototype = {
|
|
||||||
__proto__: Search.SearchProvider.prototype,
|
|
||||||
|
|
||||||
_init: function(name) {
|
|
||||||
Search.SearchProvider.prototype._init.call(this, _("RECENT ITEMS"));
|
|
||||||
this._docManager = DocInfo.getDocManager();
|
|
||||||
},
|
|
||||||
|
|
||||||
getResultMeta: function(resultId) {
|
|
||||||
let docInfo = this._docManager.lookupByUri(resultId);
|
|
||||||
if (!docInfo)
|
|
||||||
return null;
|
|
||||||
return { 'id': resultId,
|
|
||||||
'name': docInfo.name,
|
|
||||||
'createIcon': function(size) {
|
|
||||||
return docInfo.createIcon(size);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
activateResult: function(id, params) {
|
|
||||||
params = Params.parse(params, { workspace: -1,
|
|
||||||
timestamp: 0 });
|
|
||||||
|
|
||||||
let docInfo = this._docManager.lookupByUri(id);
|
|
||||||
docInfo.launch(params.workspace);
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialResultSet: function(terms) {
|
|
||||||
return this._docManager.initialSearch(terms);
|
|
||||||
},
|
|
||||||
|
|
||||||
getSubsearchResultSet: function(previousResults, terms) {
|
|
||||||
return this._docManager.subsearch(previousResults, terms);
|
|
||||||
}
|
|
||||||
};
|
|
@ -18,19 +18,19 @@
|
|||||||
* 02111-1307, USA.
|
* 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const AccountsService = imports.gi.AccountsService;
|
const AccountsService = imports.gi.AccountsService;
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
const Pango = imports.gi.Pango;
|
const Pango = imports.gi.Pango;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
|
|
||||||
const GnomeSession = imports.misc.gnomeSession
|
const GnomeSession = imports.misc.gnomeSession;
|
||||||
const Lightbox = imports.ui.lightbox;
|
const Lightbox = imports.ui.lightbox;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const ModalDialog = imports.ui.modalDialog;
|
const ModalDialog = imports.ui.modalDialog;
|
||||||
@ -43,22 +43,23 @@ const _DIALOG_ICON_SIZE = 32;
|
|||||||
|
|
||||||
const GSM_SESSION_MANAGER_LOGOUT_FORCE = 2;
|
const GSM_SESSION_MANAGER_LOGOUT_FORCE = 2;
|
||||||
|
|
||||||
const EndSessionDialogIface = {
|
const EndSessionDialogIface = <interface name="org.gnome.SessionManager.EndSessionDialog">
|
||||||
name: 'org.gnome.SessionManager.EndSessionDialog',
|
<method name="Open">
|
||||||
methods: [{ name: 'Open',
|
<arg type="u" direction="in" />
|
||||||
inSignature: 'uuuao',
|
<arg type="u" direction="in" />
|
||||||
outSignature: ''
|
<arg type="u" direction="in" />
|
||||||
}
|
<arg type="ao" direction="in" />
|
||||||
],
|
</method>
|
||||||
signals: [{ name: 'Canceled',
|
<signal name="ConfirmedLogout" />
|
||||||
inSignature: '',
|
<signal name="ConfirmedReboot" />
|
||||||
}],
|
<signal name="ConfirmedShutdown" />
|
||||||
properties: []
|
<signal name="Canceled" />
|
||||||
};
|
<signal name="Closed" />
|
||||||
|
</interface>;
|
||||||
|
|
||||||
const logoutDialogContent = {
|
const logoutDialogContent = {
|
||||||
subjectWithUser: _("Log Out %s"),
|
subjectWithUser: C_("title", "Log Out %s"),
|
||||||
subject: _("Log Out"),
|
subject: C_("title", "Log Out"),
|
||||||
inhibitedDescription: _("Click Log Out to quit these applications and log out of the system."),
|
inhibitedDescription: _("Click Log Out to quit these applications and log out of the system."),
|
||||||
uninhibitedDescriptionWithUser: function(user, seconds) {
|
uninhibitedDescriptionWithUser: function(user, seconds) {
|
||||||
return ngettext("%s will be logged out automatically in %d second.",
|
return ngettext("%s will be logged out automatically in %d second.",
|
||||||
@ -72,12 +73,12 @@ const logoutDialogContent = {
|
|||||||
},
|
},
|
||||||
endDescription: _("Logging out of the system."),
|
endDescription: _("Logging out of the system."),
|
||||||
confirmButtons: [{ signal: 'ConfirmedLogout',
|
confirmButtons: [{ signal: 'ConfirmedLogout',
|
||||||
label: _("Log Out") }],
|
label: C_("button", "Log Out") }],
|
||||||
iconStyleClass: 'end-session-dialog-logout-icon'
|
iconStyleClass: 'end-session-dialog-logout-icon'
|
||||||
};
|
};
|
||||||
|
|
||||||
const shutdownDialogContent = {
|
const shutdownDialogContent = {
|
||||||
subject: _("Power Off"),
|
subject: C_("title", "Power Off"),
|
||||||
inhibitedDescription: _("Click Power Off to quit these applications and power off the system."),
|
inhibitedDescription: _("Click Power Off to quit these applications and power off the system."),
|
||||||
uninhibitedDescription: function(seconds) {
|
uninhibitedDescription: function(seconds) {
|
||||||
return ngettext("The system will power off automatically in %d second.",
|
return ngettext("The system will power off automatically in %d second.",
|
||||||
@ -86,15 +87,15 @@ const shutdownDialogContent = {
|
|||||||
},
|
},
|
||||||
endDescription: _("Powering off the system."),
|
endDescription: _("Powering off the system."),
|
||||||
confirmButtons: [{ signal: 'ConfirmedReboot',
|
confirmButtons: [{ signal: 'ConfirmedReboot',
|
||||||
label: _("Restart") },
|
label: C_("button", "Restart") },
|
||||||
{ signal: 'ConfirmedShutdown',
|
{ signal: 'ConfirmedShutdown',
|
||||||
label: _("Power Off") }],
|
label: C_("button", "Power Off") }],
|
||||||
iconName: 'system-shutdown',
|
iconName: 'system-shutdown',
|
||||||
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
||||||
};
|
};
|
||||||
|
|
||||||
const restartDialogContent = {
|
const restartDialogContent = {
|
||||||
subject: _("Restart"),
|
subject: C_("title", "Restart"),
|
||||||
inhibitedDescription: _("Click Restart to quit these applications and restart the system."),
|
inhibitedDescription: _("Click Restart to quit these applications and restart the system."),
|
||||||
uninhibitedDescription: function(seconds) {
|
uninhibitedDescription: function(seconds) {
|
||||||
return ngettext("The system will restart automatically in %d second.",
|
return ngettext("The system will restart automatically in %d second.",
|
||||||
@ -103,7 +104,7 @@ const restartDialogContent = {
|
|||||||
},
|
},
|
||||||
endDescription: _("Restarting the system."),
|
endDescription: _("Restarting the system."),
|
||||||
confirmButtons: [{ signal: 'ConfirmedReboot',
|
confirmButtons: [{ signal: 'ConfirmedReboot',
|
||||||
label: _("Restart") }],
|
label: C_("button", "Restart") }],
|
||||||
iconName: 'system-shutdown',
|
iconName: 'system-shutdown',
|
||||||
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
iconStyleClass: 'end-session-dialog-shutdown-icon'
|
||||||
};
|
};
|
||||||
@ -115,37 +116,17 @@ const DialogContent = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function findAppFromInhibitor(inhibitor) {
|
function findAppFromInhibitor(inhibitor) {
|
||||||
let desktopFile = inhibitor.app_id;
|
let [desktopFile] = inhibitor.GetAppIdSync();
|
||||||
|
|
||||||
if (!GLib.str_has_suffix(desktopFile, '.desktop'))
|
if (!GLib.str_has_suffix(desktopFile, '.desktop'))
|
||||||
desktopFile += '.desktop';
|
desktopFile += '.desktop';
|
||||||
|
|
||||||
let candidateDesktopFiles = [];
|
return Shell.AppSystem.get_default().lookup_heuristic_basename(desktopFile);
|
||||||
|
|
||||||
candidateDesktopFiles.push(desktopFile);
|
|
||||||
candidateDesktopFiles.push('gnome-' + desktopFile);
|
|
||||||
|
|
||||||
let appSystem = Shell.AppSystem.get_default();
|
|
||||||
let app = null;
|
|
||||||
for (let i = 0; i < candidateDesktopFiles.length; i++) {
|
|
||||||
try {
|
|
||||||
app = appSystem.lookup_app(candidateDesktopFiles[i]);
|
|
||||||
|
|
||||||
if (app)
|
|
||||||
break;
|
|
||||||
} catch(e) {
|
|
||||||
// ignore errors
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return app;
|
const ListItem = new Lang.Class({
|
||||||
}
|
Name: 'ListItem',
|
||||||
|
|
||||||
function ListItem(app, reason) {
|
|
||||||
this._init(app, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
ListItem.prototype = {
|
|
||||||
_init: function(app, reason) {
|
_init: function(app, reason) {
|
||||||
this._app = app;
|
this._app = app;
|
||||||
this._reason = reason;
|
this._reason = reason;
|
||||||
@ -191,7 +172,7 @@ ListItem.prototype = {
|
|||||||
this.emit('activate');
|
this.emit('activate');
|
||||||
this._app.activate();
|
this._app.activate();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(ListItem.prototype);
|
Signals.addSignalMethods(ListItem.prototype);
|
||||||
|
|
||||||
// The logout timer only shows updates every 10 seconds
|
// The logout timer only shows updates every 10 seconds
|
||||||
@ -229,29 +210,19 @@ function _setLabelText(label, text) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function EndSessionDialog() {
|
|
||||||
if (_endSessionDialog == null) {
|
|
||||||
this._init();
|
|
||||||
DBus.session.exportObject('/org/gnome/SessionManager/EndSessionDialog',
|
|
||||||
this);
|
|
||||||
_endSessionDialog = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _endSessionDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
// This always returns the same singleton object
|
// This always returns the same singleton object
|
||||||
// By instantiating it initially, we register the
|
// By instantiating it initially, we register the
|
||||||
// bus object, etc.
|
// bus object, etc.
|
||||||
let dialog = new EndSessionDialog();
|
_endSessionDialog = new EndSessionDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
EndSessionDialog.prototype = {
|
const EndSessionDialog = new Lang.Class({
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
Name: 'EndSessionDialog',
|
||||||
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'end-session-dialog' });
|
this.parent({ styleClass: 'end-session-dialog' });
|
||||||
|
|
||||||
this._user = AccountsService.UserManager.get_default().get_user(GLib.get_user_name());
|
this._user = AccountsService.UserManager.get_default().get_user(GLib.get_user_name());
|
||||||
|
|
||||||
@ -326,6 +297,9 @@ EndSessionDialog.prototype = {
|
|||||||
if (this._applicationList.get_children().length == 0)
|
if (this._applicationList.get_children().length == 0)
|
||||||
scrollView.hide();
|
scrollView.hide();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(EndSessionDialogIface, this);
|
||||||
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/SessionManager/EndSessionDialog');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy: function() {
|
||||||
@ -341,7 +315,8 @@ EndSessionDialog.prototype = {
|
|||||||
this._iconBin.child = null;
|
this._iconBin.child = null;
|
||||||
if (iconFile) {
|
if (iconFile) {
|
||||||
this._iconBin.show();
|
this._iconBin.show();
|
||||||
this._iconBin.set_style('background-image: url("' + iconFile + '");');
|
this._iconBin.set_style('background-image: url("' + iconFile + '");' +
|
||||||
|
'background-size: contain;');
|
||||||
} else {
|
} else {
|
||||||
this._iconBin.hide();
|
this._iconBin.hide();
|
||||||
}
|
}
|
||||||
@ -439,26 +414,20 @@ EndSessionDialog.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close: function() {
|
||||||
ModalDialog.ModalDialog.prototype.close.call(this);
|
this.parent();
|
||||||
DBus.session.emit_signal('/org/gnome/SessionManager/EndSessionDialog',
|
this._dbusImpl.emit_signal('Closed', null);
|
||||||
'org.gnome.SessionManager.EndSessionDialog',
|
|
||||||
'Closed', '', []);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel: function() {
|
||||||
this._stopTimer();
|
this._stopTimer();
|
||||||
DBus.session.emit_signal('/org/gnome/SessionManager/EndSessionDialog',
|
this._dbusImpl.emit_signal('Canceled', null);
|
||||||
'org.gnome.SessionManager.EndSessionDialog',
|
|
||||||
'Canceled', '', []);
|
|
||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
_confirm: function(signal) {
|
_confirm: function(signal) {
|
||||||
this._fadeOutDialog();
|
this._fadeOutDialog();
|
||||||
this._stopTimer();
|
this._stopTimer();
|
||||||
DBus.session.emit_signal('/org/gnome/SessionManager/EndSessionDialog',
|
this._dbusImpl.emit_signal(signal, null);
|
||||||
'org.gnome.SessionManager.EndSessionDialog',
|
|
||||||
signal, '', []);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOpened: function() {
|
_onOpened: function() {
|
||||||
@ -495,7 +464,8 @@ EndSessionDialog.prototype = {
|
|||||||
let app = findAppFromInhibitor(inhibitor);
|
let app = findAppFromInhibitor(inhibitor);
|
||||||
|
|
||||||
if (app) {
|
if (app) {
|
||||||
let item = new ListItem(app, inhibitor.reason);
|
let [reason] = inhibitor.GetReasonSync();
|
||||||
|
let item = new ListItem(app, reason);
|
||||||
item.connect('activate',
|
item.connect('activate',
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
@ -510,39 +480,41 @@ EndSessionDialog.prototype = {
|
|||||||
this._updateContent();
|
this._updateContent();
|
||||||
},
|
},
|
||||||
|
|
||||||
OpenAsync: function(type, timestamp, totalSecondsToStayOpen, inhibitorObjectPaths, callback) {
|
OpenAsync: function(parameters, invocation) {
|
||||||
|
let [type, timestamp, totalSecondsToStayOpen, inhibitorObjectPaths] = parameters;
|
||||||
this._totalSecondsToStayOpen = totalSecondsToStayOpen;
|
this._totalSecondsToStayOpen = totalSecondsToStayOpen;
|
||||||
this._inhibitors = [];
|
this._inhibitors = [];
|
||||||
this._applicationList.destroy_children();
|
this._applicationList.destroy_all_children();
|
||||||
this._type = type;
|
this._type = type;
|
||||||
|
|
||||||
if (!(this._type in DialogContent))
|
if (!(this._type in DialogContent)) {
|
||||||
throw new DBus.DBusError('org.gnome.Shell.ModalDialog.TypeError',
|
invocation.return_dbus_error('org.gnome.Shell.ModalDialog.TypeError',
|
||||||
"Unknown dialog type requested");
|
"Unknown dialog type requested");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < inhibitorObjectPaths.length; i++) {
|
for (let i = 0; i < inhibitorObjectPaths.length; i++) {
|
||||||
let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i]);
|
let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i], Lang.bind(this, function(proxy, error) {
|
||||||
|
this._onInhibitorLoaded(proxy);
|
||||||
inhibitor.connect('is-loaded',
|
|
||||||
Lang.bind(this, function() {
|
|
||||||
this._onInhibitorLoaded(inhibitor);
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._inhibitors.push(inhibitor);
|
this._inhibitors.push(inhibitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._updateButtons();
|
this._updateButtons();
|
||||||
|
|
||||||
if (!this.open(timestamp))
|
if (!this.open(timestamp)) {
|
||||||
throw new DBus.DBusError('org.gnome.Shell.ModalDialog.GrabError',
|
invocation.return_dbus_error('org.gnome.Shell.ModalDialog.GrabError',
|
||||||
"Cannot grab pointer and keyboard");
|
"Cannot grab pointer and keyboard");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._updateContent();
|
this._updateContent();
|
||||||
|
|
||||||
let signalId = this.connect('opened',
|
let signalId = this.connect('opened',
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
callback();
|
invocation.return_value(null);
|
||||||
this.disconnect(signalId);
|
this.disconnect(signalId);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
DBus.conformExport(EndSessionDialog.prototype, EndSessionDialogIface);
|
|
||||||
|
@ -39,20 +39,23 @@ function _patchContainerClass(containerClass) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _makeLoggingFunc(func) {
|
||||||
|
return function() {
|
||||||
|
return func([].join.call(arguments, ', '));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
// Add some bindings to the global JS namespace; (gjs keeps the web
|
// Add some bindings to the global JS namespace; (gjs keeps the web
|
||||||
// browser convention of having that namespace be called 'window'.)
|
// browser convention of having that namespace be called 'window'.)
|
||||||
window.global = Shell.Global.get();
|
window.global = Shell.Global.get();
|
||||||
|
|
||||||
|
window.log = _makeLoggingFunc(window.log);
|
||||||
|
|
||||||
window._ = Gettext.gettext;
|
window._ = Gettext.gettext;
|
||||||
window.C_ = Gettext.pgettext;
|
window.C_ = Gettext.pgettext;
|
||||||
window.ngettext = Gettext.ngettext;
|
window.ngettext = Gettext.ngettext;
|
||||||
|
|
||||||
// Set the default direction for St widgets (this needs to be done before any use of St)
|
|
||||||
if (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL) {
|
|
||||||
St.Widget.set_default_direction(St.TextDirection.RTL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Miscellaneous monkeypatching
|
// Miscellaneous monkeypatching
|
||||||
_patchContainerClass(St.BoxLayout);
|
_patchContainerClass(St.BoxLayout);
|
||||||
_patchContainerClass(St.Table);
|
_patchContainerClass(St.Table);
|
||||||
@ -64,10 +67,14 @@ function init() {
|
|||||||
let origToString = Object.prototype.toString;
|
let origToString = Object.prototype.toString;
|
||||||
Object.prototype.toString = function() {
|
Object.prototype.toString = function() {
|
||||||
let base = origToString.call(this);
|
let base = origToString.call(this);
|
||||||
|
try {
|
||||||
if ('actor' in this && this.actor instanceof Clutter.Actor)
|
if ('actor' in this && this.actor instanceof Clutter.Actor)
|
||||||
return base.replace(/\]$/, ' delegate for ' + this.actor.toString().substring(1));
|
return base.replace(/\]$/, ' delegate for ' + this.actor.toString().substring(1));
|
||||||
else
|
else
|
||||||
return base;
|
return base;
|
||||||
|
} catch(e) {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=508783
|
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=508783
|
||||||
|
@ -11,6 +11,7 @@ const Shell = imports.gi.Shell;
|
|||||||
const Soup = imports.gi.Soup;
|
const Soup = imports.gi.Soup;
|
||||||
|
|
||||||
const Config = imports.misc.config;
|
const Config = imports.misc.config;
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const FileUtils = imports.misc.fileUtils;
|
const FileUtils = imports.misc.fileUtils;
|
||||||
const ModalDialog = imports.ui.modalDialog;
|
const ModalDialog = imports.ui.modalDialog;
|
||||||
|
|
||||||
@ -22,17 +23,13 @@ const ExtensionState = {
|
|||||||
ERROR: 3,
|
ERROR: 3,
|
||||||
OUT_OF_DATE: 4,
|
OUT_OF_DATE: 4,
|
||||||
DOWNLOADING: 5,
|
DOWNLOADING: 5,
|
||||||
|
INITIALIZED: 6,
|
||||||
|
|
||||||
// Used as an error state for operations on unknown extensions,
|
// Used as an error state for operations on unknown extensions,
|
||||||
// should never be in a real extensionMeta object.
|
// should never be in a real extensionMeta object.
|
||||||
UNINSTALLED: 99
|
UNINSTALLED: 99
|
||||||
};
|
};
|
||||||
|
|
||||||
const ExtensionType = {
|
|
||||||
SYSTEM: 1,
|
|
||||||
PER_USER: 2
|
|
||||||
};
|
|
||||||
|
|
||||||
const REPOSITORY_URL_BASE = 'https://extensions.gnome.org';
|
const REPOSITORY_URL_BASE = 'https://extensions.gnome.org';
|
||||||
const REPOSITORY_URL_DOWNLOAD = REPOSITORY_URL_BASE + '/download-extension/%s.shell-extension.zip';
|
const REPOSITORY_URL_DOWNLOAD = REPOSITORY_URL_BASE + '/download-extension/%s.shell-extension.zip';
|
||||||
const REPOSITORY_URL_INFO = REPOSITORY_URL_BASE + '/extension-info/';
|
const REPOSITORY_URL_INFO = REPOSITORY_URL_BASE + '/extension-info/';
|
||||||
@ -56,16 +53,10 @@ function _getCertFile() {
|
|||||||
|
|
||||||
_httpSession.ssl_ca_file = _getCertFile();
|
_httpSession.ssl_ca_file = _getCertFile();
|
||||||
|
|
||||||
// Maps uuid -> metadata object
|
|
||||||
const extensionMeta = {};
|
|
||||||
// Maps uuid -> importer object (extension directory tree)
|
|
||||||
const extensions = {};
|
|
||||||
// Maps uuid -> extension state object (returned from init())
|
|
||||||
const extensionStateObjs = {};
|
|
||||||
// Arrays of uuids
|
// Arrays of uuids
|
||||||
var enabledExtensions;
|
var enabledExtensions;
|
||||||
// GFile for user extensions
|
// Contains the order that extensions were enabled in.
|
||||||
var userExtensionsDir = null;
|
const extensionOrder = [];
|
||||||
|
|
||||||
// We don't really have a class to add signals on. So, create
|
// We don't really have a class to add signals on. So, create
|
||||||
// a simple dummy object, add the signal methods, and export those
|
// a simple dummy object, add the signal methods, and export those
|
||||||
@ -76,41 +67,8 @@ Signals.addSignalMethods(_signals);
|
|||||||
const connect = Lang.bind(_signals, _signals.connect);
|
const connect = Lang.bind(_signals, _signals.connect);
|
||||||
const disconnect = Lang.bind(_signals, _signals.disconnect);
|
const disconnect = Lang.bind(_signals, _signals.disconnect);
|
||||||
|
|
||||||
// UUID => Array of error messages
|
|
||||||
var errors = {};
|
|
||||||
|
|
||||||
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
|
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
|
||||||
|
|
||||||
/**
|
|
||||||
* versionCheck:
|
|
||||||
* @required: an array of versions we're compatible with
|
|
||||||
* @current: the version we have
|
|
||||||
*
|
|
||||||
* Check if a component is compatible for an extension.
|
|
||||||
* @required is an array, and at least one version must match.
|
|
||||||
* @current must be in the format <major>.<minor>.<point>.<micro>
|
|
||||||
* <micro> is always ignored
|
|
||||||
* <point> is ignored if <minor> is even (so you can target the
|
|
||||||
* whole stable release)
|
|
||||||
* <minor> and <major> must match
|
|
||||||
* Each target version must be at least <major> and <minor>
|
|
||||||
*/
|
|
||||||
function versionCheck(required, current) {
|
|
||||||
let currentArray = current.split('.');
|
|
||||||
let major = currentArray[0];
|
|
||||||
let minor = currentArray[1];
|
|
||||||
let point = currentArray[2];
|
|
||||||
for (let i = 0; i < required.length; i++) {
|
|
||||||
let requiredArray = required[i].split('.');
|
|
||||||
if (requiredArray[0] == major &&
|
|
||||||
requiredArray[1] == minor &&
|
|
||||||
(requiredArray[2] == point ||
|
|
||||||
(requiredArray[2] == undefined && parseInt(minor) % 2 == 0)))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function installExtensionFromUUID(uuid, version_tag) {
|
function installExtensionFromUUID(uuid, version_tag) {
|
||||||
let params = { uuid: uuid,
|
let params = { uuid: uuid,
|
||||||
version_tag: version_tag,
|
version_tag: version_tag,
|
||||||
@ -128,8 +86,8 @@ function installExtensionFromUUID(uuid, version_tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uninstallExtensionFromUUID(uuid) {
|
function uninstallExtensionFromUUID(uuid) {
|
||||||
let meta = extensionMeta[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
if (!meta)
|
if (!extension)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Try to disable it -- if it's ERROR'd, we can't guarantee that,
|
// Try to disable it -- if it's ERROR'd, we can't guarantee that,
|
||||||
@ -138,22 +96,15 @@ function uninstallExtensionFromUUID(uuid) {
|
|||||||
disableExtension(uuid);
|
disableExtension(uuid);
|
||||||
|
|
||||||
// Don't try to uninstall system extensions
|
// Don't try to uninstall system extensions
|
||||||
if (meta.type != ExtensionType.PER_USER)
|
if (extension.type != ExtensionUtils.ExtensionType.PER_USER)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
meta.state = ExtensionState.UNINSTALLED;
|
extension.state = ExtensionState.UNINSTALLED;
|
||||||
_signals.emit('extension-state-changed', meta);
|
_signals.emit('extension-state-changed', extension);
|
||||||
|
|
||||||
delete extensionMeta[uuid];
|
delete ExtensionUtils.extensions[uuid];
|
||||||
|
|
||||||
// Importers are marked as PERMANENT, so we can't do this.
|
FileUtils.recursivelyDeleteDir(Gio.file_new_for_path(extension.path));
|
||||||
// delete extensions[uuid];
|
|
||||||
extensions[uuid] = undefined;
|
|
||||||
|
|
||||||
delete extensionStateObjs[uuid];
|
|
||||||
delete errors[uuid];
|
|
||||||
|
|
||||||
FileUtils.recursivelyDeleteDir(Gio.file_new_for_path(meta.path));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -174,7 +125,7 @@ function gotExtensionZipFile(session, message, uuid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let stream = new Gio.UnixOutputStream({ fd: fd });
|
let stream = new Gio.UnixOutputStream({ fd: fd });
|
||||||
let dir = userExtensionsDir.get_child(uuid);
|
let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
|
||||||
Shell.write_soup_message_to_stream(stream, message);
|
Shell.write_soup_message_to_stream(stream, message);
|
||||||
stream.close(null);
|
stream.close(null);
|
||||||
let [success, pid] = GLib.spawn_async(null,
|
let [success, pid] = GLib.spawn_async(null,
|
||||||
@ -198,55 +149,94 @@ function gotExtensionZipFile(session, message, uuid) {
|
|||||||
global.settings.set_strv(ENABLED_EXTENSIONS_KEY, enabledExtensions);
|
global.settings.set_strv(ENABLED_EXTENSIONS_KEY, enabledExtensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadExtension(dir, true, ExtensionType.PER_USER);
|
loadExtension(dir, ExtensionUtils.ExtensionType.PER_USER, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableExtension(uuid) {
|
function disableExtension(uuid) {
|
||||||
let meta = extensionMeta[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
if (!meta)
|
if (!extension)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (meta.state != ExtensionState.ENABLED)
|
if (extension.state != ExtensionState.ENABLED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let extensionState = extensionStateObjs[uuid];
|
// "Rebase" the extension order by disabling and then enabling extensions
|
||||||
|
// in order to help prevent conflicts.
|
||||||
|
|
||||||
|
// Example:
|
||||||
|
// order = [A, B, C, D, E]
|
||||||
|
// user disables C
|
||||||
|
// this should: disable E, disable D, disable C, enable D, enable E
|
||||||
|
|
||||||
|
let orderIdx = extensionOrder.indexOf(uuid);
|
||||||
|
let order = extensionOrder.slice(orderIdx + 1);
|
||||||
|
let orderReversed = order.slice().reverse();
|
||||||
|
|
||||||
|
for (let i = 0; i < orderReversed.length; i++) {
|
||||||
|
let uuid = orderReversed[i];
|
||||||
|
try {
|
||||||
|
ExtensionUtils.extensions[uuid].stateObj.disable();
|
||||||
|
} catch(e) {
|
||||||
|
logExtensionError(uuid, e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
extensionState.disable();
|
extension.stateObj.disable();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
logExtensionError(uuid, e.toString());
|
logExtensionError(uuid, e.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta.state = ExtensionState.DISABLED;
|
for (let i = 0; i < order.length; i++) {
|
||||||
_signals.emit('extension-state-changed', meta);
|
let uuid = order[i];
|
||||||
|
try {
|
||||||
|
ExtensionUtils.extensions[uuid].stateObj.enable();
|
||||||
|
} catch(e) {
|
||||||
|
logExtensionError(uuid, e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extensionOrder.splice(orderIdx, 1);
|
||||||
|
|
||||||
|
extension.state = ExtensionState.DISABLED;
|
||||||
|
_signals.emit('extension-state-changed', extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableExtension(uuid) {
|
function enableExtension(uuid) {
|
||||||
let meta = extensionMeta[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
if (!meta)
|
if (!extension)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (meta.state != ExtensionState.DISABLED)
|
if (extension.state == ExtensionState.INITIALIZED)
|
||||||
|
initExtension(uuid);
|
||||||
|
|
||||||
|
if (extension.state != ExtensionState.DISABLED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let extensionState = extensionStateObjs[uuid];
|
extensionOrder.push(uuid);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
extensionState.enable();
|
extension.stateObj.enable();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
logExtensionError(uuid, e.toString());
|
logExtensionError(uuid, e.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta.state = ExtensionState.ENABLED;
|
extension.state = ExtensionState.ENABLED;
|
||||||
_signals.emit('extension-state-changed', meta);
|
_signals.emit('extension-state-changed', extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
function logExtensionError(uuid, message, state) {
|
function logExtensionError(uuid, message, state) {
|
||||||
if (!errors[uuid]) errors[uuid] = [];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
errors[uuid].push(message);
|
if (!extension)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!extension.errors)
|
||||||
|
extension.errors = [];
|
||||||
|
|
||||||
|
extension.errors.push(message);
|
||||||
global.logError('Extension "%s" had error: %s'.format(uuid, message));
|
global.logError('Extension "%s" had error: %s'.format(uuid, message));
|
||||||
state = state || ExtensionState.ERROR;
|
state = state || ExtensionState.ERROR;
|
||||||
_signals.emit('extension-state-changed', { uuid: uuid,
|
_signals.emit('extension-state-changed', { uuid: uuid,
|
||||||
@ -254,76 +244,50 @@ function logExtensionError(uuid, message, state) {
|
|||||||
state: state });
|
state: state });
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadExtension(dir, enabled, type) {
|
function loadExtension(dir, type, enabled) {
|
||||||
let info;
|
|
||||||
let uuid = dir.get_basename();
|
let uuid = dir.get_basename();
|
||||||
|
let extension;
|
||||||
|
|
||||||
let metadataFile = dir.get_child('metadata.json');
|
if (ExtensionUtils.extensions[uuid] != undefined) {
|
||||||
if (!metadataFile.query_exists(null)) {
|
global.logError('Extension "%s" is already loaded'.format(uuid));
|
||||||
logExtensionError(uuid, 'Missing metadata.json');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let metadataContents;
|
|
||||||
try {
|
try {
|
||||||
metadataContents = Shell.get_file_contents_utf8_sync(metadataFile.get_path());
|
extension = ExtensionUtils.createExtensionObject(uuid, dir, type);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
logExtensionError(uuid, 'Failed to load metadata.json: ' + e);
|
logExtensionError(uuid, e.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let meta;
|
|
||||||
try {
|
|
||||||
meta = JSON.parse(metadataContents);
|
|
||||||
} catch (e) {
|
|
||||||
logExtensionError(uuid, 'Failed to parse metadata.json: ' + e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let requiredProperties = ['uuid', 'name', 'description', 'shell-version'];
|
|
||||||
for (let i = 0; i < requiredProperties.length; i++) {
|
|
||||||
let prop = requiredProperties[i];
|
|
||||||
if (!meta[prop]) {
|
|
||||||
logExtensionError(uuid, 'missing "' + prop + '" property in metadata.json');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (extensions[uuid] != undefined) {
|
|
||||||
logExtensionError(uuid, 'extension already loaded');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Encourage people to add this
|
|
||||||
if (!meta['url']) {
|
|
||||||
global.log('Warning: Missing "url" property in metadata.json');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uuid != meta.uuid) {
|
|
||||||
logExtensionError(uuid, 'uuid "' + meta.uuid + '" from metadata.json does not match directory name "' + uuid + '"');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!versionCheck(meta['shell-version'], Config.PACKAGE_VERSION) ||
|
|
||||||
(meta['js-version'] && !versionCheck(meta['js-version'], Config.GJS_VERSION))) {
|
|
||||||
logExtensionError(uuid, 'extension is not compatible with current GNOME Shell and/or GJS version');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
extensionMeta[uuid] = meta;
|
|
||||||
meta.type = type;
|
|
||||||
meta.path = dir.get_path();
|
|
||||||
meta.error = '';
|
|
||||||
|
|
||||||
// Default to error, we set success as the last step
|
// Default to error, we set success as the last step
|
||||||
meta.state = ExtensionState.ERROR;
|
extension.state = ExtensionState.ERROR;
|
||||||
|
|
||||||
if (!versionCheck(meta['shell-version'], Config.PACKAGE_VERSION) ||
|
if (ExtensionUtils.isOutOfDate(extension)) {
|
||||||
(meta['js-version'] && !versionCheck(meta['js-version'], Config.GJS_VERSION))) {
|
|
||||||
logExtensionError(uuid, 'extension is not compatible with current GNOME Shell and/or GJS version', ExtensionState.OUT_OF_DATE);
|
logExtensionError(uuid, 'extension is not compatible with current GNOME Shell and/or GJS version', ExtensionState.OUT_OF_DATE);
|
||||||
meta.state = ExtensionState.OUT_OF_DATE;
|
extension.state = ExtensionState.OUT_OF_DATE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
initExtension(uuid);
|
||||||
|
if (extension.state == ExtensionState.DISABLED)
|
||||||
|
enableExtension(uuid);
|
||||||
|
} else {
|
||||||
|
extension.state = ExtensionState.INITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_signals.emit('extension-state-changed', extension);
|
||||||
|
global.log('Loaded extension ' + uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initExtension(uuid) {
|
||||||
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
|
let dir = extension.dir;
|
||||||
|
|
||||||
|
if (!extension)
|
||||||
|
throw new Error("Extension was not properly created. Call loadExtension first");
|
||||||
|
|
||||||
let extensionJs = dir.get_child('extension.js');
|
let extensionJs = dir.get_child('extension.js');
|
||||||
if (!extensionJs.query_exists(null)) {
|
if (!extensionJs.query_exists(null)) {
|
||||||
logExtensionError(uuid, 'Missing extension.js');
|
logExtensionError(uuid, 'Missing extension.js');
|
||||||
@ -345,12 +309,12 @@ function loadExtension(dir, enabled, type) {
|
|||||||
let extensionModule;
|
let extensionModule;
|
||||||
let extensionState = null;
|
let extensionState = null;
|
||||||
try {
|
try {
|
||||||
global.add_extension_importer('imports.ui.extensionSystem.extensions', meta.uuid, dir.get_path());
|
ExtensionUtils.installImporter(extension);
|
||||||
extensionModule = extensions[meta.uuid].extension;
|
extensionModule = extension.imports.extension;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (stylesheetPath != null)
|
if (stylesheetPath != null)
|
||||||
theme.unload_stylesheet(stylesheetPath);
|
theme.unload_stylesheet(stylesheetPath);
|
||||||
logExtensionError(uuid, e);
|
logExtensionError(uuid, '' + e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +324,7 @@ function loadExtension(dir, enabled, type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
extensionState = extensionModule.init(meta);
|
extensionState = extensionModule.init(extension);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (stylesheetPath != null)
|
if (stylesheetPath != null)
|
||||||
theme.unload_stylesheet(stylesheetPath);
|
theme.unload_stylesheet(stylesheetPath);
|
||||||
@ -370,7 +334,7 @@ function loadExtension(dir, enabled, type) {
|
|||||||
|
|
||||||
if (!extensionState)
|
if (!extensionState)
|
||||||
extensionState = extensionModule;
|
extensionState = extensionModule;
|
||||||
extensionStateObjs[uuid] = extensionState;
|
extension.stateObj = extensionState;
|
||||||
|
|
||||||
if (!extensionState.enable) {
|
if (!extensionState.enable) {
|
||||||
logExtensionError(uuid, 'missing \'enable\' function');
|
logExtensionError(uuid, 'missing \'enable\' function');
|
||||||
@ -381,14 +345,9 @@ function loadExtension(dir, enabled, type) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta.state = ExtensionState.DISABLED;
|
extension.state = ExtensionState.DISABLED;
|
||||||
|
|
||||||
if (enabled)
|
_signals.emit('extension-loaded', uuid);
|
||||||
enableExtension(uuid);
|
|
||||||
|
|
||||||
_signals.emit('extension-loaded', meta.uuid);
|
|
||||||
_signals.emit('extension-state-changed', meta);
|
|
||||||
global.log('Loaded extension ' + meta.uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEnabledExtensionsChanged() {
|
function onEnabledExtensionsChanged() {
|
||||||
@ -414,61 +373,25 @@ function onEnabledExtensionsChanged() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
|
ExtensionUtils.init();
|
||||||
userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
|
|
||||||
try {
|
|
||||||
if (!userExtensionsDir.query_exists(null))
|
|
||||||
userExtensionsDir.make_directory_with_parents(null);
|
|
||||||
} catch (e) {
|
|
||||||
global.logError('' + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
||||||
enabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
enabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _loadExtensionsIn(dir, type) {
|
|
||||||
let fileEnum;
|
|
||||||
let file, info;
|
|
||||||
try {
|
|
||||||
fileEnum = dir.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NONE, null);
|
|
||||||
} catch (e) {
|
|
||||||
global.logError('' + e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((info = fileEnum.next_file(null)) != null) {
|
|
||||||
let fileType = info.get_file_type();
|
|
||||||
if (fileType != Gio.FileType.DIRECTORY)
|
|
||||||
continue;
|
|
||||||
let name = info.get_name();
|
|
||||||
let child = dir.get_child(name);
|
|
||||||
let enabled = enabledExtensions.indexOf(name) != -1;
|
|
||||||
loadExtension(child, enabled, type);
|
|
||||||
}
|
|
||||||
fileEnum.close(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadExtensions() {
|
function loadExtensions() {
|
||||||
let systemDataDirs = GLib.get_system_data_dirs();
|
ExtensionUtils.scanExtensions(function(uuid, dir, type) {
|
||||||
for (let i = 0; i < systemDataDirs.length; i++) {
|
let enabled = enabledExtensions.indexOf(uuid) != -1;
|
||||||
let dirPath = systemDataDirs[i] + '/gnome-shell/extensions';
|
loadExtension(dir, type, enabled);
|
||||||
let dir = Gio.file_new_for_path(dirPath);
|
});
|
||||||
if (dir.query_exists(null))
|
|
||||||
_loadExtensionsIn(dir, ExtensionType.SYSTEM);
|
|
||||||
}
|
|
||||||
_loadExtensionsIn(userExtensionsDir, ExtensionType.PER_USER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function InstallExtensionDialog(uuid, version_tag, name) {
|
const InstallExtensionDialog = new Lang.Class({
|
||||||
this._init(uuid, version_tag, name);
|
Name: 'InstallExtensionDialog',
|
||||||
}
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
InstallExtensionDialog.prototype = {
|
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
|
||||||
|
|
||||||
_init: function(uuid, version_tag, name) {
|
_init: function(uuid, version_tag, name) {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'extension-dialog' });
|
this.parent({ styleClass: 'extension-dialog' });
|
||||||
|
|
||||||
this._uuid = uuid;
|
this._uuid = uuid;
|
||||||
this._version_tag = version_tag;
|
this._version_tag = version_tag;
|
||||||
@ -506,13 +429,11 @@ InstallExtensionDialog.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onInstallButtonPressed: function(button, event) {
|
_onInstallButtonPressed: function(button, event) {
|
||||||
let meta = { uuid: this._uuid,
|
let state = { uuid: this._uuid,
|
||||||
state: ExtensionState.DOWNLOADING,
|
state: ExtensionState.DOWNLOADING,
|
||||||
error: '' };
|
error: '' };
|
||||||
|
|
||||||
extensionMeta[this._uuid] = meta;
|
_signals.emit('extension-state-changed', state);
|
||||||
|
|
||||||
_signals.emit('extension-state-changed', meta);
|
|
||||||
|
|
||||||
let params = { version_tag: this._version_tag,
|
let params = { version_tag: this._version_tag,
|
||||||
shell_version: Config.PACKAGE_VERSION,
|
shell_version: Config.PACKAGE_VERSION,
|
||||||
@ -528,4 +449,4 @@ InstallExtensionDialog.prototype = {
|
|||||||
|
|
||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
45
js/ui/flashspot.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
|
const Lang = imports.lang;
|
||||||
|
|
||||||
|
const Lightbox = imports.ui.lightbox;
|
||||||
|
const Main = imports.ui.main;
|
||||||
|
const Tweener = imports.ui.tweener;
|
||||||
|
|
||||||
|
const FLASHSPOT_ANIMATION_TIME = 0.25; // seconds
|
||||||
|
|
||||||
|
const Flashspot = new Lang.Class({
|
||||||
|
Name: 'Flashspot',
|
||||||
|
Extends: Lightbox.Lightbox,
|
||||||
|
|
||||||
|
_init: function(area) {
|
||||||
|
this.parent(Main.uiGroup, { inhibitEvents: true,
|
||||||
|
width: area.width,
|
||||||
|
height: area.height });
|
||||||
|
|
||||||
|
this.actor.style_class = 'flashspot';
|
||||||
|
this.actor.set_position(area.x, area.y);
|
||||||
|
},
|
||||||
|
|
||||||
|
fire: function() {
|
||||||
|
this.actor.opacity = 0;
|
||||||
|
Tweener.addTween(this.actor,
|
||||||
|
{ opacity: 255,
|
||||||
|
time: FLASHSPOT_ANIMATION_TIME,
|
||||||
|
transition: 'linear',
|
||||||
|
onComplete: Lang.bind(this, this._onFireShowComplete)
|
||||||
|
});
|
||||||
|
this.actor.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onFireShowComplete: function() {
|
||||||
|
Tweener.addTween(this.actor,
|
||||||
|
{ opacity: 0,
|
||||||
|
time: FLASHSPOT_ANIMATION_TIME,
|
||||||
|
transition: 'linear',
|
||||||
|
onComplete: Lang.bind(this, function() {
|
||||||
|
this.destroy();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
@ -10,11 +10,9 @@ const Params = imports.misc.params;
|
|||||||
const ICON_SIZE = 48;
|
const ICON_SIZE = 48;
|
||||||
|
|
||||||
|
|
||||||
function BaseIcon(label, createIcon) {
|
const BaseIcon = new Lang.Class({
|
||||||
this._init(label, createIcon);
|
Name: 'BaseIcon',
|
||||||
}
|
|
||||||
|
|
||||||
BaseIcon.prototype = {
|
|
||||||
_init : function(label, params) {
|
_init : function(label, params) {
|
||||||
params = Params.parse(params, { createIcon: null,
|
params = Params.parse(params, { createIcon: null,
|
||||||
setSizeManually: false,
|
setSizeManually: false,
|
||||||
@ -37,7 +35,8 @@ BaseIcon.prototype = {
|
|||||||
this.actor.set_child(box);
|
this.actor.set_child(box);
|
||||||
|
|
||||||
this.iconSize = ICON_SIZE;
|
this.iconSize = ICON_SIZE;
|
||||||
this._iconBin = new St.Bin();
|
this._iconBin = new St.Bin({ x_align: St.Align.MIDDLE,
|
||||||
|
y_align: St.Align.MIDDLE });
|
||||||
|
|
||||||
box.add_actor(this._iconBin);
|
box.add_actor(this._iconBin);
|
||||||
|
|
||||||
@ -127,12 +126,12 @@ BaseIcon.prototype = {
|
|||||||
this.iconSize = size;
|
this.iconSize = size;
|
||||||
this.icon = this.createIcon(this.iconSize);
|
this.icon = this.createIcon(this.iconSize);
|
||||||
|
|
||||||
|
this._iconBin.child = this.icon;
|
||||||
|
|
||||||
// The icon returned by createIcon() might actually be smaller than
|
// The icon returned by createIcon() might actually be smaller than
|
||||||
// the requested icon size (for instance StTextureCache does this
|
// the requested icon size (for instance StTextureCache does this
|
||||||
// for fallback icons), so set the size explicitly.
|
// for fallback icons), so set the size explicitly.
|
||||||
this.icon.set_size(this.iconSize, this.iconSize);
|
this._iconBin.set_size(this.iconSize, this.iconSize);
|
||||||
|
|
||||||
this._iconBin.child = this.icon;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStyleChanged: function() {
|
_onStyleChanged: function() {
|
||||||
@ -149,13 +148,11 @@ BaseIcon.prototype = {
|
|||||||
|
|
||||||
this._createIconTexture(size);
|
this._createIconTexture(size);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function IconGrid(params) {
|
const IconGrid = new Lang.Class({
|
||||||
this._init(params);
|
Name: 'IconGrid',
|
||||||
}
|
|
||||||
|
|
||||||
IconGrid.prototype = {
|
|
||||||
_init: function(params) {
|
_init: function(params) {
|
||||||
params = Params.parse(params, { rowLimit: null,
|
params = Params.parse(params, { rowLimit: null,
|
||||||
columnLimit: null,
|
columnLimit: null,
|
||||||
@ -168,7 +165,7 @@ IconGrid.prototype = {
|
|||||||
vertical: true });
|
vertical: true });
|
||||||
// Pulled from CSS, but hardcode some defaults here
|
// Pulled from CSS, but hardcode some defaults here
|
||||||
this._spacing = 0;
|
this._spacing = 0;
|
||||||
this._item_size = ICON_SIZE;
|
this._hItemSize = this._vItemSize = ICON_SIZE;
|
||||||
this._grid = new Shell.GenericContainer();
|
this._grid = new Shell.GenericContainer();
|
||||||
this.actor.add(this._grid, { expand: true, y_align: St.Align.START });
|
this.actor.add(this._grid, { expand: true, y_align: St.Align.START });
|
||||||
this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged));
|
this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged));
|
||||||
@ -187,8 +184,8 @@ IconGrid.prototype = {
|
|||||||
// Kind of a lie, but not really an issue right now. If
|
// Kind of a lie, but not really an issue right now. If
|
||||||
// we wanted to support some sort of hidden/overflow that would
|
// we wanted to support some sort of hidden/overflow that would
|
||||||
// need higher level design
|
// need higher level design
|
||||||
alloc.min_size = this._item_size;
|
alloc.min_size = this._hItemSize;
|
||||||
alloc.natural_size = nColumns * this._item_size + totalSpacing;
|
alloc.natural_size = nColumns * this._hItemSize + totalSpacing;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getVisibleChildren: function() {
|
_getVisibleChildren: function() {
|
||||||
@ -210,7 +207,7 @@ IconGrid.prototype = {
|
|||||||
if (this._rowLimit)
|
if (this._rowLimit)
|
||||||
nRows = Math.min(nRows, this._rowLimit);
|
nRows = Math.min(nRows, this._rowLimit);
|
||||||
let totalSpacing = Math.max(0, nRows - 1) * this._spacing;
|
let totalSpacing = Math.max(0, nRows - 1) * this._spacing;
|
||||||
let height = nRows * this._item_size + totalSpacing;
|
let height = nRows * this._vItemSize + totalSpacing;
|
||||||
alloc.min_size = height;
|
alloc.min_size = height;
|
||||||
alloc.natural_size = height;
|
alloc.natural_size = height;
|
||||||
},
|
},
|
||||||
@ -243,13 +240,13 @@ IconGrid.prototype = {
|
|||||||
= children[i].get_preferred_size();
|
= children[i].get_preferred_size();
|
||||||
|
|
||||||
/* Center the item in its allocation horizontally */
|
/* Center the item in its allocation horizontally */
|
||||||
let width = Math.min(this._item_size, childNaturalWidth);
|
let width = Math.min(this._hItemSize, childNaturalWidth);
|
||||||
let childXSpacing = Math.max(0, width - childNaturalWidth) / 2;
|
let childXSpacing = Math.max(0, width - childNaturalWidth) / 2;
|
||||||
let height = Math.min(this._item_size, childNaturalHeight);
|
let height = Math.min(this._vItemSize, childNaturalHeight);
|
||||||
let childYSpacing = Math.max(0, height - childNaturalHeight) / 2;
|
let childYSpacing = Math.max(0, height - childNaturalHeight) / 2;
|
||||||
|
|
||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL) {
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
|
||||||
let _x = box.x2 - (x + width);
|
let _x = box.x2 - (x + width);
|
||||||
childBox.x1 = Math.floor(_x - childXSpacing);
|
childBox.x1 = Math.floor(_x - childXSpacing);
|
||||||
} else {
|
} else {
|
||||||
@ -273,10 +270,10 @@ IconGrid.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (columnIndex == 0) {
|
if (columnIndex == 0) {
|
||||||
y += this._item_size + this._spacing;
|
y += this._vItemSize + this._spacing;
|
||||||
x = box.x1 + leftPadding;
|
x = box.x1 + leftPadding;
|
||||||
} else {
|
} else {
|
||||||
x += this._item_size + this._spacing;
|
x += this._hItemSize + this._spacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -289,8 +286,8 @@ IconGrid.prototype = {
|
|||||||
let nColumns = 0;
|
let nColumns = 0;
|
||||||
let usedWidth = 0;
|
let usedWidth = 0;
|
||||||
while ((this._colLimit == null || nColumns < this._colLimit) &&
|
while ((this._colLimit == null || nColumns < this._colLimit) &&
|
||||||
(usedWidth + this._item_size <= forWidth)) {
|
(usedWidth + this._hItemSize <= forWidth)) {
|
||||||
usedWidth += this._item_size + this._spacing;
|
usedWidth += this._hItemSize + this._spacing;
|
||||||
nColumns += 1;
|
nColumns += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +300,8 @@ IconGrid.prototype = {
|
|||||||
_onStyleChanged: function() {
|
_onStyleChanged: function() {
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
this._spacing = themeNode.get_length('spacing');
|
this._spacing = themeNode.get_length('spacing');
|
||||||
this._item_size = themeNode.get_length('-shell-grid-item-size');
|
this._hItemSize = themeNode.get_length('-shell-grid-horizontal-item-size') || ICON_SIZE;
|
||||||
|
this._vItemSize = themeNode.get_length('-shell-grid-vertical-item-size') || ICON_SIZE;
|
||||||
this._grid.queue_relayout();
|
this._grid.queue_relayout();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -324,4 +322,4 @@ IconGrid.prototype = {
|
|||||||
visibleItemsCount: function() {
|
visibleItemsCount: function() {
|
||||||
return this._grid.get_children().length - this._grid.get_n_skip_paint();
|
return this._grid.get_children().length - this._grid.get_n_skip_paint();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -39,34 +39,31 @@ const PRETTY_KEYS = {
|
|||||||
'Alt_L': 'Alt'
|
'Alt_L': 'Alt'
|
||||||
};
|
};
|
||||||
|
|
||||||
const CaribouKeyboardIface = {
|
const CaribouKeyboardIface = <interface name='org.gnome.Caribou.Keyboard'>
|
||||||
name: 'org.gnome.Caribou.Keyboard',
|
<method name='Show'>
|
||||||
methods: [ { name: 'Show',
|
<arg type='u' direction='in' />
|
||||||
inSignature: 'u',
|
</method>
|
||||||
outSignature: ''
|
<method name='Hide'>
|
||||||
},
|
<arg type='u' direction='in' />
|
||||||
{ name: 'Hide',
|
</method>
|
||||||
inSignature: 'u',
|
<method name='SetCursorLocation'>
|
||||||
outSignature: ''
|
<arg type='i' direction='in' />
|
||||||
},
|
<arg type='i' direction='in' />
|
||||||
{ name: 'SetCursorLocation',
|
<arg type='i' direction='in' />
|
||||||
inSignature: 'iiii',
|
<arg type='i' direction='in' />
|
||||||
outSignature: ''
|
</method>
|
||||||
},
|
<method name='SetEntryLocation'>
|
||||||
{ name: 'SetEntryLocation',
|
<arg type='i' direction='in' />
|
||||||
inSignature: 'iiii',
|
<arg type='i' direction='in' />
|
||||||
outSignature: ''
|
<arg type='i' direction='in' />
|
||||||
} ],
|
<arg type='i' direction='in' />
|
||||||
properties: [ { name: 'Name',
|
</method>
|
||||||
signature: 's',
|
<property name='Name' access='read' type='s' />
|
||||||
access: 'read' } ]
|
</interface>;
|
||||||
};
|
|
||||||
|
|
||||||
function Key() {
|
const Key = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'Key',
|
||||||
}
|
|
||||||
|
|
||||||
Key.prototype = {
|
|
||||||
_init : function(key) {
|
_init : function(key) {
|
||||||
this._key = key;
|
this._key = key;
|
||||||
|
|
||||||
@ -192,15 +189,15 @@ Key.prototype = {
|
|||||||
this._boxPointer.hide(true);
|
this._boxPointer.hide(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function Keyboard() {
|
const Keyboard = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
// HACK: we can't set Name, because it collides with Name dbus property
|
||||||
}
|
// Name: 'Keyboard',
|
||||||
|
|
||||||
Keyboard.prototype = {
|
|
||||||
_init: function () {
|
_init: function () {
|
||||||
DBus.session.exportObject('/org/gnome/Caribou/Keyboard', this);
|
this._impl = Gio.DBusExportedObject.wrapJSObject(CaribouKeyboardIface, this);
|
||||||
|
this._impl.export(Gio.DBus.session, '/org/gnome/Caribou/Keyboard');
|
||||||
|
|
||||||
this.actor = null;
|
this.actor = null;
|
||||||
|
|
||||||
@ -272,6 +269,11 @@ Keyboard.prototype = {
|
|||||||
|
|
||||||
this._addKeys();
|
this._addKeys();
|
||||||
|
|
||||||
|
// Keys should be layout according to the group, not the
|
||||||
|
// locale; as Caribou already provides the expected layout,
|
||||||
|
// this means enforcing LTR for all locales.
|
||||||
|
this.actor.text_direction = Clutter.TextDirection.LTR;
|
||||||
|
|
||||||
this._keyboardNotifyId = this._keyboard.connect('notify::active-group', Lang.bind(this, this._onGroupChanged));
|
this._keyboardNotifyId = this._keyboard.connect('notify::active-group', Lang.bind(this, this._onGroupChanged));
|
||||||
this._focusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged));
|
this._focusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged));
|
||||||
|
|
||||||
@ -289,7 +291,7 @@ Keyboard.prototype = {
|
|||||||
if (focus && (focus._extended_keys || (focus._key && focus._key.extended_key)))
|
if (focus && (focus._extended_keys || (focus._key && focus._key.extended_key)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let time = global.current_event_time();
|
let time = global.get_current_time();
|
||||||
if (focus instanceof Clutter.Text)
|
if (focus instanceof Clutter.Text)
|
||||||
this.Show(time);
|
this.Show(time);
|
||||||
else
|
else
|
||||||
@ -532,19 +534,15 @@ Keyboard.prototype = {
|
|||||||
get Name() {
|
get Name() {
|
||||||
return 'gnome-shell';
|
return 'gnome-shell';
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
DBus.conformExport(Keyboard.prototype, CaribouKeyboardIface);
|
|
||||||
|
|
||||||
function KeyboardSource() {
|
const KeyboardSource = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'KeyboardSource',
|
||||||
}
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
KeyboardSource.prototype = {
|
|
||||||
__proto__: MessageTray.Source.prototype,
|
|
||||||
|
|
||||||
_init: function(keyboard) {
|
_init: function(keyboard) {
|
||||||
|
this.parent(_("Keyboard"));
|
||||||
this._keyboard = keyboard;
|
this._keyboard = keyboard;
|
||||||
MessageTray.Source.prototype._init.call(this, _("Keyboard"));
|
|
||||||
|
|
||||||
this._setSummaryIcon(this.createNotificationIcon());
|
this._setSummaryIcon(this.createNotificationIcon());
|
||||||
},
|
},
|
||||||
@ -567,4 +565,4 @@ KeyboardSource.prototype = {
|
|||||||
open: function() {
|
open: function() {
|
||||||
this._keyboard.show();
|
this._keyboard.show();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
207
js/ui/keyringPrompt.js
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
|
const Lang = imports.lang;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const St = imports.gi.St;
|
||||||
|
const Pango = imports.gi.Pango;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
const GObject = imports.gi.GObject;
|
||||||
|
const Gcr = imports.gi.Gcr;
|
||||||
|
|
||||||
|
const ModalDialog = imports.ui.modalDialog;
|
||||||
|
const ShellEntry = imports.ui.shellEntry;
|
||||||
|
const CheckBox = imports.ui.checkBox;
|
||||||
|
|
||||||
|
let prompter = null;
|
||||||
|
|
||||||
|
const KeyringDialog = new Lang.Class({
|
||||||
|
Name: 'KeyringDialog',
|
||||||
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
|
_init: function() {
|
||||||
|
this.parent({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
|
this.prompt = new Shell.KeyringPrompt();
|
||||||
|
this.prompt.connect('show-password', Lang.bind(this, this._onShowPassword));
|
||||||
|
this.prompt.connect('show-confirm', Lang.bind(this, this._onShowConfirm));
|
||||||
|
this.prompt.connect('hide-prompt', Lang.bind(this, this._onHidePrompt));
|
||||||
|
|
||||||
|
let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
|
||||||
|
vertical: false });
|
||||||
|
this.contentLayout.add(mainContentBox);
|
||||||
|
|
||||||
|
let icon = new St.Icon({ icon_name: 'dialog-password-symbolic' });
|
||||||
|
mainContentBox.add(icon,
|
||||||
|
{ x_fill: true,
|
||||||
|
y_fill: false,
|
||||||
|
x_align: St.Align.END,
|
||||||
|
y_align: St.Align.START });
|
||||||
|
|
||||||
|
this._messageBox = new St.BoxLayout({ style_class: 'prompt-dialog-message-layout',
|
||||||
|
vertical: true });
|
||||||
|
mainContentBox.add(this._messageBox,
|
||||||
|
{ y_align: St.Align.START, expand: true, x_fill: true, y_fill: true });
|
||||||
|
|
||||||
|
let subject = new St.Label({ style_class: 'prompt-dialog-headline' });
|
||||||
|
this.prompt.bind_property('message', subject, 'text', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
|
||||||
|
this._messageBox.add(subject,
|
||||||
|
{ y_fill: false,
|
||||||
|
y_align: St.Align.START });
|
||||||
|
|
||||||
|
let description = new St.Label({ style_class: 'prompt-dialog-description' });
|
||||||
|
description.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
|
description.clutter_text.line_wrap = true;
|
||||||
|
this.prompt.bind_property('description', description, 'text', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
this._messageBox.add(description,
|
||||||
|
{ y_fill: true,
|
||||||
|
y_align: St.Align.START });
|
||||||
|
|
||||||
|
this._controlTable = null;
|
||||||
|
|
||||||
|
let buttons = [{ label: '',
|
||||||
|
action: Lang.bind(this, this._onCancelButton),
|
||||||
|
key: Clutter.Escape
|
||||||
|
},
|
||||||
|
{ label: '',
|
||||||
|
action: Lang.bind(this, this._onContinueButton)
|
||||||
|
}]
|
||||||
|
|
||||||
|
this.setButtons(buttons);
|
||||||
|
this._cancelButton = buttons[0].button;
|
||||||
|
this._continueButton = buttons[1].button;
|
||||||
|
|
||||||
|
this.prompt.bind_property('cancel-label', this._cancelButton, 'label', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
this.prompt.bind_property('continue-label', this._continueButton, 'label', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildControlTable: function() {
|
||||||
|
let table = new St.Table({ style_class: 'keyring-dialog-control-table' });
|
||||||
|
let row = 0;
|
||||||
|
|
||||||
|
if (this.prompt.password_visible) {
|
||||||
|
let label = new St.Label(({ style_class: 'prompt-dialog-password-label' }));
|
||||||
|
label.set_text(_("Password:"));
|
||||||
|
table.add(label, { row: row, col: 0, x_expand: false, x_fill: true, x_align: St.Align.START });
|
||||||
|
this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
|
||||||
|
text: '',
|
||||||
|
can_focus: true});
|
||||||
|
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
|
||||||
|
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
|
||||||
|
this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onPasswordActivate));
|
||||||
|
table.add(this._passwordEntry, { row: row, col: 1, x_expand: true, x_fill: true, x_align: St.Align.START });
|
||||||
|
row++;
|
||||||
|
} else {
|
||||||
|
this._passwordEntry = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.prompt.confirm_visible) {
|
||||||
|
var label = new St.Label(({ style_class: 'prompt-dialog-password-label' }));
|
||||||
|
label.set_text(_("Type again:"));
|
||||||
|
table.add(label, { row: row, col: 0, x_expand: false, x_fill: true, x_align: St.Align.START });
|
||||||
|
this._confirmEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
|
||||||
|
text: '',
|
||||||
|
can_focus: true});
|
||||||
|
this._confirmEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE
|
||||||
|
ShellEntry.addContextMenu(this._confirmEntry, { isPassword: true });
|
||||||
|
this._confirmEntry.clutter_text.connect('activate', Lang.bind(this, this._onConfirmActivate));
|
||||||
|
table.add(this._confirmEntry, { row: row, col: 1, x_expand: true, x_fill: true, x_align: St.Align.START });
|
||||||
|
row++;
|
||||||
|
} else {
|
||||||
|
this._confirmEntry = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.prompt.set_password_actor(this._passwordEntry ? this._passwordEntry.clutter_text : null);
|
||||||
|
this.prompt.set_confirm_actor(this._confirmEntry ? this._confirmEntry.clutter_text : null);
|
||||||
|
|
||||||
|
if (this.prompt.choice_visible) {
|
||||||
|
let choice = new CheckBox.CheckBox();
|
||||||
|
this.prompt.bind_property('choice-label', choice.getLabelActor(), 'text', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
this.prompt.bind_property('choice-chosen', choice.actor, 'checked', GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.BIDIRECTIONAL);
|
||||||
|
table.add(choice.actor, { row: row, col: 1, x_expand: false, x_fill: true, x_align: St.Align.START });
|
||||||
|
row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
let warning = new St.Label({ style_class: 'prompt-dialog-error-label' });
|
||||||
|
warning.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
|
warning.clutter_text.line_wrap = true;
|
||||||
|
table.add(warning, { row: row, col: 1, x_expand: false, x_fill: false, x_align: St.Align.START });
|
||||||
|
this.prompt.bind_property('warning-visible', warning, 'visible', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
this.prompt.bind_property('warning', warning, 'text', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
|
||||||
|
if (this._controlTable) {
|
||||||
|
this._controlTable.destroy_all_children();
|
||||||
|
this._controlTable.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._controlTable = table;
|
||||||
|
this._messageBox.add(table, { x_fill: true, y_fill: true });
|
||||||
|
},
|
||||||
|
|
||||||
|
_ensureOpen: function() {
|
||||||
|
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
||||||
|
// already open - it just returns true without side-effects
|
||||||
|
if (this.open())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// The above fail if e.g. unable to get input grab
|
||||||
|
//
|
||||||
|
// In an ideal world this wouldn't happen (because the
|
||||||
|
// Shell is in complete control of the session) but that's
|
||||||
|
// just not how things work right now.
|
||||||
|
|
||||||
|
log('keyringPrompt: Failed to show modal dialog.' +
|
||||||
|
' Dismissing prompt request');
|
||||||
|
this.prompt.cancel()
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
_onShowPassword: function(prompt) {
|
||||||
|
this._buildControlTable();
|
||||||
|
this._ensureOpen();
|
||||||
|
this._passwordEntry.grab_key_focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onShowConfirm: function(prompt) {
|
||||||
|
this._buildControlTable();
|
||||||
|
this._ensureOpen();
|
||||||
|
this._continueButton.grab_key_focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onHidePrompt: function(prompt) {
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onPasswordActivate: function() {
|
||||||
|
if (this.prompt.confirm_visible)
|
||||||
|
this._confirmEntry.grab_key_focus();
|
||||||
|
else
|
||||||
|
this._onContinueButton();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onConfirmActivate: function() {
|
||||||
|
this._onContinueButton();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onContinueButton: function() {
|
||||||
|
this.prompt.complete()
|
||||||
|
},
|
||||||
|
|
||||||
|
_onCancelButton: function() {
|
||||||
|
this.prompt.cancel()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
prompter = new Gcr.SystemPrompter();
|
||||||
|
prompter.connect('new-prompt', function(prompter) {
|
||||||
|
let dialog = new KeyringDialog();
|
||||||
|
return dialog.prompt;
|
||||||
|
});
|
||||||
|
|
||||||
|
let connection = Gio.DBus.session;
|
||||||
|
prompter.register(connection);
|
||||||
|
Gio.bus_own_name_on_connection (connection, 'org.gnome.keyring.SystemPrompter',
|
||||||
|
Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||||
|
}
|
@ -8,6 +8,7 @@ const Shell = imports.gi.Shell;
|
|||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
|
||||||
|
const DND = imports.ui.dnd;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const ScreenSaver = imports.misc.screenSaver;
|
const ScreenSaver = imports.misc.screenSaver;
|
||||||
@ -17,13 +18,11 @@ const HOT_CORNER_ACTIVATION_TIMEOUT = 0.5;
|
|||||||
const STARTUP_ANIMATION_TIME = 0.2;
|
const STARTUP_ANIMATION_TIME = 0.2;
|
||||||
const KEYBOARD_ANIMATION_TIME = 0.5;
|
const KEYBOARD_ANIMATION_TIME = 0.5;
|
||||||
|
|
||||||
function LayoutManager() {
|
const LayoutManager = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'LayoutManager',
|
||||||
}
|
|
||||||
|
|
||||||
LayoutManager.prototype = {
|
|
||||||
_init: function () {
|
_init: function () {
|
||||||
this._rtl = (St.Widget.get_default_direction() == St.TextDirection.RTL);
|
this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||||
this.monitors = [];
|
this.monitors = [];
|
||||||
this.primaryMonitor = null;
|
this.primaryMonitor = null;
|
||||||
this.primaryIndex = -1;
|
this.primaryIndex = -1;
|
||||||
@ -374,7 +373,7 @@ LayoutManager.prototype = {
|
|||||||
findMonitorForActor: function(actor) {
|
findMonitorForActor: function(actor) {
|
||||||
return this._chrome.findMonitorForActor(actor);
|
return this._chrome.findMonitorForActor(actor);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(LayoutManager.prototype);
|
Signals.addSignalMethods(LayoutManager.prototype);
|
||||||
|
|
||||||
|
|
||||||
@ -382,11 +381,9 @@ Signals.addSignalMethods(LayoutManager.prototype);
|
|||||||
//
|
//
|
||||||
// This class manages a "hot corner" that can toggle switching to
|
// This class manages a "hot corner" that can toggle switching to
|
||||||
// overview.
|
// overview.
|
||||||
function HotCorner() {
|
const HotCorner = new Lang.Class({
|
||||||
this._init();
|
Name: 'HotCorner',
|
||||||
}
|
|
||||||
|
|
||||||
HotCorner.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
// We use this flag to mark the case where the user has entered the
|
// We use this flag to mark the case where the user has entered the
|
||||||
// hot corner and has not left both the hot corner and a surrounding
|
// hot corner and has not left both the hot corner and a surrounding
|
||||||
@ -408,7 +405,7 @@ HotCorner.prototype = {
|
|||||||
|
|
||||||
this.actor.add_actor(this._corner);
|
this.actor.add_actor(this._corner);
|
||||||
|
|
||||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL) {
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
|
||||||
this._corner.set_position(this.actor.width - this._corner.width, 0);
|
this._corner.set_position(this.actor.width - this._corner.width, 0);
|
||||||
this.actor.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
this.actor.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||||
} else {
|
} else {
|
||||||
@ -437,9 +434,9 @@ HotCorner.prototype = {
|
|||||||
Lang.bind(this, this._onCornerLeft));
|
Lang.bind(this, this._onCornerLeft));
|
||||||
|
|
||||||
// Cache the three ripples instead of dynamically creating and destroying them.
|
// Cache the three ripples instead of dynamically creating and destroying them.
|
||||||
this._ripple1 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0 });
|
this._ripple1 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0, visible: false });
|
||||||
this._ripple2 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0 });
|
this._ripple2 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0, visible: false });
|
||||||
this._ripple3 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0 });
|
this._ripple3 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0, visible: false });
|
||||||
|
|
||||||
Main.uiGroup.add_actor(this._ripple1);
|
Main.uiGroup.add_actor(this._ripple1);
|
||||||
Main.uiGroup.add_actor(this._ripple2);
|
Main.uiGroup.add_actor(this._ripple2);
|
||||||
@ -460,7 +457,7 @@ HotCorner.prototype = {
|
|||||||
|
|
||||||
ripple._opacity = startOpacity;
|
ripple._opacity = startOpacity;
|
||||||
|
|
||||||
if (ripple.get_direction() == St.TextDirection.RTL)
|
if (ripple.get_text_direction() == Clutter.TextDirection.RTL)
|
||||||
ripple.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
ripple.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||||
|
|
||||||
ripple.visible = true;
|
ripple.visible = true;
|
||||||
@ -494,13 +491,15 @@ HotCorner.prototype = {
|
|||||||
|
|
||||||
handleDragOver: function(source, actor, x, y, time) {
|
handleDragOver: function(source, actor, x, y, time) {
|
||||||
if (source != Main.xdndHandler)
|
if (source != Main.xdndHandler)
|
||||||
return;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
|
|
||||||
if (!Main.overview.visible && !Main.overview.animationInProgress) {
|
if (!Main.overview.visible && !Main.overview.animationInProgress) {
|
||||||
this.rippleAnimation();
|
this.rippleAnimation();
|
||||||
Main.overview.showTemporarily();
|
Main.overview.showTemporarily();
|
||||||
Main.overview.beginItemDrag(actor);
|
Main.overview.beginItemDrag(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return DND.DragMotionResult.CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCornerEntered : function() {
|
_onCornerEntered : function() {
|
||||||
@ -548,7 +547,7 @@ HotCorner.prototype = {
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
// This manages the shell "chrome"; the UI that's visible in the
|
// This manages the shell "chrome"; the UI that's visible in the
|
||||||
@ -561,11 +560,9 @@ const defaultParams = {
|
|||||||
affectsInputRegion: true
|
affectsInputRegion: true
|
||||||
};
|
};
|
||||||
|
|
||||||
function Chrome() {
|
const Chrome = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'Chrome',
|
||||||
}
|
|
||||||
|
|
||||||
Chrome.prototype = {
|
|
||||||
_init: function(layoutManager) {
|
_init: function(layoutManager) {
|
||||||
this._layoutManager = layoutManager;
|
this._layoutManager = layoutManager;
|
||||||
|
|
||||||
@ -587,11 +584,12 @@ Chrome.prototype = {
|
|||||||
|
|
||||||
this._screenSaverActive = false;
|
this._screenSaverActive = false;
|
||||||
this._screenSaverProxy = new ScreenSaver.ScreenSaverProxy();
|
this._screenSaverProxy = new ScreenSaver.ScreenSaverProxy();
|
||||||
this._screenSaverProxy.connect('ActiveChanged', Lang.bind(this, this._onScreenSaverActiveChanged));
|
this._screenSaverProxy.connectSignal('ActiveChanged', Lang.bind(this, function(proxy, senderName, [isActive]) {
|
||||||
this._screenSaverProxy.GetActiveRemote(Lang.bind(this,
|
this._onScreenSaverActiveChanged(isActive);
|
||||||
function(result, err) {
|
}));
|
||||||
|
this._screenSaverProxy.GetActiveRemote(Lang.bind(this, function(result, err) {
|
||||||
if (!err)
|
if (!err)
|
||||||
this._onScreenSaverActiveChanged(this._screenSaverProxy, result);
|
this._onScreenSaverActiveChanged(result[0]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._relayout();
|
this._relayout();
|
||||||
@ -733,7 +731,7 @@ Chrome.prototype = {
|
|||||||
this._queueUpdateRegions();
|
this._queueUpdateRegions();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onScreenSaverActiveChanged: function(proxy, screenSaverActive) {
|
_onScreenSaverActiveChanged: function(screenSaverActive) {
|
||||||
this._screenSaverActive = screenSaverActive;
|
this._screenSaverActive = screenSaverActive;
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
this._queueUpdateRegions();
|
this._queueUpdateRegions();
|
||||||
@ -980,4 +978,4 @@ Chrome.prototype = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
|
const Clutter = imports.gi.Clutter;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
@ -30,11 +31,9 @@ const Tweener = imports.ui.tweener;
|
|||||||
* @container and will track any changes in its size. You can override
|
* @container and will track any changes in its size. You can override
|
||||||
* this by passing an explicit width and height in @params.
|
* this by passing an explicit width and height in @params.
|
||||||
*/
|
*/
|
||||||
function Lightbox(container, params) {
|
const Lightbox = new Lang.Class({
|
||||||
this._init(container, params);
|
Name: 'Lightbox',
|
||||||
}
|
|
||||||
|
|
||||||
Lightbox.prototype = {
|
|
||||||
_init : function(container, params) {
|
_init : function(container, params) {
|
||||||
params = Params.parse(params, { inhibitEvents: false,
|
params = Params.parse(params, { inhibitEvents: false,
|
||||||
width: null,
|
width: null,
|
||||||
@ -59,11 +58,10 @@ Lightbox.prototype = {
|
|||||||
if (params.width && params.height) {
|
if (params.width && params.height) {
|
||||||
this.actor.width = params.width;
|
this.actor.width = params.width;
|
||||||
this.actor.height = params.height;
|
this.actor.height = params.height;
|
||||||
this._allocationChangedSignalId = 0;
|
|
||||||
} else {
|
} else {
|
||||||
this.actor.width = container.width;
|
let constraint = new Clutter.BindConstraint({ source: container,
|
||||||
this.actor.height = container.height;
|
coordinate: Clutter.BindCoordinate.ALL });
|
||||||
this._allocationChangedSignalId = container.connect('allocation-changed', Lang.bind(this, this._allocationChanged));
|
this.actor.add_constraint(constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._actorAddedSignalId = container.connect('actor-added', Lang.bind(this, this._actorAdded));
|
this._actorAddedSignalId = container.connect('actor-added', Lang.bind(this, this._actorAdded));
|
||||||
@ -72,16 +70,6 @@ Lightbox.prototype = {
|
|||||||
this._highlighted = null;
|
this._highlighted = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocationChanged : function(container, box, flags) {
|
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
|
||||||
this.actor.width = this.width;
|
|
||||||
this.actor.height = this.height;
|
|
||||||
return false;
|
|
||||||
}));
|
|
||||||
this.width = this._container.width;
|
|
||||||
this.height = this._container.height;
|
|
||||||
},
|
|
||||||
|
|
||||||
_actorAdded : function(container, newChild) {
|
_actorAdded : function(container, newChild) {
|
||||||
let children = this._container.get_children();
|
let children = this._container.get_children();
|
||||||
let myIndex = children.indexOf(this.actor);
|
let myIndex = children.indexOf(this.actor);
|
||||||
@ -189,11 +177,9 @@ Lightbox.prototype = {
|
|||||||
* by destroying its container or by explicitly calling this.destroy().
|
* by destroying its container or by explicitly calling this.destroy().
|
||||||
*/
|
*/
|
||||||
_onDestroy: function() {
|
_onDestroy: function() {
|
||||||
if (this._allocationChangedSignalId != 0)
|
|
||||||
this._container.disconnect(this._allocationChangedSignalId);
|
|
||||||
this._container.disconnect(this._actorAddedSignalId);
|
this._container.disconnect(this._actorAddedSignalId);
|
||||||
this._container.disconnect(this._actorRemovedSignalId);
|
this._container.disconnect(this._actorRemovedSignalId);
|
||||||
|
|
||||||
this.highlight(null);
|
this.highlight(null);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -4,11 +4,9 @@ const Lang = imports.lang;
|
|||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
|
||||||
function Link(props) {
|
const Link = new Lang.Class({
|
||||||
this._init(props);
|
Name: 'Link',
|
||||||
}
|
|
||||||
|
|
||||||
Link.prototype = {
|
|
||||||
_init : function(props) {
|
_init : function(props) {
|
||||||
let realProps = { reactive: true,
|
let realProps = { reactive: true,
|
||||||
track_hover: true,
|
track_hover: true,
|
||||||
@ -19,6 +17,5 @@ Link.prototype = {
|
|||||||
|
|
||||||
this.actor = new St.Button(realProps);
|
this.actor = new St.Button(realProps);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
Signals.addSignalMethods(Link.prototype);
|
Signals.addSignalMethods(Link.prototype);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Cogl = imports.gi.Cogl;
|
const Cogl = imports.gi.Cogl;
|
||||||
const GConf = imports.gi.GConf;
|
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
@ -16,10 +15,12 @@ const Mainloop = imports.mainloop;
|
|||||||
|
|
||||||
const History = imports.misc.history;
|
const History = imports.misc.history;
|
||||||
const ExtensionSystem = imports.ui.extensionSystem;
|
const ExtensionSystem = imports.ui.extensionSystem;
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const Link = imports.ui.link;
|
const Link = imports.ui.link;
|
||||||
const ShellEntry = imports.ui.shellEntry;
|
const ShellEntry = imports.ui.shellEntry;
|
||||||
const Tweener = imports.ui.tweener;
|
const Tweener = imports.ui.tweener;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
const JsParse = imports.misc.jsParse;
|
||||||
|
|
||||||
/* Imports...feel free to add here as needed */
|
/* Imports...feel free to add here as needed */
|
||||||
var commandHeader = 'const Clutter = imports.gi.Clutter; ' +
|
var commandHeader = 'const Clutter = imports.gi.Clutter; ' +
|
||||||
@ -41,12 +42,88 @@ var commandHeader = 'const Clutter = imports.gi.Clutter; ' +
|
|||||||
'const r = Lang.bind(Main.lookingGlass, Main.lookingGlass.getResult); ';
|
'const r = Lang.bind(Main.lookingGlass, Main.lookingGlass.getResult); ';
|
||||||
|
|
||||||
const HISTORY_KEY = 'looking-glass-history';
|
const HISTORY_KEY = 'looking-glass-history';
|
||||||
|
// Time between tabs for them to count as a double-tab event
|
||||||
|
const AUTO_COMPLETE_DOUBLE_TAB_DELAY = 500;
|
||||||
|
const AUTO_COMPLETE_SHOW_COMPLETION_ANIMATION_DURATION = 0.2;
|
||||||
|
const AUTO_COMPLETE_GLOBAL_KEYWORDS = _getAutoCompleteGlobalKeywords();
|
||||||
|
|
||||||
function Notebook() {
|
function _getAutoCompleteGlobalKeywords() {
|
||||||
this._init();
|
const keywords = ['true', 'false', 'null', 'new'];
|
||||||
|
// Don't add the private properties of window (i.e., ones starting with '_')
|
||||||
|
const windowProperties = Object.getOwnPropertyNames(window).filter(function(a){ return a.charAt(0) != '_' });
|
||||||
|
const headerProperties = JsParse.getDeclaredConstants(commandHeader);
|
||||||
|
|
||||||
|
return keywords.concat(windowProperties).concat(headerProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notebook.prototype = {
|
const AutoComplete = new Lang.Class({
|
||||||
|
Name: 'AutoComplete',
|
||||||
|
|
||||||
|
_init: function(entry) {
|
||||||
|
this._entry = entry;
|
||||||
|
this._entry.connect('key-press-event', Lang.bind(this, this._entryKeyPressEvent));
|
||||||
|
this._lastTabTime = global.get_current_time();
|
||||||
|
},
|
||||||
|
|
||||||
|
_processCompletionRequest: function(event) {
|
||||||
|
if (event.completions.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Unique match = go ahead and complete; multiple matches + single tab = complete the common starting string;
|
||||||
|
// multiple matches + double tab = emit a suggest event with all possible options
|
||||||
|
if (event.completions.length == 1) {
|
||||||
|
this.additionalCompletionText(event.completions[0], event.attrHead);
|
||||||
|
this.emit('completion', { completion: event.completions[0], type: 'whole-word' });
|
||||||
|
} else if (event.completions.length > 1 && event.tabType === 'single') {
|
||||||
|
let commonPrefix = JsParse.getCommonPrefix(event.completions);
|
||||||
|
|
||||||
|
if (commonPrefix.length > 0) {
|
||||||
|
this.additionalCompletionText(commonPrefix, event.attrHead);
|
||||||
|
this.emit('completion', { completion: commonPrefix, type: 'prefix' });
|
||||||
|
this.emit('suggest', { completions: event.completions});
|
||||||
|
}
|
||||||
|
} else if (event.completions.length > 1 && event.tabType === 'double') {
|
||||||
|
this.emit('suggest', { completions: event.completions});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_entryKeyPressEvent: function(actor, event) {
|
||||||
|
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
||||||
|
let text = this._entry.get_text();
|
||||||
|
if (cursorPos != -1) {
|
||||||
|
text = text.slice(0, cursorPos);
|
||||||
|
}
|
||||||
|
if (event.get_key_symbol() == Clutter.Tab) {
|
||||||
|
let [completions, attrHead] = JsParse.getCompletions(text, commandHeader, AUTO_COMPLETE_GLOBAL_KEYWORDS);
|
||||||
|
let currTime = global.get_current_time();
|
||||||
|
if ((currTime - this._lastTabTime) < AUTO_COMPLETE_DOUBLE_TAB_DELAY) {
|
||||||
|
this._processCompletionRequest({ tabType: 'double',
|
||||||
|
completions: completions,
|
||||||
|
attrHead: attrHead });
|
||||||
|
} else {
|
||||||
|
this._processCompletionRequest({ tabType: 'single',
|
||||||
|
completions: completions,
|
||||||
|
attrHead: attrHead });
|
||||||
|
}
|
||||||
|
this._lastTabTime = currTime;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Insert characters of text not already included in head at cursor position. i.e., if text="abc" and head="a",
|
||||||
|
// the string "bc" will be appended to this._entry
|
||||||
|
additionalCompletionText: function(text, head) {
|
||||||
|
let additionalCompletionText = text.slice(head.length);
|
||||||
|
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
||||||
|
|
||||||
|
this._entry.clutter_text.insert_text(additionalCompletionText, cursorPos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Signals.addSignalMethods(AutoComplete.prototype);
|
||||||
|
|
||||||
|
|
||||||
|
const Notebook = new Lang.Class({
|
||||||
|
Name: 'Notebook',
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new St.BoxLayout({ vertical: true });
|
this.actor = new St.BoxLayout({ vertical: true });
|
||||||
|
|
||||||
@ -151,8 +228,26 @@ Notebook.prototype = {
|
|||||||
return;
|
return;
|
||||||
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
||||||
vAdjust.value = vAdjust.upper - vAdjust.page_size;
|
vAdjust.value = vAdjust.upper - vAdjust.page_size;
|
||||||
|
},
|
||||||
|
|
||||||
|
nextTab: function() {
|
||||||
|
let nextIndex = this._selectedIndex;
|
||||||
|
if (nextIndex < this._tabs.length - 1) {
|
||||||
|
++nextIndex;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
this.selectIndex(nextIndex);
|
||||||
|
},
|
||||||
|
|
||||||
|
prevTab: function() {
|
||||||
|
let prevIndex = this._selectedIndex;
|
||||||
|
if (prevIndex > 0) {
|
||||||
|
--prevIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectIndex(prevIndex);
|
||||||
|
}
|
||||||
|
});
|
||||||
Signals.addSignalMethods(Notebook.prototype);
|
Signals.addSignalMethods(Notebook.prototype);
|
||||||
|
|
||||||
function objectToString(o) {
|
function objectToString(o) {
|
||||||
@ -164,12 +259,9 @@ function objectToString(o) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ObjLink(o, title) {
|
const ObjLink = new Lang.Class({
|
||||||
this._init(o, title);
|
Name: 'ObjLink',
|
||||||
}
|
Extends: Link.Link,
|
||||||
|
|
||||||
ObjLink.prototype = {
|
|
||||||
__proto__: Link.Link,
|
|
||||||
|
|
||||||
_init: function(o, title) {
|
_init: function(o, title) {
|
||||||
let text;
|
let text;
|
||||||
@ -179,7 +271,8 @@ ObjLink.prototype = {
|
|||||||
text = objectToString(o);
|
text = objectToString(o);
|
||||||
text = GLib.markup_escape_text(text, -1);
|
text = GLib.markup_escape_text(text, -1);
|
||||||
this._obj = o;
|
this._obj = o;
|
||||||
Link.Link.prototype._init.call(this, { label: text });
|
|
||||||
|
this.parent({ label: text });
|
||||||
this.actor.get_child().single_line_mode = true;
|
this.actor.get_child().single_line_mode = true;
|
||||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||||
},
|
},
|
||||||
@ -187,13 +280,11 @@ ObjLink.prototype = {
|
|||||||
_onClicked: function (link) {
|
_onClicked: function (link) {
|
||||||
Main.lookingGlass.inspectObject(this._obj, this.actor);
|
Main.lookingGlass.inspectObject(this._obj, this.actor);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function Result(command, o, index) {
|
const Result = new Lang.Class({
|
||||||
this._init(command, o, index);
|
Name: 'Result',
|
||||||
}
|
|
||||||
|
|
||||||
Result.prototype = {
|
|
||||||
_init : function(command, o, index) {
|
_init : function(command, o, index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.o = o;
|
this.o = o;
|
||||||
@ -215,13 +306,11 @@ Result.prototype = {
|
|||||||
padBin.add_actor(line);
|
padBin.add_actor(line);
|
||||||
this.actor.add(padBin);
|
this.actor.add(padBin);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function WindowList() {
|
const WindowList = new Lang.Class({
|
||||||
this._init();
|
Name: 'WindowList',
|
||||||
}
|
|
||||||
|
|
||||||
WindowList.prototype = {
|
|
||||||
_init : function () {
|
_init : function () {
|
||||||
this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
|
this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
@ -262,14 +351,12 @@ WindowList.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(WindowList.prototype);
|
Signals.addSignalMethods(WindowList.prototype);
|
||||||
|
|
||||||
function ObjInspector() {
|
const ObjInspector = new Lang.Class({
|
||||||
this._init();
|
Name: 'ObjInspector',
|
||||||
}
|
|
||||||
|
|
||||||
ObjInspector.prototype = {
|
|
||||||
_init : function () {
|
_init : function () {
|
||||||
this._obj = null;
|
this._obj = null;
|
||||||
this._previousObj = null;
|
this._previousObj = null;
|
||||||
@ -313,7 +400,14 @@ ObjInspector.prototype = {
|
|||||||
button.connect('clicked', Lang.bind(this, this.close));
|
button.connect('clicked', Lang.bind(this, this.close));
|
||||||
hbox.add(button);
|
hbox.add(button);
|
||||||
if (typeof(obj) == typeof({})) {
|
if (typeof(obj) == typeof({})) {
|
||||||
|
let properties = [];
|
||||||
for (let propName in obj) {
|
for (let propName in obj) {
|
||||||
|
properties.push(propName);
|
||||||
|
}
|
||||||
|
properties.sort();
|
||||||
|
|
||||||
|
for (let i = 0; i < properties.length; i++) {
|
||||||
|
let propName = properties[i];
|
||||||
let valueStr;
|
let valueStr;
|
||||||
let link;
|
let link;
|
||||||
try {
|
try {
|
||||||
@ -369,7 +463,7 @@ ObjInspector.prototype = {
|
|||||||
_onBack: function() {
|
_onBack: function() {
|
||||||
this.selectObject(this._previousObj, true);
|
this.selectObject(this._previousObj, true);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function addBorderPaintHook(actor) {
|
function addBorderPaintHook(actor) {
|
||||||
let signalId = actor.connect_after('paint',
|
let signalId = actor.connect_after('paint',
|
||||||
@ -395,11 +489,9 @@ function addBorderPaintHook(actor) {
|
|||||||
return signalId;
|
return signalId;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Inspector() {
|
const Inspector = new Lang.Class({
|
||||||
this._init();
|
Name: 'Inspector',
|
||||||
}
|
|
||||||
|
|
||||||
Inspector.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
let container = new Shell.GenericContainer({ width: 0,
|
let container = new Shell.GenericContainer({ width: 0,
|
||||||
height: 0 });
|
height: 0 });
|
||||||
@ -538,56 +630,13 @@ Inspector.prototype = {
|
|||||||
this._borderPaintId = addBorderPaintHook(this._target);
|
this._borderPaintId = addBorderPaintHook(this._target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
Signals.addSignalMethods(Inspector.prototype);
|
Signals.addSignalMethods(Inspector.prototype);
|
||||||
|
|
||||||
function ErrorLog() {
|
const Memory = new Lang.Class({
|
||||||
this._init();
|
Name: 'Memory',
|
||||||
}
|
|
||||||
|
|
||||||
ErrorLog.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
this.actor = new St.BoxLayout();
|
|
||||||
this.text = new St.Label();
|
|
||||||
this.actor.add(this.text);
|
|
||||||
// We need to override StLabel's default ellipsization when
|
|
||||||
// using line_wrap; otherwise ClutterText's layout is going
|
|
||||||
// to constrain both the width and height, which prevents
|
|
||||||
// scrolling.
|
|
||||||
this.text.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
||||||
this.text.clutter_text.line_wrap = true;
|
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this, this._renderText));
|
|
||||||
},
|
|
||||||
|
|
||||||
_formatTime: function(d){
|
|
||||||
function pad(n) { return n < 10 ? '0' + n : n; }
|
|
||||||
return d.getUTCFullYear()+'-'
|
|
||||||
+ pad(d.getUTCMonth()+1)+'-'
|
|
||||||
+ pad(d.getUTCDate())+'T'
|
|
||||||
+ pad(d.getUTCHours())+':'
|
|
||||||
+ pad(d.getUTCMinutes())+':'
|
|
||||||
+ pad(d.getUTCSeconds())+'Z';
|
|
||||||
},
|
|
||||||
|
|
||||||
_renderText: function() {
|
|
||||||
if (!this.actor.mapped)
|
|
||||||
return;
|
|
||||||
let text = this.text.text;
|
|
||||||
let stack = Main._getAndClearErrorStack();
|
|
||||||
for (let i = 0; i < stack.length; i++) {
|
|
||||||
let logItem = stack[i];
|
|
||||||
text += logItem.category + ' t=' + this._formatTime(new Date(logItem.timestamp)) + ' ' + logItem.message + '\n';
|
|
||||||
}
|
|
||||||
this.text.text = text;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function Memory() {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
|
|
||||||
Memory.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new St.BoxLayout({ vertical: true });
|
this.actor = new St.BoxLayout({ vertical: true });
|
||||||
this._glibc_uordblks = new St.Label();
|
this._glibc_uordblks = new St.Label();
|
||||||
@ -632,13 +681,11 @@ Memory.prototype = {
|
|||||||
this._gjs_closure.text = 'gjs_closure: ' + memInfo.gjs_closure;
|
this._gjs_closure.text = 'gjs_closure: ' + memInfo.gjs_closure;
|
||||||
this._last_gc_seconds_ago.text = 'last_gc_seconds_ago: ' + memInfo.last_gc_seconds_ago;
|
this._last_gc_seconds_ago.text = 'last_gc_seconds_ago: ' + memInfo.last_gc_seconds_ago;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function Extensions() {
|
const Extensions = new Lang.Class({
|
||||||
this._init();
|
Name: 'Extensions',
|
||||||
}
|
|
||||||
|
|
||||||
Extensions.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new St.BoxLayout({ vertical: true,
|
this.actor = new St.BoxLayout({ vertical: true,
|
||||||
name: 'lookingGlassExtensions' });
|
name: 'lookingGlassExtensions' });
|
||||||
@ -650,7 +697,7 @@ Extensions.prototype = {
|
|||||||
this._extensionsList.add(this._noExtensions);
|
this._extensionsList.add(this._noExtensions);
|
||||||
this.actor.add(this._extensionsList);
|
this.actor.add(this._extensionsList);
|
||||||
|
|
||||||
for (let uuid in ExtensionSystem.extensionMeta)
|
for (let uuid in ExtensionUtils.extensions)
|
||||||
this._loadExtension(null, uuid);
|
this._loadExtension(null, uuid);
|
||||||
|
|
||||||
ExtensionSystem.connect('extension-loaded',
|
ExtensionSystem.connect('extension-loaded',
|
||||||
@ -658,10 +705,10 @@ Extensions.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_loadExtension: function(o, uuid) {
|
_loadExtension: function(o, uuid) {
|
||||||
let extension = ExtensionSystem.extensionMeta[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
// There can be cases where we create dummy extension metadata
|
// There can be cases where we create dummy extension metadata
|
||||||
// that's not really a proper extension. Don't bother with these.
|
// that's not really a proper extension. Don't bother with these.
|
||||||
if (!extension.name)
|
if (!extension.metadata.name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let extensionDisplay = this._createExtensionDisplay(extension);
|
let extensionDisplay = this._createExtensionDisplay(extension);
|
||||||
@ -673,24 +720,52 @@ Extensions.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onViewSource: function (actor) {
|
_onViewSource: function (actor) {
|
||||||
let meta = actor._extensionMeta;
|
let extension = actor._extension;
|
||||||
let file = Gio.file_new_for_path(meta.path);
|
let uri = extension.dir.get_uri();
|
||||||
let uri = file.get_uri();
|
|
||||||
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context());
|
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context());
|
||||||
Main.lookingGlass.close();
|
Main.lookingGlass.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWebPage: function (actor) {
|
_onWebPage: function (actor) {
|
||||||
let meta = actor._extensionMeta;
|
let extension = actor._extension;
|
||||||
Gio.app_info_launch_default_for_uri(meta.url, global.create_app_launch_context());
|
Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context());
|
||||||
Main.lookingGlass.close();
|
Main.lookingGlass.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onViewErrors: function (actor) {
|
||||||
|
let extension = actor._extension;
|
||||||
|
let shouldShow = !actor._isShowing;
|
||||||
|
|
||||||
|
if (shouldShow) {
|
||||||
|
let errors = extension.errors;
|
||||||
|
let errorDisplay = new St.BoxLayout({ vertical: true });
|
||||||
|
if (errors && errors.length) {
|
||||||
|
for (let i = 0; i < errors.length; i ++)
|
||||||
|
errorDisplay.add(new St.Label({ text: errors[i] }));
|
||||||
|
} else {
|
||||||
|
/* Translators: argument is an extension UUID. */
|
||||||
|
let message = _("%s has not emitted any errors.").format(extension.uuid);
|
||||||
|
errorDisplay.add(new St.Label({ text: message }));
|
||||||
|
}
|
||||||
|
|
||||||
|
actor._errorDisplay = errorDisplay;
|
||||||
|
actor._parentBox.add(errorDisplay);
|
||||||
|
actor.label = _("Hide Errors");
|
||||||
|
} else {
|
||||||
|
actor._errorDisplay.destroy();
|
||||||
|
actor._errorDisplay = null;
|
||||||
|
actor.label = _("Show Errors");
|
||||||
|
}
|
||||||
|
|
||||||
|
actor._isShowing = shouldShow;
|
||||||
|
},
|
||||||
|
|
||||||
_stateToString: function(extensionState) {
|
_stateToString: function(extensionState) {
|
||||||
switch (extensionState) {
|
switch (extensionState) {
|
||||||
case ExtensionSystem.ExtensionState.ENABLED:
|
case ExtensionSystem.ExtensionState.ENABLED:
|
||||||
return _("Enabled");
|
return _("Enabled");
|
||||||
case ExtensionSystem.ExtensionState.DISABLED:
|
case ExtensionSystem.ExtensionState.DISABLED:
|
||||||
|
case ExtensionSystem.ExtensionState.INITIALIZED:
|
||||||
return _("Disabled");
|
return _("Disabled");
|
||||||
case ExtensionSystem.ExtensionState.ERROR:
|
case ExtensionSystem.ExtensionState.ERROR:
|
||||||
return _("Error");
|
return _("Error");
|
||||||
@ -702,43 +777,48 @@ Extensions.prototype = {
|
|||||||
return 'Unknown'; // Not translated, shouldn't appear
|
return 'Unknown'; // Not translated, shouldn't appear
|
||||||
},
|
},
|
||||||
|
|
||||||
_createExtensionDisplay: function(meta) {
|
_createExtensionDisplay: function(extension) {
|
||||||
let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true });
|
let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true });
|
||||||
let name = new St.Label({ style_class: 'lg-extension-name',
|
let name = new St.Label({ style_class: 'lg-extension-name',
|
||||||
text: meta.name });
|
text: extension.metadata.name });
|
||||||
box.add(name, { expand: true });
|
box.add(name, { expand: true });
|
||||||
let description = new St.Label({ style_class: 'lg-extension-description',
|
let description = new St.Label({ style_class: 'lg-extension-description',
|
||||||
text: meta.description || 'No description' });
|
text: extension.metadata.description || 'No description' });
|
||||||
box.add(description, { expand: true });
|
box.add(description, { expand: true });
|
||||||
|
|
||||||
let metaBox = new St.BoxLayout({ style_class: 'lg-extension-meta' });
|
let metaBox = new St.BoxLayout({ style_class: 'lg-extension-meta' });
|
||||||
box.add(metaBox);
|
box.add(metaBox);
|
||||||
let stateString = this._stateToString(meta.state);
|
let stateString = this._stateToString(extension.state);
|
||||||
let state = new St.Label({ style_class: 'lg-extension-state',
|
let state = new St.Label({ style_class: 'lg-extension-state',
|
||||||
text: this._stateToString(meta.state) });
|
text: this._stateToString(extension.state) });
|
||||||
metaBox.add(state);
|
metaBox.add(state);
|
||||||
|
|
||||||
let viewsource = new Link.Link({ label: _("View Source") });
|
let viewsource = new Link.Link({ label: _("View Source") });
|
||||||
viewsource.actor._extensionMeta = meta;
|
viewsource.actor._extension = extension;
|
||||||
viewsource.actor.connect('clicked', Lang.bind(this, this._onViewSource));
|
viewsource.actor.connect('clicked', Lang.bind(this, this._onViewSource));
|
||||||
metaBox.add(viewsource.actor);
|
metaBox.add(viewsource.actor);
|
||||||
|
|
||||||
if (meta.url) {
|
if (extension.metadata.url) {
|
||||||
let webpage = new Link.Link({ label: _("Web Page") });
|
let webpage = new Link.Link({ label: _("Web Page") });
|
||||||
webpage.actor._extensionMeta = meta;
|
webpage.actor._extension = extension;
|
||||||
webpage.actor.connect('clicked', Lang.bind(this, this._onWebPage));
|
webpage.actor.connect('clicked', Lang.bind(this, this._onWebPage));
|
||||||
metaBox.add(webpage.actor);
|
metaBox.add(webpage.actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let viewerrors = new Link.Link({ label: _("Show Errors") });
|
||||||
|
viewerrors.actor._extension = extension;
|
||||||
|
viewerrors.actor._parentBox = box;
|
||||||
|
viewerrors.actor._isShowing = false;
|
||||||
|
viewerrors.actor.connect('clicked', Lang.bind(this, this._onViewErrors));
|
||||||
|
metaBox.add(viewerrors.actor);
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function LookingGlass() {
|
const LookingGlass = new Lang.Class({
|
||||||
this._init();
|
Name: 'LookingGlass',
|
||||||
}
|
|
||||||
|
|
||||||
LookingGlass.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this._borderPaintTarget = null;
|
this._borderPaintTarget = null;
|
||||||
this._borderPaintId = 0;
|
this._borderPaintId = 0;
|
||||||
@ -755,7 +835,8 @@ LookingGlass.prototype = {
|
|||||||
this.actor = new St.BoxLayout({ name: 'LookingGlassDialog',
|
this.actor = new St.BoxLayout({ name: 'LookingGlassDialog',
|
||||||
style_class: 'lg-dialog',
|
style_class: 'lg-dialog',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
visible: false });
|
visible: false,
|
||||||
|
reactive: true });
|
||||||
this.actor.connect('key-press-event', Lang.bind(this, this._globalKeyPressEvent));
|
this.actor.connect('key-press-event', Lang.bind(this, this._globalKeyPressEvent));
|
||||||
|
|
||||||
this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
|
this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
|
||||||
@ -810,15 +891,15 @@ LookingGlass.prototype = {
|
|||||||
this._resultsArea = new St.BoxLayout({ name: 'ResultsArea', vertical: true });
|
this._resultsArea = new St.BoxLayout({ name: 'ResultsArea', vertical: true });
|
||||||
this._evalBox.add(this._resultsArea, { expand: true });
|
this._evalBox.add(this._resultsArea, { expand: true });
|
||||||
|
|
||||||
let entryArea = new St.BoxLayout({ name: 'EntryArea' });
|
this._entryArea = new St.BoxLayout({ name: 'EntryArea' });
|
||||||
this._evalBox.add_actor(entryArea);
|
this._evalBox.add_actor(this._entryArea);
|
||||||
|
|
||||||
let label = new St.Label({ text: 'js>>> ' });
|
let label = new St.Label({ text: 'js>>> ' });
|
||||||
entryArea.add(label);
|
this._entryArea.add(label);
|
||||||
|
|
||||||
this._entry = new St.Entry({ can_focus: true });
|
this._entry = new St.Entry({ can_focus: true });
|
||||||
ShellEntry.addContextMenu(this._entry);
|
ShellEntry.addContextMenu(this._entry);
|
||||||
entryArea.add(this._entry, { expand: true });
|
this._entryArea.add(this._entry, { expand: true });
|
||||||
|
|
||||||
this._windowList = new WindowList();
|
this._windowList = new WindowList();
|
||||||
this._windowList.connect('selected', Lang.bind(this, function(list, window) {
|
this._windowList.connect('selected', Lang.bind(this, function(list, window) {
|
||||||
@ -827,9 +908,6 @@ LookingGlass.prototype = {
|
|||||||
}));
|
}));
|
||||||
notebook.appendPage('Windows', this._windowList.actor);
|
notebook.appendPage('Windows', this._windowList.actor);
|
||||||
|
|
||||||
this._errorLog = new ErrorLog();
|
|
||||||
notebook.appendPage('Errors', this._errorLog.actor);
|
|
||||||
|
|
||||||
this._memory = new Memory();
|
this._memory = new Memory();
|
||||||
notebook.appendPage('Memory', this._memory.actor);
|
notebook.appendPage('Memory', this._memory.actor);
|
||||||
|
|
||||||
@ -837,6 +915,9 @@ LookingGlass.prototype = {
|
|||||||
notebook.appendPage('Extensions', this._extensions.actor);
|
notebook.appendPage('Extensions', this._extensions.actor);
|
||||||
|
|
||||||
this._entry.clutter_text.connect('activate', Lang.bind(this, function (o, e) {
|
this._entry.clutter_text.connect('activate', Lang.bind(this, function (o, e) {
|
||||||
|
// Hide any completions we are currently showing
|
||||||
|
this._hideCompletions();
|
||||||
|
|
||||||
let text = o.get_text();
|
let text = o.get_text();
|
||||||
// Ensure we don't get newlines in the command; the history file is
|
// Ensure we don't get newlines in the command; the history file is
|
||||||
// newline-separated.
|
// newline-separated.
|
||||||
@ -852,6 +933,17 @@ LookingGlass.prototype = {
|
|||||||
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
|
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
|
||||||
entry: this._entry.clutter_text });
|
entry: this._entry.clutter_text });
|
||||||
|
|
||||||
|
this._autoComplete = new AutoComplete(this._entry);
|
||||||
|
this._autoComplete.connect('suggest', Lang.bind(this, function(a,e) {
|
||||||
|
this._showCompletions(e.completions);
|
||||||
|
}));
|
||||||
|
// If a completion is completed unambiguously, the currently-displayed completion
|
||||||
|
// suggestions become irrelevant.
|
||||||
|
this._autoComplete.connect('completion', Lang.bind(this, function(a,e) {
|
||||||
|
if (e.type == 'whole-word')
|
||||||
|
this._hideCompletions();
|
||||||
|
}));
|
||||||
|
|
||||||
this._resize();
|
this._resize();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -896,6 +988,59 @@ LookingGlass.prototype = {
|
|||||||
this._notebook.scrollToBottom(0);
|
this._notebook.scrollToBottom(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_showCompletions: function(completions) {
|
||||||
|
if (!this._completionActor) {
|
||||||
|
let actor = new St.BoxLayout({ vertical: true });
|
||||||
|
|
||||||
|
this._completionText = new St.Label({ name: 'LookingGlassAutoCompletionText', style_class: 'lg-completions-text' });
|
||||||
|
this._completionText.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
|
this._completionText.clutter_text.line_wrap = true;
|
||||||
|
actor.add(this._completionText);
|
||||||
|
|
||||||
|
let line = new Clutter.Rectangle();
|
||||||
|
let padBin = new St.Bin({ x_fill: true, y_fill: true });
|
||||||
|
padBin.add_actor(line);
|
||||||
|
actor.add(padBin);
|
||||||
|
|
||||||
|
this._completionActor = actor;
|
||||||
|
this._evalBox.insert_child_below(this._completionActor, this._entryArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._completionText.set_text(completions.join(', '));
|
||||||
|
|
||||||
|
// Setting the height to -1 allows us to get its actual preferred height rather than
|
||||||
|
// whatever was last given in set_height by Tweener.
|
||||||
|
this._completionActor.set_height(-1);
|
||||||
|
let [minHeight, naturalHeight] = this._completionText.get_preferred_height(this._resultsArea.get_width());
|
||||||
|
|
||||||
|
// Don't reanimate if we are already visible
|
||||||
|
if (this._completionActor.visible) {
|
||||||
|
this._completionActor.height = naturalHeight;
|
||||||
|
} else {
|
||||||
|
this._completionActor.show();
|
||||||
|
Tweener.removeTweens(this._completionActor);
|
||||||
|
Tweener.addTween(this._completionActor, { time: AUTO_COMPLETE_SHOW_COMPLETION_ANIMATION_DURATION / St.get_slow_down_factor(),
|
||||||
|
transition: 'easeOutQuad',
|
||||||
|
height: naturalHeight,
|
||||||
|
opacity: 255
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_hideCompletions: function() {
|
||||||
|
if (this._completionActor) {
|
||||||
|
Tweener.removeTweens(this._completionActor);
|
||||||
|
Tweener.addTween(this._completionActor, { time: AUTO_COMPLETE_SHOW_COMPLETION_ANIMATION_DURATION / St.get_slow_down_factor(),
|
||||||
|
transition: 'easeOutQuad',
|
||||||
|
height: 0,
|
||||||
|
opacity: 0,
|
||||||
|
onComplete: Lang.bind(this, function () {
|
||||||
|
this._completionActor.hide();
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_evaluate : function(command) {
|
_evaluate : function(command) {
|
||||||
this._history.addItem(command);
|
this._history.addItem(command);
|
||||||
|
|
||||||
@ -960,6 +1105,7 @@ LookingGlass.prototype = {
|
|||||||
// Handle key events which are relevant for all tabs of the LookingGlass
|
// Handle key events which are relevant for all tabs of the LookingGlass
|
||||||
_globalKeyPressEvent : function(actor, event) {
|
_globalKeyPressEvent : function(actor, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
|
let modifierState = event.get_state();
|
||||||
if (symbol == Clutter.Escape) {
|
if (symbol == Clutter.Escape) {
|
||||||
if (this._objInspector.actor.visible) {
|
if (this._objInspector.actor.visible) {
|
||||||
this._objInspector.close();
|
this._objInspector.close();
|
||||||
@ -968,6 +1114,14 @@ LookingGlass.prototype = {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view
|
||||||
|
if (modifierState & Clutter.ModifierType.CONTROL_MASK) {
|
||||||
|
if (symbol == Clutter.KEY_Page_Up) {
|
||||||
|
this._notebook.prevTab();
|
||||||
|
} else if (symbol == Clutter.KEY_Page_Down) {
|
||||||
|
this._notebook.nextTab();
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1018,5 +1172,5 @@ LookingGlass.prototype = {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(LookingGlass.prototype);
|
Signals.addSignalMethods(LookingGlass.prototype);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const GDesktopEnums = imports.gi.GDesktopEnums;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
@ -12,22 +13,6 @@ const Main = imports.ui.main;
|
|||||||
const MagnifierDBus = imports.ui.magnifierDBus;
|
const MagnifierDBus = imports.ui.magnifierDBus;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
|
||||||
// Keep enums in sync with GSettings schemas
|
|
||||||
const MouseTrackingMode = {
|
|
||||||
NONE: 0,
|
|
||||||
CENTERED: 1,
|
|
||||||
PROPORTIONAL: 2,
|
|
||||||
PUSH: 3
|
|
||||||
};
|
|
||||||
|
|
||||||
const ScreenPosition = {
|
|
||||||
NONE: 0,
|
|
||||||
FULL_SCREEN: 1,
|
|
||||||
TOP_HALF: 2,
|
|
||||||
BOTTOM_HALF: 3,
|
|
||||||
LEFT_HALF: 4,
|
|
||||||
RIGHT_HALF: 5
|
|
||||||
};
|
|
||||||
|
|
||||||
const MOUSE_POLL_FREQUENCY = 50;
|
const MOUSE_POLL_FREQUENCY = 50;
|
||||||
const CROSSHAIRS_CLIP_SIZE = [100, 100];
|
const CROSSHAIRS_CLIP_SIZE = [100, 100];
|
||||||
@ -51,17 +36,15 @@ const CROSS_HAIRS_CLIP_KEY = 'cross-hairs-clip';
|
|||||||
|
|
||||||
let magDBusService = null;
|
let magDBusService = null;
|
||||||
|
|
||||||
function Magnifier() {
|
const Magnifier = new Lang.Class({
|
||||||
this._init();
|
Name: 'Magnifier',
|
||||||
}
|
|
||||||
|
|
||||||
Magnifier.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
// Magnifier is a manager of ZoomRegions.
|
// Magnifier is a manager of ZoomRegions.
|
||||||
this._zoomRegions = [];
|
this._zoomRegions = [];
|
||||||
|
|
||||||
// Create small clutter tree for the magnified mouse.
|
// Create small clutter tree for the magnified mouse.
|
||||||
let xfixesCursor = Shell.XFixesCursor.get_default();
|
let xfixesCursor = Shell.XFixesCursor.get_for_stage(global.stage);
|
||||||
this._mouseSprite = new Clutter.Texture();
|
this._mouseSprite = new Clutter.Texture();
|
||||||
xfixesCursor.update_texture_image(this._mouseSprite);
|
xfixesCursor.update_texture_image(this._mouseSprite);
|
||||||
this._cursorRoot = new Clutter.Group();
|
this._cursorRoot = new Clutter.Group();
|
||||||
@ -520,7 +503,7 @@ Magnifier.prototype = {
|
|||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
let position = this._settings.get_enum(SCREEN_POSITION_KEY);
|
let position = this._settings.get_enum(SCREEN_POSITION_KEY);
|
||||||
this._zoomRegions[0].setScreenPosition(position);
|
this._zoomRegions[0].setScreenPosition(position);
|
||||||
if (position != ScreenPosition.FULL_SCREEN)
|
if (position != GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN)
|
||||||
this._updateLensMode();
|
this._updateLensMode();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -558,23 +541,22 @@ Magnifier.prototype = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(Magnifier.prototype);
|
Signals.addSignalMethods(Magnifier.prototype);
|
||||||
|
|
||||||
function ZoomRegion(magnifier, mouseSourceActor) {
|
const ZoomRegion = new Lang.Class({
|
||||||
this._init(magnifier, mouseSourceActor);
|
Name: 'ZoomRegion',
|
||||||
}
|
|
||||||
|
|
||||||
ZoomRegion.prototype = {
|
|
||||||
_init: function(magnifier, mouseSourceActor) {
|
_init: function(magnifier, mouseSourceActor) {
|
||||||
this._magnifier = magnifier;
|
this._magnifier = magnifier;
|
||||||
|
|
||||||
this._mouseTrackingMode = MouseTrackingMode.NONE;
|
this._mouseTrackingMode = GDesktopEnums.MagnifierMouseTrackingMode.NONE;
|
||||||
this._clampScrollingAtEdges = false;
|
this._clampScrollingAtEdges = false;
|
||||||
this._lensMode = false;
|
this._lensMode = false;
|
||||||
this._screenPosition = ScreenPosition.FULL_SCREEN;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;
|
||||||
|
|
||||||
this._magView = null;
|
this._magView = null;
|
||||||
|
this._background = null;
|
||||||
this._uiGroupClone = null;
|
this._uiGroupClone = null;
|
||||||
this._mouseSourceActor = mouseSourceActor;
|
this._mouseSourceActor = mouseSourceActor;
|
||||||
this._mouseActor = null;
|
this._mouseActor = null;
|
||||||
@ -584,12 +566,15 @@ ZoomRegion.prototype = {
|
|||||||
this._viewPortX = 0;
|
this._viewPortX = 0;
|
||||||
this._viewPortY = 0;
|
this._viewPortY = 0;
|
||||||
this._viewPortWidth = global.screen_width;
|
this._viewPortWidth = global.screen_width;
|
||||||
this._viewPortWidth = global.screen_height;
|
this._viewPortHeight = global.screen_height;
|
||||||
this._xCenter = this._viewPortWidth / 2;
|
this._xCenter = this._viewPortWidth / 2;
|
||||||
this._yCenter = this._viewPortHeight / 2;
|
this._yCenter = this._viewPortHeight / 2;
|
||||||
this._xMagFactor = 1;
|
this._xMagFactor = 1;
|
||||||
this._yMagFactor = 1;
|
this._yMagFactor = 1;
|
||||||
this._followingCursor = false;
|
this._followingCursor = false;
|
||||||
|
|
||||||
|
Main.layoutManager.connect('monitors-changed',
|
||||||
|
Lang.bind(this, this._monitorsChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -647,7 +632,8 @@ ZoomRegion.prototype = {
|
|||||||
* @mode: One of the enum MouseTrackingMode values.
|
* @mode: One of the enum MouseTrackingMode values.
|
||||||
*/
|
*/
|
||||||
setMouseTrackingMode: function(mode) {
|
setMouseTrackingMode: function(mode) {
|
||||||
if (mode >= MouseTrackingMode.NONE && mode <= MouseTrackingMode.PUSH)
|
if (mode >= GDesktopEnums.MagnifierMouseTrackingMode.NONE &&
|
||||||
|
mode <= GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
|
||||||
this._mouseTrackingMode = mode;
|
this._mouseTrackingMode = mode;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -668,7 +654,7 @@ ZoomRegion.prototype = {
|
|||||||
*/
|
*/
|
||||||
setViewPort: function(viewPort) {
|
setViewPort: function(viewPort) {
|
||||||
this._setViewPort(viewPort);
|
this._setViewPort(viewPort);
|
||||||
this._screenPosition = ScreenPosition.NONE;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.NONE;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -750,7 +736,7 @@ ZoomRegion.prototype = {
|
|||||||
viewPort.width = global.screen_width;
|
viewPort.width = global.screen_width;
|
||||||
viewPort.height = global.screen_height/2;
|
viewPort.height = global.screen_height/2;
|
||||||
this._setViewPort(viewPort);
|
this._setViewPort(viewPort);
|
||||||
this._screenPosition = ScreenPosition.TOP_HALF;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.TOP_HALF;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -764,7 +750,7 @@ ZoomRegion.prototype = {
|
|||||||
viewPort.width = global.screen_width;
|
viewPort.width = global.screen_width;
|
||||||
viewPort.height = global.screen_height/2;
|
viewPort.height = global.screen_height/2;
|
||||||
this._setViewPort(viewPort);
|
this._setViewPort(viewPort);
|
||||||
this._screenPosition = ScreenPosition.BOTTOM_HALF;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.BOTTOM_HALF;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -778,7 +764,7 @@ ZoomRegion.prototype = {
|
|||||||
viewPort.width = global.screen_width/2;
|
viewPort.width = global.screen_width/2;
|
||||||
viewPort.height = global.screen_height;
|
viewPort.height = global.screen_height;
|
||||||
this._setViewPort(viewPort);
|
this._setViewPort(viewPort);
|
||||||
this._screenPosition = ScreenPosition.LEFT_HALF;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.LEFT_HALF;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -792,7 +778,7 @@ ZoomRegion.prototype = {
|
|||||||
viewPort.width = global.screen_width/2;
|
viewPort.width = global.screen_width/2;
|
||||||
viewPort.height = global.screen_height;
|
viewPort.height = global.screen_height;
|
||||||
this._setViewPort(viewPort);
|
this._setViewPort(viewPort);
|
||||||
this._screenPosition = ScreenPosition.RIGHT_HALF;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.RIGHT_HALF;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -808,7 +794,7 @@ ZoomRegion.prototype = {
|
|||||||
viewPort.height = global.screen_height;
|
viewPort.height = global.screen_height;
|
||||||
this.setViewPort(viewPort);
|
this.setViewPort(viewPort);
|
||||||
|
|
||||||
this._screenPosition = ScreenPosition.FULL_SCREEN;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -821,19 +807,19 @@ ZoomRegion.prototype = {
|
|||||||
*/
|
*/
|
||||||
setScreenPosition: function(inPosition) {
|
setScreenPosition: function(inPosition) {
|
||||||
switch (inPosition) {
|
switch (inPosition) {
|
||||||
case ScreenPosition.FULL_SCREEN:
|
case GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN:
|
||||||
this.setFullScreenMode();
|
this.setFullScreenMode();
|
||||||
break;
|
break;
|
||||||
case ScreenPosition.TOP_HALF:
|
case GDesktopEnums.MagnifierScreenPosition.TOP_HALF:
|
||||||
this.setTopHalf();
|
this.setTopHalf();
|
||||||
break;
|
break;
|
||||||
case ScreenPosition.BOTTOM_HALF:
|
case GDesktopEnums.MagnifierScreenPosition.BOTTOM_HALF:
|
||||||
this.setBottomHalf();
|
this.setBottomHalf();
|
||||||
break;
|
break;
|
||||||
case ScreenPosition.LEFT_HALF:
|
case GDesktopEnums.MagnifierScreenPosition.LEFT_HALF:
|
||||||
this.setLeftHalf();
|
this.setLeftHalf();
|
||||||
break;
|
break;
|
||||||
case ScreenPosition.RIGHT_HALF:
|
case GDesktopEnums.MagnifierScreenPosition.RIGHT_HALF:
|
||||||
this.setRightHalf();
|
this.setRightHalf();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -856,7 +842,7 @@ ZoomRegion.prototype = {
|
|||||||
*/
|
*/
|
||||||
scrollToMousePos: function() {
|
scrollToMousePos: function() {
|
||||||
this._followingCursor = true;
|
this._followingCursor = true;
|
||||||
if (this._mouseTrackingMode != MouseTrackingMode.NONE)
|
if (this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE)
|
||||||
this._changeROI({ redoCursorTracking: true });
|
this._changeROI({ redoCursorTracking: true });
|
||||||
else
|
else
|
||||||
this._updateMousePosition();
|
this._updateMousePosition();
|
||||||
@ -909,15 +895,15 @@ ZoomRegion.prototype = {
|
|||||||
|
|
||||||
// Add a background for when the magnified uiGroup is scrolled
|
// Add a background for when the magnified uiGroup is scrolled
|
||||||
// out of view (don't want to see desktop showing through).
|
// out of view (don't want to see desktop showing through).
|
||||||
let background = new Clutter.Rectangle({ color: Main.DEFAULT_BACKGROUND_COLOR });
|
this._background = new Clutter.Rectangle({ color: Main.DEFAULT_BACKGROUND_COLOR });
|
||||||
mainGroup.add_actor(background);
|
mainGroup.add_actor(this._background);
|
||||||
|
|
||||||
// Clone the group that contains all of UI on the screen. This is the
|
// Clone the group that contains all of UI on the screen. This is the
|
||||||
// chrome, the windows, etc.
|
// chrome, the windows, etc.
|
||||||
this._uiGroupClone = new Clutter.Clone({ source: Main.uiGroup });
|
this._uiGroupClone = new Clutter.Clone({ source: Main.uiGroup });
|
||||||
mainGroup.add_actor(this._uiGroupClone);
|
mainGroup.add_actor(this._uiGroupClone);
|
||||||
Main.uiGroup.set_size(global.screen_width, global.screen_height);
|
Main.uiGroup.set_size(global.screen_width, global.screen_height);
|
||||||
background.set_size(global.screen_width, global.screen_height);
|
this._background.set_size(global.screen_width, global.screen_height);
|
||||||
|
|
||||||
// Add either the given mouseSourceActor to the ZoomRegion, or a clone of
|
// Add either the given mouseSourceActor to the ZoomRegion, or a clone of
|
||||||
// it.
|
// it.
|
||||||
@ -941,6 +927,7 @@ ZoomRegion.prototype = {
|
|||||||
|
|
||||||
this._magView.destroy();
|
this._magView.destroy();
|
||||||
this._magView = null;
|
this._magView = null;
|
||||||
|
this._background = null;
|
||||||
this._uiGroupClone = null;
|
this._uiGroupClone = null;
|
||||||
this._mouseActor = null;
|
this._mouseActor = null;
|
||||||
this._crossHairsActor = null;
|
this._crossHairsActor = null;
|
||||||
@ -991,7 +978,7 @@ ZoomRegion.prototype = {
|
|||||||
this._yMagFactor = params.yMagFactor;
|
this._yMagFactor = params.yMagFactor;
|
||||||
|
|
||||||
if (params.redoCursorTracking &&
|
if (params.redoCursorTracking &&
|
||||||
this._mouseTrackingMode != MouseTrackingMode.NONE) {
|
this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE) {
|
||||||
// This depends on this.xMagFactor/yMagFactor already being updated
|
// This depends on this.xMagFactor/yMagFactor already being updated
|
||||||
[params.xCenter, params.yCenter] = this._centerFromMousePosition();
|
[params.xCenter, params.yCenter] = this._centerFromMousePosition();
|
||||||
}
|
}
|
||||||
@ -1041,7 +1028,7 @@ ZoomRegion.prototype = {
|
|||||||
_isFullScreen: function() {
|
_isFullScreen: function() {
|
||||||
// Does the magnified view occupy the whole screen? Note that this
|
// Does the magnified view occupy the whole screen? Note that this
|
||||||
// doesn't necessarily imply
|
// doesn't necessarily imply
|
||||||
// this._screenPosition = ScreenPosition.FULL_SCREEN;
|
// this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;
|
||||||
|
|
||||||
if (this._viewPortX != 0 || this._viewPortY != 0)
|
if (this._viewPortX != 0 || this._viewPortY != 0)
|
||||||
return false;
|
return false;
|
||||||
@ -1058,13 +1045,13 @@ ZoomRegion.prototype = {
|
|||||||
let xMouse = this._magnifier.xMouse;
|
let xMouse = this._magnifier.xMouse;
|
||||||
let yMouse = this._magnifier.yMouse;
|
let yMouse = this._magnifier.yMouse;
|
||||||
|
|
||||||
if (this._mouseTrackingMode == MouseTrackingMode.PROPORTIONAL) {
|
if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL) {
|
||||||
return this._centerFromMouseProportional(xMouse, yMouse);
|
return this._centerFromMouseProportional(xMouse, yMouse);
|
||||||
}
|
}
|
||||||
else if (this._mouseTrackingMode == MouseTrackingMode.PUSH) {
|
else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH) {
|
||||||
return this._centerFromMousePush(xMouse, yMouse);
|
return this._centerFromMousePush(xMouse, yMouse);
|
||||||
}
|
}
|
||||||
else if (this._mouseTrackingMode == MouseTrackingMode.CENTERED) {
|
else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.CENTERED) {
|
||||||
return this._centerFromMouseCentered(xMouse, yMouse);
|
return this._centerFromMouseCentered(xMouse, yMouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,14 +1150,28 @@ ZoomRegion.prototype = {
|
|||||||
this._crossHairsActor.set_position(xMagMouse - groupWidth / 2,
|
this._crossHairsActor.set_position(xMagMouse - groupWidth / 2,
|
||||||
yMagMouse - groupHeight / 2);
|
yMagMouse - groupHeight / 2);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
|
||||||
|
|
||||||
function Crosshairs() {
|
_monitorsChanged: function() {
|
||||||
this._init();
|
if (!this.isActive())
|
||||||
}
|
return;
|
||||||
|
|
||||||
|
Main.uiGroup.set_size(global.screen_width, global.screen_height);
|
||||||
|
this._background.set_size(global.screen_width, global.screen_height);
|
||||||
|
|
||||||
|
if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE)
|
||||||
|
this._setViewPort({ x: this._viewPortX,
|
||||||
|
y: this._viewPortY,
|
||||||
|
width: this._viewPortWidth,
|
||||||
|
height: this._viewPortHeight });
|
||||||
|
else
|
||||||
|
this.setScreenPosition(this._screenPosition);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const Crosshairs = new Lang.Class({
|
||||||
|
Name: 'Crosshairs',
|
||||||
|
|
||||||
Crosshairs.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
|
|
||||||
// Set the group containing the crosshairs to three times the desktop
|
// Set the group containing the crosshairs to three times the desktop
|
||||||
@ -1195,6 +1196,14 @@ Crosshairs.prototype = {
|
|||||||
this._clipSize = [0, 0];
|
this._clipSize = [0, 0];
|
||||||
this._clones = [];
|
this._clones = [];
|
||||||
this.reCenter();
|
this.reCenter();
|
||||||
|
|
||||||
|
Main.layoutManager.connect('monitors-changed',
|
||||||
|
Lang.bind(this, this._monitorsChanged));
|
||||||
|
},
|
||||||
|
|
||||||
|
_monitorsChanged: function() {
|
||||||
|
this._actor.set_size(global.screen_width * 3, global.screen_height * 3);
|
||||||
|
this.reCenter();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1219,10 +1228,7 @@ Crosshairs.prototype = {
|
|||||||
crosshairsActor = new Clutter.Clone({ source: this._actor });
|
crosshairsActor = new Clutter.Clone({ source: this._actor });
|
||||||
this._clones.push(crosshairsActor);
|
this._clones.push(crosshairsActor);
|
||||||
}
|
}
|
||||||
if (this._actor.visible)
|
crosshairsActor.visible = this._actor.visible;
|
||||||
crosshairsActor.show();
|
|
||||||
else
|
|
||||||
crosshairsActor.hide();
|
|
||||||
|
|
||||||
container.add_actor(crosshairsActor);
|
container.add_actor(crosshairsActor);
|
||||||
container.raise_child(magnifiedMouse, crosshairsActor);
|
container.raise_child(magnifiedMouse, crosshairsActor);
|
||||||
@ -1426,4 +1432,4 @@ Crosshairs.prototype = {
|
|||||||
this._vertTopHair.set_position((groupWidth - thickness) / 2, top);
|
this._vertTopHair.set_position((groupWidth - thickness) / 2, top);
|
||||||
this._vertBottomHair.set_position((groupWidth - thickness) / 2, bottom);
|
this._vertBottomHair.set_position((groupWidth - thickness) / 2, bottom);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
const Gio = imports.gi.Gio;
|
||||||
|
const Lang = imports.lang;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
const MAG_SERVICE_NAME = 'org.gnome.Magnifier';
|
const MAG_SERVICE_NAME = 'org.gnome.Magnifier';
|
||||||
@ -10,61 +11,99 @@ const ZOOM_SERVICE_PATH = '/org/gnome/Magnifier/ZoomRegion';
|
|||||||
|
|
||||||
// Subset of gnome-mag's Magnifier dbus interface -- to be expanded. See:
|
// Subset of gnome-mag's Magnifier dbus interface -- to be expanded. See:
|
||||||
// http://git.gnome.org/browse/gnome-mag/tree/xml/...Magnifier.xml
|
// http://git.gnome.org/browse/gnome-mag/tree/xml/...Magnifier.xml
|
||||||
const MagnifierIface = {
|
const MagnifierIface = <interface name={MAG_SERVICE_NAME}>
|
||||||
name: MAG_SERVICE_NAME,
|
<method name="setActive">
|
||||||
methods: [
|
<arg type="b" direction="in" />
|
||||||
{ name: 'setActive', inSignature: 'b', outSignature: '' },
|
</method>
|
||||||
{ name: 'isActive', inSignature: '', outSignature: 'b' },
|
<method name="isActive">
|
||||||
{ name: 'showCursor', inSignature: '', outSignature: '' },
|
<arg type="b" direction="out" />
|
||||||
{ name: 'hideCursor', inSignature: '', outSignature: '' },
|
</method>
|
||||||
{ name: 'createZoomRegion', inSignature: 'ddaiai', outSignature: 'o' },
|
<method name="showCursor" />
|
||||||
{ name: 'addZoomRegion', inSignature: 'o', outSignature: 'b' },
|
<method name="hideCursor" />
|
||||||
{ name: 'getZoomRegions', inSignature: '', outSignature: 'ao' },
|
<method name="createZoomRegion">
|
||||||
{ name: 'clearAllZoomRegions', inSignature: '', outSignature: '' },
|
<arg type="d" direction="in" />
|
||||||
{ name: 'fullScreenCapable', inSignature: '', outSignature: 'b' },
|
<arg type="d" direction="in" />
|
||||||
|
<arg type="ai" direction="in" />
|
||||||
{ name: 'setCrosswireSize', inSignature: 'i', outSignature: '' },
|
<arg type="ai" direction="in" />
|
||||||
{ name: 'getCrosswireSize', inSignature: '', outSignature: 'i' },
|
<arg type="o" direction="out" />
|
||||||
{ name: 'setCrosswireLength', inSignature: 'i', outSignature: '' },
|
</method>
|
||||||
{ name: 'getCrosswireLength', inSignature: '', outSignature: 'i' },
|
<method name="addZoomRegion">
|
||||||
{ name: 'setCrosswireClip', inSignature: 'b', outSignature: '' },
|
<arg type="o" direction="in" />
|
||||||
{ name: 'getCrosswireClip', inSignature: '', outSignature: 'b' },
|
<arg type="b" direction="out" />
|
||||||
{ name: 'setCrosswireColor', inSignature: 'u', outSignature: '' },
|
</method>
|
||||||
{ name: 'getCrosswireColor', inSignature: '', outSignature: 'u' }
|
<method name="getZoomRegions">
|
||||||
],
|
<arg type="ao" direction="out" />
|
||||||
signals: [],
|
</method>
|
||||||
properties: []
|
<method name="clearAllZoomRegions" />
|
||||||
};
|
<method name="fullScreenCapable">
|
||||||
|
<arg type="b" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="setCrosswireSize">
|
||||||
|
<arg type="i" direction="in" />
|
||||||
|
</method>
|
||||||
|
<method name="getCrosswireSize">
|
||||||
|
<arg type="i" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="setCrosswireLength">
|
||||||
|
<arg type="i" direction="in" />
|
||||||
|
</method>
|
||||||
|
<method name="getCrosswireLength">
|
||||||
|
<arg type="i" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="setCrosswireClip">
|
||||||
|
<arg type="b" direction="in" />
|
||||||
|
</method>
|
||||||
|
<method name="getCrosswireClip">
|
||||||
|
<arg type="b" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="setCrosswireColor">
|
||||||
|
<arg type="u" direction="in" />
|
||||||
|
</method>
|
||||||
|
<method name="getCrosswireColor">
|
||||||
|
<arg type="u" direction="out" />
|
||||||
|
</method>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
// Subset of gnome-mag's ZoomRegion dbus interface -- to be expanded. See:
|
// Subset of gnome-mag's ZoomRegion dbus interface -- to be expanded. See:
|
||||||
// http://git.gnome.org/browse/gnome-mag/tree/xml/...ZoomRegion.xml
|
// http://git.gnome.org/browse/gnome-mag/tree/xml/...ZoomRegion.xml
|
||||||
const ZoomRegionIface = {
|
const ZoomRegionIface = <interface name={ZOOM_SERVICE_NAME}>
|
||||||
name: ZOOM_SERVICE_NAME,
|
<method name="setMagFactor">
|
||||||
methods: [
|
<arg type="d" direction="in" />
|
||||||
{ name: 'setMagFactor', inSignature: 'dd', outSignature: ''},
|
<arg type="d" direction="in" />
|
||||||
{ name: 'getMagFactor', inSignature: '', outSignature: 'dd' },
|
</method>
|
||||||
{ name: 'setRoi', inSignature: 'ai', outSignature: '' },
|
<method name="getMagFactor">
|
||||||
{ name: 'getRoi', inSignature: '', outSignature: 'ai' },
|
<arg type="d" direction="out" />
|
||||||
{ name: 'shiftContentsTo', inSignature: 'ii', outSignature: 'b' },
|
<arg type="d" direction="out" />
|
||||||
{ name: 'moveResize', inSignature: 'ai', outSignature: '' }
|
</method>
|
||||||
],
|
<method name="setRoi">
|
||||||
signals: [],
|
<arg type="ai" direction="in" />
|
||||||
properties: []
|
</method>
|
||||||
};
|
<method name="getRoi">
|
||||||
|
<arg type="ai" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="shiftContentsTo">
|
||||||
|
<arg type="i" direction="in" />
|
||||||
|
<arg type="i" direction="in" />
|
||||||
|
<arg type="b" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="moveResize">
|
||||||
|
<arg type="ai" direction="in" />
|
||||||
|
</method>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
// For making unique ZoomRegion DBus proxy object paths of the form:
|
// For making unique ZoomRegion DBus proxy object paths of the form:
|
||||||
// '/org/gnome/Magnifier/ZoomRegion/zoomer0',
|
// '/org/gnome/Magnifier/ZoomRegion/zoomer0',
|
||||||
// '/org/gnome/Magnifier/ZoomRegion/zoomer1', etc.
|
// '/org/gnome/Magnifier/ZoomRegion/zoomer1', etc.
|
||||||
let _zoomRegionInstanceCount = 0;
|
let _zoomRegionInstanceCount = 0;
|
||||||
|
|
||||||
function ShellMagnifier() {
|
const ShellMagnifier = new Lang.Class({
|
||||||
this._init();
|
Name: 'ShellMagnifier',
|
||||||
}
|
|
||||||
|
|
||||||
ShellMagnifier.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._zoomers = {};
|
this._zoomers = {};
|
||||||
DBus.session.exportObject(MAG_SERVICE_PATH, this);
|
|
||||||
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(MagnifierIface, this);
|
||||||
|
this._dbusImpl.export(Gio.DBus.session, MAG_SERVICE_PATH);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,10 +234,10 @@ ShellMagnifier.prototype = {
|
|||||||
Main.magnifier.clearAllZoomRegions();
|
Main.magnifier.clearAllZoomRegions();
|
||||||
for (let objectPath in this._zoomers) {
|
for (let objectPath in this._zoomers) {
|
||||||
let proxyAndZoomer = this._zoomers[objectPath];
|
let proxyAndZoomer = this._zoomers[objectPath];
|
||||||
|
proxyAndZoomer.proxy.destroy();
|
||||||
proxyAndZoomer.proxy = null;
|
proxyAndZoomer.proxy = null;
|
||||||
proxyAndZoomer.zoomRegion = null;
|
proxyAndZoomer.zoomRegion = null;
|
||||||
delete this._zoomers[objectPath];
|
delete this._zoomers[objectPath];
|
||||||
DBus.session.unexportObject(proxyAndZoomer);
|
|
||||||
}
|
}
|
||||||
this._zoomers = {};
|
this._zoomers = {};
|
||||||
},
|
},
|
||||||
@ -285,7 +324,7 @@ ShellMagnifier.prototype = {
|
|||||||
// Drop the leading '#'.
|
// Drop the leading '#'.
|
||||||
return parseInt(colorString.slice(1), 16);
|
return parseInt(colorString.slice(1), 16);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ShellMagnifierZoomRegion:
|
* ShellMagnifierZoomRegion:
|
||||||
@ -293,15 +332,14 @@ ShellMagnifier.prototype = {
|
|||||||
* @zoomerObjectPath: String that is the path to a DBus ZoomRegion.
|
* @zoomerObjectPath: String that is the path to a DBus ZoomRegion.
|
||||||
* @zoomRegion: The actual zoom region associated with the object path.
|
* @zoomRegion: The actual zoom region associated with the object path.
|
||||||
*/
|
*/
|
||||||
function ShellMagnifierZoomRegion(zoomerObjectPath, zoomRegion) {
|
const ShellMagnifierZoomRegion = new Lang.Class({
|
||||||
this._init(zoomerObjectPath, zoomRegion);
|
Name: 'ShellMagnifierZoomRegion',
|
||||||
}
|
|
||||||
|
|
||||||
ShellMagnifierZoomRegion.prototype = {
|
|
||||||
_init: function(zoomerObjectPath, zoomRegion) {
|
_init: function(zoomerObjectPath, zoomRegion) {
|
||||||
this._zoomRegion = zoomRegion;
|
this._zoomRegion = zoomRegion;
|
||||||
DBus.session.proxifyObject(this, ZOOM_SERVICE_NAME, zoomerObjectPath);
|
|
||||||
DBus.session.exportObject(zoomerObjectPath, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ZoomRegionIface, this);
|
||||||
|
this._dbusImpl.export(Gio.DBus.session, zoomerObjectPath);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -376,8 +414,9 @@ ShellMagnifierZoomRegion.prototype = {
|
|||||||
moveResize: function(viewPort) {
|
moveResize: function(viewPort) {
|
||||||
let viewRect = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
let viewRect = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
||||||
this._zoomRegion.setViewPort(viewRect);
|
this._zoomRegion.setViewPort(viewRect);
|
||||||
}
|
},
|
||||||
};
|
|
||||||
|
|
||||||
DBus.conformExport(ShellMagnifier.prototype, MagnifierIface);
|
destroy: function() {
|
||||||
DBus.conformExport(ShellMagnifierZoomRegion.prototype, ZoomRegionIface);
|
this._dbusImpl.unexport();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
162
js/ui/main.js
@ -1,11 +1,9 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Gdk = imports.gi.Gdk;
|
const Gdk = imports.gi.Gdk;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const GConf = imports.gi.GConf;
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
@ -17,6 +15,7 @@ const AutorunManager = imports.ui.autorunManager;
|
|||||||
const CtrlAltTab = imports.ui.ctrlAltTab;
|
const CtrlAltTab = imports.ui.ctrlAltTab;
|
||||||
const EndSessionDialog = imports.ui.endSessionDialog;
|
const EndSessionDialog = imports.ui.endSessionDialog;
|
||||||
const PolkitAuthenticationAgent = imports.ui.polkitAuthenticationAgent;
|
const PolkitAuthenticationAgent = imports.ui.polkitAuthenticationAgent;
|
||||||
|
const KeyringPrompt = imports.ui.keyringPrompt;
|
||||||
const Environment = imports.ui.environment;
|
const Environment = imports.ui.environment;
|
||||||
const ExtensionSystem = imports.ui.extensionSystem;
|
const ExtensionSystem = imports.ui.extensionSystem;
|
||||||
const Keyboard = imports.ui.keyboard;
|
const Keyboard = imports.ui.keyboard;
|
||||||
@ -39,6 +38,7 @@ const XdndHandler = imports.ui.xdndHandler;
|
|||||||
const StatusIconDispatcher = imports.ui.statusIconDispatcher;
|
const StatusIconDispatcher = imports.ui.statusIconDispatcher;
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
|
|
||||||
|
const OVERRIDES_SCHEMA = 'org.gnome.shell.overrides';
|
||||||
const DEFAULT_BACKGROUND_COLOR = new Clutter.Color();
|
const DEFAULT_BACKGROUND_COLOR = new Clutter.Color();
|
||||||
DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff);
|
DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff);
|
||||||
|
|
||||||
@ -67,11 +67,11 @@ let statusIconDispatcher = null;
|
|||||||
let keyboard = null;
|
let keyboard = null;
|
||||||
let layoutManager = null;
|
let layoutManager = null;
|
||||||
let networkAgent = null;
|
let networkAgent = null;
|
||||||
let _errorLogStack = [];
|
|
||||||
let _startDate;
|
let _startDate;
|
||||||
let _defaultCssStylesheet = null;
|
let _defaultCssStylesheet = null;
|
||||||
let _cssStylesheet = null;
|
let _cssStylesheet = null;
|
||||||
let _gdmCssStylesheet = null;
|
let _gdmCssStylesheet = null;
|
||||||
|
let _overridesSettings = null;
|
||||||
|
|
||||||
let background = null;
|
let background = null;
|
||||||
|
|
||||||
@ -100,19 +100,24 @@ function _createGDMSession() {
|
|||||||
|
|
||||||
function _initRecorder() {
|
function _initRecorder() {
|
||||||
let recorderSettings = new Gio.Settings({ schema: 'org.gnome.shell.recorder' });
|
let recorderSettings = new Gio.Settings({ schema: 'org.gnome.shell.recorder' });
|
||||||
|
let bindingSettings = new Gio.Settings({ schema: 'org.gnome.shell.keybindings' });
|
||||||
|
|
||||||
global.screen.connect('toggle-recording', function() {
|
global.display.add_keybinding('toggle-recording',
|
||||||
|
bindingSettings,
|
||||||
|
Meta.KeyBindingFlags.NONE, function() {
|
||||||
if (recorder == null) {
|
if (recorder == null) {
|
||||||
recorder = new Shell.Recorder({ stage: global.stage });
|
recorder = new Shell.Recorder({ stage: global.stage });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recorder.is_recording()) {
|
if (recorder.is_recording()) {
|
||||||
recorder.pause();
|
recorder.close();
|
||||||
Meta.enable_unredirect_for_screen(global.screen);
|
Meta.enable_unredirect_for_screen(global.screen);
|
||||||
} else {
|
} else {
|
||||||
// read the parameters from GSettings always in case they have changed
|
// read the parameters from GSettings always in case they have changed
|
||||||
recorder.set_framerate(recorderSettings.get_int('framerate'));
|
recorder.set_framerate(recorderSettings.get_int('framerate'));
|
||||||
recorder.set_filename('shell-%d%u-%c.' + recorderSettings.get_string('file-extension'));
|
/* Translators: this is a filename used for screencast recording */
|
||||||
|
// xgettext:no-c-format
|
||||||
|
recorder.set_filename(_("Screencast from %d %t") + '.' + recorderSettings.get_string('file-extension'));
|
||||||
let pipeline = recorderSettings.get_string('pipeline');
|
let pipeline = recorderSettings.get_string('pipeline');
|
||||||
|
|
||||||
if (!pipeline.match(/^\s*$/))
|
if (!pipeline.match(/^\s*$/))
|
||||||
@ -134,15 +139,11 @@ function _initUserSession() {
|
|||||||
ExtensionSystem.init();
|
ExtensionSystem.init();
|
||||||
ExtensionSystem.loadExtensions();
|
ExtensionSystem.loadExtensions();
|
||||||
|
|
||||||
let shellwm = global.window_manager;
|
Meta.keybindings_set_custom_handler('panel-run-dialog', function() {
|
||||||
|
|
||||||
shellwm.takeover_keybinding('panel_run_dialog');
|
|
||||||
shellwm.connect('keybinding::panel_run_dialog', function () {
|
|
||||||
getRunDialog().open();
|
getRunDialog().open();
|
||||||
});
|
});
|
||||||
|
|
||||||
shellwm.takeover_keybinding('panel_main_menu');
|
Meta.keybindings_set_custom_handler('panel-main-menu', function () {
|
||||||
shellwm.connect('keybinding::panel_main_menu', function () {
|
|
||||||
overview.toggle();
|
overview.toggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -151,11 +152,9 @@ function _initUserSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
// Monkey patch utility functions into the global proxy;
|
// These are here so we don't break compatibility.
|
||||||
// This is easier and faster than indirecting down into global
|
global.logError = window.log;
|
||||||
// if we want to call back up into JS.
|
global.log = window.log;
|
||||||
global.logError = _logError;
|
|
||||||
global.log = _logDebug;
|
|
||||||
|
|
||||||
// Chain up async errors reported from C
|
// Chain up async errors reported from C
|
||||||
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });
|
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });
|
||||||
@ -163,11 +162,6 @@ function start() {
|
|||||||
Gio.DesktopAppInfo.set_desktop_env('GNOME');
|
Gio.DesktopAppInfo.set_desktop_env('GNOME');
|
||||||
|
|
||||||
shellDBusService = new ShellDBus.GnomeShell();
|
shellDBusService = new ShellDBus.GnomeShell();
|
||||||
// Force a connection now; dbus.js will do this internally
|
|
||||||
// if we use its name acquisition stuff but we aren't right
|
|
||||||
// now; to do so we'd need to convert from its async calls
|
|
||||||
// back into sync ones.
|
|
||||||
DBus.session.flush();
|
|
||||||
|
|
||||||
// Ensure ShellWindowTracker and ShellAppUsage are initialized; this will
|
// Ensure ShellWindowTracker and ShellAppUsage are initialized; this will
|
||||||
// also initialize ShellAppSystem first. ShellAppSystem
|
// also initialize ShellAppSystem first. ShellAppSystem
|
||||||
@ -177,9 +171,11 @@ function start() {
|
|||||||
// and recalculate application associations, so to avoid
|
// and recalculate application associations, so to avoid
|
||||||
// races for now we initialize it here. It's better to
|
// races for now we initialize it here. It's better to
|
||||||
// be predictable anyways.
|
// be predictable anyways.
|
||||||
Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
Shell.AppUsage.get_default();
|
Shell.AppUsage.get_default();
|
||||||
|
|
||||||
|
tracker.connect('startup-sequence-changed', _queueCheckWorkspaces);
|
||||||
|
|
||||||
// The stage is always covered so Clutter doesn't need to clear it; however
|
// The stage is always covered so Clutter doesn't need to clear it; however
|
||||||
// the color is used as the default contents for the Mutter root background
|
// the color is used as the default contents for the Mutter root background
|
||||||
// actor so set it anyways.
|
// actor so set it anyways.
|
||||||
@ -198,7 +194,16 @@ function start() {
|
|||||||
for (let i = 0; i < children.length; i++)
|
for (let i = 0; i < children.length; i++)
|
||||||
children[i].allocate_preferred_size(flags);
|
children[i].allocate_preferred_size(flags);
|
||||||
});
|
});
|
||||||
St.set_ui_root(global.stage, uiGroup);
|
uiGroup.connect('get-preferred-width',
|
||||||
|
function(actor, forHeight, alloc) {
|
||||||
|
let width = global.stage.width;
|
||||||
|
[alloc.min_size, alloc.natural_size] = [width, width];
|
||||||
|
});
|
||||||
|
uiGroup.connect('get-preferred-height',
|
||||||
|
function(actor, forWidth, alloc) {
|
||||||
|
let height = global.stage.height;
|
||||||
|
[alloc.min_size, alloc.natural_size] = [height, height];
|
||||||
|
});
|
||||||
global.window_group.reparent(uiGroup);
|
global.window_group.reparent(uiGroup);
|
||||||
global.overlay_group.reparent(uiGroup);
|
global.overlay_group.reparent(uiGroup);
|
||||||
global.stage.add_actor(uiGroup);
|
global.stage.add_actor(uiGroup);
|
||||||
@ -239,11 +244,13 @@ function start() {
|
|||||||
// Attempt to become a PolicyKit authentication agent
|
// Attempt to become a PolicyKit authentication agent
|
||||||
PolkitAuthenticationAgent.init()
|
PolkitAuthenticationAgent.init()
|
||||||
|
|
||||||
|
// Become a prompter for gnome keyring
|
||||||
|
KeyringPrompt.init();
|
||||||
|
|
||||||
_startDate = new Date();
|
_startDate = new Date();
|
||||||
|
|
||||||
global.stage.connect('captured-event', _globalKeyPressHandler);
|
global.stage.connect('captured-event', _globalKeyPressHandler);
|
||||||
|
|
||||||
_log('info', 'loaded at ' + _startDate);
|
|
||||||
log('GNOME Shell started at ' + _startDate);
|
log('GNOME Shell started at ' + _startDate);
|
||||||
|
|
||||||
let perfModuleName = GLib.getenv("SHELL_PERF_MODULE");
|
let perfModuleName = GLib.getenv("SHELL_PERF_MODULE");
|
||||||
@ -253,6 +260,9 @@ function start() {
|
|||||||
Scripting.runPerfScript(module, perfOutput);
|
Scripting.runPerfScript(module, perfOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_overridesSettings = new Gio.Settings({ schema: OVERRIDES_SCHEMA });
|
||||||
|
_overridesSettings.connect('changed::dynamic-workspaces', _queueCheckWorkspaces);
|
||||||
|
|
||||||
global.screen.connect('notify::n-workspaces', _nWorkspacesChanged);
|
global.screen.connect('notify::n-workspaces', _nWorkspacesChanged);
|
||||||
|
|
||||||
global.screen.connect('window-entered-monitor', _windowEnteredMonitor);
|
global.screen.connect('window-entered-monitor', _windowEnteredMonitor);
|
||||||
@ -277,17 +287,30 @@ function _checkWorkspaces() {
|
|||||||
let i;
|
let i;
|
||||||
let emptyWorkspaces = [];
|
let emptyWorkspaces = [];
|
||||||
|
|
||||||
|
if (!Meta.prefs_get_dynamic_workspaces()) {
|
||||||
|
_checkWorkspacesId = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < _workspaces.length; i++) {
|
for (i = 0; i < _workspaces.length; i++) {
|
||||||
let lastRemoved = _workspaces[i]._lastRemovedWindow;
|
let lastRemoved = _workspaces[i]._lastRemovedWindow;
|
||||||
if (lastRemoved &&
|
if ((lastRemoved &&
|
||||||
(lastRemoved.get_window_type() == Meta.WindowType.SPLASHSCREEN ||
|
(lastRemoved.get_window_type() == Meta.WindowType.SPLASHSCREEN ||
|
||||||
lastRemoved.get_window_type() == Meta.WindowType.DIALOG ||
|
lastRemoved.get_window_type() == Meta.WindowType.DIALOG ||
|
||||||
lastRemoved.get_window_type() == Meta.WindowType.MODAL_DIALOG))
|
lastRemoved.get_window_type() == Meta.WindowType.MODAL_DIALOG)) ||
|
||||||
|
_workspaces[i]._keepAliveId)
|
||||||
emptyWorkspaces[i] = false;
|
emptyWorkspaces[i] = false;
|
||||||
else
|
else
|
||||||
emptyWorkspaces[i] = true;
|
emptyWorkspaces[i] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let sequences = Shell.WindowTracker.get_default().get_startup_sequences();
|
||||||
|
for (i = 0; i < sequences.length; i++) {
|
||||||
|
let index = sequences[i].get_workspace();
|
||||||
|
if (index >= 0 && index <= global.screen.n_workspaces)
|
||||||
|
emptyWorkspaces[index] = false;
|
||||||
|
}
|
||||||
|
|
||||||
let windows = global.get_window_actors();
|
let windows = global.get_window_actors();
|
||||||
for (i = 0; i < windows.length; i++) {
|
for (i = 0; i < windows.length; i++) {
|
||||||
let win = windows[i];
|
let win = windows[i];
|
||||||
@ -335,6 +358,17 @@ function _checkWorkspaces() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function keepWorkspaceAlive(workspace, duration) {
|
||||||
|
if (workspace._keepAliveId)
|
||||||
|
Mainloop.source_remove(workspace._keepAliveId);
|
||||||
|
|
||||||
|
workspace._keepAliveId = Mainloop.timeout_add(duration, function() {
|
||||||
|
workspace._keepAliveId = 0;
|
||||||
|
_queueCheckWorkspaces();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function _windowRemoved(workspace, window) {
|
function _windowRemoved(workspace, window) {
|
||||||
workspace._lastRemovedWindow = window;
|
workspace._lastRemovedWindow = window;
|
||||||
_queueCheckWorkspaces();
|
_queueCheckWorkspaces();
|
||||||
@ -343,6 +377,7 @@ function _windowRemoved(workspace, window) {
|
|||||||
workspace._lastRemovedWindow = null;
|
workspace._lastRemovedWindow = null;
|
||||||
_queueCheckWorkspaces();
|
_queueCheckWorkspaces();
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,59 +536,6 @@ function notifyError(msg, details) {
|
|||||||
notify(msg, details);
|
notify(msg, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* _log:
|
|
||||||
* @category: string message type ('info', 'error')
|
|
||||||
* @msg: A message string
|
|
||||||
* ...: Any further arguments are converted into JSON notation,
|
|
||||||
* and appended to the log message, separated by spaces.
|
|
||||||
*
|
|
||||||
* Log a message into the LookingGlass error
|
|
||||||
* stream. This is primarily intended for use by the
|
|
||||||
* extension system as well as debugging.
|
|
||||||
*/
|
|
||||||
function _log(category, msg) {
|
|
||||||
let text = msg;
|
|
||||||
if (arguments.length > 2) {
|
|
||||||
text += ': ';
|
|
||||||
for (let i = 2; i < arguments.length; i++) {
|
|
||||||
text += JSON.stringify(arguments[i]);
|
|
||||||
if (i < arguments.length - 1)
|
|
||||||
text += ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_errorLogStack.push({timestamp: new Date().getTime(),
|
|
||||||
category: category,
|
|
||||||
message: text });
|
|
||||||
}
|
|
||||||
|
|
||||||
function _logError(msg) {
|
|
||||||
return _log('error', msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _logDebug(msg) {
|
|
||||||
return _log('debug', msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used by the error display in lookingGlass.js
|
|
||||||
function _getAndClearErrorStack() {
|
|
||||||
let errors = _errorLogStack;
|
|
||||||
_errorLogStack = [];
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
function logStackTrace(msg) {
|
|
||||||
try {
|
|
||||||
throw new Error();
|
|
||||||
} catch (e) {
|
|
||||||
// e.stack must have at least two lines, with the first being
|
|
||||||
// logStackTrace() (which we strip off), and the second being
|
|
||||||
// our caller.
|
|
||||||
let trace = e.stack.substr(e.stack.indexOf('\n') + 1);
|
|
||||||
log(msg ? (msg + '\n' + trace) : trace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isWindowActorDisplayedOnWorkspace(win, workspaceIndex) {
|
function isWindowActorDisplayedOnWorkspace(win, workspaceIndex) {
|
||||||
return win.get_workspace() == workspaceIndex ||
|
return win.get_workspace() == workspaceIndex ||
|
||||||
(win.get_meta_window() && win.get_meta_window().is_on_all_workspaces());
|
(win.get_meta_window() && win.get_meta_window().is_on_all_workspaces());
|
||||||
@ -578,21 +560,12 @@ function _globalKeyPressHandler(actor, event) {
|
|||||||
|
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
let keyCode = event.get_key_code();
|
let keyCode = event.get_key_code();
|
||||||
let modifierState = Shell.get_event_state(event);
|
let ignoredModifiers = global.display.get_ignored_modifier_mask();
|
||||||
|
let modifierState = event.get_state() & ~ignoredModifiers;
|
||||||
|
|
||||||
// This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
|
// This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
|
||||||
let action = global.display.get_keybinding_action(keyCode, modifierState);
|
let action = global.display.get_keybinding_action(keyCode, modifierState);
|
||||||
|
|
||||||
// The screenshot action should always be available (even if a
|
|
||||||
// modal dialog is present)
|
|
||||||
if (action == Meta.KeyBindingAction.COMMAND_SCREENSHOT) {
|
|
||||||
let gconf = GConf.Client.get_default();
|
|
||||||
let command = gconf.get_string('/apps/metacity/keybinding_commands/command_screenshot');
|
|
||||||
if (command != null && command != '')
|
|
||||||
Util.spawnCommandLine(command);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Other bindings are only available to the user session when the overview is up and
|
// Other bindings are only available to the user session when the overview is up and
|
||||||
// no modal dialog is present.
|
// no modal dialog is present.
|
||||||
if (global.session_type == Shell.SessionType.USER && (!overview.visible || modalCount > 1))
|
if (global.session_type == Shell.SessionType.USER && (!overview.visible || modalCount > 1))
|
||||||
@ -668,14 +641,17 @@ function _findModal(actor) {
|
|||||||
* initiated event. If not provided then the value of
|
* initiated event. If not provided then the value of
|
||||||
* global.get_current_time() is assumed.
|
* global.get_current_time() is assumed.
|
||||||
*
|
*
|
||||||
|
* @options: optional Meta.ModalOptions flags to indicate that the
|
||||||
|
* pointer is alrady grabbed
|
||||||
|
*
|
||||||
* Returns: true iff we successfully acquired a grab or already had one
|
* Returns: true iff we successfully acquired a grab or already had one
|
||||||
*/
|
*/
|
||||||
function pushModal(actor, timestamp) {
|
function pushModal(actor, timestamp, options) {
|
||||||
if (timestamp == undefined)
|
if (timestamp == undefined)
|
||||||
timestamp = global.get_current_time();
|
timestamp = global.get_current_time();
|
||||||
|
|
||||||
if (modalCount == 0) {
|
if (modalCount == 0) {
|
||||||
if (!global.begin_modal(timestamp)) {
|
if (!global.begin_modal(timestamp, options ? options : 0)) {
|
||||||
log('pushModal: invocation of begin_modal failed');
|
log('pushModal: invocation of begin_modal failed');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ const Clutter = imports.gi.Clutter;
|
|||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
@ -83,11 +84,9 @@ function _fixMarkup(text, allowMarkup) {
|
|||||||
return GLib.markup_escape_text(text, -1);
|
return GLib.markup_escape_text(text, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function URLHighlighter(text, lineWrap, allowMarkup) {
|
const URLHighlighter = new Lang.Class({
|
||||||
this._init(text, lineWrap, allowMarkup);
|
Name: 'URLHighlighter',
|
||||||
}
|
|
||||||
|
|
||||||
URLHighlighter.prototype = {
|
|
||||||
_init: function(text, lineWrap, allowMarkup) {
|
_init: function(text, lineWrap, allowMarkup) {
|
||||||
if (!text)
|
if (!text)
|
||||||
text = '';
|
text = '';
|
||||||
@ -211,13 +210,11 @@ URLHighlighter.prototype = {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function FocusGrabber() {
|
const FocusGrabber = new Lang.Class({
|
||||||
this._init();
|
Name: 'FocusGrabber',
|
||||||
}
|
|
||||||
|
|
||||||
FocusGrabber.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = null;
|
this.actor = null;
|
||||||
|
|
||||||
@ -265,7 +262,9 @@ FocusGrabber.prototype = {
|
|||||||
|
|
||||||
this._hasFocus = true;
|
this._hasFocus = true;
|
||||||
|
|
||||||
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
if (!this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false))
|
||||||
|
this.actor.grab_key_focus();
|
||||||
|
|
||||||
this.emit('focus-grabbed');
|
this.emit('focus-grabbed');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -351,7 +350,7 @@ FocusGrabber.prototype = {
|
|||||||
this._togglingFocusGrabMode = false;
|
this._togglingFocusGrabMode = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Signals.addSignalMethods(FocusGrabber.prototype);
|
Signals.addSignalMethods(FocusGrabber.prototype);
|
||||||
|
|
||||||
// Notification:
|
// Notification:
|
||||||
@ -408,11 +407,9 @@ Signals.addSignalMethods(FocusGrabber.prototype);
|
|||||||
// the content and the action area of the notification will be cleared.
|
// the content and the action area of the notification will be cleared.
|
||||||
// The content area is also always cleared if 'customContent' is false
|
// The content area is also always cleared if 'customContent' is false
|
||||||
// because it might contain the @banner that didn't fit in the banner mode.
|
// because it might contain the @banner that didn't fit in the banner mode.
|
||||||
function Notification(source, title, banner, params) {
|
const Notification = new Lang.Class({
|
||||||
this._init(source, title, banner, params);
|
Name: 'Notification',
|
||||||
}
|
|
||||||
|
|
||||||
Notification.prototype = {
|
|
||||||
IMAGE_SIZE: 125,
|
IMAGE_SIZE: 125,
|
||||||
|
|
||||||
_init: function(source, title, banner, params) {
|
_init: function(source, title, banner, params) {
|
||||||
@ -429,7 +426,7 @@ Notification.prototype = {
|
|||||||
this._bannerBodyText = null;
|
this._bannerBodyText = null;
|
||||||
this._bannerBodyMarkup = false;
|
this._bannerBodyMarkup = false;
|
||||||
this._titleFitsInBannerMode = true;
|
this._titleFitsInBannerMode = true;
|
||||||
this._titleDirection = St.TextDirection.NONE;
|
this._titleDirection = Clutter.TextDirection.DEFAULT;
|
||||||
this._spacing = 0;
|
this._spacing = 0;
|
||||||
this._scrollPolicy = Gtk.PolicyType.AUTOMATIC;
|
this._scrollPolicy = Gtk.PolicyType.AUTOMATIC;
|
||||||
this._imageBin = null;
|
this._imageBin = null;
|
||||||
@ -439,12 +436,12 @@ Notification.prototype = {
|
|||||||
this.destroy(reason);
|
this.destroy(reason);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.actor = new St.Button();
|
this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
|
|
||||||
this._table = new St.Table({ name: 'notification',
|
this._table = new St.Table({ style_class: 'notification',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
this._table.connect('style-changed', Lang.bind(this, this._styleChanged));
|
this._table.connect('style-changed', Lang.bind(this, this._styleChanged));
|
||||||
this.actor.set_child(this._table);
|
this.actor.set_child(this._table);
|
||||||
@ -550,9 +547,9 @@ Notification.prototype = {
|
|||||||
this._titleLabel.clutter_text.set_markup('<b>' + title + '</b>');
|
this._titleLabel.clutter_text.set_markup('<b>' + title + '</b>');
|
||||||
|
|
||||||
if (Pango.find_base_dir(title, -1) == Pango.Direction.RTL)
|
if (Pango.find_base_dir(title, -1) == Pango.Direction.RTL)
|
||||||
this._titleDirection = St.TextDirection.RTL;
|
this._titleDirection = Clutter.TextDirection.RTL;
|
||||||
else
|
else
|
||||||
this._titleDirection = St.TextDirection.LTR;
|
this._titleDirection = Clutter.TextDirection.LTR;
|
||||||
|
|
||||||
// Let the title's text direction control the overall direction
|
// Let the title's text direction control the overall direction
|
||||||
// of the notification - in case where different scripts are used
|
// of the notification - in case where different scripts are used
|
||||||
@ -560,7 +557,7 @@ Notification.prototype = {
|
|||||||
// arguably for action buttons as well. Labels other than the title
|
// arguably for action buttons as well. Labels other than the title
|
||||||
// will be allocated at the available width, so that their alignment
|
// will be allocated at the available width, so that their alignment
|
||||||
// is done correctly automatically.
|
// is done correctly automatically.
|
||||||
this._table.set_direction(this._titleDirection);
|
this._table.set_text_direction(this._titleDirection);
|
||||||
|
|
||||||
// Unless the notification has custom content, we save this._bannerBodyText
|
// Unless the notification has custom content, we save this._bannerBodyText
|
||||||
// to add it to the content of the notification if the notification is
|
// to add it to the content of the notification if the notification is
|
||||||
@ -580,7 +577,7 @@ Notification.prototype = {
|
|||||||
|
|
||||||
if (params.body)
|
if (params.body)
|
||||||
this.addBody(params.body, params.bodyMarkup);
|
this.addBody(params.body, params.bodyMarkup);
|
||||||
this._updated();
|
this.updated();
|
||||||
},
|
},
|
||||||
|
|
||||||
setIconVisible: function(visible) {
|
setIconVisible: function(visible) {
|
||||||
@ -589,20 +586,21 @@ Notification.prototype = {
|
|||||||
|
|
||||||
enableScrolling: function(enableScrolling) {
|
enableScrolling: function(enableScrolling) {
|
||||||
this._scrollPolicy = enableScrolling ? Gtk.PolicyType.AUTOMATIC : Gtk.PolicyType.NEVER;
|
this._scrollPolicy = enableScrolling ? Gtk.PolicyType.AUTOMATIC : Gtk.PolicyType.NEVER;
|
||||||
if (this._scrollArea)
|
if (this._scrollArea) {
|
||||||
this._scrollArea.vscrollbar_policy = this._scrollPolicy;
|
this._scrollArea.vscrollbar_policy = this._scrollPolicy;
|
||||||
|
this._scrollArea.enable_mouse_scrolling = enableScrolling;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createScrollArea: function() {
|
_createScrollArea: function() {
|
||||||
this._table.add_style_class_name('multi-line-notification');
|
this._table.add_style_class_name('multi-line-notification');
|
||||||
this._scrollArea = new St.ScrollView({ name: 'notification-scrollview',
|
this._scrollArea = new St.ScrollView({ style_class: 'notification-scrollview',
|
||||||
vscrollbar_policy: this._scrollPolicy,
|
vscrollbar_policy: this._scrollPolicy,
|
||||||
hscrollbar_policy: Gtk.PolicyType.NEVER,
|
hscrollbar_policy: Gtk.PolicyType.NEVER });
|
||||||
style_class: 'vfade' });
|
|
||||||
this._table.add(this._scrollArea, { row: 1,
|
this._table.add(this._scrollArea, { row: 1,
|
||||||
col: 2 });
|
col: 2 });
|
||||||
this._updateLastColumnSettings();
|
this._updateLastColumnSettings();
|
||||||
this._contentArea = new St.BoxLayout({ name: 'notification-body',
|
this._contentArea = new St.BoxLayout({ style_class: 'notification-body',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
this._scrollArea.add_actor(this._contentArea);
|
this._scrollArea.add_actor(this._contentArea);
|
||||||
// If we know the notification will be expandable, we need to add
|
// If we know the notification will be expandable, we need to add
|
||||||
@ -620,7 +618,7 @@ Notification.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._contentArea.add(actor, style ? style : {});
|
this._contentArea.add(actor, style ? style : {});
|
||||||
this._updated();
|
this.updated();
|
||||||
},
|
},
|
||||||
|
|
||||||
// addBody:
|
// addBody:
|
||||||
@ -683,7 +681,7 @@ Notification.prototype = {
|
|||||||
this._table.add_style_class_name('multi-line-notification');
|
this._table.add_style_class_name('multi-line-notification');
|
||||||
this._table.add(this._actionArea, props);
|
this._table.add(this._actionArea, props);
|
||||||
this._updateLastColumnSettings();
|
this._updateLastColumnSettings();
|
||||||
this._updated();
|
this.updated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLastColumnSettings: function() {
|
_updateLastColumnSettings: function() {
|
||||||
@ -738,7 +736,7 @@ Notification.prototype = {
|
|||||||
addButton: function(id, label) {
|
addButton: function(id, label) {
|
||||||
if (!this._buttonBox) {
|
if (!this._buttonBox) {
|
||||||
|
|
||||||
let box = new St.BoxLayout({ name: 'notification-actions' });
|
let box = new St.BoxLayout({ style_class: 'notification-actions' });
|
||||||
this.setActionArea(box, { x_expand: false,
|
this.setActionArea(box, { x_expand: false,
|
||||||
y_expand: false,
|
y_expand: false,
|
||||||
x_fill: false,
|
x_fill: false,
|
||||||
@ -764,7 +762,7 @@ Notification.prototype = {
|
|||||||
this._buttonFocusManager.add_group(this._buttonBox);
|
this._buttonFocusManager.add_group(this._buttonBox);
|
||||||
button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
|
button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
|
||||||
|
|
||||||
this._updated();
|
this.updated();
|
||||||
},
|
},
|
||||||
|
|
||||||
setUrgency: function(urgency) {
|
setUrgency: function(urgency) {
|
||||||
@ -809,7 +807,7 @@ Notification.prototype = {
|
|||||||
|
|
||||||
let titleBox = new Clutter.ActorBox();
|
let titleBox = new Clutter.ActorBox();
|
||||||
let titleBoxW = Math.min(titleNatW, availWidth);
|
let titleBoxW = Math.min(titleNatW, availWidth);
|
||||||
if (this._titleDirection == St.TextDirection.RTL) {
|
if (this._titleDirection == Clutter.TextDirection.RTL) {
|
||||||
titleBox.x1 = availWidth - titleBoxW;
|
titleBox.x1 = availWidth - titleBoxW;
|
||||||
titleBox.x2 = availWidth;
|
titleBox.x2 = availWidth;
|
||||||
} else {
|
} else {
|
||||||
@ -828,7 +826,7 @@ Notification.prototype = {
|
|||||||
} else {
|
} else {
|
||||||
let bannerBox = new Clutter.ActorBox();
|
let bannerBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
if (this._titleDirection == St.TextDirection.RTL) {
|
if (this._titleDirection == Clutter.TextDirection.RTL) {
|
||||||
bannerBox.x1 = 0;
|
bannerBox.x1 = 0;
|
||||||
bannerBox.x2 = titleBox.x1 - this._spacing;
|
bannerBox.x2 = titleBox.x1 - this._spacing;
|
||||||
|
|
||||||
@ -860,7 +858,7 @@ Notification.prototype = {
|
|||||||
if (this._canExpandContent()) {
|
if (this._canExpandContent()) {
|
||||||
this._addBannerBody();
|
this._addBannerBody();
|
||||||
this._table.add_style_class_name('multi-line-notification');
|
this._table.add_style_class_name('multi-line-notification');
|
||||||
this._updated();
|
this.updated();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}));
|
}));
|
||||||
@ -871,7 +869,7 @@ Notification.prototype = {
|
|||||||
(!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification'));
|
(!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification'));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updated: function() {
|
updated: function() {
|
||||||
if (this.expanded)
|
if (this.expanded)
|
||||||
this.expand(false);
|
this.expand(false);
|
||||||
},
|
},
|
||||||
@ -954,14 +952,12 @@ Notification.prototype = {
|
|||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
this.actor._delegate = null;
|
this.actor._delegate = null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(Notification.prototype);
|
Signals.addSignalMethods(Notification.prototype);
|
||||||
|
|
||||||
function Source(title) {
|
const Source = new Lang.Class({
|
||||||
this._init(title);
|
Name: 'MessageTraySource',
|
||||||
}
|
|
||||||
|
|
||||||
Source.prototype = {
|
|
||||||
ICON_SIZE: 24,
|
ICON_SIZE: 24,
|
||||||
|
|
||||||
_init: function(title) {
|
_init: function(title) {
|
||||||
@ -992,6 +988,7 @@ Source.prototype = {
|
|||||||
|
|
||||||
this.isTransient = false;
|
this.isTransient = false;
|
||||||
this.isChat = false;
|
this.isChat = false;
|
||||||
|
this.isMuted = false;
|
||||||
|
|
||||||
this.notifications = [];
|
this.notifications = [];
|
||||||
},
|
},
|
||||||
@ -1013,9 +1010,9 @@ Source.prototype = {
|
|||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
let [minWidth, minHeight, naturalWidth, naturalHeight] = this._counterBin.get_preferred_size();
|
let [minWidth, minHeight, naturalWidth, naturalHeight] = this._counterBin.get_preferred_size();
|
||||||
let direction = this.actor.get_direction();
|
let direction = this.actor.get_text_direction();
|
||||||
|
|
||||||
if (direction == St.TextDirection.LTR) {
|
if (direction == Clutter.TextDirection.LTR) {
|
||||||
// allocate on the right in LTR
|
// allocate on the right in LTR
|
||||||
childBox.x1 = box.x2 - naturalWidth;
|
childBox.x1 = box.x2 - naturalWidth;
|
||||||
childBox.x2 = box.x2;
|
childBox.x2 = box.x2;
|
||||||
@ -1056,6 +1053,13 @@ Source.prototype = {
|
|||||||
this.emit('title-changed');
|
this.emit('title-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setMuted: function(muted) {
|
||||||
|
if (!this.isChat || this.isMuted == muted)
|
||||||
|
return;
|
||||||
|
this.isMuted = muted;
|
||||||
|
this.emit('muted-changed');
|
||||||
|
},
|
||||||
|
|
||||||
// Called to create a new icon actor (of size this.ICON_SIZE).
|
// Called to create a new icon actor (of size this.ICON_SIZE).
|
||||||
// Must be overridden by the subclass if you do not pass icons
|
// Must be overridden by the subclass if you do not pass icons
|
||||||
// explicitly to the Notification() constructor.
|
// explicitly to the Notification() constructor.
|
||||||
@ -1094,6 +1098,7 @@ Source.prototype = {
|
|||||||
|
|
||||||
notify: function(notification) {
|
notify: function(notification) {
|
||||||
this.pushNotification(notification);
|
this.pushNotification(notification);
|
||||||
|
if (!this.isMuted)
|
||||||
this.emit('notify', notification);
|
this.emit('notify', notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1134,14 +1139,12 @@ Source.prototype = {
|
|||||||
_lastNotificationRemoved: function() {
|
_lastNotificationRemoved: function() {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(Source.prototype);
|
Signals.addSignalMethods(Source.prototype);
|
||||||
|
|
||||||
function SummaryItem(source) {
|
const SummaryItem = new Lang.Class({
|
||||||
this._init(source);
|
Name: 'SummaryItem',
|
||||||
}
|
|
||||||
|
|
||||||
SummaryItem.prototype = {
|
|
||||||
_init: function(source) {
|
_init: function(source) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.source.connect('notification-added', Lang.bind(this, this._notificationAddedToSource));
|
this.source.connect('notification-added', Lang.bind(this, this._notificationAddedToSource));
|
||||||
@ -1210,6 +1213,18 @@ SummaryItem.prototype = {
|
|||||||
}));
|
}));
|
||||||
this.rightClickMenu.add(item.actor);
|
this.rightClickMenu.add(item.actor);
|
||||||
|
|
||||||
|
if (source.isChat) {
|
||||||
|
item = new PopupMenu.PopupMenuItem('');
|
||||||
|
item.actor.connect('notify::mapped', Lang.bind(this, function() {
|
||||||
|
item.label.set_text(source.isMuted ? _("Unmute") : _("Mute"));
|
||||||
|
}));
|
||||||
|
item.connect('activate', Lang.bind(this, function() {
|
||||||
|
source.setMuted(!source.isMuted);
|
||||||
|
this.emit('done-displaying-content');
|
||||||
|
}));
|
||||||
|
this.rightClickMenu.add(item.actor);
|
||||||
|
}
|
||||||
|
|
||||||
let focusManager = St.FocusManager.get_for_stage(global.stage);
|
let focusManager = St.FocusManager.get_for_stage(global.stage);
|
||||||
focusManager.add_group(this.rightClickMenu);
|
focusManager.add_group(this.rightClickMenu);
|
||||||
},
|
},
|
||||||
@ -1317,26 +1332,26 @@ SummaryItem.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.notificationStack.get_children().length > 0)
|
let firstNotification = this._stackedNotifications[0];
|
||||||
this.notificationStack.get_children()[0]._delegate.setIconVisible(true);
|
if (firstNotification)
|
||||||
|
firstNotification.notification.setIconVisible(true);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(SummaryItem.prototype);
|
Signals.addSignalMethods(SummaryItem.prototype);
|
||||||
|
|
||||||
function MessageTray() {
|
const MessageTray = new Lang.Class({
|
||||||
this._init();
|
Name: 'MessageTray',
|
||||||
}
|
|
||||||
|
|
||||||
MessageTray.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._presence = new GnomeSession.Presence();
|
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
|
||||||
this._userStatus = GnomeSession.PresenceStatus.AVAILABLE;
|
this._onStatusChanged(proxy.status);
|
||||||
|
}));
|
||||||
this._busy = false;
|
this._busy = false;
|
||||||
this._backFromAway = false;
|
this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) {
|
||||||
this._presence.connect('StatusChanged', Lang.bind(this, this._onStatusChanged));
|
this._onStatusChanged(status);
|
||||||
this._presence.getStatus(Lang.bind(this, this._onStatusChanged));
|
}));
|
||||||
|
|
||||||
this.actor = new St.Group({ name: 'message-tray',
|
this.actor = new St.Widget({ name: 'message-tray',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
track_hover: true });
|
track_hover: true });
|
||||||
this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged));
|
this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged));
|
||||||
@ -1377,6 +1392,12 @@ MessageTray.prototype = {
|
|||||||
this._summaryItemTitleWidth = 0;
|
this._summaryItemTitleWidth = 0;
|
||||||
this._pointerBarrier = 0;
|
this._pointerBarrier = 0;
|
||||||
|
|
||||||
|
this._unseenNotifications = [];
|
||||||
|
this._idleMonitorWatchId = 0;
|
||||||
|
this._backFromAway = false;
|
||||||
|
|
||||||
|
this.idleMonitor = new Shell.IdleMonitor();
|
||||||
|
|
||||||
// To simplify the summary item animation code, we pretend
|
// To simplify the summary item animation code, we pretend
|
||||||
// that there's an invisible SummaryItem to the left of the
|
// that there's an invisible SummaryItem to the left of the
|
||||||
// leftmost real summary item, and that it's expanded when all
|
// leftmost real summary item, and that it's expanded when all
|
||||||
@ -1419,8 +1440,16 @@ MessageTray.prototype = {
|
|||||||
this._notificationRemoved = false;
|
this._notificationRemoved = false;
|
||||||
this._reNotifyAfterHideNotification = null;
|
this._reNotifyAfterHideNotification = null;
|
||||||
|
|
||||||
|
this._corner = new Clutter.Rectangle({ width: 1,
|
||||||
|
height: 1,
|
||||||
|
opacity: 0,
|
||||||
|
reactive: true });
|
||||||
|
this._corner.connect('enter-event', Lang.bind(this, this._onCornerEnter));
|
||||||
|
Main.layoutManager.trayBox.add_actor(this._corner);
|
||||||
|
Main.layoutManager.trackChrome(this._corner);
|
||||||
|
|
||||||
Main.layoutManager.trayBox.add_actor(this.actor);
|
Main.layoutManager.trayBox.add_actor(this.actor);
|
||||||
this.actor.y = -1;
|
this.actor.y = this.actor.height;
|
||||||
Main.layoutManager.trackChrome(this.actor);
|
Main.layoutManager.trackChrome(this.actor);
|
||||||
Main.layoutManager.trackChrome(this._notificationBin);
|
Main.layoutManager.trackChrome(this._notificationBin);
|
||||||
|
|
||||||
@ -1459,12 +1488,24 @@ MessageTray.prototype = {
|
|||||||
this._chatSummaryItemsCount = 0;
|
this._chatSummaryItemsCount = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onCornerEnter: function(actor, event) {
|
||||||
|
this._pointerInSummary = true;
|
||||||
|
this._updateState();
|
||||||
|
},
|
||||||
|
|
||||||
_setSizePosition: function() {
|
_setSizePosition: function() {
|
||||||
let monitor = Main.layoutManager.bottomMonitor;
|
let monitor = Main.layoutManager.bottomMonitor;
|
||||||
this._notificationBin.x = 0;
|
this._notificationBin.x = 0;
|
||||||
this._notificationBin.width = monitor.width;
|
this._notificationBin.width = monitor.width;
|
||||||
this._summaryBin.x = 0;
|
this._summaryBin.x = 0;
|
||||||
this._summaryBin.width = monitor.width;
|
this._summaryBin.width = monitor.width;
|
||||||
|
|
||||||
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
|
this._corner.x = 0;
|
||||||
|
else
|
||||||
|
this._corner.x = Main.layoutManager.trayBox.width - 1;
|
||||||
|
|
||||||
|
this._corner.y = Main.layoutManager.trayBox.height - 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
contains: function(source) {
|
contains: function(source) {
|
||||||
@ -1488,10 +1529,10 @@ MessageTray.prototype = {
|
|||||||
let summaryItem = new SummaryItem(source);
|
let summaryItem = new SummaryItem(source);
|
||||||
|
|
||||||
if (source.isChat) {
|
if (source.isChat) {
|
||||||
this._summary.insert_actor(summaryItem.actor, 0);
|
this._summary.insert_child_at_index(summaryItem.actor, 0);
|
||||||
this._chatSummaryItemsCount++;
|
this._chatSummaryItemsCount++;
|
||||||
} else {
|
} else {
|
||||||
this._summary.insert_actor(summaryItem.actor, this._chatSummaryItemsCount);
|
this._summary.insert_child_at_index(summaryItem.actor, this._chatSummaryItemsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
let titleWidth = summaryItem.getTitleNaturalWidth();
|
let titleWidth = summaryItem.getTitleNaturalWidth();
|
||||||
@ -1518,6 +1559,14 @@ MessageTray.prototype = {
|
|||||||
|
|
||||||
source.connect('notify', Lang.bind(this, this._onNotify));
|
source.connect('notify', Lang.bind(this, this._onNotify));
|
||||||
|
|
||||||
|
source.connect('muted-changed', Lang.bind(this,
|
||||||
|
function () {
|
||||||
|
if (source.isMuted)
|
||||||
|
this._notificationQueue = this._notificationQueue.filter(function(notification) {
|
||||||
|
return source != notification.source;
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
summaryItem.actor.connect('notify::hover', Lang.bind(this,
|
summaryItem.actor.connect('notify::hover', Lang.bind(this,
|
||||||
function () {
|
function () {
|
||||||
this._onSummaryItemHoverChanged(summaryItem);
|
this._onSummaryItemHoverChanged(summaryItem);
|
||||||
@ -1592,6 +1641,10 @@ MessageTray.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationDestroy: function(notification) {
|
_onNotificationDestroy: function(notification) {
|
||||||
|
let unseenNotificationsIndex = this._unseenNotifications.indexOf(notification);
|
||||||
|
if (unseenNotificationsIndex != -1)
|
||||||
|
this._unseenNotifications.splice(unseenNotificationsIndex, 1);
|
||||||
|
|
||||||
if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) {
|
if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) {
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
this._notificationRemoved = true;
|
this._notificationRemoved = true;
|
||||||
@ -1832,7 +1885,7 @@ MessageTray.prototype = {
|
|||||||
// automatically. Instead, the user is able to expand the notification by mousing away from it and then
|
// automatically. Instead, the user is able to expand the notification by mousing away from it and then
|
||||||
// mousing back in. Because this is an expected action, we set the boolean flag that indicates that a longer
|
// mousing back in. Because this is an expected action, we set the boolean flag that indicates that a longer
|
||||||
// timeout should be used before popping down the notification.
|
// timeout should be used before popping down the notification.
|
||||||
if (this._notificationBin.contains(actorAtShowNotificationPosition)) {
|
if (this.actor.contains(actorAtShowNotificationPosition)) {
|
||||||
this._useLongerTrayLeftTimeout = true;
|
this._useLongerTrayLeftTimeout = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1874,17 +1927,11 @@ MessageTray.prototype = {
|
|||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStatusChanged: function(presence, status) {
|
_onStatusChanged: function(status) {
|
||||||
this._backFromAway = (this._userStatus == GnomeSession.PresenceStatus.IDLE && this._userStatus != status);
|
|
||||||
this._userStatus = status;
|
|
||||||
|
|
||||||
if (status == GnomeSession.PresenceStatus.BUSY) {
|
if (status == GnomeSession.PresenceStatus.BUSY) {
|
||||||
// remove notification and allow the summary to be closed now
|
// remove notification and allow the summary to be closed now
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
if (this._summaryTimeoutId) {
|
this._unsetSummaryTimeout();
|
||||||
Mainloop.source_remove(this._summaryTimeoutId);
|
|
||||||
this._summaryTimeoutId = 0;
|
|
||||||
}
|
|
||||||
this._busy = true;
|
this._busy = true;
|
||||||
} else if (status != GnomeSession.PresenceStatus.IDLE) {
|
} else if (status != GnomeSession.PresenceStatus.IDLE) {
|
||||||
// We preserve the previous value of this._busy if the status turns to IDLE
|
// We preserve the previous value of this._busy if the status turns to IDLE
|
||||||
@ -1914,6 +1961,7 @@ MessageTray.prototype = {
|
|||||||
this._pointerInTray = false;
|
this._pointerInTray = false;
|
||||||
this._pointerInSummary = false;
|
this._pointerInSummary = false;
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
|
this._unsetSummaryTimeout();
|
||||||
this._updateState();
|
this._updateState();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1924,6 +1972,7 @@ MessageTray.prototype = {
|
|||||||
this._pointerInTray = false;
|
this._pointerInTray = false;
|
||||||
this._pointerInSummary = false;
|
this._pointerInSummary = false;
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
|
this._unsetSummaryTimeout();
|
||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1969,15 +2018,13 @@ MessageTray.prototype = {
|
|||||||
|| notificationsVisible;
|
|| notificationsVisible;
|
||||||
|
|
||||||
if (this._summaryState == State.HIDDEN && !mustHideSummary) {
|
if (this._summaryState == State.HIDDEN && !mustHideSummary) {
|
||||||
if (this._backFromAway) {
|
if (summarySummoned) {
|
||||||
// Immediately set this to false, so that we don't schedule a timeout later
|
|
||||||
this._backFromAway = false;
|
|
||||||
if (!this._busy)
|
|
||||||
this._showSummary(LONGER_SUMMARY_TIMEOUT);
|
|
||||||
} else if (notificationsDone && this._newSummaryItems.length > 0 && !this._busy) {
|
|
||||||
this._showSummary(SUMMARY_TIMEOUT);
|
|
||||||
} else if (summarySummoned) {
|
|
||||||
this._showSummary(0);
|
this._showSummary(0);
|
||||||
|
} else if (notificationsDone && !this._busy) {
|
||||||
|
if (this._backFromAway && this._unseenNotifications.length > 0)
|
||||||
|
this._showSummary(LONGER_SUMMARY_TIMEOUT);
|
||||||
|
else if (this._newSummaryItems.length > 0)
|
||||||
|
this._showSummary(SUMMARY_TIMEOUT);
|
||||||
}
|
}
|
||||||
} else if (this._summaryState == State.SHOWN) {
|
} else if (this._summaryState == State.SHOWN) {
|
||||||
if (!summaryPinned || mustHideSummary)
|
if (!summaryPinned || mustHideSummary)
|
||||||
@ -2009,8 +2056,11 @@ MessageTray.prototype = {
|
|||||||
if (haveClickedSummaryItem && !summarySourceIsMainNotificationSource && canShowSummaryBoxPointer && !requestedNotificationStackIsEmpty)
|
if (haveClickedSummaryItem && !summarySourceIsMainNotificationSource && canShowSummaryBoxPointer && !requestedNotificationStackIsEmpty)
|
||||||
this._showSummaryBoxPointer();
|
this._showSummaryBoxPointer();
|
||||||
} else if (this._summaryBoxPointerState == State.SHOWN) {
|
} else if (this._summaryBoxPointerState == State.SHOWN) {
|
||||||
if (!haveClickedSummaryItem || !canShowSummaryBoxPointer || wrongSummaryBoxPointer || mustHideSummary)
|
if (!haveClickedSummaryItem || !canShowSummaryBoxPointer || wrongSummaryBoxPointer || mustHideSummary) {
|
||||||
this._hideSummaryBoxPointer();
|
this._hideSummaryBoxPointer();
|
||||||
|
if (wrongSummaryBoxPointer)
|
||||||
|
this._showSummaryBoxPointer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tray itself
|
// Tray itself
|
||||||
@ -2057,14 +2107,38 @@ MessageTray.prototype = {
|
|||||||
|
|
||||||
_hideTray: function() {
|
_hideTray: function() {
|
||||||
this._tween(this.actor, '_trayState', State.HIDDEN,
|
this._tween(this.actor, '_trayState', State.HIDDEN,
|
||||||
{ y: -1,
|
{ y: this.actor.height,
|
||||||
time: ANIMATION_TIME,
|
time: ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad'
|
transition: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onIdleMonitorWatch: function(monitor, id, userBecameIdle) {
|
||||||
|
this.idleMonitor.remove_watch(this._idleMonitorWatchId);
|
||||||
|
this._idleMonitorWatchId = 0;
|
||||||
|
|
||||||
|
if (userBecameIdle) {
|
||||||
|
// The user became idle, which means the user was active while the notifications were
|
||||||
|
// shown and we can unset this._unseenNotifications .
|
||||||
|
this._unseenNotiications = [];
|
||||||
|
} else if (this._unseenNotifications.length == 1 && this._unseenNotifications[0] == this._notification) {
|
||||||
|
// The user became active while the only notification in this._unseenNotifications is being shown
|
||||||
|
// as this._notification , so we can unset this._unseenNotifications .
|
||||||
|
this._unseenNotifications = [];
|
||||||
|
} else {
|
||||||
|
// The user became active and we have one or more unseen notifications. We should show
|
||||||
|
// the message tray to the user to inform the user about the missed notifications.
|
||||||
|
this._backFromAway = true;
|
||||||
|
this._updateState();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_showNotification: function() {
|
_showNotification: function() {
|
||||||
this._notification = this._notificationQueue.shift();
|
this._notification = this._notificationQueue.shift();
|
||||||
|
this._unseenNotifications.push(this._notification);
|
||||||
|
if (this._idleMonitorWatchId == 0)
|
||||||
|
this._idleMonitorWatchId = this.idleMonitor.add_watch(1000,
|
||||||
|
Lang.bind(this, this._onIdleMonitorWatch));
|
||||||
this._notificationClickedId = this._notification.connect('done-displaying',
|
this._notificationClickedId = this._notification.connect('done-displaying',
|
||||||
Lang.bind(this, this._escapeTray));
|
Lang.bind(this, this._escapeTray));
|
||||||
this._notificationBin.child = this._notification.actor;
|
this._notificationBin.child = this._notification.actor;
|
||||||
@ -2143,6 +2217,13 @@ MessageTray.prototype = {
|
|||||||
Lang.bind(this, this._notificationTimeout));
|
Lang.bind(this, this._notificationTimeout));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_unsetSummaryTimeout: function(timeout) {
|
||||||
|
if (this._summaryTimeoutId) {
|
||||||
|
Mainloop.source_remove(this._summaryTimeoutId);
|
||||||
|
this._summaryTimeoutId = 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
_notificationTimeout: function() {
|
_notificationTimeout: function() {
|
||||||
let [x, y, mods] = global.get_pointer();
|
let [x, y, mods] = global.get_pointer();
|
||||||
if (y > this._lastSeenMouseY + 10 && !this.actor.hover) {
|
if (y > this._lastSeenMouseY + 10 && !this.actor.hover) {
|
||||||
@ -2226,6 +2307,7 @@ MessageTray.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_showSummary: function(timeout) {
|
_showSummary: function(timeout) {
|
||||||
|
this._updateSeenSummaryItems();
|
||||||
this._summaryBin.opacity = 0;
|
this._summaryBin.opacity = 0;
|
||||||
this._summaryBin.y = this.actor.height;
|
this._summaryBin.y = this.actor.height;
|
||||||
this._tween(this._summaryBin, '_summaryState', State.SHOWN,
|
this._tween(this._summaryBin, '_summaryState', State.SHOWN,
|
||||||
@ -2240,8 +2322,6 @@ MessageTray.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_showSummaryCompleted: function(timeout) {
|
_showSummaryCompleted: function(timeout) {
|
||||||
this._newSummaryItems = [];
|
|
||||||
|
|
||||||
if (timeout != 0) {
|
if (timeout != 0) {
|
||||||
this._summaryTimeoutId =
|
this._summaryTimeoutId =
|
||||||
Mainloop.timeout_add(timeout * 1000,
|
Mainloop.timeout_add(timeout * 1000,
|
||||||
@ -2256,6 +2336,7 @@ MessageTray.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_hideSummary: function() {
|
_hideSummary: function() {
|
||||||
|
this._updateSeenSummaryItems();
|
||||||
this._tween(this._summaryBin, '_summaryState', State.HIDDEN,
|
this._tween(this._summaryBin, '_summaryState', State.HIDDEN,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: ANIMATION_TIME,
|
time: ANIMATION_TIME,
|
||||||
@ -2263,13 +2344,20 @@ MessageTray.prototype = {
|
|||||||
onComplete: this._hideSummaryCompleted,
|
onComplete: this._hideSummaryCompleted,
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
});
|
});
|
||||||
this._newSummaryItems = [];
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideSummaryCompleted: function() {
|
_hideSummaryCompleted: function() {
|
||||||
this._setExpandedSummaryItem(null);
|
this._setExpandedSummaryItem(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_updateSeenSummaryItems: function() {
|
||||||
|
if (this._backFromAway) {
|
||||||
|
this._backFromAway = false;
|
||||||
|
this._unseenNotifications = [];
|
||||||
|
}
|
||||||
|
this._newSummaryItems = [];
|
||||||
|
},
|
||||||
|
|
||||||
_showSummaryBoxPointer: function() {
|
_showSummaryBoxPointer: function() {
|
||||||
this._summaryBoxPointerItem = this._clickedSummaryItem;
|
this._summaryBoxPointerItem = this._clickedSummaryItem;
|
||||||
this._summaryBoxPointerContentUpdatedId = this._summaryBoxPointerItem.connect('content-updated',
|
this._summaryBoxPointerContentUpdatedId = this._summaryBoxPointerItem.connect('content-updated',
|
||||||
@ -2351,9 +2439,8 @@ MessageTray.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._summaryBoxPointerState = State.HIDING;
|
this._summaryBoxPointerState = State.HIDING;
|
||||||
// Unset this._clickedSummaryItem if we are no longer showing the summary or if
|
// Unset this._clickedSummaryItem if we are no longer showing the summary
|
||||||
// this._clickedSummaryItem is still the item associated with the currently showing box pointer
|
if (this._summaryState != State.SHOWN)
|
||||||
if (this._summaryState != State.SHOWN || this._summaryBoxPointerItem == this._clickedSummaryItem)
|
|
||||||
this._unsetClickedSummaryItem();
|
this._unsetClickedSummaryItem();
|
||||||
|
|
||||||
this._focusGrabber.ungrabFocus();
|
this._focusGrabber.ungrabFocus();
|
||||||
@ -2395,17 +2482,14 @@ MessageTray.prototype = {
|
|||||||
if (this._clickedSummaryItem)
|
if (this._clickedSummaryItem)
|
||||||
this._updateState();
|
this._updateState();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function SystemNotificationSource() {
|
const SystemNotificationSource = new Lang.Class({
|
||||||
this._init();
|
Name: 'SystemNotificationSource',
|
||||||
}
|
Extends: Source,
|
||||||
|
|
||||||
SystemNotificationSource.prototype = {
|
|
||||||
__proto__: Source.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Source.prototype._init.call(this, _("System Information"));
|
this.parent(_("System Information"));
|
||||||
|
|
||||||
this._setSummaryIcon(this.createNotificationIcon());
|
this._setSummaryIcon(this.createNotificationIcon());
|
||||||
},
|
},
|
||||||
@ -2419,4 +2503,4 @@ SystemNotificationSource.prototype = {
|
|||||||
open: function() {
|
open: function() {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -10,6 +10,7 @@ const Pango = imports.gi.Pango;
|
|||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
|
||||||
@ -29,11 +30,9 @@ const State = {
|
|||||||
FADED_OUT: 4
|
FADED_OUT: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
function ModalDialog() {
|
const ModalDialog = new Lang.Class({
|
||||||
this._init();
|
Name: 'ModalDialog',
|
||||||
}
|
|
||||||
|
|
||||||
ModalDialog.prototype = {
|
|
||||||
_init: function(params) {
|
_init: function(params) {
|
||||||
params = Params.parse(params, { shellReactive: false,
|
params = Params.parse(params, { shellReactive: false,
|
||||||
styleClass: null });
|
styleClass: null });
|
||||||
@ -42,13 +41,14 @@ ModalDialog.prototype = {
|
|||||||
this._hasModal = false;
|
this._hasModal = false;
|
||||||
this._shellReactive = params.shellReactive;
|
this._shellReactive = params.shellReactive;
|
||||||
|
|
||||||
this._group = new St.Group({ visible: false,
|
this._group = new St.Widget({ visible: false,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0 });
|
y: 0,
|
||||||
|
accessible_role: Atk.Role.DIALOG });
|
||||||
Main.uiGroup.add_actor(this._group);
|
Main.uiGroup.add_actor(this._group);
|
||||||
|
|
||||||
let constraint = new Clutter.BindConstraint({ source: global.stage,
|
let constraint = new Clutter.BindConstraint({ source: global.stage,
|
||||||
coordinate: Clutter.BindCoordinate.POSITION | Clutter.BindCoordinate.SIZE });
|
coordinate: Clutter.BindCoordinate.ALL });
|
||||||
this._group.add_constraint(constraint);
|
this._group.add_constraint(constraint);
|
||||||
|
|
||||||
this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
|
this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
|
||||||
@ -89,6 +89,7 @@ ModalDialog.prototype = {
|
|||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
|
|
||||||
this._buttonLayout = new St.BoxLayout({ style_class: 'modal-dialog-button-box',
|
this._buttonLayout = new St.BoxLayout({ style_class: 'modal-dialog-button-box',
|
||||||
|
visible: false,
|
||||||
vertical: false });
|
vertical: false });
|
||||||
this._dialogLayout.add(this._buttonLayout,
|
this._dialogLayout.add(this._buttonLayout,
|
||||||
{ expand: true,
|
{ expand: true,
|
||||||
@ -97,6 +98,7 @@ ModalDialog.prototype = {
|
|||||||
|
|
||||||
global.focus_manager.add_group(this._dialogLayout);
|
global.focus_manager.add_group(this._dialogLayout);
|
||||||
this._initialKeyFocus = this._dialogLayout;
|
this._initialKeyFocus = this._dialogLayout;
|
||||||
|
this._initialKeyFocusDestroyId = 0;
|
||||||
this._savedKeyFocus = null;
|
this._savedKeyFocus = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -107,9 +109,11 @@ ModalDialog.prototype = {
|
|||||||
setButtons: function(buttons) {
|
setButtons: function(buttons) {
|
||||||
let hadChildren = this._buttonLayout.get_children() > 0;
|
let hadChildren = this._buttonLayout.get_children() > 0;
|
||||||
|
|
||||||
this._buttonLayout.destroy_children();
|
this._buttonLayout.destroy_all_children();
|
||||||
this._actionKeys = {};
|
this._actionKeys = {};
|
||||||
|
|
||||||
|
this._buttonLayout.visible = (buttons.length > 0);
|
||||||
|
|
||||||
for (let i = 0; i < buttons.length; i++) {
|
for (let i = 0; i < buttons.length; i++) {
|
||||||
let buttonInfo = buttons[i];
|
let buttonInfo = buttons[i];
|
||||||
let label = buttonInfo['label'];
|
let label = buttonInfo['label'];
|
||||||
@ -131,8 +135,7 @@ ModalDialog.prototype = {
|
|||||||
else
|
else
|
||||||
x_alignment = St.Align.MIDDLE;
|
x_alignment = St.Align.MIDDLE;
|
||||||
|
|
||||||
if (this._initialKeyFocus == this._dialogLayout ||
|
if (!this._initialKeyFocusDestroyId)
|
||||||
this._buttonLayout.contains(this._initialKeyFocus))
|
|
||||||
this._initialKeyFocus = buttonInfo.button;
|
this._initialKeyFocus = buttonInfo.button;
|
||||||
this._buttonLayout.add(buttonInfo.button,
|
this._buttonLayout.add(buttonInfo.button,
|
||||||
{ expand: true,
|
{ expand: true,
|
||||||
@ -202,7 +205,15 @@ ModalDialog.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setInitialKeyFocus: function(actor) {
|
setInitialKeyFocus: function(actor) {
|
||||||
|
if (this._initialKeyFocusDestroyId)
|
||||||
|
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
||||||
|
|
||||||
this._initialKeyFocus = actor;
|
this._initialKeyFocus = actor;
|
||||||
|
|
||||||
|
this._initialKeyFocusDestroyId = actor.connect('destroy', Lang.bind(this, function() {
|
||||||
|
this._initialKeyFocus = this._dialogLayout;
|
||||||
|
this._initialKeyFocusDestroyId = 0;
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(timestamp) {
|
open: function(timestamp) {
|
||||||
@ -303,5 +314,5 @@ ModalDialog.prototype = {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(ModalDialog.prototype);
|
Signals.addSignalMethods(ModalDialog.prototype);
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const GObject = imports.gi.GObject;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const NetworkManager = imports.gi.NetworkManager;
|
const NetworkManager = imports.gi.NetworkManager;
|
||||||
const NMClient = imports.gi.NMClient;
|
const NMClient = imports.gi.NMClient;
|
||||||
@ -28,19 +30,19 @@ const Pango = imports.gi.Pango;
|
|||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
|
||||||
|
const Config = imports.misc.config;
|
||||||
const ModalDialog = imports.ui.modalDialog;
|
const ModalDialog = imports.ui.modalDialog;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const ShellEntry = imports.ui.shellEntry;
|
const ShellEntry = imports.ui.shellEntry;
|
||||||
|
|
||||||
function NetworkSecretDialog() {
|
const VPN_UI_GROUP = 'VPN Plugin UI';
|
||||||
this._init.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkSecretDialog.prototype = {
|
const NetworkSecretDialog = new Lang.Class({
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
Name: 'NetworkSecretDialog',
|
||||||
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(agent, requestId, connection, settingName, hints) {
|
_init: function(agent, requestId, connection, settingName, hints, contentOverride) {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'polkit-dialog' });
|
this.parent({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
this._agent = agent;
|
this._agent = agent;
|
||||||
this._requestId = requestId;
|
this._requestId = requestId;
|
||||||
@ -48,9 +50,12 @@ NetworkSecretDialog.prototype = {
|
|||||||
this._settingName = settingName;
|
this._settingName = settingName;
|
||||||
this._hints = hints;
|
this._hints = hints;
|
||||||
|
|
||||||
|
if (contentOverride)
|
||||||
|
this._content = contentOverride;
|
||||||
|
else
|
||||||
this._content = this._getContent();
|
this._content = this._getContent();
|
||||||
|
|
||||||
let mainContentBox = new St.BoxLayout({ style_class: 'polkit-dialog-main-layout',
|
let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
|
||||||
vertical: false });
|
vertical: false });
|
||||||
this.contentLayout.add(mainContentBox,
|
this.contentLayout.add(mainContentBox,
|
||||||
{ x_fill: true,
|
{ x_fill: true,
|
||||||
@ -63,19 +68,19 @@ NetworkSecretDialog.prototype = {
|
|||||||
x_align: St.Align.END,
|
x_align: St.Align.END,
|
||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
|
|
||||||
let messageBox = new St.BoxLayout({ style_class: 'polkit-dialog-message-layout',
|
let messageBox = new St.BoxLayout({ style_class: 'prompt-dialog-message-layout',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
mainContentBox.add(messageBox,
|
mainContentBox.add(messageBox,
|
||||||
{ y_align: St.Align.START });
|
{ y_align: St.Align.START });
|
||||||
|
|
||||||
let subjectLabel = new St.Label({ style_class: 'polkit-dialog-headline',
|
let subjectLabel = new St.Label({ style_class: 'prompt-dialog-headline',
|
||||||
text: this._content.title });
|
text: this._content.title });
|
||||||
messageBox.add(subjectLabel,
|
messageBox.add(subjectLabel,
|
||||||
{ y_fill: false,
|
{ y_fill: false,
|
||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
|
|
||||||
if (this._content.message != null) {
|
if (this._content.message != null) {
|
||||||
let descriptionLabel = new St.Label({ style_class: 'polkit-dialog-description',
|
let descriptionLabel = new St.Label({ style_class: 'prompt-dialog-description',
|
||||||
text: this._content.message,
|
text: this._content.message,
|
||||||
// HACK: for reasons unknown to me, the label
|
// HACK: for reasons unknown to me, the label
|
||||||
// is not asked the correct height for width,
|
// is not asked the correct height for width,
|
||||||
@ -96,12 +101,12 @@ NetworkSecretDialog.prototype = {
|
|||||||
let pos = 0;
|
let pos = 0;
|
||||||
for (let i = 0; i < this._content.secrets.length; i++) {
|
for (let i = 0; i < this._content.secrets.length; i++) {
|
||||||
let secret = this._content.secrets[i];
|
let secret = this._content.secrets[i];
|
||||||
let label = new St.Label({ style_class: 'polkit-dialog-password-label',
|
let label = new St.Label({ style_class: 'prompt-dialog-password-label',
|
||||||
text: secret.label });
|
text: secret.label });
|
||||||
|
|
||||||
let reactive = secret.key != null;
|
let reactive = secret.key != null;
|
||||||
|
|
||||||
secret.entry = new St.Entry({ style_class: 'polkit-dialog-password-entry',
|
secret.entry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
|
||||||
text: secret.value, can_focus: reactive,
|
text: secret.value, can_focus: reactive,
|
||||||
reactive: reactive });
|
reactive: reactive });
|
||||||
ShellEntry.addContextMenu(secret.entry,
|
ShellEntry.addContextMenu(secret.entry,
|
||||||
@ -177,14 +182,14 @@ NetworkSecretDialog.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this._agent.respond(this._requestId, false);
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
|
||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
}
|
}
|
||||||
// do nothing if not valid
|
// do nothing if not valid
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel: function() {
|
||||||
this._agent.respond(this._requestId, true);
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -358,23 +363,263 @@ NetworkSecretDialog.prototype = {
|
|||||||
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NetworkAgent() {
|
const VPNRequestHandler = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'VPNRequestHandler',
|
||||||
|
|
||||||
|
_init: function(agent, requestId, authHelper, serviceType, connection, hints, flags) {
|
||||||
|
this._agent = agent;
|
||||||
|
this._requestId = requestId;
|
||||||
|
this._connection = connection;
|
||||||
|
this._pluginOutBuffer = [];
|
||||||
|
this._title = null;
|
||||||
|
this._description = null;
|
||||||
|
this._content = [ ];
|
||||||
|
this._shellDialog = null;
|
||||||
|
|
||||||
|
let connectionSetting = connection.get_setting_connection();
|
||||||
|
|
||||||
|
let argv = [ authHelper.fileName,
|
||||||
|
'-u', connectionSetting.uuid,
|
||||||
|
'-n', connectionSetting.id,
|
||||||
|
'-s', serviceType
|
||||||
|
];
|
||||||
|
if (authHelper.externalUIMode)
|
||||||
|
argv.push('--external-ui-mode');
|
||||||
|
if (flags & NMClient.SecretAgentGetSecretsFlags.ALLOW_INTERACTION)
|
||||||
|
argv.push('-i');
|
||||||
|
if (flags & NMClient.SecretAgentGetSecretsFlags.REQUEST_NEW)
|
||||||
|
argv.push('-r');
|
||||||
|
|
||||||
|
this._newStylePlugin = authHelper.externalUIMode;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let [success, pid, stdin, stdout, stderr] =
|
||||||
|
GLib.spawn_async_with_pipes(null, /* pwd */
|
||||||
|
argv,
|
||||||
|
null, /* envp */
|
||||||
|
GLib.SpawnFlags.DO_NOT_REAP_CHILD,
|
||||||
|
null /* child_setup */);
|
||||||
|
|
||||||
|
this._childPid = pid;
|
||||||
|
this._stdin = new Gio.UnixOutputStream({ fd: stdin, close_fd: true });
|
||||||
|
this._stdout = new Gio.UnixInputStream({ fd: stdout, close_fd: true });
|
||||||
|
// We need this one too, even if don't actually care of what the process
|
||||||
|
// has to say on stderr, because otherwise the fd opened by g_spawn_async_with_pipes
|
||||||
|
// is kept open indefinitely
|
||||||
|
let stderrStream = new Gio.UnixInputStream({ fd: stderr, close_fd: true });
|
||||||
|
stderrStream.close(null);
|
||||||
|
this._dataStdout = new Gio.DataInputStream({ base_stream: this._stdout });
|
||||||
|
|
||||||
|
if (this._newStylePlugin)
|
||||||
|
this._readStdoutNewStyle();
|
||||||
|
else
|
||||||
|
this._readStdoutOldStyle();
|
||||||
|
|
||||||
|
this._childWatch = GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid,
|
||||||
|
Lang.bind(this, this._vpnChildFinished));
|
||||||
|
|
||||||
|
this._writeConnection();
|
||||||
|
} catch(e) {
|
||||||
|
logError(e, 'error while spawning VPN auth helper');
|
||||||
|
|
||||||
|
this._agent.respond(requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
cancel: function() {
|
||||||
|
if (this._newStylePlugin && this._shellDialog) {
|
||||||
|
this._shellDialog.close(global.get_current_time());
|
||||||
|
this._shellDialog.destroy();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
this._stdin.write('QUIT\n\n', null);
|
||||||
|
} catch(e) { /* ignore broken pipe errors */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkAgent.prototype = {
|
this.destroy();
|
||||||
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
if (this._destroyed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GLib.source_remove(this._childWatch);
|
||||||
|
|
||||||
|
this._stdin.close(null);
|
||||||
|
// Stdout is closed when we finish reading from it
|
||||||
|
|
||||||
|
this._destroyed = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
_vpnChildFinished: function(pid, status, requestObj) {
|
||||||
|
if (this._newStylePlugin) {
|
||||||
|
// For new style plugin, all work is done in the async reading functions
|
||||||
|
// Just reap the process here
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let [exited, exitStatus] = Shell.util_wifexited(status);
|
||||||
|
|
||||||
|
if (exited) {
|
||||||
|
if (exitStatus != 0)
|
||||||
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||||
|
else
|
||||||
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
|
||||||
|
} else
|
||||||
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
|
||||||
|
|
||||||
|
this.destroy();
|
||||||
|
},
|
||||||
|
|
||||||
|
_vpnChildProcessLineOldStyle: function(line) {
|
||||||
|
if (this._previousLine != undefined) {
|
||||||
|
// Two consecutive newlines mean that the child should be closed
|
||||||
|
// (the actual newlines are eaten by Gio.DataInputStream)
|
||||||
|
// Send a termination message
|
||||||
|
if (line == '' && this._previousLine == '') {
|
||||||
|
try {
|
||||||
|
this._stdin.write('QUIT\n\n', null);
|
||||||
|
} catch(e) { /* ignore broken pipe errors */ }
|
||||||
|
} else {
|
||||||
|
this._agent.set_password(this._requestId, this._previousLine, line);
|
||||||
|
this._previousLine = undefined;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this._previousLine = line;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_readStdoutOldStyle: function() {
|
||||||
|
this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
||||||
|
let [line, len] = this._dataStdout.read_line_finish_utf8(result);
|
||||||
|
|
||||||
|
if (line == null) {
|
||||||
|
// end of file
|
||||||
|
this._stdout.close(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._vpnChildProcessLineOldStyle(line);
|
||||||
|
|
||||||
|
// try to read more!
|
||||||
|
this._readStdoutOldStyle();
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
_readStdoutNewStyle: function() {
|
||||||
|
this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
||||||
|
let cnt = this._dataStdout.fill_finish(result);
|
||||||
|
|
||||||
|
if (cnt == 0) {
|
||||||
|
// end of file
|
||||||
|
this._showNewStyleDialog();
|
||||||
|
|
||||||
|
this._stdout.close(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to read more
|
||||||
|
this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size());
|
||||||
|
this._readStdoutNewStyle();
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
_showNewStyleDialog: function() {
|
||||||
|
let keyfile = new GLib.KeyFile();
|
||||||
|
let contentOverride;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let data = this._dataStdout.peek_buffer();
|
||||||
|
keyfile.load_from_data(data.toString(), data.length,
|
||||||
|
GLib.KeyFileFlags.NONE);
|
||||||
|
|
||||||
|
if (keyfile.get_integer(VPN_UI_GROUP, 'Version') != 2)
|
||||||
|
throw new Error('Invalid plugin keyfile version, is %d');
|
||||||
|
|
||||||
|
contentOverride = { title: keyfile.get_string(VPN_UI_GROUP, 'Title'),
|
||||||
|
message: keyfile.get_string(VPN_UI_GROUP, 'Description'),
|
||||||
|
secrets: [] };
|
||||||
|
|
||||||
|
let [groups, len] = keyfile.get_groups();
|
||||||
|
for (let i = 0; i < groups.length; i++) {
|
||||||
|
if (groups[i] == VPN_UI_GROUP)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
let value = keyfile.get_string(groups[i], 'Value');
|
||||||
|
let shouldAsk = keyfile.get_boolean(groups[i], 'ShouldAsk');
|
||||||
|
|
||||||
|
if (shouldAsk) {
|
||||||
|
contentOverride.secrets.push({ label: keyfile.get_string(groups[i], 'Label'),
|
||||||
|
key: groups[i],
|
||||||
|
value: value,
|
||||||
|
password: keyfile.get_boolean(groups[i], 'IsSecret')
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (!value.length) // Ignore empty secrets
|
||||||
|
continue;
|
||||||
|
|
||||||
|
this._agent.set_password(this._requestId, groups[i], value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
logError(e, 'error while reading VPN plugin output keyfile');
|
||||||
|
|
||||||
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contentOverride.secrets.length) {
|
||||||
|
// Only show the dialog if we actually have something to ask
|
||||||
|
this._shellDialog = new NetworkSecretDialog(this._agent, this._requestId, this._connection, 'vpn', [], contentOverride);
|
||||||
|
this._shellDialog.open(global.get_current_time());
|
||||||
|
} else {
|
||||||
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_writeConnection: function() {
|
||||||
|
let vpnSetting = this._connection.get_setting_vpn();
|
||||||
|
|
||||||
|
try {
|
||||||
|
vpnSetting.foreach_data_item(Lang.bind(this, function(key, value) {
|
||||||
|
this._stdin.write('DATA_KEY=' + key + '\n', null);
|
||||||
|
this._stdin.write('DATA_VAL=' + (value || '') + '\n\n', null);
|
||||||
|
}));
|
||||||
|
vpnSetting.foreach_secret(Lang.bind(this, function(key, value) {
|
||||||
|
this._stdin.write('SECRET_KEY=' + key + '\n', null);
|
||||||
|
this._stdin.write('SECRET_VAL=' + (value || '') + '\n\n', null);
|
||||||
|
}));
|
||||||
|
this._stdin.write('DONE\n\n', null);
|
||||||
|
} catch(e) {
|
||||||
|
logError(e, 'internal error while writing connection to helper');
|
||||||
|
|
||||||
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const NetworkAgent = new Lang.Class({
|
||||||
|
Name: 'NetworkAgent',
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._native = new Shell.NetworkAgent({ auto_register: true,
|
this._native = new Shell.NetworkAgent({ auto_register: true,
|
||||||
identifier: 'org.gnome.Shell.NetworkAgent' });
|
identifier: 'org.gnome.Shell.NetworkAgent' });
|
||||||
|
|
||||||
this._dialogs = { };
|
this._dialogs = { };
|
||||||
|
this._vpnRequests = { };
|
||||||
|
|
||||||
this._native.connect('new-request', Lang.bind(this, this._newRequest));
|
this._native.connect('new-request', Lang.bind(this, this._newRequest));
|
||||||
this._native.connect('cancel-request', Lang.bind(this, this._cancelRequest));
|
this._native.connect('cancel-request', Lang.bind(this, this._cancelRequest));
|
||||||
},
|
},
|
||||||
|
|
||||||
_newRequest: function(agent, requestId, connection, settingName, hints) {
|
_newRequest: function(agent, requestId, connection, settingName, hints, flags) {
|
||||||
|
if (settingName == 'vpn') {
|
||||||
|
this._vpnRequest(requestId, connection, hints, flags);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let dialog = new NetworkSecretDialog(agent, requestId, connection, settingName, hints);
|
let dialog = new NetworkSecretDialog(agent, requestId, connection, settingName, hints);
|
||||||
dialog.connect('destroy', Lang.bind(this, function() {
|
dialog.connect('destroy', Lang.bind(this, function() {
|
||||||
delete this._dialogs[requestId];
|
delete this._dialogs[requestId];
|
||||||
@ -384,7 +629,74 @@ NetworkAgent.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_cancelRequest: function(agent, requestId) {
|
_cancelRequest: function(agent, requestId) {
|
||||||
|
if (this._dialogs[requestId]) {
|
||||||
this._dialogs[requestId].close(global.get_current_time());
|
this._dialogs[requestId].close(global.get_current_time());
|
||||||
this._dialogs[requestId].destroy();
|
this._dialogs[requestId].destroy();
|
||||||
|
delete this._dialogs[requestId];
|
||||||
|
} else if (this._vpnRequests[requestId]) {
|
||||||
|
this._vpnRequests[requestId].cancel();
|
||||||
|
delete this._vpnRequests[requestId];
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
|
_vpnRequest: function(requestId, connection, hints, flags) {
|
||||||
|
let vpnSetting = connection.get_setting_vpn();
|
||||||
|
let serviceType = vpnSetting.service_type;
|
||||||
|
|
||||||
|
this._buildVPNServiceCache();
|
||||||
|
|
||||||
|
let binary = this._vpnBinaries[serviceType];
|
||||||
|
if (!binary) {
|
||||||
|
log('Invalid VPN service type (cannot find authentication binary)');
|
||||||
|
|
||||||
|
/* cancel the auth process */
|
||||||
|
this._native.respond(requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._vpnRequests[requestId] = new VPNRequestHandler(this._native, requestId, binary, serviceType, connection, hints, flags);
|
||||||
|
},
|
||||||
|
|
||||||
|
_buildVPNServiceCache: function() {
|
||||||
|
if (this._vpnCacheBuilt)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._vpnCacheBuilt = true;
|
||||||
|
this._vpnBinaries = { };
|
||||||
|
|
||||||
|
let dir = Gio.file_new_for_path(GLib.build_filenamev([Config.SYSCONFDIR, 'NetworkManager/VPN']));
|
||||||
|
try {
|
||||||
|
let fileEnum = dir.enumerate_children('standard::name', Gio.FileQueryInfoFlags.NONE, null);
|
||||||
|
let info;
|
||||||
|
|
||||||
|
while ((info = fileEnum.next_file(null))) {
|
||||||
|
let name = info.get_name();
|
||||||
|
if (name.substr(-5) != '.name')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let keyfile = new GLib.KeyFile();
|
||||||
|
keyfile.load_from_file(dir.get_child(name).get_path(), GLib.KeyFileFlags.NONE);
|
||||||
|
let service = keyfile.get_string('VPN Connection', 'service');
|
||||||
|
let binary = keyfile.get_string('GNOME', 'auth-dialog');
|
||||||
|
let externalUIMode = false;
|
||||||
|
try {
|
||||||
|
externalUIMode = keyfile.get_boolean('GNOME', 'supports-external-ui-mode');
|
||||||
|
} catch(e) { } // ignore errors if key does not exist
|
||||||
|
let path = GLib.build_filenamev([Config.LIBEXECDIR, binary]);
|
||||||
|
|
||||||
|
if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE))
|
||||||
|
this._vpnBinaries[service] = { fileName: path, externalUIMode: externalUIMode };
|
||||||
|
else
|
||||||
|
throw new Error('VPN plugin at %s is not executable'.format(path));
|
||||||
|
} catch(e) {
|
||||||
|
log('Error \'%s\' while processing VPN keyfile \'%s\''.
|
||||||
|
format(e.message, dir.get_child(name).get_path()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
logError(e, 'error while enumerating VPN auth helpers');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const DBus = imports.dbus;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
@ -16,49 +16,52 @@ const Util = imports.misc.util;
|
|||||||
|
|
||||||
let nextNotificationId = 1;
|
let nextNotificationId = 1;
|
||||||
|
|
||||||
// Should really be defined in dbus.js
|
// Should really be defined in Gio.js
|
||||||
const BusIface = {
|
const BusIface = <interface name="org.freedesktop.DBus">
|
||||||
name: 'org.freedesktop.DBus',
|
<method name="GetConnectionUnixProcessID">
|
||||||
methods: [{ name: 'GetConnectionUnixProcessID',
|
<arg type="s" direction="in" />
|
||||||
inSignature: 's',
|
<arg type="u" direction="out" />
|
||||||
outSignature: 'i' }]
|
</method>
|
||||||
};
|
</interface>;
|
||||||
|
|
||||||
const Bus = function () {
|
var BusProxy = Gio.DBusProxy.makeProxyWrapper(BusIface);
|
||||||
this._init();
|
function Bus() {
|
||||||
};
|
return new BusProxy(Gio.DBus.session, 'org.freedesktop.DBus', '/org/freedesktop/DBus');
|
||||||
|
|
||||||
Bus.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
DBus.session.proxifyObject(this, 'org.freedesktop.DBus', '/org/freedesktop/DBus');
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
DBus.proxifyPrototype(Bus.prototype, BusIface);
|
const NotificationDaemonIface = <interface name="org.freedesktop.Notifications">
|
||||||
|
<method name="Notify">
|
||||||
const NotificationDaemonIface = {
|
<arg type="s" direction="in"/>
|
||||||
name: 'org.freedesktop.Notifications',
|
<arg type="u" direction="in"/>
|
||||||
methods: [{ name: 'Notify',
|
<arg type="s" direction="in"/>
|
||||||
inSignature: 'susssasa{sv}i',
|
<arg type="s" direction="in"/>
|
||||||
outSignature: 'u'
|
<arg type="s" direction="in"/>
|
||||||
},
|
<arg type="as" direction="in"/>
|
||||||
{ name: 'CloseNotification',
|
<arg type="a{sv}" direction="in"/>
|
||||||
inSignature: 'u',
|
<arg type="i" direction="in"/>
|
||||||
outSignature: ''
|
<arg type="u" direction="out"/>
|
||||||
},
|
</method>
|
||||||
{ name: 'GetCapabilities',
|
<method name="CloseNotification">
|
||||||
inSignature: '',
|
<arg type="u" direction="in"/>
|
||||||
outSignature: 'as'
|
</method>
|
||||||
},
|
<method name="GetCapabilities">
|
||||||
{ name: 'GetServerInformation',
|
<arg type="as" direction="out"/>
|
||||||
inSignature: '',
|
</method>
|
||||||
outSignature: 'ssss'
|
<method name="GetServerInformation">
|
||||||
}],
|
<arg type="s" direction="out"/>
|
||||||
signals: [{ name: 'NotificationClosed',
|
<arg type="s" direction="out"/>
|
||||||
inSignature: 'uu' },
|
<arg type="s" direction="out"/>
|
||||||
{ name: 'ActionInvoked',
|
<arg type="s" direction="out"/>
|
||||||
inSignature: 'us' }]
|
</method>
|
||||||
};
|
<signal name="NotificationClosed">
|
||||||
|
<arg type="u"/>
|
||||||
|
<arg type="u"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="ActionInvoked">
|
||||||
|
<arg type="u"/>
|
||||||
|
<arg type="s"/>
|
||||||
|
</signal>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
const NotificationClosedReason = {
|
const NotificationClosedReason = {
|
||||||
EXPIRED: 1,
|
EXPIRED: 1,
|
||||||
@ -84,15 +87,14 @@ const rewriteRules = {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
function NotificationDaemon() {
|
const NotificationDaemon = new Lang.Class({
|
||||||
this._init();
|
Name: 'NotificationDaemon',
|
||||||
}
|
|
||||||
|
|
||||||
NotificationDaemon.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
DBus.session.exportObject('/org/freedesktop/Notifications', this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(NotificationDaemonIface, this);
|
||||||
|
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
|
||||||
|
|
||||||
this._sources = {};
|
this._sources = [];
|
||||||
this._senderToPid = {};
|
this._senderToPid = {};
|
||||||
this._notifications = {};
|
this._notifications = {};
|
||||||
this._busProxy = new Bus();
|
this._busProxy = new Bus();
|
||||||
@ -150,14 +152,30 @@ NotificationDaemon.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_lookupSource: function(title, pid, trayIcon) {
|
||||||
|
for (let i = 0; i < this._sources.length; i++) {
|
||||||
|
let source = this._sources[i];
|
||||||
|
if (source.pid == pid &&
|
||||||
|
(source.initialTitle == title || source.trayIcon || trayIcon))
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
// Returns the source associated with ndata.notification if it is set.
|
// Returns the source associated with ndata.notification if it is set.
|
||||||
// Otherwise, returns the source associated with the pid if one is
|
// Otherwise, returns the source associated with the title and pid if
|
||||||
// stored in this._sources and the notification is not transient.
|
// such source is stored in this._sources and the notification is not
|
||||||
// Otherwise, creates a new source as long as pid is provided.
|
// transient. If the existing or requested source is associated with
|
||||||
|
// a tray icon and passed in pid matches a pid of an existing source,
|
||||||
|
// the title match is ignored to enable representing a tray icon and
|
||||||
|
// notifications from the same application with a single source.
|
||||||
|
//
|
||||||
|
// If no existing source is found, a new source is created as long as
|
||||||
|
// pid is provided.
|
||||||
//
|
//
|
||||||
// Either a pid or ndata.notification is needed to retrieve or
|
// Either a pid or ndata.notification is needed to retrieve or
|
||||||
// create a source.
|
// create a source.
|
||||||
_getSource: function(title, pid, ndata, sender) {
|
_getSource: function(title, pid, ndata, sender, trayIcon) {
|
||||||
if (!pid && !(ndata && ndata.notification))
|
if (!pid && !(ndata && ndata.notification))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -174,20 +192,24 @@ NotificationDaemon.prototype = {
|
|||||||
// with a transient one from the same sender, so we
|
// with a transient one from the same sender, so we
|
||||||
// always create a new source object for new transient notifications
|
// always create a new source object for new transient notifications
|
||||||
// and never add it to this._sources .
|
// and never add it to this._sources .
|
||||||
if (!isForTransientNotification && this._sources[pid]) {
|
if (!isForTransientNotification) {
|
||||||
let source = this._sources[pid];
|
let source = this._lookupSource(title, pid, trayIcon);
|
||||||
|
if (source) {
|
||||||
source.setTitle(title);
|
source.setTitle(title);
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let source = new Source(title, pid, sender);
|
let source = new Source(title, pid, sender, trayIcon);
|
||||||
source.setTransient(isForTransientNotification);
|
source.setTransient(isForTransientNotification);
|
||||||
|
|
||||||
if (!isForTransientNotification) {
|
if (!isForTransientNotification) {
|
||||||
this._sources[pid] = source;
|
this._sources.push(source);
|
||||||
source.connect('destroy', Lang.bind(this,
|
source.connect('destroy', Lang.bind(this,
|
||||||
function() {
|
function() {
|
||||||
delete this._sources[pid];
|
let index = this._sources.indexOf(source);
|
||||||
|
if (index >= 0)
|
||||||
|
this._sources.splice(index, 1);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,8 +217,8 @@ NotificationDaemon.prototype = {
|
|||||||
return source;
|
return source;
|
||||||
},
|
},
|
||||||
|
|
||||||
Notify: function(appName, replacesId, icon, summary, body,
|
NotifyAsync: function(params, invocation) {
|
||||||
actions, hints, timeout) {
|
let [appName, replacesId, icon, summary, body, actions, hints, timeout] = params;
|
||||||
let id;
|
let id;
|
||||||
|
|
||||||
// Filter out chat, presence, calls and invitation notifications from
|
// Filter out chat, presence, calls and invitation notifications from
|
||||||
@ -215,7 +237,7 @@ NotificationDaemon.prototype = {
|
|||||||
function () {
|
function () {
|
||||||
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
|
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
|
||||||
}));
|
}));
|
||||||
return id;
|
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
let rewrites = rewriteRules[appName];
|
let rewrites = rewriteRules[appName];
|
||||||
@ -227,6 +249,11 @@ NotificationDaemon.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let hint in hints) {
|
||||||
|
// unpack the variants
|
||||||
|
hints[hint] = hints[hint].deep_unpack();
|
||||||
|
}
|
||||||
|
|
||||||
hints = Params.parse(hints, { urgency: Urgency.NORMAL }, true);
|
hints = Params.parse(hints, { urgency: Urgency.NORMAL }, true);
|
||||||
|
|
||||||
// Be compatible with the various hints for image data and image path
|
// Be compatible with the various hints for image data and image path
|
||||||
@ -258,31 +285,36 @@ NotificationDaemon.prototype = {
|
|||||||
}
|
}
|
||||||
this._notifications[id] = ndata;
|
this._notifications[id] = ndata;
|
||||||
|
|
||||||
let sender = DBus.getCurrentMessageContext().sender;
|
let sender = invocation.get_sender();
|
||||||
let pid = this._senderToPid[sender];
|
let pid = this._senderToPid[sender];
|
||||||
|
|
||||||
let source = this._getSource(appName, pid, ndata, sender);
|
let source = this._getSource(appName, pid, ndata, sender, null);
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
this._notifyForSource(source, ndata);
|
this._notifyForSource(source, ndata);
|
||||||
return id;
|
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replacesId) {
|
if (replacesId) {
|
||||||
// There's already a pending call to GetConnectionUnixProcessID,
|
// There's already a pending call to GetConnectionUnixProcessID,
|
||||||
// which will see the new notification data when it finishes,
|
// which will see the new notification data when it finishes,
|
||||||
// so we don't have to do anything.
|
// so we don't have to do anything.
|
||||||
return id;
|
return invocation.return_value(GLib.Variant.new('(u)', [id]));;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._busProxy.GetConnectionUnixProcessIDRemote(sender, Lang.bind(this,
|
this._busProxy.GetConnectionUnixProcessIDRemote(sender, Lang.bind(this, function (result, excp) {
|
||||||
function (pid, ex) {
|
|
||||||
// The app may have updated or removed the notification
|
// The app may have updated or removed the notification
|
||||||
ndata = this._notifications[id];
|
ndata = this._notifications[id];
|
||||||
if (!ndata)
|
if (!ndata)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
source = this._getSource(appName, pid, ndata, sender);
|
if (excp) {
|
||||||
|
logError(excp, 'Call to GetConnectionUnixProcessID failed');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let [pid] = result;
|
||||||
|
source = this._getSource(appName, pid, ndata, sender, null);
|
||||||
|
|
||||||
// We only store sender-pid entries for persistent sources.
|
// We only store sender-pid entries for persistent sources.
|
||||||
// Removing the entries once the source is destroyed
|
// Removing the entries once the source is destroyed
|
||||||
@ -294,15 +326,14 @@ NotificationDaemon.prototype = {
|
|||||||
// distroyed.
|
// distroyed.
|
||||||
if (!source.isTransient) {
|
if (!source.isTransient) {
|
||||||
this._senderToPid[sender] = pid;
|
this._senderToPid[sender] = pid;
|
||||||
source.connect('destroy', Lang.bind(this,
|
source.connect('destroy', Lang.bind(this, function() {
|
||||||
function() {
|
|
||||||
delete this._senderToPid[sender];
|
delete this._senderToPid[sender];
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
this._notifyForSource(source, ndata);
|
this._notifyForSource(source, ndata);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return id;
|
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyForSource: function(source, ndata) {
|
_notifyForSource: function(source, ndata) {
|
||||||
@ -432,8 +463,8 @@ NotificationDaemon.prototype = {
|
|||||||
if (!tracker.focus_app)
|
if (!tracker.focus_app)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (let id in this._sources) {
|
for (let i = 0; i < this._sources.length; i++) {
|
||||||
let source = this._sources[id];
|
let source = this._sources[i];
|
||||||
if (source.app == tracker.focus_app) {
|
if (source.app == tracker.focus_app) {
|
||||||
source.destroyNonResidentNotifications();
|
source.destroyNonResidentNotifications();
|
||||||
return;
|
return;
|
||||||
@ -442,61 +473,55 @@ NotificationDaemon.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_emitNotificationClosed: function(id, reason) {
|
_emitNotificationClosed: function(id, reason) {
|
||||||
DBus.session.emit_signal('/org/freedesktop/Notifications',
|
this._dbusImpl.emit_signal('NotificationClosed',
|
||||||
'org.freedesktop.Notifications',
|
GLib.Variant.new('(uu)', [id, reason]));
|
||||||
'NotificationClosed', 'uu',
|
|
||||||
[id, reason]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitActionInvoked: function(id, action) {
|
_emitActionInvoked: function(id, action) {
|
||||||
DBus.session.emit_signal('/org/freedesktop/Notifications',
|
this._dbusImpl.emit_signal('ActionInvoked',
|
||||||
'org.freedesktop.Notifications',
|
GLib.Variant.new('(us)', [id, action]));
|
||||||
'ActionInvoked', 'us',
|
|
||||||
[id, action]);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTrayIconAdded: function(o, icon) {
|
_onTrayIconAdded: function(o, icon) {
|
||||||
let source = this._getSource(icon.title || icon.wm_class || _("Unknown"), icon.pid, null, null);
|
let source = this._getSource(icon.title || icon.wm_class || _("Unknown"), icon.pid, null, null, icon);
|
||||||
source.setTrayIcon(icon);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTrayIconRemoved: function(o, icon) {
|
_onTrayIconRemoved: function(o, icon) {
|
||||||
let source = this._sources[icon.pid];
|
let source = this._lookupSource(null, icon.pid, true);
|
||||||
if (source)
|
if (source)
|
||||||
source.destroy();
|
source.destroy();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
DBus.conformExport(NotificationDaemon.prototype, NotificationDaemonIface);
|
const Source = new Lang.Class({
|
||||||
|
Name: 'NotificationDaemonSource',
|
||||||
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
function Source(title, pid, sender) {
|
_init: function(title, pid, sender, trayIcon) {
|
||||||
this._init(title, pid, sender);
|
this.parent(title);
|
||||||
}
|
|
||||||
|
|
||||||
Source.prototype = {
|
this.initialTitle = title;
|
||||||
__proto__: MessageTray.Source.prototype,
|
|
||||||
|
|
||||||
_init: function(title, pid, sender) {
|
this.pid = pid;
|
||||||
MessageTray.Source.prototype._init.call(this, title);
|
|
||||||
|
|
||||||
this._pid = pid;
|
|
||||||
if (sender)
|
if (sender)
|
||||||
// TODO: dbus-glib implementation of watch_name() doesn’t return an id to be used for
|
this._nameWatcherId = Gio.DBus.session.watch_name(sender,
|
||||||
// unwatch_name() or implement unwatch_name(), however when we move to using GDBus implementation,
|
Gio.BusNameWatcherFlags.NONE,
|
||||||
// we should save the id here and call unwatch_name() with it in destroy().
|
|
||||||
// Moving to GDBus is the work in progress: https://bugzilla.gnome.org/show_bug.cgi?id=648651
|
|
||||||
// and https://bugzilla.gnome.org/show_bug.cgi?id=622921 .
|
|
||||||
DBus.session.watch_name(sender,
|
|
||||||
false,
|
|
||||||
null,
|
null,
|
||||||
Lang.bind(this, this._onNameVanished));
|
Lang.bind(this, this._onNameVanished));
|
||||||
|
else
|
||||||
|
this._nameWatcherId = 0;
|
||||||
|
|
||||||
this._setApp();
|
this._setApp();
|
||||||
if (this.app)
|
if (this.app)
|
||||||
this.title = this.app.get_name();
|
this.title = this.app.get_name();
|
||||||
else
|
else
|
||||||
this.useNotificationIcon = true;
|
this.useNotificationIcon = true;
|
||||||
this._trayIcon = null;
|
|
||||||
|
this.trayIcon = trayIcon;
|
||||||
|
if (this.trayIcon) {
|
||||||
|
this._setSummaryIcon(this.trayIcon);
|
||||||
|
this.useNotificationIcon = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameVanished: function() {
|
_onNameVanished: function() {
|
||||||
@ -523,7 +548,7 @@ Source.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleSummaryClick: function() {
|
handleSummaryClick: function() {
|
||||||
if (!this._trayIcon)
|
if (!this.trayIcon)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let event = Clutter.get_current_event();
|
let event = Clutter.get_current_event();
|
||||||
@ -544,44 +569,54 @@ Source.prototype = {
|
|||||||
let id = global.connect('notify::stage-input-mode', Lang.bind(this,
|
let id = global.connect('notify::stage-input-mode', Lang.bind(this,
|
||||||
function () {
|
function () {
|
||||||
global.disconnect(id);
|
global.disconnect(id);
|
||||||
this._trayIcon.click(event);
|
this.trayIcon.click(event);
|
||||||
}));
|
}));
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
} else {
|
} else {
|
||||||
this._trayIcon.click(event);
|
this.trayIcon.click(event);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_getApp: function() {
|
||||||
|
let app;
|
||||||
|
|
||||||
|
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
|
||||||
|
if (app != null)
|
||||||
|
return app;
|
||||||
|
|
||||||
|
if (this.trayIcon) {
|
||||||
|
app = Shell.AppSystem.get_default().lookup_wmclass(this.trayIcon.wmclass);
|
||||||
|
if (app != null)
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
_setApp: function() {
|
_setApp: function() {
|
||||||
if (this.app)
|
if (this.app)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.app = Shell.WindowTracker.get_default().get_app_from_pid(this._pid);
|
this.app = this._getApp();
|
||||||
if (!this.app)
|
if (!this.app)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Only override the icon if we were previously using
|
// Only override the icon if we were previously using
|
||||||
// notification-based icons (ie, not a trayicon) or if it was unset before
|
// notification-based icons (ie, not a trayicon) or if it was unset before
|
||||||
if (!this._trayIcon) {
|
if (!this.trayIcon) {
|
||||||
this.useNotificationIcon = false;
|
this.useNotificationIcon = false;
|
||||||
this._setSummaryIcon(this.app.create_icon_texture (this.ICON_SIZE));
|
this._setSummaryIcon(this.app.create_icon_texture (this.ICON_SIZE));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setTrayIcon: function(icon) {
|
|
||||||
this._setSummaryIcon(icon);
|
|
||||||
this.useNotificationIcon = false;
|
|
||||||
this._trayIcon = icon;
|
|
||||||
},
|
|
||||||
|
|
||||||
open: function(notification) {
|
open: function(notification) {
|
||||||
this.destroyNonResidentNotifications();
|
this.destroyNonResidentNotifications();
|
||||||
this.openApp();
|
this.openApp();
|
||||||
},
|
},
|
||||||
|
|
||||||
_lastNotificationRemoved: function() {
|
_lastNotificationRemoved: function() {
|
||||||
if (!this._trayIcon)
|
if (!this.trayIcon)
|
||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -597,6 +632,11 @@ Source.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
MessageTray.Source.prototype.destroy.call(this);
|
if (this._nameWatcherId) {
|
||||||
|
Gio.DBus.session.unwatch_name(this._nameWatcherId);
|
||||||
|
this._nameWatcherId = 0;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
this.parent();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -14,15 +14,16 @@ const AppDisplay = imports.ui.appDisplay;
|
|||||||
const ContactDisplay = imports.ui.contactDisplay;
|
const ContactDisplay = imports.ui.contactDisplay;
|
||||||
const Dash = imports.ui.dash;
|
const Dash = imports.ui.dash;
|
||||||
const DND = imports.ui.dnd;
|
const DND = imports.ui.dnd;
|
||||||
const DocDisplay = imports.ui.docDisplay;
|
|
||||||
const Lightbox = imports.ui.lightbox;
|
const Lightbox = imports.ui.lightbox;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const MessageTray = imports.ui.messageTray;
|
const MessageTray = imports.ui.messageTray;
|
||||||
const Panel = imports.ui.panel;
|
const Panel = imports.ui.panel;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const PlaceDisplay = imports.ui.placeDisplay;
|
const PlaceDisplay = imports.ui.placeDisplay;
|
||||||
|
const RemoteSearch = imports.ui.remoteSearch;
|
||||||
const Tweener = imports.ui.tweener;
|
const Tweener = imports.ui.tweener;
|
||||||
const ViewSelector = imports.ui.viewSelector;
|
const ViewSelector = imports.ui.viewSelector;
|
||||||
|
const Wanda = imports.ui.wanda;
|
||||||
const WorkspacesView = imports.ui.workspacesView;
|
const WorkspacesView = imports.ui.workspacesView;
|
||||||
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
|
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
|
||||||
|
|
||||||
@ -46,11 +47,9 @@ const SwipeScrollResult = {
|
|||||||
CLICK: 2
|
CLICK: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
function ShellInfo() {
|
const ShellInfo = new Lang.Class({
|
||||||
this._init();
|
Name: 'ShellInfo',
|
||||||
}
|
|
||||||
|
|
||||||
ShellInfo.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._source = null;
|
this._source = null;
|
||||||
this._undoCallback = null;
|
this._undoCallback = null;
|
||||||
@ -95,13 +94,11 @@ ShellInfo.prototype = {
|
|||||||
|
|
||||||
this._source.notify(notification);
|
this._source.notify(notification);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function Overview() {
|
const Overview = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'Overview',
|
||||||
}
|
|
||||||
|
|
||||||
Overview.prototype = {
|
|
||||||
_init : function(params) {
|
_init : function(params) {
|
||||||
params = Params.parse(params, { isDummy: false });
|
params = Params.parse(params, { isDummy: false });
|
||||||
|
|
||||||
@ -112,7 +109,6 @@ Overview.prototype = {
|
|||||||
if (this.isDummy) {
|
if (this.isDummy) {
|
||||||
this.animationInProgress = false;
|
this.animationInProgress = false;
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.workspaces = null;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +126,10 @@ Overview.prototype = {
|
|||||||
|
|
||||||
this._spacing = 0;
|
this._spacing = 0;
|
||||||
|
|
||||||
this._group = new St.Group({ name: 'overview',
|
/* Translators: This is the main view to select
|
||||||
|
activities. See also note for "Activities" string. */
|
||||||
|
this._group = new St.Widget({ name: 'overview',
|
||||||
|
accessible_name: _("Overview"),
|
||||||
reactive: true });
|
reactive: true });
|
||||||
this._group._delegate = this;
|
this._group._delegate = this;
|
||||||
this._group.connect('style-changed',
|
this._group.connect('style-changed',
|
||||||
@ -184,8 +183,6 @@ Overview.prototype = {
|
|||||||
this._lastActiveWorkspaceIndex = -1;
|
this._lastActiveWorkspaceIndex = -1;
|
||||||
this._lastHoveredWindow = null;
|
this._lastHoveredWindow = null;
|
||||||
this._needsFakePointerEvent = false;
|
this._needsFakePointerEvent = false;
|
||||||
|
|
||||||
this.workspaces = null;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// The members we construct that are implemented in JS might
|
// The members we construct that are implemented in JS might
|
||||||
@ -208,12 +205,16 @@ Overview.prototype = {
|
|||||||
this._viewSelector.addViewTab('applications', _("Applications"), appView.actor, 'system-run');
|
this._viewSelector.addViewTab('applications', _("Applications"), appView.actor, 'system-run');
|
||||||
|
|
||||||
// Default search providers
|
// Default search providers
|
||||||
|
// Wanda comes obviously first
|
||||||
|
this.addSearchProvider(new Wanda.WandaSearchProvider());
|
||||||
this.addSearchProvider(new AppDisplay.AppSearchProvider());
|
this.addSearchProvider(new AppDisplay.AppSearchProvider());
|
||||||
this.addSearchProvider(new AppDisplay.SettingsSearchProvider());
|
this.addSearchProvider(new AppDisplay.SettingsSearchProvider());
|
||||||
this.addSearchProvider(new PlaceDisplay.PlaceSearchProvider());
|
this.addSearchProvider(new PlaceDisplay.PlaceSearchProvider());
|
||||||
this.addSearchProvider(new DocDisplay.DocSearchProvider());
|
|
||||||
this.addSearchProvider(new ContactDisplay.ContactSearchProvider());
|
this.addSearchProvider(new ContactDisplay.ContactSearchProvider());
|
||||||
|
|
||||||
|
// Load remote search providers provided by applications
|
||||||
|
RemoteSearch.loadRemoteSearchProviders(Lang.bind(this, this.addSearchProvider));
|
||||||
|
|
||||||
// TODO - recalculate everything when desktop size changes
|
// TODO - recalculate everything when desktop size changes
|
||||||
this._dash = new Dash.Dash();
|
this._dash = new Dash.Dash();
|
||||||
this._group.add_actor(this._dash.actor);
|
this._group.add_actor(this._dash.actor);
|
||||||
@ -359,7 +360,7 @@ Overview.prototype = {
|
|||||||
let direction;
|
let direction;
|
||||||
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
||||||
direction = stageX > this._dragStartX ? -1 : 1;
|
direction = stageX > this._dragStartX ? -1 : 1;
|
||||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
direction *= -1;
|
direction *= -1;
|
||||||
} else {
|
} else {
|
||||||
direction = stageY > this._dragStartY ? -1 : 1;
|
direction = stageY > this._dragStartY ? -1 : 1;
|
||||||
@ -451,7 +452,7 @@ Overview.prototype = {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
||||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
this._scrollAdjustment.value -= (dx / primary.width) * this._scrollAdjustment.page_size;
|
this._scrollAdjustment.value -= (dx / primary.width) * this._scrollAdjustment.page_size;
|
||||||
else
|
else
|
||||||
this._scrollAdjustment.value += (dx / primary.width) * this._scrollAdjustment.page_size;
|
this._scrollAdjustment.value += (dx / primary.width) * this._scrollAdjustment.page_size;
|
||||||
@ -492,7 +493,7 @@ Overview.prototype = {
|
|||||||
this.hide();
|
this.hide();
|
||||||
|
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
let primary = Main.layoutManager.primaryMonitor;
|
||||||
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
let rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||||
|
|
||||||
let contentY = Main.panel.actor.height;
|
let contentY = Main.panel.actor.height;
|
||||||
let contentHeight = primary.height - contentY - Main.messageTray.actor.height;
|
let contentHeight = primary.height - contentY - Main.messageTray.actor.height;
|
||||||
@ -591,13 +592,10 @@ Overview.prototype = {
|
|||||||
|
|
||||||
this._workspacesDisplay.show();
|
this._workspacesDisplay.show();
|
||||||
|
|
||||||
this.workspaces = this._workspacesDisplay.workspacesView;
|
|
||||||
global.overlay_group.add_actor(this.workspaces.actor);
|
|
||||||
|
|
||||||
if (!this._desktopFade.child)
|
if (!this._desktopFade.child)
|
||||||
this._desktopFade.child = this._getDesktopClone();
|
this._desktopFade.child = this._getDesktopClone();
|
||||||
|
|
||||||
if (!this.workspaces.getActiveWorkspace().hasMaximizedWindows()) {
|
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
|
||||||
this._desktopFade.opacity = 255;
|
this._desktopFade.opacity = 255;
|
||||||
this._desktopFade.show();
|
this._desktopFade.show();
|
||||||
Tweener.addTween(this._desktopFade,
|
Tweener.addTween(this._desktopFade,
|
||||||
@ -732,7 +730,7 @@ Overview.prototype = {
|
|||||||
this.animationInProgress = true;
|
this.animationInProgress = true;
|
||||||
this._hideInProgress = true;
|
this._hideInProgress = true;
|
||||||
|
|
||||||
if (!this.workspaces.getActiveWorkspace().hasMaximizedWindows()) {
|
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
|
||||||
this._desktopFade.opacity = 0;
|
this._desktopFade.opacity = 0;
|
||||||
this._desktopFade.show();
|
this._desktopFade.show();
|
||||||
Tweener.addTween(this._desktopFade,
|
Tweener.addTween(this._desktopFade,
|
||||||
@ -741,7 +739,7 @@ Overview.prototype = {
|
|||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.workspaces.hide();
|
this._workspacesDisplay.zoomFromOverview();
|
||||||
|
|
||||||
// Make other elements fade out.
|
// Make other elements fade out.
|
||||||
Tweener.addTween(this._group,
|
Tweener.addTween(this._group,
|
||||||
@ -783,9 +781,6 @@ Overview.prototype = {
|
|||||||
|
|
||||||
global.window_group.show();
|
global.window_group.show();
|
||||||
|
|
||||||
this.workspaces.destroy();
|
|
||||||
this.workspaces = null;
|
|
||||||
|
|
||||||
this._workspacesDisplay.hide();
|
this._workspacesDisplay.hide();
|
||||||
|
|
||||||
this._desktopFade.hide();
|
this._desktopFade.hide();
|
||||||
@ -811,5 +806,5 @@ Overview.prototype = {
|
|||||||
this._needsFakePointerEvent = false;
|
this._needsFakePointerEvent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(Overview.prototype);
|
Signals.addSignalMethods(Overview.prototype);
|
||||||
|
331
js/ui/panel.js
@ -3,15 +3,20 @@
|
|||||||
const Cairo = imports.cairo;
|
const Cairo = imports.cairo;
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const Gtk = imports.gi.Gtk;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
|
const Meta = imports.gi.Meta;
|
||||||
const Pango = imports.gi.Pango;
|
const Pango = imports.gi.Pango;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const Config = imports.misc.config;
|
const Config = imports.misc.config;
|
||||||
const CtrlAltTab = imports.ui.ctrlAltTab;
|
const CtrlAltTab = imports.ui.ctrlAltTab;
|
||||||
|
const DND = imports.ui.dnd;
|
||||||
const Layout = imports.ui.layout;
|
const Layout = imports.ui.layout;
|
||||||
const Overview = imports.ui.overview;
|
const Overview = imports.ui.overview;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
@ -32,7 +37,7 @@ const STANDARD_STATUS_AREA_SHELL_IMPLEMENTATION = {
|
|||||||
'a11y': imports.ui.status.accessibility.ATIndicator,
|
'a11y': imports.ui.status.accessibility.ATIndicator,
|
||||||
'volume': imports.ui.status.volume.Indicator,
|
'volume': imports.ui.status.volume.Indicator,
|
||||||
'battery': imports.ui.status.power.Indicator,
|
'battery': imports.ui.status.power.Indicator,
|
||||||
'keyboard': imports.ui.status.keyboard.XKBIndicator,
|
'keyboard': imports.ui.status.keyboard.InputSourceIndicator,
|
||||||
'userMenu': imports.ui.userMenu.UserMenuButton
|
'userMenu': imports.ui.userMenu.UserMenuButton
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,7 +55,7 @@ const GDM_STATUS_AREA_SHELL_IMPLEMENTATION = {
|
|||||||
'a11y': imports.ui.status.accessibility.ATIndicator,
|
'a11y': imports.ui.status.accessibility.ATIndicator,
|
||||||
'volume': imports.ui.status.volume.Indicator,
|
'volume': imports.ui.status.volume.Indicator,
|
||||||
'battery': imports.ui.status.power.Indicator,
|
'battery': imports.ui.status.power.Indicator,
|
||||||
'keyboard': imports.ui.status.keyboard.XKBIndicator,
|
'keyboard': imports.ui.status.keyboard.InputSourceIndicator,
|
||||||
'powerMenu': imports.gdm.powerMenu.PowerMenuButton
|
'powerMenu': imports.gdm.powerMenu.PowerMenuButton
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -98,54 +103,59 @@ function _unpremultiply(color) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function AnimatedIcon(name, size) {
|
const AnimatedIcon = new Lang.Class({
|
||||||
this._init(name, size);
|
Name: 'AnimatedIcon',
|
||||||
}
|
|
||||||
|
|
||||||
AnimatedIcon.prototype = {
|
|
||||||
_init: function(name, size) {
|
_init: function(name, size) {
|
||||||
this.actor = new St.Bin({ visible: false });
|
this.actor = new St.Bin({ visible: false });
|
||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
this.actor.connect('notify::visible', Lang.bind(this, function() {
|
this.actor.connect('notify::visible', Lang.bind(this, this._onVisibleNotify));
|
||||||
if (this.actor.visible) {
|
|
||||||
this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
|
|
||||||
} else {
|
|
||||||
if (this._timeoutId)
|
|
||||||
Mainloop.source_remove(this._timeoutId);
|
|
||||||
this._timeoutId = 0;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._timeoutId = 0;
|
this._timeoutId = 0;
|
||||||
this._i = 0;
|
this._frame = 0;
|
||||||
this._animations = St.TextureCache.get_default().load_sliced_image (global.datadir + '/theme/' + name, size, size);
|
this._animations = St.TextureCache.get_default().load_sliced_image (global.datadir + '/theme/' + name, size, size);
|
||||||
this.actor.set_child(this._animations);
|
this.actor.set_child(this._animations);
|
||||||
},
|
},
|
||||||
|
|
||||||
_update: function() {
|
_disconnectTimeout: function() {
|
||||||
this._animations.hide_all();
|
if (this._timeoutId > 0) {
|
||||||
this._animations.show();
|
Mainloop.source_remove(this._timeoutId);
|
||||||
if (this._i && this._i < this._animations.get_n_children())
|
this._timeoutId = 0;
|
||||||
this._animations.get_nth_child(this._i++).show();
|
|
||||||
else {
|
|
||||||
this._i = 1;
|
|
||||||
if (this._animations.get_n_children())
|
|
||||||
this._animations.get_nth_child(0).show();
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_onVisibleNotify: function() {
|
||||||
|
if (this.actor.visible)
|
||||||
|
this._timeoutId = Mainloop.timeout_add(ANIMATED_ICON_UPDATE_TIMEOUT, Lang.bind(this, this._update));
|
||||||
|
else
|
||||||
|
this._disconnectTimeout();
|
||||||
|
},
|
||||||
|
|
||||||
|
_showFrame: function(frame) {
|
||||||
|
let oldFrameActor = this._animations.get_child_at_index(this._frame);
|
||||||
|
if (oldFrameActor)
|
||||||
|
oldFrameActor.hide();
|
||||||
|
|
||||||
|
this._frame = (frame % this._animations.get_n_children());
|
||||||
|
|
||||||
|
let newFrameActor = this._animations.get_child_at_index(this._frame);
|
||||||
|
if (newFrameActor)
|
||||||
|
newFrameActor.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
_update: function() {
|
||||||
|
this._showFrame(this._frame + 1);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy: function() {
|
||||||
if (this._timeoutId)
|
this._disconnectTimeout();
|
||||||
Mainloop.source_remove(this._timeoutId);
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function TextShadower() {
|
const TextShadower = new Lang.Class({
|
||||||
this._init();
|
Name: 'TextShadower',
|
||||||
}
|
|
||||||
|
|
||||||
TextShadower.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = new Shell.GenericContainer();
|
this.actor = new Shell.GenericContainer();
|
||||||
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||||
@ -225,7 +235,7 @@ TextShadower.prototype = {
|
|||||||
child.allocate(childBox, flags);
|
child.allocate(childBox, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppMenuButton:
|
* AppMenuButton:
|
||||||
@ -235,22 +245,26 @@ TextShadower.prototype = {
|
|||||||
* this menu also handles startup notification for it. So when we
|
* this menu also handles startup notification for it. So when we
|
||||||
* have an active startup notification, we switch modes to display that.
|
* have an active startup notification, we switch modes to display that.
|
||||||
*/
|
*/
|
||||||
function AppMenuButton() {
|
const AppMenuButton = new Lang.Class({
|
||||||
this._init();
|
Name: 'AppMenuButton',
|
||||||
}
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
AppMenuButton.prototype = {
|
_init: function(menuManager) {
|
||||||
__proto__: PanelMenu.Button.prototype,
|
this.parent(0.0, null, true);
|
||||||
|
|
||||||
|
this.actor.accessible_role = Atk.Role.MENU;
|
||||||
|
|
||||||
_init: function() {
|
|
||||||
PanelMenu.Button.prototype._init.call(this, 0.0);
|
|
||||||
this._startingApps = [];
|
this._startingApps = [];
|
||||||
|
|
||||||
|
this._menuManager = menuManager;
|
||||||
this._targetApp = null;
|
this._targetApp = null;
|
||||||
|
this._appMenuNotifyId = 0;
|
||||||
|
this._actionGroupNotifyId = 0;
|
||||||
|
|
||||||
let bin = new St.Bin({ name: 'appMenu' });
|
let bin = new St.Bin({ name: 'appMenu' });
|
||||||
this.actor.add_actor(bin);
|
this.actor.add_actor(bin);
|
||||||
|
|
||||||
|
this.actor.bind_property("reactive", this.actor, "can-focus", 0);
|
||||||
this.actor.reactive = false;
|
this.actor.reactive = false;
|
||||||
this._targetIsCurrent = false;
|
this._targetIsCurrent = false;
|
||||||
|
|
||||||
@ -271,10 +285,6 @@ AppMenuButton.prototype = {
|
|||||||
|
|
||||||
this._iconBottomClip = 0;
|
this._iconBottomClip = 0;
|
||||||
|
|
||||||
this._quitMenu = new PopupMenu.PopupMenuItem('');
|
|
||||||
this.menu.addMenuItem(this._quitMenu);
|
|
||||||
this._quitMenu.connect('activate', Lang.bind(this, this._onQuit));
|
|
||||||
|
|
||||||
this._visible = !Main.overview.visible;
|
this._visible = !Main.overview.visible;
|
||||||
if (!this._visible)
|
if (!this._visible)
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
@ -294,7 +304,7 @@ AppMenuButton.prototype = {
|
|||||||
|
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
tracker.connect('notify::focus-app', Lang.bind(this, this._sync));
|
tracker.connect('notify::focus-app', Lang.bind(this, this._focusAppChanged));
|
||||||
appSys.connect('app-state-changed', Lang.bind(this, this._onAppStateChanged));
|
appSys.connect('app-state-changed', Lang.bind(this, this._onAppStateChanged));
|
||||||
|
|
||||||
global.window_manager.connect('switch-workspace', Lang.bind(this, this._sync));
|
global.window_manager.connect('switch-workspace', Lang.bind(this, this._sync));
|
||||||
@ -308,11 +318,12 @@ AppMenuButton.prototype = {
|
|||||||
|
|
||||||
this._visible = true;
|
this._visible = true;
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
this.actor.reactive = true;
|
|
||||||
|
|
||||||
if (!this._targetIsCurrent)
|
if (!this._targetIsCurrent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this.actor.reactive = true;
|
||||||
|
|
||||||
Tweener.removeTweens(this.actor);
|
Tweener.removeTweens(this.actor);
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this.actor,
|
||||||
{ opacity: 255,
|
{ opacity: 255,
|
||||||
@ -407,12 +418,12 @@ AppMenuButton.prototype = {
|
|||||||
|
|
||||||
let [minWidth, minHeight, naturalWidth, naturalHeight] = this._iconBox.get_preferred_size();
|
let [minWidth, minHeight, naturalWidth, naturalHeight] = this._iconBox.get_preferred_size();
|
||||||
|
|
||||||
let direction = this.actor.get_direction();
|
let direction = this.actor.get_text_direction();
|
||||||
|
|
||||||
let yPadding = Math.floor(Math.max(0, allocHeight - naturalHeight) / 2);
|
let yPadding = Math.floor(Math.max(0, allocHeight - naturalHeight) / 2);
|
||||||
childBox.y1 = yPadding;
|
childBox.y1 = yPadding;
|
||||||
childBox.y2 = childBox.y1 + Math.min(naturalHeight, allocHeight);
|
childBox.y2 = childBox.y1 + Math.min(naturalHeight, allocHeight);
|
||||||
if (direction == St.TextDirection.LTR) {
|
if (direction == Clutter.TextDirection.LTR) {
|
||||||
childBox.x1 = 0;
|
childBox.x1 = 0;
|
||||||
childBox.x2 = childBox.x1 + Math.min(naturalWidth, allocWidth);
|
childBox.x2 = childBox.x1 + Math.min(naturalWidth, allocWidth);
|
||||||
} else {
|
} else {
|
||||||
@ -429,7 +440,7 @@ AppMenuButton.prototype = {
|
|||||||
childBox.y1 = yPadding;
|
childBox.y1 = yPadding;
|
||||||
childBox.y2 = childBox.y1 + Math.min(naturalHeight, allocHeight);
|
childBox.y2 = childBox.y1 + Math.min(naturalHeight, allocHeight);
|
||||||
|
|
||||||
if (direction == St.TextDirection.LTR) {
|
if (direction == Clutter.TextDirection.LTR) {
|
||||||
childBox.x1 = Math.floor(iconWidth / 2);
|
childBox.x1 = Math.floor(iconWidth / 2);
|
||||||
childBox.x2 = Math.min(childBox.x1 + naturalWidth, allocWidth);
|
childBox.x2 = Math.min(childBox.x1 + naturalWidth, allocWidth);
|
||||||
} else {
|
} else {
|
||||||
@ -438,7 +449,7 @@ AppMenuButton.prototype = {
|
|||||||
}
|
}
|
||||||
this._label.actor.allocate(childBox, flags);
|
this._label.actor.allocate(childBox, flags);
|
||||||
|
|
||||||
if (direction == St.TextDirection.LTR) {
|
if (direction == Clutter.TextDirection.LTR) {
|
||||||
childBox.x1 = Math.floor(iconWidth / 2) + this._label.actor.width;
|
childBox.x1 = Math.floor(iconWidth / 2) + this._label.actor.width;
|
||||||
childBox.x2 = childBox.x1 + this._spinner.actor.width;
|
childBox.x2 = childBox.x1 + this._spinner.actor.width;
|
||||||
childBox.y1 = box.y1;
|
childBox.y1 = box.y1;
|
||||||
@ -453,12 +464,6 @@ AppMenuButton.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onQuit: function() {
|
|
||||||
if (this._targetApp == null)
|
|
||||||
return;
|
|
||||||
this._targetApp.request_quit();
|
|
||||||
},
|
|
||||||
|
|
||||||
_onAppStateChanged: function(appSys, app) {
|
_onAppStateChanged: function(appSys, app) {
|
||||||
let state = app.state;
|
let state = app.state;
|
||||||
if (state != Shell.AppState.STARTING) {
|
if (state != Shell.AppState.STARTING) {
|
||||||
@ -475,16 +480,9 @@ AppMenuButton.prototype = {
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_focusAppChanged: function() {
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let lastStartedApp = null;
|
|
||||||
let workspace = global.screen.get_active_workspace();
|
|
||||||
for (let i = 0; i < this._startingApps.length; i++)
|
|
||||||
if (this._startingApps[i].is_on_workspace(workspace))
|
|
||||||
lastStartedApp = this._startingApps[i];
|
|
||||||
|
|
||||||
let focusedApp = tracker.focus_app;
|
let focusedApp = tracker.focus_app;
|
||||||
|
|
||||||
if (!focusedApp) {
|
if (!focusedApp) {
|
||||||
// If the app has just lost focus to the panel, pretend
|
// If the app has just lost focus to the panel, pretend
|
||||||
// nothing happened; otherwise you can't keynav to the
|
// nothing happened; otherwise you can't keynav to the
|
||||||
@ -492,6 +490,17 @@ AppMenuButton.prototype = {
|
|||||||
if (global.stage_input_mode == Shell.StageInputMode.FOCUSED)
|
if (global.stage_input_mode == Shell.StageInputMode.FOCUSED)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._sync();
|
||||||
|
},
|
||||||
|
|
||||||
|
_sync: function() {
|
||||||
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
|
let focusedApp = tracker.focus_app;
|
||||||
|
let lastStartedApp = null;
|
||||||
|
let workspace = global.screen.get_active_workspace();
|
||||||
|
for (let i = 0; i < this._startingApps.length; i++)
|
||||||
|
if (this._startingApps[i].is_on_workspace(workspace))
|
||||||
|
lastStartedApp = this._startingApps[i];
|
||||||
|
|
||||||
let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
|
let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
|
||||||
|
|
||||||
@ -509,6 +518,9 @@ AppMenuButton.prototype = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!targetApp.is_on_workspace(workspace))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!this._targetIsCurrent) {
|
if (!this._targetIsCurrent) {
|
||||||
this.actor.reactive = true;
|
this.actor.reactive = true;
|
||||||
this._targetIsCurrent = true;
|
this._targetIsCurrent = true;
|
||||||
@ -520,8 +532,10 @@ AppMenuButton.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (targetApp == this._targetApp) {
|
if (targetApp == this._targetApp) {
|
||||||
if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
|
if (targetApp && targetApp.get_state() != Shell.AppState.STARTING) {
|
||||||
this.stopAnimation();
|
this.stopAnimation();
|
||||||
|
this._maybeSetMenu();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,37 +545,72 @@ AppMenuButton.prototype = {
|
|||||||
this._iconBox.hide();
|
this._iconBox.hide();
|
||||||
this._label.setText('');
|
this._label.setText('');
|
||||||
|
|
||||||
|
if (this._appMenuNotifyId)
|
||||||
|
this._targetApp.disconnect(this._appMenuNotifyId);
|
||||||
|
if (this._actionGroupNotifyId)
|
||||||
|
this._targetApp.disconnect(this._actionGroupNotifyId);
|
||||||
|
if (targetApp) {
|
||||||
|
this._appMenuNotifyId = targetApp.connect('notify::menu', Lang.bind(this, this._sync));
|
||||||
|
this._actionGroupNotifyId = targetApp.connect('notify::action-group', Lang.bind(this, this._sync));
|
||||||
|
} else {
|
||||||
|
this._appMenuNotifyId = 0;
|
||||||
|
this._actionGroupNotifyId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
this._targetApp = targetApp;
|
this._targetApp = targetApp;
|
||||||
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
|
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
|
||||||
|
|
||||||
this._label.setText(targetApp.get_name());
|
this._label.setText(targetApp.get_name());
|
||||||
// TODO - _quit() doesn't really work on apps in state STARTING yet
|
this.setName(targetApp.get_name());
|
||||||
this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
|
|
||||||
|
|
||||||
this._iconBox.set_child(icon);
|
this._iconBox.set_child(icon);
|
||||||
this._iconBox.show();
|
this._iconBox.show();
|
||||||
|
|
||||||
if (targetApp.get_state() == Shell.AppState.STARTING)
|
if (targetApp.get_state() == Shell.AppState.STARTING)
|
||||||
this.startAnimation();
|
this.startAnimation();
|
||||||
|
else
|
||||||
|
this._maybeSetMenu();
|
||||||
|
|
||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
|
},
|
||||||
|
|
||||||
|
_maybeSetMenu: function() {
|
||||||
|
let menu;
|
||||||
|
|
||||||
|
if (this._targetApp.action_group && this._targetApp.menu) {
|
||||||
|
if (this.menu instanceof PopupMenu.RemoteMenu &&
|
||||||
|
this.menu.actionGroup == this._targetApp.action_group)
|
||||||
|
return;
|
||||||
|
|
||||||
|
menu = new PopupMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group);
|
||||||
|
} else {
|
||||||
|
if (this.menu && !(this.menu instanceof PopupMenu.RemoteMenu))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// fallback to older menu
|
||||||
|
menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0);
|
||||||
|
menu.addAction(_("Quit"), Lang.bind(this, function() {
|
||||||
|
this._targetApp.request_quit();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
this.setMenu(menu);
|
||||||
|
this._menuManager.addMenu(menu);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Signals.addSignalMethods(AppMenuButton.prototype);
|
Signals.addSignalMethods(AppMenuButton.prototype);
|
||||||
|
|
||||||
// Activities button. Because everything else in the top bar is a
|
// Activities button. Because everything else in the top bar is a
|
||||||
// PanelMenu.Button, it simplifies some things to make this be one too.
|
// PanelMenu.Button, it simplifies some things to make this be one too.
|
||||||
// We just hack it up to not actually have a menu attached to it.
|
// We just hack it up to not actually have a menu attached to it.
|
||||||
function ActivitiesButton() {
|
const ActivitiesButton = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ActivitiesButton',
|
||||||
}
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
ActivitiesButton.prototype = {
|
|
||||||
__proto__: PanelMenu.Button.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.Button.prototype._init.call(this, 0.0);
|
this.parent(0.0);
|
||||||
|
this.actor.accessible_role = Atk.Role.TOGGLE_BUTTON;
|
||||||
|
|
||||||
let container = new Shell.GenericContainer();
|
let container = new Shell.GenericContainer();
|
||||||
container.connect('get-preferred-width', Lang.bind(this, this._containerGetPreferredWidth));
|
container.connect('get-preferred-width', Lang.bind(this, this._containerGetPreferredWidth));
|
||||||
@ -575,6 +624,8 @@ ActivitiesButton.prototype = {
|
|||||||
this._label = new St.Label({ text: _("Activities") });
|
this._label = new St.Label({ text: _("Activities") });
|
||||||
container.add_actor(this._label);
|
container.add_actor(this._label);
|
||||||
|
|
||||||
|
this.actor.label_actor = this._label;
|
||||||
|
|
||||||
this._hotCorner = new Layout.HotCorner();
|
this._hotCorner = new Layout.HotCorner();
|
||||||
container.add_actor(this._hotCorner.actor);
|
container.add_actor(this._hotCorner.actor);
|
||||||
|
|
||||||
@ -590,10 +641,12 @@ ActivitiesButton.prototype = {
|
|||||||
Main.overview.connect('showing', Lang.bind(this, function() {
|
Main.overview.connect('showing', Lang.bind(this, function() {
|
||||||
this.actor.add_style_pseudo_class('overview');
|
this.actor.add_style_pseudo_class('overview');
|
||||||
this._escapeMenuGrab();
|
this._escapeMenuGrab();
|
||||||
|
this.actor.add_accessible_state (Atk.StateType.CHECKED);
|
||||||
}));
|
}));
|
||||||
Main.overview.connect('hiding', Lang.bind(this, function() {
|
Main.overview.connect('hiding', Lang.bind(this, function() {
|
||||||
this.actor.remove_style_pseudo_class('overview');
|
this.actor.remove_style_pseudo_class('overview');
|
||||||
this._escapeMenuGrab();
|
this._escapeMenuGrab();
|
||||||
|
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._xdndTimeOut = 0;
|
this._xdndTimeOut = 0;
|
||||||
@ -615,7 +668,7 @@ ActivitiesButton.prototype = {
|
|||||||
let primary = Main.layoutManager.primaryMonitor;
|
let primary = Main.layoutManager.primaryMonitor;
|
||||||
let hotBox = new Clutter.ActorBox();
|
let hotBox = new Clutter.ActorBox();
|
||||||
let ok, x, y;
|
let ok, x, y;
|
||||||
if (actor.get_direction() == St.TextDirection.LTR) {
|
if (actor.get_text_direction() == Clutter.TextDirection.LTR) {
|
||||||
[ok, x, y] = actor.transform_stage_point(primary.x, primary.y)
|
[ok, x, y] = actor.transform_stage_point(primary.x, primary.y)
|
||||||
} else {
|
} else {
|
||||||
[ok, x, y] = actor.transform_stage_point(primary.x + primary.width, primary.y);
|
[ok, x, y] = actor.transform_stage_point(primary.x + primary.width, primary.y);
|
||||||
@ -632,12 +685,14 @@ ActivitiesButton.prototype = {
|
|||||||
|
|
||||||
handleDragOver: function(source, actor, x, y, time) {
|
handleDragOver: function(source, actor, x, y, time) {
|
||||||
if (source != Main.xdndHandler)
|
if (source != Main.xdndHandler)
|
||||||
return;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
|
|
||||||
if (this._xdndTimeOut != 0)
|
if (this._xdndTimeOut != 0)
|
||||||
Mainloop.source_remove(this._xdndTimeOut);
|
Mainloop.source_remove(this._xdndTimeOut);
|
||||||
this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT,
|
this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT,
|
||||||
Lang.bind(this, this._xdndShowOverview, actor));
|
Lang.bind(this, this._xdndShowOverview, actor));
|
||||||
|
|
||||||
|
return DND.DragMotionResult.CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_escapeMenuGrab: function() {
|
_escapeMenuGrab: function() {
|
||||||
@ -698,13 +753,11 @@ ActivitiesButton.prototype = {
|
|||||||
Mainloop.source_remove(this._xdndTimeOut);
|
Mainloop.source_remove(this._xdndTimeOut);
|
||||||
this._xdndTimeOut = 0;
|
this._xdndTimeOut = 0;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PanelCorner(panel, side) {
|
const PanelCorner = new Lang.Class({
|
||||||
this._init(panel, side);
|
Name: 'PanelCorner',
|
||||||
}
|
|
||||||
|
|
||||||
PanelCorner.prototype = {
|
|
||||||
_init: function(box, side) {
|
_init: function(box, side) {
|
||||||
this._side = side;
|
this._side = side;
|
||||||
|
|
||||||
@ -769,7 +822,7 @@ PanelCorner.prototype = {
|
|||||||
|
|
||||||
let rtlAwareContainer = this._box instanceof St.BoxLayout;
|
let rtlAwareContainer = this._box instanceof St.BoxLayout;
|
||||||
if (rtlAwareContainer &&
|
if (rtlAwareContainer &&
|
||||||
this._box.get_direction() == St.TextDirection.RTL) {
|
this._box.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||||
if (this._side == St.Side.LEFT)
|
if (this._side == St.Side.LEFT)
|
||||||
side = St.Side.RIGHT;
|
side = St.Side.RIGHT;
|
||||||
else if (this._side == St.Side.RIGHT)
|
else if (this._side == St.Side.RIGHT)
|
||||||
@ -815,12 +868,10 @@ PanelCorner.prototype = {
|
|||||||
let node = this.actor.get_theme_node();
|
let node = this.actor.get_theme_node();
|
||||||
|
|
||||||
let cornerRadius = node.get_length("-panel-corner-radius");
|
let cornerRadius = node.get_length("-panel-corner-radius");
|
||||||
let innerBorderWidth = node.get_length('-panel-corner-inner-border-width');
|
let borderWidth = node.get_length('-panel-corner-border-width');
|
||||||
let outerBorderWidth = node.get_length('-panel-corner-outer-border-width');
|
|
||||||
|
|
||||||
let backgroundColor = node.get_color('-panel-corner-background-color');
|
let backgroundColor = node.get_color('-panel-corner-background-color');
|
||||||
let innerBorderColor = node.get_color('-panel-corner-inner-border-color');
|
let borderColor = node.get_color('-panel-corner-border-color');
|
||||||
let outerBorderColor = node.get_color('-panel-corner-outer-border-color');
|
|
||||||
|
|
||||||
let cr = this.actor.get_context();
|
let cr = this.actor.get_context();
|
||||||
cr.setOperator(Cairo.Operator.SOURCE);
|
cr.setOperator(Cairo.Operator.SOURCE);
|
||||||
@ -828,40 +879,23 @@ PanelCorner.prototype = {
|
|||||||
cr.moveTo(0, 0);
|
cr.moveTo(0, 0);
|
||||||
if (this._side == St.Side.LEFT)
|
if (this._side == St.Side.LEFT)
|
||||||
cr.arc(cornerRadius,
|
cr.arc(cornerRadius,
|
||||||
innerBorderWidth + cornerRadius,
|
borderWidth + cornerRadius,
|
||||||
cornerRadius, Math.PI, 3 * Math.PI / 2);
|
cornerRadius, Math.PI, 3 * Math.PI / 2);
|
||||||
else
|
else
|
||||||
cr.arc(0,
|
cr.arc(0,
|
||||||
innerBorderWidth + cornerRadius,
|
borderWidth + cornerRadius,
|
||||||
cornerRadius, 3 * Math.PI / 2, 2 * Math.PI);
|
cornerRadius, 3 * Math.PI / 2, 2 * Math.PI);
|
||||||
cr.lineTo(cornerRadius, 0);
|
cr.lineTo(cornerRadius, 0);
|
||||||
cr.closePath();
|
cr.closePath();
|
||||||
|
|
||||||
let savedPath = cr.copyPath();
|
let savedPath = cr.copyPath();
|
||||||
|
|
||||||
let over = _over(innerBorderColor,
|
|
||||||
_over(outerBorderColor, backgroundColor));
|
|
||||||
Clutter.cairo_set_source_color(cr, over);
|
|
||||||
cr.fill();
|
|
||||||
|
|
||||||
let xOffsetDirection = this._side == St.Side.LEFT ? -1 : 1;
|
let xOffsetDirection = this._side == St.Side.LEFT ? -1 : 1;
|
||||||
let offset = outerBorderWidth;
|
let over = _over(borderColor, backgroundColor);
|
||||||
over = _over(innerBorderColor, backgroundColor);
|
|
||||||
Clutter.cairo_set_source_color(cr, over);
|
Clutter.cairo_set_source_color(cr, over);
|
||||||
|
|
||||||
cr.save();
|
|
||||||
cr.translate(xOffsetDirection * offset, - offset);
|
|
||||||
cr.appendPath(savedPath);
|
|
||||||
cr.fill();
|
|
||||||
cr.restore();
|
|
||||||
|
|
||||||
if (this._side == St.Side.LEFT)
|
|
||||||
cr.rectangle(cornerRadius - offset, 0, offset, outerBorderWidth);
|
|
||||||
else
|
|
||||||
cr.rectangle(0, 0, offset, outerBorderWidth);
|
|
||||||
cr.fill();
|
cr.fill();
|
||||||
|
|
||||||
offset = innerBorderWidth;
|
let offset = borderWidth;
|
||||||
Clutter.cairo_set_source_color(cr, backgroundColor);
|
Clutter.cairo_set_source_color(cr, backgroundColor);
|
||||||
|
|
||||||
cr.save();
|
cr.save();
|
||||||
@ -875,19 +909,17 @@ PanelCorner.prototype = {
|
|||||||
let node = this.actor.get_theme_node();
|
let node = this.actor.get_theme_node();
|
||||||
|
|
||||||
let cornerRadius = node.get_length("-panel-corner-radius");
|
let cornerRadius = node.get_length("-panel-corner-radius");
|
||||||
let innerBorderWidth = node.get_length('-panel-corner-inner-border-width');
|
let borderWidth = node.get_length('-panel-corner-border-width');
|
||||||
|
|
||||||
this.actor.set_size(cornerRadius, innerBorderWidth + cornerRadius);
|
this.actor.set_size(cornerRadius, borderWidth + cornerRadius);
|
||||||
this.actor.set_anchor_point(0, innerBorderWidth);
|
this.actor.set_anchor_point(0, borderWidth);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
function Panel() {
|
const Panel = new Lang.Class({
|
||||||
this._init();
|
Name: 'Panel',
|
||||||
}
|
|
||||||
|
|
||||||
Panel.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this.actor = new Shell.GenericContainer({ name: 'panel',
|
this.actor = new Shell.GenericContainer({ name: 'panel',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
@ -911,14 +943,14 @@ Panel.prototype = {
|
|||||||
this._rightBox = new St.BoxLayout({ name: 'panelRight' });
|
this._rightBox = new St.BoxLayout({ name: 'panelRight' });
|
||||||
this.actor.add_actor(this._rightBox);
|
this.actor.add_actor(this._rightBox);
|
||||||
|
|
||||||
if (this.actor.get_direction() == St.TextDirection.RTL)
|
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL)
|
||||||
this._leftCorner = new PanelCorner(this._rightBox, St.Side.LEFT);
|
this._leftCorner = new PanelCorner(this._rightBox, St.Side.LEFT);
|
||||||
else
|
else
|
||||||
this._leftCorner = new PanelCorner(this._leftBox, St.Side.LEFT);
|
this._leftCorner = new PanelCorner(this._leftBox, St.Side.LEFT);
|
||||||
|
|
||||||
this.actor.add_actor(this._leftCorner.actor);
|
this.actor.add_actor(this._leftCorner.actor);
|
||||||
|
|
||||||
if (this.actor.get_direction() == St.TextDirection.RTL)
|
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL)
|
||||||
this._rightCorner = new PanelCorner(this._leftBox, St.Side.RIGHT);
|
this._rightCorner = new PanelCorner(this._leftBox, St.Side.RIGHT);
|
||||||
else
|
else
|
||||||
this._rightCorner = new PanelCorner(this._rightBox, St.Side.RIGHT);
|
this._rightCorner = new PanelCorner(this._rightBox, St.Side.RIGHT);
|
||||||
@ -927,6 +959,7 @@ Panel.prototype = {
|
|||||||
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||||
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||||
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
||||||
|
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
||||||
|
|
||||||
/* Button on the left side of the panel. */
|
/* Button on the left side of the panel. */
|
||||||
if (global.session_type == Shell.SessionType.USER) {
|
if (global.session_type == Shell.SessionType.USER) {
|
||||||
@ -938,9 +971,8 @@ Panel.prototype = {
|
|||||||
// more cleanly with the rest of the panel
|
// more cleanly with the rest of the panel
|
||||||
this._menus.addMenu(this._activitiesButton.menu);
|
this._menus.addMenu(this._activitiesButton.menu);
|
||||||
|
|
||||||
this._appMenu = new AppMenuButton();
|
this._appMenu = new AppMenuButton(this._menus);
|
||||||
this._leftBox.add(this._appMenu.actor);
|
this._leftBox.add(this._appMenu.actor);
|
||||||
this._menus.addMenu(this._appMenu.menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
@ -995,7 +1027,7 @@ Panel.prototype = {
|
|||||||
|
|
||||||
childBox.y1 = 0;
|
childBox.y1 = 0;
|
||||||
childBox.y2 = allocHeight;
|
childBox.y2 = allocHeight;
|
||||||
if (this.actor.get_direction() == St.TextDirection.RTL) {
|
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||||
childBox.x1 = allocWidth - Math.min(Math.floor(sideWidth),
|
childBox.x1 = allocWidth - Math.min(Math.floor(sideWidth),
|
||||||
leftNaturalWidth);
|
leftNaturalWidth);
|
||||||
childBox.x2 = allocWidth;
|
childBox.x2 = allocWidth;
|
||||||
@ -1014,7 +1046,7 @@ Panel.prototype = {
|
|||||||
|
|
||||||
childBox.y1 = 0;
|
childBox.y1 = 0;
|
||||||
childBox.y2 = allocHeight;
|
childBox.y2 = allocHeight;
|
||||||
if (this.actor.get_direction() == St.TextDirection.RTL) {
|
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||||
childBox.x1 = 0;
|
childBox.x1 = 0;
|
||||||
childBox.x2 = Math.min(Math.floor(sideWidth),
|
childBox.x2 = Math.min(Math.floor(sideWidth),
|
||||||
rightNaturalWidth);
|
rightNaturalWidth);
|
||||||
@ -1042,6 +1074,54 @@ Panel.prototype = {
|
|||||||
this._rightCorner.actor.allocate(childBox, flags);
|
this._rightCorner.actor.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onButtonPress: function(actor, event) {
|
||||||
|
if (event.get_source() != actor)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
let button = event.get_button();
|
||||||
|
if (button != 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
let focusWindow = global.display.focus_window;
|
||||||
|
if (!focusWindow)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
let dragWindow = focusWindow.is_attached_dialog() ? focusWindow.get_transient_for()
|
||||||
|
: focusWindow;
|
||||||
|
if (!dragWindow)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
let rect = dragWindow.get_outer_rect();
|
||||||
|
let [stageX, stageY] = event.get_coords();
|
||||||
|
|
||||||
|
let allowDrag = dragWindow.maximized_vertically &&
|
||||||
|
stageX > rect.x && stageX < rect.x + rect.width;
|
||||||
|
|
||||||
|
if (!allowDrag)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
global.display.begin_grab_op(global.screen,
|
||||||
|
dragWindow,
|
||||||
|
Meta.GrabOp.MOVING,
|
||||||
|
false, /* pointer grab */
|
||||||
|
true, /* frame action */
|
||||||
|
button,
|
||||||
|
event.get_state(),
|
||||||
|
event.get_time(),
|
||||||
|
stageX, stageY);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
openAppMenu: function() {
|
||||||
|
let menu = this._appMenu.menu;
|
||||||
|
if (Main.overview.visible || menu.isOpen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
menu.open();
|
||||||
|
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||||
|
},
|
||||||
|
|
||||||
startStatusArea: function() {
|
startStatusArea: function() {
|
||||||
for (let i = 0; i < this._status_area_order.length; i++) {
|
for (let i = 0; i < this._status_area_order.length; i++) {
|
||||||
let role = this._status_area_order[i];
|
let role = this._status_area_order[i];
|
||||||
@ -1062,13 +1142,13 @@ Panel.prototype = {
|
|||||||
for (i = children.length - 1; i >= 0; i--) {
|
for (i = children.length - 1; i >= 0; i--) {
|
||||||
let rolePosition = children[i]._rolePosition;
|
let rolePosition = children[i]._rolePosition;
|
||||||
if (position > rolePosition) {
|
if (position > rolePosition) {
|
||||||
this._rightBox.insert_actor(actor, i + 1);
|
this._rightBox.insert_child_at_index(actor, i + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
// If we didn't find a position, we must be first
|
// If we didn't find a position, we must be first
|
||||||
this._rightBox.insert_actor(actor, 0);
|
this._rightBox.insert_child_at_index(actor, 0);
|
||||||
}
|
}
|
||||||
actor._rolePosition = position;
|
actor._rolePosition = position;
|
||||||
},
|
},
|
||||||
@ -1114,5 +1194,4 @@ Panel.prototype = {
|
|||||||
if (box && box._delegate instanceof PanelMenu.ButtonBox)
|
if (box && box._delegate instanceof PanelMenu.ButtonBox)
|
||||||
box.destroy();
|
box.destroy();
|
||||||
},
|
},
|
||||||
|
});
|
||||||
};
|
|
||||||
|
@ -6,16 +6,15 @@ const Lang = imports.lang;
|
|||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
|
|
||||||
function ButtonBox(params) {
|
const ButtonBox = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ButtonBox',
|
||||||
};
|
|
||||||
|
|
||||||
ButtonBox.prototype = {
|
|
||||||
_init: function(params) {
|
_init: function(params) {
|
||||||
params = Params.parse(params, { style_class: 'panel-button' }, true);
|
params = Params.parse(params, { style_class: 'panel-button' }, true);
|
||||||
this.actor = new Shell.GenericContainer(params);
|
this.actor = new Shell.GenericContainer(params);
|
||||||
@ -92,44 +91,71 @@ ButtonBox.prototype = {
|
|||||||
|
|
||||||
child.allocate(childBox, flags);
|
child.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
|
|
||||||
function Button(menuAlignment) {
|
const Button = new Lang.Class({
|
||||||
this._init(menuAlignment);
|
Name: 'PanelMenuButton',
|
||||||
}
|
Extends: ButtonBox,
|
||||||
|
|
||||||
Button.prototype = {
|
_init: function(menuAlignment, nameText, dontCreateMenu) {
|
||||||
__proto__: ButtonBox.prototype,
|
this.parent({ reactive: true,
|
||||||
|
|
||||||
_init: function(menuAlignment) {
|
|
||||||
ButtonBox.prototype._init.call(this, { reactive: true,
|
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
track_hover: true });
|
track_hover: true,
|
||||||
|
accessible_role: Atk.Role.MENU });
|
||||||
|
|
||||||
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
||||||
this.actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress));
|
this.actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress));
|
||||||
this.menu = new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP);
|
|
||||||
|
if (dontCreateMenu)
|
||||||
|
this.menu = null;
|
||||||
|
else
|
||||||
|
this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
|
||||||
|
|
||||||
|
this.setName(nameText);
|
||||||
|
},
|
||||||
|
|
||||||
|
setName: function(text) {
|
||||||
|
if (text != null) {
|
||||||
|
// This is the easiest way to provide a accessible name to
|
||||||
|
// this widget. The label could be also used for other
|
||||||
|
// purposes in the future.
|
||||||
|
if (!this.label) {
|
||||||
|
this.label = new St.Label({ text: text });
|
||||||
|
this.actor.label_actor = this.label;
|
||||||
|
} else
|
||||||
|
this.label.text = text;
|
||||||
|
} else {
|
||||||
|
this.label = null;
|
||||||
|
this.actor.label_actor = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setMenu: function(menu) {
|
||||||
|
if (this.menu)
|
||||||
|
this.menu.destroy();
|
||||||
|
|
||||||
|
this.menu = menu;
|
||||||
|
if (this.menu) {
|
||||||
this.menu.actor.add_style_class_name('panel-menu');
|
this.menu.actor.add_style_class_name('panel-menu');
|
||||||
this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged));
|
this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged));
|
||||||
this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress));
|
this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress));
|
||||||
|
|
||||||
Main.uiGroup.add_actor(this.menu.actor);
|
Main.uiGroup.add_actor(this.menu.actor);
|
||||||
this.menu.actor.hide();
|
this.menu.actor.hide();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonPress: function(actor, event) {
|
_onButtonPress: function(actor, event) {
|
||||||
if (!this.menu.isOpen) {
|
if (!this.menu)
|
||||||
// Setting the max-height won't do any good if the minimum height of the
|
return;
|
||||||
// menu is higher then the screen; it's useful if part of the menu is
|
|
||||||
// scrollable so the minimum height is smaller than the natural height
|
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
|
||||||
this.menu.actor.style = ('max-height: ' +
|
|
||||||
Math.round(monitor.height - Main.panel.actor.height) +
|
|
||||||
'px;');
|
|
||||||
}
|
|
||||||
this.menu.toggle();
|
this.menu.toggle();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceKeyPress: function(actor, event) {
|
_onSourceKeyPress: function(actor, event) {
|
||||||
|
if (!this.menu)
|
||||||
|
return false;
|
||||||
|
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
|
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
|
||||||
this.menu.toggle();
|
this.menu.toggle();
|
||||||
@ -165,6 +191,14 @@ Button.prototype = {
|
|||||||
this.actor.add_style_pseudo_class('active');
|
this.actor.add_style_pseudo_class('active');
|
||||||
else
|
else
|
||||||
this.actor.remove_style_pseudo_class('active');
|
this.actor.remove_style_pseudo_class('active');
|
||||||
|
|
||||||
|
// Setting the max-height won't do any good if the minimum height of the
|
||||||
|
// menu is higher then the screen; it's useful if part of the menu is
|
||||||
|
// scrollable so the minimum height is smaller than the natural height
|
||||||
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
|
this.menu.actor.style = ('max-height: ' +
|
||||||
|
Math.round(monitor.height - Main.panel.actor.height) +
|
||||||
|
'px;');
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
@ -175,30 +209,27 @@ Button.prototype = {
|
|||||||
|
|
||||||
this.emit('destroy');
|
this.emit('destroy');
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(Button.prototype);
|
Signals.addSignalMethods(Button.prototype);
|
||||||
|
|
||||||
/* SystemStatusButton:
|
/* SystemStatusButton:
|
||||||
*
|
*
|
||||||
* This class manages one System Status indicator (network, keyboard,
|
* This class manages one System Status indicator (network, keyboard,
|
||||||
* volume, bluetooth...), which is just a PanelMenuButton with an
|
* volume, bluetooth...), which is just a PanelMenuButton with an
|
||||||
* icon and a tooltip
|
* icon.
|
||||||
*/
|
*/
|
||||||
function SystemStatusButton() {
|
const SystemStatusButton = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'SystemStatusButton',
|
||||||
}
|
Extends: Button,
|
||||||
|
|
||||||
SystemStatusButton.prototype = {
|
_init: function(iconName, nameText) {
|
||||||
__proto__: Button.prototype,
|
this.parent(0.0, nameText);
|
||||||
|
|
||||||
_init: function(iconName,tooltipText) {
|
|
||||||
Button.prototype._init.call(this, 0.0);
|
|
||||||
this._iconActor = new St.Icon({ icon_name: iconName,
|
this._iconActor = new St.Icon({ icon_name: iconName,
|
||||||
icon_type: St.IconType.SYMBOLIC,
|
icon_type: St.IconType.SYMBOLIC,
|
||||||
style_class: 'system-status-icon' });
|
style_class: 'system-status-icon' });
|
||||||
this.actor.add_actor(this._iconActor);
|
this.actor.add_actor(this._iconActor);
|
||||||
this.actor.add_style_class_name('panel-status-button');
|
this.actor.add_style_class_name('panel-status-button');
|
||||||
this.setTooltip(tooltipText);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setIcon: function(iconName) {
|
setIcon: function(iconName) {
|
||||||
@ -207,16 +238,5 @@ SystemStatusButton.prototype = {
|
|||||||
|
|
||||||
setGIcon: function(gicon) {
|
setGIcon: function(gicon) {
|
||||||
this._iconActor.gicon = gicon;
|
this._iconActor.gicon = gicon;
|
||||||
},
|
|
||||||
|
|
||||||
setTooltip: function(text) {
|
|
||||||
if (text != null) {
|
|
||||||
this.tooltip = text;
|
|
||||||
this.actor.has_tooltip = true;
|
|
||||||
this.actor.tooltip_text = text;
|
|
||||||
} else {
|
|
||||||
this.actor.has_tooltip = false;
|
|
||||||
this.tooltip = null;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
};
|
|
||||||
|
@ -22,11 +22,9 @@ const Util = imports.misc.util;
|
|||||||
* @iconFactory: A JavaScript callback which will create an icon texture given a size parameter
|
* @iconFactory: A JavaScript callback which will create an icon texture given a size parameter
|
||||||
* @launch: A JavaScript callback to launch the entry
|
* @launch: A JavaScript callback to launch the entry
|
||||||
*/
|
*/
|
||||||
function PlaceInfo(id, name, iconFactory, launch) {
|
const PlaceInfo = new Lang.Class({
|
||||||
this._init(id, name, iconFactory, launch);
|
Name: 'PlaceInfo',
|
||||||
}
|
|
||||||
|
|
||||||
PlaceInfo.prototype = {
|
|
||||||
_init: function(id, name, iconFactory, launch) {
|
_init: function(id, name, iconFactory, launch) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -55,7 +53,7 @@ PlaceInfo.prototype = {
|
|||||||
isRemovable: function() {
|
isRemovable: function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
// Helper function to translate launch parameters into a GAppLaunchContext
|
// Helper function to translate launch parameters into a GAppLaunchContext
|
||||||
function _makeLaunchContext(params)
|
function _makeLaunchContext(params)
|
||||||
@ -72,12 +70,9 @@ function _makeLaunchContext(params)
|
|||||||
return launchContext;
|
return launchContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
function PlaceDeviceInfo(mount) {
|
const PlaceDeviceInfo = new Lang.Class({
|
||||||
this._init(mount);
|
Name: 'PlaceDeviceInfo',
|
||||||
}
|
Extends: PlaceInfo,
|
||||||
|
|
||||||
PlaceDeviceInfo.prototype = {
|
|
||||||
__proto__: PlaceInfo.prototype,
|
|
||||||
|
|
||||||
_init: function(mount) {
|
_init: function(mount) {
|
||||||
this._mount = mount;
|
this._mount = mount;
|
||||||
@ -123,13 +118,11 @@ PlaceDeviceInfo.prototype = {
|
|||||||
_("Retry"));
|
_("Retry"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PlacesManager() {
|
const PlacesManager = new Lang.Class({
|
||||||
this._init();
|
Name: 'PlacesManager',
|
||||||
}
|
|
||||||
|
|
||||||
PlacesManager.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._defaultPlaces = [];
|
this._defaultPlaces = [];
|
||||||
this._mounts = [];
|
this._mounts = [];
|
||||||
@ -162,9 +155,12 @@ PlacesManager.prototype = {
|
|||||||
|
|
||||||
this._connect = new PlaceInfo('special:connect', _("Connect to..."),
|
this._connect = new PlaceInfo('special:connect', _("Connect to..."),
|
||||||
function (size) {
|
function (size) {
|
||||||
return new St.Icon({ icon_name: 'applications-internet',
|
// do NOT use St.Icon here, it crashes the shell
|
||||||
icon_type: St.IconType.FULLCOLOR,
|
// see wanda.js for details
|
||||||
icon_size: size });
|
return St.TextureCache.get_default().load_icon_name(null,
|
||||||
|
'applications-internet',
|
||||||
|
St.IconType.FULLCOLOR,
|
||||||
|
size);
|
||||||
},
|
},
|
||||||
function (params) {
|
function (params) {
|
||||||
// BUG: nautilus-connect-server doesn't have a desktop file, so we can't
|
// BUG: nautilus-connect-server doesn't have a desktop file, so we can't
|
||||||
@ -195,9 +191,9 @@ PlacesManager.prototype = {
|
|||||||
|
|
||||||
this._bookmarksPath = GLib.build_filenamev([GLib.get_home_dir(), '.gtk-bookmarks']);
|
this._bookmarksPath = GLib.build_filenamev([GLib.get_home_dir(), '.gtk-bookmarks']);
|
||||||
this._bookmarksFile = Gio.file_new_for_path(this._bookmarksPath);
|
this._bookmarksFile = Gio.file_new_for_path(this._bookmarksPath);
|
||||||
let monitor = this._bookmarksFile.monitor_file(Gio.FileMonitorFlags.NONE, null);
|
this._monitor = this._bookmarksFile.monitor_file(Gio.FileMonitorFlags.NONE, null);
|
||||||
this._bookmarkTimeoutId = 0;
|
this._bookmarkTimeoutId = 0;
|
||||||
monitor.connect('changed', Lang.bind(this, function () {
|
this._monitor.connect('changed', Lang.bind(this, function () {
|
||||||
if (this._bookmarkTimeoutId > 0)
|
if (this._bookmarkTimeoutId > 0)
|
||||||
return;
|
return;
|
||||||
/* Defensive event compression */
|
/* Defensive event compression */
|
||||||
@ -360,31 +356,32 @@ PlacesManager.prototype = {
|
|||||||
_removeById: function(sourceArray, id) {
|
_removeById: function(sourceArray, id) {
|
||||||
sourceArray.splice(this._lookupIndexById(sourceArray, id), 1);
|
sourceArray.splice(this._lookupIndexById(sourceArray, id), 1);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(PlacesManager.prototype);
|
Signals.addSignalMethods(PlacesManager.prototype);
|
||||||
|
|
||||||
|
const PlaceSearchProvider = new Lang.Class({
|
||||||
function PlaceSearchProvider() {
|
Name: 'PlaceSearchProvider',
|
||||||
this._init();
|
Extends: Search.SearchProvider,
|
||||||
}
|
|
||||||
|
|
||||||
PlaceSearchProvider.prototype = {
|
|
||||||
__proto__: Search.SearchProvider.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Search.SearchProvider.prototype._init.call(this, _("PLACES & DEVICES"));
|
this.parent(_("PLACES & DEVICES"));
|
||||||
},
|
},
|
||||||
|
|
||||||
getResultMeta: function(resultId) {
|
getResultMetas: function(resultIds) {
|
||||||
let placeInfo = Main.placesManager.lookupPlaceById(resultId);
|
let metas = [];
|
||||||
|
for (let i = 0; i < resultIds.length; i++) {
|
||||||
|
let placeInfo = Main.placesManager.lookupPlaceById(resultIds[i]);
|
||||||
if (!placeInfo)
|
if (!placeInfo)
|
||||||
return null;
|
metas.push(null);
|
||||||
return { 'id': resultId,
|
else
|
||||||
|
metas.push({ 'id': resultIds[i],
|
||||||
'name': placeInfo.name,
|
'name': placeInfo.name,
|
||||||
'createIcon': function(size) {
|
'createIcon': function(size) {
|
||||||
return placeInfo.iconFactory(size);
|
return placeInfo.iconFactory(size);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
}
|
||||||
|
return metas;
|
||||||
},
|
},
|
||||||
|
|
||||||
activateResult: function(id, params) {
|
activateResult: function(id, params) {
|
||||||
@ -434,4 +431,4 @@ PlaceSearchProvider.prototype = {
|
|||||||
let places = previousResults.map(function (id) { return Main.placesManager.lookupPlaceById(id); });
|
let places = previousResults.map(function (id) { return Main.placesManager.lookupPlaceById(id); });
|
||||||
return this._searchPlaces(places, terms);
|
return this._searchPlaces(places, terms);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -27,6 +27,7 @@ const AccountsService = imports.gi.AccountsService;
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Pango = imports.gi.Pango;
|
const Pango = imports.gi.Pango;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Polkit = imports.gi.Polkit;
|
const Polkit = imports.gi.Polkit;
|
||||||
@ -35,15 +36,12 @@ const PolkitAgent = imports.gi.PolkitAgent;
|
|||||||
const ModalDialog = imports.ui.modalDialog;
|
const ModalDialog = imports.ui.modalDialog;
|
||||||
const ShellEntry = imports.ui.shellEntry;
|
const ShellEntry = imports.ui.shellEntry;
|
||||||
|
|
||||||
function AuthenticationDialog(actionId, message, cookie, userNames) {
|
const AuthenticationDialog = new Lang.Class({
|
||||||
this._init(actionId, message, cookie, userNames);
|
Name: 'AuthenticationDialog',
|
||||||
}
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
AuthenticationDialog.prototype = {
|
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
|
||||||
|
|
||||||
_init: function(actionId, message, cookie, userNames) {
|
_init: function(actionId, message, cookie, userNames) {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'polkit-dialog' });
|
this.parent({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
this.actionId = actionId;
|
this.actionId = actionId;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@ -51,7 +49,7 @@ AuthenticationDialog.prototype = {
|
|||||||
this._wasDismissed = false;
|
this._wasDismissed = false;
|
||||||
this._completed = false;
|
this._completed = false;
|
||||||
|
|
||||||
let mainContentBox = new St.BoxLayout({ style_class: 'polkit-dialog-main-layout',
|
let mainContentBox = new St.BoxLayout({ style_class: 'prompt-dialog-main-layout',
|
||||||
vertical: false });
|
vertical: false });
|
||||||
this.contentLayout.add(mainContentBox,
|
this.contentLayout.add(mainContentBox,
|
||||||
{ x_fill: true,
|
{ x_fill: true,
|
||||||
@ -64,19 +62,19 @@ AuthenticationDialog.prototype = {
|
|||||||
x_align: St.Align.END,
|
x_align: St.Align.END,
|
||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
|
|
||||||
let messageBox = new St.BoxLayout({ style_class: 'polkit-dialog-message-layout',
|
let messageBox = new St.BoxLayout({ style_class: 'prompt-dialog-message-layout',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
mainContentBox.add(messageBox,
|
mainContentBox.add(messageBox,
|
||||||
{ y_align: St.Align.START });
|
{ y_align: St.Align.START });
|
||||||
|
|
||||||
this._subjectLabel = new St.Label({ style_class: 'polkit-dialog-headline',
|
this._subjectLabel = new St.Label({ style_class: 'prompt-dialog-headline',
|
||||||
text: _("Authentication Required") });
|
text: _("Authentication Required") });
|
||||||
|
|
||||||
messageBox.add(this._subjectLabel,
|
messageBox.add(this._subjectLabel,
|
||||||
{ y_fill: false,
|
{ y_fill: false,
|
||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
|
|
||||||
this._descriptionLabel = new St.Label({ style_class: 'polkit-dialog-description',
|
this._descriptionLabel = new St.Label({ style_class: 'prompt-dialog-description',
|
||||||
text: message });
|
text: message });
|
||||||
this._descriptionLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
this._descriptionLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
this._descriptionLabel.clutter_text.line_wrap = true;
|
this._descriptionLabel.clutter_text.line_wrap = true;
|
||||||
@ -88,10 +86,14 @@ AuthenticationDialog.prototype = {
|
|||||||
if (userNames.length > 1) {
|
if (userNames.length > 1) {
|
||||||
log('polkitAuthenticationAgent: Received ' + userNames.length +
|
log('polkitAuthenticationAgent: Received ' + userNames.length +
|
||||||
' identities that can be used for authentication. Only ' +
|
' identities that can be used for authentication. Only ' +
|
||||||
'considering the first one.');
|
'considering one.');
|
||||||
}
|
}
|
||||||
|
|
||||||
let userName = userNames[0];
|
let userName = GLib.get_user_name();
|
||||||
|
if (userNames.indexOf(userName) < 0)
|
||||||
|
userName = 'root';
|
||||||
|
if (userNames.indexOf(userName) < 0)
|
||||||
|
userName = userNames[0];
|
||||||
|
|
||||||
this._user = AccountsService.UserManager.get_default().get_user(userName);
|
this._user = AccountsService.UserManager.get_default().get_user(userName);
|
||||||
let userRealName = this._user.get_real_name()
|
let userRealName = this._user.get_real_name()
|
||||||
@ -135,9 +137,9 @@ AuthenticationDialog.prototype = {
|
|||||||
|
|
||||||
this._passwordBox = new St.BoxLayout({ vertical: false });
|
this._passwordBox = new St.BoxLayout({ vertical: false });
|
||||||
messageBox.add(this._passwordBox);
|
messageBox.add(this._passwordBox);
|
||||||
this._passwordLabel = new St.Label(({ style_class: 'polkit-dialog-password-label' }));
|
this._passwordLabel = new St.Label(({ style_class: 'prompt-dialog-password-label' }));
|
||||||
this._passwordBox.add(this._passwordLabel);
|
this._passwordBox.add(this._passwordLabel);
|
||||||
this._passwordEntry = new St.Entry({ style_class: 'polkit-dialog-password-entry',
|
this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
|
||||||
text: "",
|
text: "",
|
||||||
can_focus: true});
|
can_focus: true});
|
||||||
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
|
ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true });
|
||||||
@ -147,13 +149,13 @@ AuthenticationDialog.prototype = {
|
|||||||
this.setInitialKeyFocus(this._passwordEntry);
|
this.setInitialKeyFocus(this._passwordEntry);
|
||||||
this._passwordBox.hide();
|
this._passwordBox.hide();
|
||||||
|
|
||||||
this._errorMessageLabel = new St.Label({ style_class: 'polkit-dialog-error-label' });
|
this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label' });
|
||||||
this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
this._errorMessageLabel.clutter_text.line_wrap = true;
|
this._errorMessageLabel.clutter_text.line_wrap = true;
|
||||||
messageBox.add(this._errorMessageLabel);
|
messageBox.add(this._errorMessageLabel);
|
||||||
this._errorMessageLabel.hide();
|
this._errorMessageLabel.hide();
|
||||||
|
|
||||||
this._infoMessageLabel = new St.Label({ style_class: 'polkit-dialog-info-label' });
|
this._infoMessageLabel = new St.Label({ style_class: 'prompt-dialog-info-label' });
|
||||||
this._infoMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
this._infoMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
this._infoMessageLabel.clutter_text.line_wrap = true;
|
this._infoMessageLabel.clutter_text.line_wrap = true;
|
||||||
messageBox.add(this._infoMessageLabel);
|
messageBox.add(this._infoMessageLabel);
|
||||||
@ -163,7 +165,7 @@ AuthenticationDialog.prototype = {
|
|||||||
* infoMessage and errorMessageLabel - but it is still invisible because
|
* infoMessage and errorMessageLabel - but it is still invisible because
|
||||||
* gnome-shell.css sets the color to be transparent
|
* gnome-shell.css sets the color to be transparent
|
||||||
*/
|
*/
|
||||||
this._nullMessageLabel = new St.Label({ style_class: 'polkit-dialog-null-label',
|
this._nullMessageLabel = new St.Label({ style_class: 'prompt-dialog-null-label',
|
||||||
text: 'abc'});
|
text: 'abc'});
|
||||||
this._nullMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
this._nullMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
this._nullMessageLabel.clutter_text.line_wrap = true;
|
this._nullMessageLabel.clutter_text.line_wrap = true;
|
||||||
@ -330,15 +332,12 @@ AuthenticationDialog.prototype = {
|
|||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
this._emitDone(false, true);
|
this._emitDone(false, true);
|
||||||
},
|
},
|
||||||
|
});
|
||||||
};
|
|
||||||
Signals.addSignalMethods(AuthenticationDialog.prototype);
|
Signals.addSignalMethods(AuthenticationDialog.prototype);
|
||||||
|
|
||||||
function AuthenticationAgent() {
|
const AuthenticationAgent = new Lang.Class({
|
||||||
this._init();
|
Name: 'AuthenticationAgent',
|
||||||
}
|
|
||||||
|
|
||||||
AuthenticationAgent.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._native = new Shell.PolkitAuthenticationAgent();
|
this._native = new Shell.PolkitAuthenticationAgent();
|
||||||
this._native.connect('initiate', Lang.bind(this, this._onInitiate));
|
this._native.connect('initiate', Lang.bind(this, this._onInitiate));
|
||||||
@ -394,12 +393,13 @@ AuthenticationAgent.prototype = {
|
|||||||
Lang.bind(this,
|
Lang.bind(this,
|
||||||
function() {
|
function() {
|
||||||
this._reallyCompleteRequest(wasDismissed);
|
this._reallyCompleteRequest(wasDismissed);
|
||||||
|
return false;
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
this._reallyCompleteRequest(wasDismissed);
|
this._reallyCompleteRequest(wasDismissed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
let agent = new AuthenticationAgent();
|
let agent = new AuthenticationAgent();
|
||||||
|
@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
const Cairo = imports.cairo;
|
const Cairo = imports.cairo;
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
const Atk = imports.gi.Atk;
|
||||||
|
|
||||||
const BoxPointer = imports.ui.boxpointer;
|
const BoxPointer = imports.ui.boxpointer;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
@ -26,11 +29,9 @@ function _ensureStyle(actor) {
|
|||||||
actor.ensure_style();
|
actor.ensure_style();
|
||||||
}
|
}
|
||||||
|
|
||||||
function PopupBaseMenuItem(params) {
|
const PopupBaseMenuItem = new Lang.Class({
|
||||||
this._init(params);
|
Name: 'PopupBaseMenuItem',
|
||||||
}
|
|
||||||
|
|
||||||
PopupBaseMenuItem.prototype = {
|
|
||||||
_init: function (params) {
|
_init: function (params) {
|
||||||
params = Params.parse (params, { reactive: true,
|
params = Params.parse (params, { reactive: true,
|
||||||
activate: true,
|
activate: true,
|
||||||
@ -41,7 +42,8 @@ PopupBaseMenuItem.prototype = {
|
|||||||
this.actor = new Shell.GenericContainer({ style_class: 'popup-menu-item',
|
this.actor = new Shell.GenericContainer({ style_class: 'popup-menu-item',
|
||||||
reactive: params.reactive,
|
reactive: params.reactive,
|
||||||
track_hover: params.reactive,
|
track_hover: params.reactive,
|
||||||
can_focus: params.reactive });
|
can_focus: params.reactive,
|
||||||
|
accessible_role: Atk.Role.MENU_ITEM});
|
||||||
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||||
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||||
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
||||||
@ -108,13 +110,15 @@ PopupBaseMenuItem.prototype = {
|
|||||||
this.emit('activate', event);
|
this.emit('activate', event);
|
||||||
},
|
},
|
||||||
|
|
||||||
setActive: function (active) {
|
setActive: function (active, params) {
|
||||||
let activeChanged = active != this.active;
|
let activeChanged = active != this.active;
|
||||||
|
params = Params.parse (params, { grabKeyboard: true });
|
||||||
|
|
||||||
if (activeChanged) {
|
if (activeChanged) {
|
||||||
this.active = active;
|
this.active = active;
|
||||||
if (active) {
|
if (active) {
|
||||||
this.actor.add_style_pseudo_class('active');
|
this.actor.add_style_pseudo_class('active');
|
||||||
|
if (params.grabKeyboard)
|
||||||
this.actor.grab_key_focus();
|
this.actor.grab_key_focus();
|
||||||
} else
|
} else
|
||||||
this.actor.remove_style_pseudo_class('active');
|
this.actor.remove_style_pseudo_class('active');
|
||||||
@ -271,7 +275,7 @@ PopupBaseMenuItem.prototype = {
|
|||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate: function(actor, box, flags) {
|
||||||
let height = box.y2 - box.y1;
|
let height = box.y2 - box.y1;
|
||||||
let direction = this.actor.get_direction();
|
let direction = this.actor.get_text_direction();
|
||||||
|
|
||||||
if (this._dot) {
|
if (this._dot) {
|
||||||
// The dot is placed outside box
|
// The dot is placed outside box
|
||||||
@ -281,7 +285,7 @@ PopupBaseMenuItem.prototype = {
|
|||||||
let dotBox = new Clutter.ActorBox();
|
let dotBox = new Clutter.ActorBox();
|
||||||
let dotWidth = Math.round(box.x1 / 2);
|
let dotWidth = Math.round(box.x1 / 2);
|
||||||
|
|
||||||
if (direction == St.TextDirection.LTR) {
|
if (direction == Clutter.TextDirection.LTR) {
|
||||||
dotBox.x1 = Math.round(box.x1 / 4);
|
dotBox.x1 = Math.round(box.x1 / 4);
|
||||||
dotBox.x2 = dotBox.x1 + dotWidth;
|
dotBox.x2 = dotBox.x1 + dotWidth;
|
||||||
} else {
|
} else {
|
||||||
@ -294,7 +298,7 @@ PopupBaseMenuItem.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let x;
|
let x;
|
||||||
if (direction == St.TextDirection.LTR)
|
if (direction == Clutter.TextDirection.LTR)
|
||||||
x = box.x1;
|
x = box.x1;
|
||||||
else
|
else
|
||||||
x = box.x2;
|
x = box.x2;
|
||||||
@ -309,7 +313,7 @@ PopupBaseMenuItem.prototype = {
|
|||||||
let availWidth, extraWidth;
|
let availWidth, extraWidth;
|
||||||
if (this._columnWidths) {
|
if (this._columnWidths) {
|
||||||
if (child.span == -1) {
|
if (child.span == -1) {
|
||||||
if (direction == St.TextDirection.LTR)
|
if (direction == Clutter.TextDirection.LTR)
|
||||||
availWidth = box.x2 - x;
|
availWidth = box.x2 - x;
|
||||||
else
|
else
|
||||||
availWidth = x - box.x1;
|
availWidth = x - box.x1;
|
||||||
@ -321,7 +325,7 @@ PopupBaseMenuItem.prototype = {
|
|||||||
extraWidth = availWidth - naturalWidth;
|
extraWidth = availWidth - naturalWidth;
|
||||||
} else {
|
} else {
|
||||||
if (child.span == -1) {
|
if (child.span == -1) {
|
||||||
if (direction == St.TextDirection.LTR)
|
if (direction == Clutter.TextDirection.LTR)
|
||||||
availWidth = box.x2 - x;
|
availWidth = box.x2 - x;
|
||||||
else
|
else
|
||||||
availWidth = x - box.x1;
|
availWidth = x - box.x1;
|
||||||
@ -331,7 +335,7 @@ PopupBaseMenuItem.prototype = {
|
|||||||
extraWidth = 0;
|
extraWidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (direction == St.TextDirection.LTR) {
|
if (direction == Clutter.TextDirection.LTR) {
|
||||||
if (child.expand) {
|
if (child.expand) {
|
||||||
childBox.x1 = x;
|
childBox.x1 = x;
|
||||||
childBox.x2 = x + availWidth;
|
childBox.x2 = x + availWidth;
|
||||||
@ -369,39 +373,34 @@ PopupBaseMenuItem.prototype = {
|
|||||||
|
|
||||||
child.actor.allocate(childBox, flags);
|
child.actor.allocate(childBox, flags);
|
||||||
|
|
||||||
if (direction == St.TextDirection.LTR)
|
if (direction == Clutter.TextDirection.LTR)
|
||||||
x += availWidth + this._spacing;
|
x += availWidth + this._spacing;
|
||||||
else
|
else
|
||||||
x -= availWidth + this._spacing;
|
x -= availWidth + this._spacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(PopupBaseMenuItem.prototype);
|
Signals.addSignalMethods(PopupBaseMenuItem.prototype);
|
||||||
|
|
||||||
function PopupMenuItem() {
|
const PopupMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupMenuItem',
|
||||||
}
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
PopupMenuItem.prototype = {
|
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function (text, params) {
|
_init: function (text, params) {
|
||||||
PopupBaseMenuItem.prototype._init.call(this, params);
|
this.parent(params);
|
||||||
|
|
||||||
this.label = new St.Label({ text: text });
|
this.label = new St.Label({ text: text });
|
||||||
this.addActor(this.label);
|
this.addActor(this.label);
|
||||||
|
this.actor.label_actor = this.label
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PopupSeparatorMenuItem() {
|
const PopupSeparatorMenuItem = new Lang.Class({
|
||||||
this._init();
|
Name: 'PopupSeparatorMenuItem',
|
||||||
}
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
PopupSeparatorMenuItem.prototype = {
|
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function () {
|
_init: function () {
|
||||||
PopupBaseMenuItem.prototype._init.call(this, { reactive: false });
|
this.parent({ reactive: false });
|
||||||
|
|
||||||
this._drawingArea = new St.DrawingArea({ style_class: 'popup-separator-menu-item' });
|
this._drawingArea = new St.DrawingArea({ style_class: 'popup-separator-menu-item' });
|
||||||
this.addActor(this._drawingArea, { span: -1, expand: true });
|
this.addActor(this._drawingArea, { span: -1, expand: true });
|
||||||
@ -427,22 +426,19 @@ PopupSeparatorMenuItem.prototype = {
|
|||||||
cr.rectangle(margin, gradientOffset, gradientWidth, gradientHeight);
|
cr.rectangle(margin, gradientOffset, gradientWidth, gradientHeight);
|
||||||
cr.fill();
|
cr.fill();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
const PopupAlternatingMenuItemState = {
|
const PopupAlternatingMenuItemState = {
|
||||||
DEFAULT: 0,
|
DEFAULT: 0,
|
||||||
ALTERNATIVE: 1
|
ALTERNATIVE: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function PopupAlternatingMenuItem() {
|
const PopupAlternatingMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupAlternatingMenuItem',
|
||||||
}
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
PopupAlternatingMenuItem.prototype = {
|
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function(text, alternateText, params) {
|
_init: function(text, alternateText, params) {
|
||||||
PopupBaseMenuItem.prototype._init.call(this, params);
|
this.parent(params);
|
||||||
this.actor.add_style_class_name('popup-alternating-menu-item');
|
this.actor.add_style_class_name('popup-alternating-menu-item');
|
||||||
|
|
||||||
this._text = text;
|
this._text = text;
|
||||||
@ -450,6 +446,7 @@ PopupAlternatingMenuItem.prototype = {
|
|||||||
this.label = new St.Label({ text: text });
|
this.label = new St.Label({ text: text });
|
||||||
this.state = PopupAlternatingMenuItemState.DEFAULT;
|
this.state = PopupAlternatingMenuItemState.DEFAULT;
|
||||||
this.addActor(this.label);
|
this.addActor(this.label);
|
||||||
|
this.actor.label_actor = this.label;
|
||||||
|
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
|
this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
|
||||||
},
|
},
|
||||||
@ -528,17 +525,14 @@ PopupAlternatingMenuItem.prototype = {
|
|||||||
|
|
||||||
this._updateLabel();
|
this._updateLabel();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PopupSliderMenuItem() {
|
const PopupSliderMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupSliderMenuItem',
|
||||||
}
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
PopupSliderMenuItem.prototype = {
|
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function(value) {
|
_init: function(value) {
|
||||||
PopupBaseMenuItem.prototype._init.call(this, { activate: false });
|
this.parent({ activate: false });
|
||||||
|
|
||||||
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
|
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
|
||||||
|
|
||||||
@ -552,6 +546,10 @@ PopupSliderMenuItem.prototype = {
|
|||||||
this._slider.connect('repaint', Lang.bind(this, this._sliderRepaint));
|
this._slider.connect('repaint', Lang.bind(this, this._sliderRepaint));
|
||||||
this.actor.connect('button-press-event', Lang.bind(this, this._startDragging));
|
this.actor.connect('button-press-event', Lang.bind(this, this._startDragging));
|
||||||
this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
||||||
|
this.actor.connect('notify::mapped', Lang.bind(this, function() {
|
||||||
|
if (!this.actor.mapped)
|
||||||
|
this._endDragging();
|
||||||
|
}));
|
||||||
|
|
||||||
this._releaseId = this._motionId = 0;
|
this._releaseId = this._motionId = 0;
|
||||||
this._dragging = false;
|
this._dragging = false;
|
||||||
@ -714,15 +712,14 @@ PopupSliderMenuItem.prototype = {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function Switch() {
|
const Switch = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'Switch',
|
||||||
}
|
|
||||||
|
|
||||||
Switch.prototype = {
|
|
||||||
_init: function(state) {
|
_init: function(state) {
|
||||||
this.actor = new St.Bin({ style_class: 'toggle-switch' });
|
this.actor = new St.Bin({ style_class: 'toggle-switch',
|
||||||
|
accessible_role: Atk.Role.CHECK_BOX});
|
||||||
// Translators: this MUST be either "toggle-switch-us"
|
// Translators: this MUST be either "toggle-switch-us"
|
||||||
// (for toggle switches containing the English words
|
// (for toggle switches containing the English words
|
||||||
// "ON" and "OFF") or "toggle-switch-intl" (for toggle
|
// "ON" and "OFF") or "toggle-switch-intl" (for toggle
|
||||||
@ -743,21 +740,22 @@ Switch.prototype = {
|
|||||||
toggle: function() {
|
toggle: function() {
|
||||||
this.setToggleState(!this.state);
|
this.setToggleState(!this.state);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PopupSwitchMenuItem() {
|
const PopupSwitchMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupSwitchMenuItem',
|
||||||
}
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
PopupSwitchMenuItem.prototype = {
|
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function(text, active, params) {
|
_init: function(text, active, params) {
|
||||||
PopupBaseMenuItem.prototype._init.call(this, params);
|
this.parent(params);
|
||||||
|
|
||||||
this.label = new St.Label({ text: text });
|
this.label = new St.Label({ text: text });
|
||||||
this._switch = new Switch(active);
|
this._switch = new Switch(active);
|
||||||
|
|
||||||
|
this.actor.accessible_role = Atk.Role.CHECK_MENU_ITEM;
|
||||||
|
this.checkAccessibleState();
|
||||||
|
this.actor.label_actor = this.label;
|
||||||
|
|
||||||
this.addActor(this.label);
|
this.addActor(this.label);
|
||||||
|
|
||||||
this._statusBin = new St.Bin({ x_align: St.Align.END });
|
this._statusBin = new St.Bin({ x_align: St.Align.END });
|
||||||
@ -776,11 +774,14 @@ PopupSwitchMenuItem.prototype = {
|
|||||||
this._statusBin.child = this._statusLabel;
|
this._statusBin.child = this._statusLabel;
|
||||||
this.actor.reactive = false;
|
this.actor.reactive = false;
|
||||||
this.actor.can_focus = false;
|
this.actor.can_focus = false;
|
||||||
|
this.actor.accessible_role = Atk.Role.MENU_ITEM;
|
||||||
} else {
|
} else {
|
||||||
this._statusBin.child = this._switch.actor;
|
this._statusBin.child = this._switch.actor;
|
||||||
this.actor.reactive = true;
|
this.actor.reactive = true;
|
||||||
this.actor.can_focus = true;
|
this.actor.can_focus = true;
|
||||||
|
this.actor.accessible_role = Atk.Role.CHECK_MENU_ITEM;
|
||||||
}
|
}
|
||||||
|
this.checkAccessibleState();
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function(event) {
|
activate: function(event) {
|
||||||
@ -788,12 +789,19 @@ PopupSwitchMenuItem.prototype = {
|
|||||||
this.toggle();
|
this.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupBaseMenuItem.prototype.activate.call(this, event);
|
// we allow pressing space to toggle the switch
|
||||||
|
// without closing the menu
|
||||||
|
if (event.type() == Clutter.EventType.KEY_PRESS &&
|
||||||
|
event.get_key_symbol() == Clutter.KEY_space)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.parent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
this._switch.toggle();
|
this._switch.toggle();
|
||||||
this.emit('toggled', this._switch.state);
|
this.emit('toggled', this._switch.state);
|
||||||
|
this.checkAccessibleState();
|
||||||
},
|
},
|
||||||
|
|
||||||
get state() {
|
get state() {
|
||||||
@ -802,18 +810,29 @@ PopupSwitchMenuItem.prototype = {
|
|||||||
|
|
||||||
setToggleState: function(state) {
|
setToggleState: function(state) {
|
||||||
this._switch.setToggleState(state);
|
this._switch.setToggleState(state);
|
||||||
}
|
this.checkAccessibleState();
|
||||||
};
|
},
|
||||||
|
|
||||||
function PopupImageMenuItem() {
|
checkAccessibleState: function() {
|
||||||
this._init.apply(this, arguments);
|
switch (this.actor.accessible_role) {
|
||||||
|
case Atk.Role.CHECK_MENU_ITEM:
|
||||||
|
if (this._switch.state)
|
||||||
|
this.actor.add_accessible_state (Atk.StateType.CHECKED);
|
||||||
|
else
|
||||||
|
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
PopupImageMenuItem.prototype = {
|
const PopupImageMenuItem = new Lang.Class({
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
Name: 'PopupImageMenuItem',
|
||||||
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function (text, iconName, params) {
|
_init: function (text, iconName, params) {
|
||||||
PopupBaseMenuItem.prototype._init.call(this, params);
|
this.parent(params);
|
||||||
|
|
||||||
this.label = new St.Label({ text: text });
|
this.label = new St.Label({ text: text });
|
||||||
this.addActor(this.label);
|
this.addActor(this.label);
|
||||||
@ -826,13 +845,12 @@ PopupImageMenuItem.prototype = {
|
|||||||
setIcon: function(name) {
|
setIcon: function(name) {
|
||||||
this._icon.icon_name = name;
|
this._icon.icon_name = name;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PopupMenuBase() {
|
const PopupMenuBase = new Lang.Class({
|
||||||
throw new TypeError('Trying to instantiate abstract class PopupMenuBase');
|
Name: 'PopupMenuBase',
|
||||||
}
|
Abstract: true,
|
||||||
|
|
||||||
PopupMenuBase.prototype = {
|
|
||||||
_init: function(sourceActor, styleClass) {
|
_init: function(sourceActor, styleClass) {
|
||||||
this.sourceActor = sourceActor;
|
this.sourceActor = sourceActor;
|
||||||
|
|
||||||
@ -888,6 +906,10 @@ PopupMenuBase.prototype = {
|
|||||||
return menuItem;
|
return menuItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isEmpty: function() {
|
||||||
|
return this.box.get_children().length == 0;
|
||||||
|
},
|
||||||
|
|
||||||
isChildMenu: function(menu) {
|
isChildMenu: function(menu) {
|
||||||
return this._childMenus.indexOf(menu) != -1;
|
return this._childMenus.indexOf(menu) != -1;
|
||||||
},
|
},
|
||||||
@ -958,7 +980,12 @@ PopupMenuBase.prototype = {
|
|||||||
this.emit('activate', menuItem);
|
this.emit('activate', menuItem);
|
||||||
this.close(true);
|
this.close(true);
|
||||||
}));
|
}));
|
||||||
menuItem.connect('destroy', Lang.bind(this, function(emitter) {
|
// the weird name is to avoid a conflict with some random property
|
||||||
|
// the menuItem may have, called destroyId
|
||||||
|
// (FIXME: in the future it may make sense to have container objects
|
||||||
|
// like PopupMenuManager does)
|
||||||
|
menuItem._popupMenuDestroyId = menuItem.connect('destroy', Lang.bind(this, function(menuItem) {
|
||||||
|
menuItem.disconnect(menuItem._popupMenuDestroyId);
|
||||||
menuItem.disconnect(menuItem._activateId);
|
menuItem.disconnect(menuItem._activateId);
|
||||||
menuItem.disconnect(menuItem._activeChangeId);
|
menuItem.disconnect(menuItem._activeChangeId);
|
||||||
menuItem.disconnect(menuItem._sensitiveChangeId);
|
menuItem.disconnect(menuItem._sensitiveChangeId);
|
||||||
@ -1013,12 +1040,19 @@ PopupMenuBase.prototype = {
|
|||||||
let items = this._getMenuItems();
|
let items = this._getMenuItems();
|
||||||
if (position < items.length) {
|
if (position < items.length) {
|
||||||
before_item = items[position].actor;
|
before_item = items[position].actor;
|
||||||
this.box.insert_before(menuItem.actor, before_item);
|
this.box.insert_child_below(menuItem.actor, before_item);
|
||||||
} else
|
} else {
|
||||||
this.box.add(menuItem.actor);
|
this.box.add(menuItem.actor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (menuItem instanceof PopupMenuSection) {
|
if (menuItem instanceof PopupMenuSection) {
|
||||||
this._connectSubMenuSignals(menuItem, menuItem);
|
this._connectSubMenuSignals(menuItem, menuItem);
|
||||||
|
menuItem._closingId = this.connect('open-state-changed',
|
||||||
|
function(self, open) {
|
||||||
|
if (!open)
|
||||||
|
menuItem.close(false);
|
||||||
|
});
|
||||||
menuItem.connect('destroy', Lang.bind(this, function() {
|
menuItem.connect('destroy', Lang.bind(this, function() {
|
||||||
menuItem.disconnect(menuItem._subMenuActivateId);
|
menuItem.disconnect(menuItem._subMenuActivateId);
|
||||||
menuItem.disconnect(menuItem._subMenuActiveChangeId);
|
menuItem.disconnect(menuItem._subMenuActiveChangeId);
|
||||||
@ -1029,7 +1063,7 @@ PopupMenuBase.prototype = {
|
|||||||
if (before_item == null)
|
if (before_item == null)
|
||||||
this.box.add(menuItem.menu.actor);
|
this.box.add(menuItem.menu.actor);
|
||||||
else
|
else
|
||||||
this.box.insert_before(menuItem.menu.actor, before_item);
|
this.box.insert_child_below(menuItem.menu.actor, before_item);
|
||||||
this._connectSubMenuSignals(menuItem, menuItem.menu);
|
this._connectSubMenuSignals(menuItem, menuItem.menu);
|
||||||
this._connectItemSignals(menuItem);
|
this._connectItemSignals(menuItem);
|
||||||
menuItem._closingId = this.connect('open-state-changed', function(self, open) {
|
menuItem._closingId = this.connect('open-state-changed', function(self, open) {
|
||||||
@ -1132,18 +1166,15 @@ PopupMenuBase.prototype = {
|
|||||||
|
|
||||||
this.emit('destroy');
|
this.emit('destroy');
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(PopupMenuBase.prototype);
|
Signals.addSignalMethods(PopupMenuBase.prototype);
|
||||||
|
|
||||||
function PopupMenu() {
|
const PopupMenu = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupMenu',
|
||||||
}
|
Extends: PopupMenuBase,
|
||||||
|
|
||||||
PopupMenu.prototype = {
|
|
||||||
__proto__: PopupMenuBase.prototype,
|
|
||||||
|
|
||||||
_init: function(sourceActor, arrowAlignment, arrowSide) {
|
_init: function(sourceActor, arrowAlignment, arrowSide) {
|
||||||
PopupMenuBase.prototype._init.call (this, sourceActor, 'popup-menu-content');
|
this.parent(sourceActor, 'popup-menu-content');
|
||||||
|
|
||||||
this._arrowAlignment = arrowAlignment;
|
this._arrowAlignment = arrowAlignment;
|
||||||
this._arrowSide = arrowSide;
|
this._arrowSide = arrowSide;
|
||||||
@ -1206,6 +1237,9 @@ PopupMenu.prototype = {
|
|||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
|
|
||||||
this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment);
|
this._boxPointer.setPosition(this.sourceActor, this._arrowAlignment);
|
||||||
@ -1228,17 +1262,14 @@ PopupMenu.prototype = {
|
|||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
this.emit('open-state-changed', false);
|
this.emit('open-state-changed', false);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PopupSubMenu() {
|
const PopupSubMenu = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupSubMenu',
|
||||||
}
|
Extends: PopupMenuBase,
|
||||||
|
|
||||||
PopupSubMenu.prototype = {
|
|
||||||
__proto__: PopupMenuBase.prototype,
|
|
||||||
|
|
||||||
_init: function(sourceActor, sourceArrow) {
|
_init: function(sourceActor, sourceArrow) {
|
||||||
PopupMenuBase.prototype._init.call(this, sourceActor);
|
this.parent(sourceActor);
|
||||||
|
|
||||||
this._arrow = sourceArrow;
|
this._arrow = sourceArrow;
|
||||||
this._arrow.rotation_center_z_gravity = Clutter.Gravity.CENTER;
|
this._arrow.rotation_center_z_gravity = Clutter.Gravity.CENTER;
|
||||||
@ -1300,6 +1331,9 @@ PopupSubMenu.prototype = {
|
|||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
|
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
@ -1393,7 +1427,7 @@ PopupSubMenu.prototype = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PopupMenuSection:
|
* PopupMenuSection:
|
||||||
@ -1403,40 +1437,47 @@ PopupSubMenu.prototype = {
|
|||||||
* can add it to another menu), but is completely transparent
|
* can add it to another menu), but is completely transparent
|
||||||
* to the user
|
* to the user
|
||||||
*/
|
*/
|
||||||
function PopupMenuSection() {
|
const PopupMenuSection = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupMenuSection',
|
||||||
}
|
Extends: PopupMenuBase,
|
||||||
|
|
||||||
PopupMenuSection.prototype = {
|
|
||||||
__proto__: PopupMenuBase.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PopupMenuBase.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this.actor = this.box;
|
this.actor = this.box;
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
|
|
||||||
|
// an array of externally managed separators
|
||||||
|
this.separators = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
// deliberately ignore any attempt to open() or close()
|
// deliberately ignore any attempt to open() or close(), but emit the
|
||||||
open: function(animate) { },
|
// corresponding signal so children can still pick it up
|
||||||
close: function() { },
|
open: function(animate) { this.emit('open-state-changed', true); },
|
||||||
}
|
close: function() { this.emit('open-state-changed', false); },
|
||||||
|
|
||||||
function PopupSubMenuMenuItem() {
|
destroy: function() {
|
||||||
this._init.apply(this, arguments);
|
for (let i = 0; i < this.separators.length; i++)
|
||||||
}
|
this.separators[i].destroy();
|
||||||
|
this.separators = [];
|
||||||
|
|
||||||
PopupSubMenuMenuItem.prototype = {
|
this.parent();
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const PopupSubMenuMenuItem = new Lang.Class({
|
||||||
|
Name: 'PopupSubMenuMenuItem',
|
||||||
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function(text) {
|
_init: function(text) {
|
||||||
PopupBaseMenuItem.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this.actor.add_style_class_name('popup-submenu-menu-item');
|
this.actor.add_style_class_name('popup-submenu-menu-item');
|
||||||
|
|
||||||
this.label = new St.Label({ text: text });
|
this.label = new St.Label({ text: text });
|
||||||
this.addActor(this.label);
|
this.addActor(this.label);
|
||||||
|
this.actor.label_actor = this.label;
|
||||||
this._triangle = new St.Label({ text: '\u25B8' });
|
this._triangle = new St.Label({ text: '\u25B8' });
|
||||||
this.addActor(this._triangle, { align: St.Align.END });
|
this.addActor(this._triangle, { align: St.Align.END });
|
||||||
|
|
||||||
@ -1453,7 +1494,8 @@ PopupSubMenuMenuItem.prototype = {
|
|||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
this.menu.destroy();
|
this.menu.destroy();
|
||||||
PopupBaseMenuItem.prototype.destroy.call(this);
|
|
||||||
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPressEvent: function(actor, event) {
|
_onKeyPressEvent: function(actor, event) {
|
||||||
@ -1468,7 +1510,7 @@ PopupSubMenuMenuItem.prototype = {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PopupBaseMenuItem.prototype._onKeyPressEvent.call(this, actor, event);
|
return this.parent(actor, event);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function(event) {
|
activate: function(event) {
|
||||||
@ -1478,22 +1520,21 @@ PopupSubMenuMenuItem.prototype = {
|
|||||||
_onButtonReleaseEvent: function(actor) {
|
_onButtonReleaseEvent: function(actor) {
|
||||||
this.menu.toggle();
|
this.menu.toggle();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PopupComboMenu() {
|
const PopupComboMenu = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupComboMenu',
|
||||||
}
|
Extends: PopupMenuBase,
|
||||||
|
|
||||||
PopupComboMenu.prototype = {
|
|
||||||
__proto__: PopupMenuBase.prototype,
|
|
||||||
|
|
||||||
_init: function(sourceActor) {
|
_init: function(sourceActor) {
|
||||||
PopupMenuBase.prototype._init.call(this,
|
this.parent(sourceActor, 'popup-combo-menu');
|
||||||
sourceActor, 'popup-combo-menu');
|
|
||||||
this.actor = this.box;
|
this.actor = this.box;
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
|
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
|
||||||
this.actor.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn));
|
this.actor.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn));
|
||||||
|
sourceActor.connect('style-changed',
|
||||||
|
Lang.bind(this, this._onSourceActorStyleChanged));
|
||||||
this._activeItemPos = -1;
|
this._activeItemPos = -1;
|
||||||
global.focus_manager.add_group(this.actor);
|
global.focus_manager.add_group(this.actor);
|
||||||
},
|
},
|
||||||
@ -1513,10 +1554,33 @@ PopupComboMenu.prototype = {
|
|||||||
activeItem.actor.grab_key_focus();
|
activeItem.actor.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onSourceActorStyleChanged: function() {
|
||||||
|
// PopupComboBoxMenuItem clones the active item's actors
|
||||||
|
// to work with arbitrary items in the menu; this means
|
||||||
|
// that we need to propagate some style information and
|
||||||
|
// enforce style updates even when the menu is closed
|
||||||
|
let activeItem = this._getMenuItems()[this._activeItemPos];
|
||||||
|
if (this.sourceActor.has_style_pseudo_class('insensitive'))
|
||||||
|
activeItem.actor.add_style_pseudo_class('insensitive');
|
||||||
|
else
|
||||||
|
activeItem.actor.remove_style_pseudo_class('insensitive');
|
||||||
|
|
||||||
|
// To propagate the :active style, we need to make sure that the
|
||||||
|
// internal state of the PopupComboMenu is updated as well, but
|
||||||
|
// we must not move the keyboard grab
|
||||||
|
activeItem.setActive(this.sourceActor.has_style_pseudo_class('active'),
|
||||||
|
{ grabKeyboard: false });
|
||||||
|
|
||||||
|
_ensureStyle(this.actor);
|
||||||
|
},
|
||||||
|
|
||||||
open: function() {
|
open: function() {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
|
|
||||||
let [sourceX, sourceY] = this.sourceActor.get_transformed_position();
|
let [sourceX, sourceY] = this.sourceActor.get_transformed_position();
|
||||||
@ -1560,6 +1624,10 @@ PopupComboMenu.prototype = {
|
|||||||
this._activeItemPos = position;
|
this._activeItemPos = position;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getActiveItem: function() {
|
||||||
|
return this._getMenuItems()[this._activeItemPos];
|
||||||
|
},
|
||||||
|
|
||||||
setItemVisible: function(position, visible) {
|
setItemVisible: function(position, visible) {
|
||||||
if (!visible && position == this._activeItemPos) {
|
if (!visible && position == this._activeItemPos) {
|
||||||
log('Trying to hide the active menu item.');
|
log('Trying to hide the active menu item.');
|
||||||
@ -1572,17 +1640,16 @@ PopupComboMenu.prototype = {
|
|||||||
getItemVisible: function(position) {
|
getItemVisible: function(position) {
|
||||||
return this._getMenuItems()[position].actor.visible;
|
return this._getMenuItems()[position].actor.visible;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function PopupComboBoxMenuItem() {
|
const PopupComboBoxMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PopupComboBoxMenuItem',
|
||||||
}
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
PopupComboBoxMenuItem.prototype = {
|
|
||||||
__proto__: PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function (params) {
|
_init: function (params) {
|
||||||
PopupBaseMenuItem.prototype._init.call(this, params);
|
this.parent(params);
|
||||||
|
|
||||||
|
this.actor.accessible_role = Atk.Role.COMBO_BOX;
|
||||||
|
|
||||||
this._itemBox = new Shell.Stack();
|
this._itemBox = new Shell.Stack();
|
||||||
this.addActor(this._itemBox);
|
this.addActor(this._itemBox);
|
||||||
@ -1680,6 +1747,11 @@ PopupComboBoxMenuItem.prototype = {
|
|||||||
Lang.bind(this, this._itemActivated, position));
|
Lang.bind(this, this._itemActivated, position));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkAccessibleLabel: function() {
|
||||||
|
let activeItem = this._menu.getActiveItem();
|
||||||
|
this.actor.label_actor = activeItem.label;
|
||||||
|
},
|
||||||
|
|
||||||
setActiveItem: function(position) {
|
setActiveItem: function(position) {
|
||||||
let item = this._items[position];
|
let item = this._items[position];
|
||||||
if (!item)
|
if (!item)
|
||||||
@ -1690,6 +1762,8 @@ PopupComboBoxMenuItem.prototype = {
|
|||||||
this._activeItemPos = position;
|
this._activeItemPos = position;
|
||||||
for (let i = 0; i < this._items.length; i++)
|
for (let i = 0; i < this._items.length; i++)
|
||||||
this._items[i].visible = (i == this._activeItemPos);
|
this._items[i].visible = (i == this._activeItemPos);
|
||||||
|
|
||||||
|
this.checkAccessibleLabel();
|
||||||
},
|
},
|
||||||
|
|
||||||
setItemVisible: function(position, visible) {
|
setItemVisible: function(position, visible) {
|
||||||
@ -1700,16 +1774,276 @@ PopupComboBoxMenuItem.prototype = {
|
|||||||
this.setActiveItem(position);
|
this.setActiveItem(position);
|
||||||
this.emit('active-item-changed', position);
|
this.emit('active-item-changed', position);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RemoteMenu:
|
||||||
|
*
|
||||||
|
* A PopupMenu that tracks a GMenuModel and shows its actions
|
||||||
|
* (exposed by GApplication/GActionGroup)
|
||||||
|
*/
|
||||||
|
const RemoteMenu = new Lang.Class({
|
||||||
|
Name: 'RemoteMenu',
|
||||||
|
Extends: PopupMenu,
|
||||||
|
|
||||||
|
_init: function(sourceActor, model, actionGroup) {
|
||||||
|
this.parent(sourceActor, 0.0, St.Side.TOP);
|
||||||
|
|
||||||
|
this.model = model;
|
||||||
|
this.actionGroup = actionGroup;
|
||||||
|
|
||||||
|
this._actions = { };
|
||||||
|
this._modelChanged(this.model, 0, 0, this.model.get_n_items(), this);
|
||||||
|
|
||||||
|
this._actionStateChangeId = this.actionGroup.connect('action-state-changed', Lang.bind(this, this._actionStateChanged));
|
||||||
|
this._actionEnableChangeId = this.actionGroup.connect('action-enabled-changed', Lang.bind(this, this._actionEnabledChanged));
|
||||||
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
if (this._actionStateChangeId) {
|
||||||
|
this.actionGroup.disconnect(this._actionStateChangeId);
|
||||||
|
this._actionStateChangeId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._actionEnableChangeId) {
|
||||||
|
this.actionGroup.disconnect(this._actionEnableChangeId);
|
||||||
|
this._actionEnableChangeId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.parent();
|
||||||
|
},
|
||||||
|
|
||||||
|
_createMenuItem: function(model, index) {
|
||||||
|
let labelValue = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_LABEL, null);
|
||||||
|
let label = labelValue ? labelValue.deep_unpack() : '';
|
||||||
|
// remove all underscores that are not followed by another underscore
|
||||||
|
label = label.replace(/_([^_])/, '$1');
|
||||||
|
|
||||||
|
let section_link = model.get_item_link(index, Gio.MENU_LINK_SECTION);
|
||||||
|
if (section_link) {
|
||||||
|
let item = new PopupMenuSection();
|
||||||
|
if (label) {
|
||||||
|
let title = new PopupMenuItem(label, { reactive: false,
|
||||||
|
style_class: 'popup-subtitle-menu-item' });
|
||||||
|
item._titleMenuItem = title;
|
||||||
|
title._ignored = true;
|
||||||
|
item.addMenuItem(title);
|
||||||
|
}
|
||||||
|
this._modelChanged(section_link, 0, 0, section_link.get_n_items(), item);
|
||||||
|
return [item, true, ''];
|
||||||
|
}
|
||||||
|
|
||||||
|
let submenu_link = model.get_item_link(index, Gio.MENU_LINK_SUBMENU);
|
||||||
|
|
||||||
|
if (submenu_link) {
|
||||||
|
let item = new PopupSubMenuMenuItem(label);
|
||||||
|
this._modelChanged(submenu_link, 0, 0, submenu_link.get_n_items(), item.menu);
|
||||||
|
return [item, false, ''];
|
||||||
|
}
|
||||||
|
|
||||||
|
let action_id = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_ACTION, null).deep_unpack();
|
||||||
|
if (!this.actionGroup.has_action(action_id)) {
|
||||||
|
// the action may not be there yet, wait for action-added
|
||||||
|
return [null, false, 'action-added'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this._actions[action_id])
|
||||||
|
this._actions[action_id] = { enabled: this.actionGroup.get_action_enabled(action_id),
|
||||||
|
state: this.actionGroup.get_action_state(action_id),
|
||||||
|
items: [ ],
|
||||||
};
|
};
|
||||||
|
let action = this._actions[action_id];
|
||||||
|
let item, target, destroyId, specificSignalId;
|
||||||
|
|
||||||
|
if (action.state) {
|
||||||
|
// Docs have get_state_hint(), except that the DBus protocol
|
||||||
|
// has no provision for it (so ShellApp does not implement it,
|
||||||
|
// and neither GApplication), and g_action_get_state_hint()
|
||||||
|
// always returns null
|
||||||
|
// Funny :)
|
||||||
|
|
||||||
|
switch (String.fromCharCode(action.state.classify())) {
|
||||||
|
case 'b':
|
||||||
|
item = new PopupSwitchMenuItem(label, action.state.get_boolean());
|
||||||
|
action.items.push(item);
|
||||||
|
specificSignalId = item.connect('toggled', Lang.bind(this, function(item) {
|
||||||
|
this.actionGroup.activate_action(action_id, null);
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
item = new PopupMenuItem(label);
|
||||||
|
item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null).deep_unpack();
|
||||||
|
action.items.push(item);
|
||||||
|
item.setShowDot(action.state.deep_unpack() == item._remoteTarget);
|
||||||
|
specificSignalId = item.connect('activate', Lang.bind(this, function(item) {
|
||||||
|
this.actionGroup.activate_action(action_id, GLib.Variant.new_string(item._remoteTarget));
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log('Action "%s" has state of type %s, which is not supported'.format(action_id, action.state.get_type_string()));
|
||||||
|
return [null, false, 'action-state-changed'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
target = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null);
|
||||||
|
item = new PopupMenuItem(label);
|
||||||
|
action.items.push(item);
|
||||||
|
specificSignalId = item.connect('activate', Lang.bind(this, function() {
|
||||||
|
this.actionGroup.activate_action(action_id, target);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
item.actor.reactive = item.actor.can_focus = action.enabled;
|
||||||
|
if (action.enabled)
|
||||||
|
item.actor.remove_style_pseudo_class('insensitive');
|
||||||
|
else
|
||||||
|
item.actor.add_style_pseudo_class('insensitive');
|
||||||
|
|
||||||
|
destroyId = item.connect('destroy', Lang.bind(this, function() {
|
||||||
|
item.disconnect(destroyId);
|
||||||
|
item.disconnect(specificSignalId);
|
||||||
|
|
||||||
|
let pos = action.items.indexOf(item);
|
||||||
|
if (pos != -1)
|
||||||
|
action.items.splice(pos, 1);
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [item, false, ''];
|
||||||
|
},
|
||||||
|
|
||||||
|
_modelChanged: function(model, position, removed, added, target) {
|
||||||
|
let j, k;
|
||||||
|
let j0, k0;
|
||||||
|
|
||||||
|
let currentItems = target._getMenuItems();
|
||||||
|
|
||||||
|
k0 = 0;
|
||||||
|
// skip ignored items at the beginning
|
||||||
|
while (k0 < currentItems.length && currentItems[k0]._ignored)
|
||||||
|
k0++;
|
||||||
|
// find the right menu item matching the model item
|
||||||
|
for (j0 = 0; j0 < position; j0++, k0++) {
|
||||||
|
if (currentItems[k0]._ignored)
|
||||||
|
k0++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removed == -1) {
|
||||||
|
// special flag to indicate we should destroy everything
|
||||||
|
for (k = k0; k < currentItems.length; k++)
|
||||||
|
currentItems[k].destroy();
|
||||||
|
} else {
|
||||||
|
for (j = j0, k = k0; j < j0 + removed; j++, k++) {
|
||||||
|
currentItems[k].destroy();
|
||||||
|
|
||||||
|
if (currentItems[k]._ignored)
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = j0, k = k0; j < j0 + added; j++, k++) {
|
||||||
|
let [item, addSeparator, changeSignal] = this._createMenuItem(model, j);
|
||||||
|
|
||||||
|
if (item) {
|
||||||
|
// separators must be added in the parent to make autohiding work
|
||||||
|
if (addSeparator) {
|
||||||
|
let separator = new PopupSeparatorMenuItem();
|
||||||
|
item.separators.push(separator);
|
||||||
|
separator._ignored = true;
|
||||||
|
target.addMenuItem(separator, k+1);
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.addMenuItem(item, k);
|
||||||
|
|
||||||
|
if (addSeparator) {
|
||||||
|
let separator = new PopupSeparatorMenuItem();
|
||||||
|
item.separators.push(separator);
|
||||||
|
separator._ignored = true;
|
||||||
|
target.addMenuItem(separator, k+1);
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
} else if (changeSignal) {
|
||||||
|
let signalId = this.actionGroup.connect(changeSignal, Lang.bind(this, function() {
|
||||||
|
this.actionGroup.disconnect(signalId);
|
||||||
|
|
||||||
|
// force a full update
|
||||||
|
this._modelChanged(model, 0, -1, model.get_n_items(), target);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!model._changedId) {
|
||||||
|
model._changedId = model.connect('items-changed', Lang.bind(this, this._modelChanged, target));
|
||||||
|
model._destroyId = target.connect('destroy', function() {
|
||||||
|
if (model._changedId)
|
||||||
|
model.disconnect(model._changedId);
|
||||||
|
if (model._destroyId)
|
||||||
|
target.disconnect(model._destroyId);
|
||||||
|
model._changedId = 0;
|
||||||
|
model._destroyId = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target instanceof PopupMenuSection) {
|
||||||
|
if (target._titleMenuItem)
|
||||||
|
target.actor.visible = target.numMenuItems != 1;
|
||||||
|
else
|
||||||
|
target.actor.visible = target.numMenuItems != 0;
|
||||||
|
} else {
|
||||||
|
let sourceItem = target.sourceActor._delegate;
|
||||||
|
if (sourceItem instanceof PopupSubMenuMenuItem)
|
||||||
|
sourceItem.actor.visible = target.numMenuItems != 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_actionStateChanged: function(actionGroup, action_id) {
|
||||||
|
let action = this._actions[action_id];
|
||||||
|
if (!action)
|
||||||
|
return;
|
||||||
|
|
||||||
|
action.state = actionGroup.get_action_state(action_id);
|
||||||
|
if (action.items.length) {
|
||||||
|
switch (String.fromCharCode(action.state.classify())) {
|
||||||
|
case 'b':
|
||||||
|
for (let i = 0; i < action.items.length; i++)
|
||||||
|
action.items[i].setToggleState(action.state.get_boolean());
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
for (let i = 0; i < action.items.length; i++)
|
||||||
|
action.items[i].setValue(action.state.get_double());
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
for (let i = 0; i < action.items.length; i++)
|
||||||
|
action.items[i].setShowDot(action.items[i]._remoteTarget == action.state.deep_unpack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_actionEnabledChanged: function(actionGroup, action_id) {
|
||||||
|
let action = this._actions[action_id];
|
||||||
|
if (!action)
|
||||||
|
return;
|
||||||
|
|
||||||
|
action.enabled = actionGroup.get_action_enabled(action_id);
|
||||||
|
if (action.items.length) {
|
||||||
|
for (let i = 0; i < action.items.length; i++) {
|
||||||
|
let item = action.items[i];
|
||||||
|
item.actor.reactive = item.actor.can_focus = action.enabled;
|
||||||
|
|
||||||
|
if (action.enabled)
|
||||||
|
item.actor.remove_style_pseudo_class('insensitive');
|
||||||
|
else
|
||||||
|
item.actor.add_style_pseudo_class('insensitive');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/* Basic implementation of a menu manager.
|
/* Basic implementation of a menu manager.
|
||||||
* Call addMenu to add menus
|
* Call addMenu to add menus
|
||||||
*/
|
*/
|
||||||
function PopupMenuManager(owner) {
|
const PopupMenuManager = new Lang.Class({
|
||||||
this._init(owner);
|
Name: 'PopupMenuManager',
|
||||||
}
|
|
||||||
|
|
||||||
PopupMenuManager.prototype = {
|
|
||||||
_init: function(owner) {
|
_init: function(owner) {
|
||||||
this._owner = owner;
|
this._owner = owner;
|
||||||
this.grabbed = false;
|
this.grabbed = false;
|
||||||
@ -1981,4 +2315,4 @@ PopupMenuManager.prototype = {
|
|||||||
if (this._activeMenu != null)
|
if (this._activeMenu != null)
|
||||||
this._activeMenu.close(true);
|
this._activeMenu.close(true);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
185
js/ui/remoteSearch.js
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const Lang = imports.lang;
|
||||||
|
const St = imports.gi.St;
|
||||||
|
|
||||||
|
const FileUtils = imports.misc.fileUtils;
|
||||||
|
const Search = imports.ui.search;
|
||||||
|
|
||||||
|
const KEY_FILE_GROUP = 'Shell Search Provider';
|
||||||
|
|
||||||
|
const SearchProviderIface = <interface name="org.gnome.Shell.SearchProvider">
|
||||||
|
<method name="GetInitialResultSet">
|
||||||
|
<arg type="as" direction="in" />
|
||||||
|
<arg type="as" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="GetSubsearchResultSet">
|
||||||
|
<arg type="as" direction="in" />
|
||||||
|
<arg type="as" direction="in" />
|
||||||
|
<arg type="as" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="GetResultMetas">
|
||||||
|
<arg type="as" direction="in" />
|
||||||
|
<arg type="aa{sv}" direction="out" />
|
||||||
|
</method>
|
||||||
|
<method name="ActivateResult">
|
||||||
|
<arg type="s" direction="in" />
|
||||||
|
</method>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
|
var SearchProviderProxy = Gio.DBusProxy.makeProxyWrapper(SearchProviderIface);
|
||||||
|
|
||||||
|
|
||||||
|
function loadRemoteSearchProviders(addProviderCallback) {
|
||||||
|
let dataDirs = GLib.get_system_data_dirs();
|
||||||
|
for (let i = 0; i < dataDirs.length; i++) {
|
||||||
|
let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'search-providers']);
|
||||||
|
let dir = Gio.file_new_for_path(path);
|
||||||
|
if (!dir.query_exists(null))
|
||||||
|
continue;
|
||||||
|
loadRemoteSearchProvidersFromDir(dir, addProviderCallback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function loadRemoteSearchProvidersFromDir(dir, addProviderCallback) {
|
||||||
|
let dirPath = dir.get_path();
|
||||||
|
FileUtils.listDirAsync(dir, Lang.bind(this, function(files) {
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
let keyfile = new GLib.KeyFile();
|
||||||
|
let path = GLib.build_filenamev([dirPath, files[i].get_name()]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
keyfile.load_from_file(path, 0);
|
||||||
|
} catch(e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!keyfile.has_group(KEY_FILE_GROUP))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
let remoteProvider, title;
|
||||||
|
try {
|
||||||
|
let group = KEY_FILE_GROUP;
|
||||||
|
let icon = keyfile.get_string(group, 'Icon');
|
||||||
|
let busName = keyfile.get_string(group, 'BusName');
|
||||||
|
let objectPath = keyfile.get_string(group, 'ObjectPath');
|
||||||
|
title = keyfile.get_locale_string(group, 'Title', null);
|
||||||
|
|
||||||
|
remoteProvider = new RemoteSearchProvider(title,
|
||||||
|
icon,
|
||||||
|
busName,
|
||||||
|
objectPath);
|
||||||
|
} catch(e) {
|
||||||
|
log('Failed to add search provider "%s": %s'.format(title, e.toString()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
addProviderCallback(remoteProvider);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const RemoteSearchProvider = new Lang.Class({
|
||||||
|
Name: 'RemoteSearchProvider',
|
||||||
|
Extends: Search.SearchProvider,
|
||||||
|
|
||||||
|
_init: function(title, icon, dbusName, dbusPath) {
|
||||||
|
this._proxy = new SearchProviderProxy(Gio.DBus.session,
|
||||||
|
dbusName, dbusPath);
|
||||||
|
|
||||||
|
this.parent(title.toUpperCase());
|
||||||
|
this.async = true;
|
||||||
|
this._cancellable = new Gio.Cancellable();
|
||||||
|
},
|
||||||
|
|
||||||
|
createIcon: function(size, meta) {
|
||||||
|
if (meta['gicon']) {
|
||||||
|
return new St.Icon({ gicon: Gio.icon_new_for_string(meta['gicon']),
|
||||||
|
icon_size: size,
|
||||||
|
icon_type: St.IconType.FULLCOLOR });
|
||||||
|
} else if (meta['icon-data']) {
|
||||||
|
let [width, height, rowStride, hasAlpha,
|
||||||
|
bitsPerSample, nChannels, data] = meta['icon-data'];
|
||||||
|
let textureCache = St.TextureCache.get_default();
|
||||||
|
return textureCache.load_from_raw(data, hasAlpha,
|
||||||
|
width, height, rowStride, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ugh, but we want to fall back to something ...
|
||||||
|
return new St.Icon({ icon_name: 'text-x-generic',
|
||||||
|
icon_size: size,
|
||||||
|
icon_type: St.IconType.FULLCOLOR });
|
||||||
|
},
|
||||||
|
|
||||||
|
_getResultsFinished: function(results, error) {
|
||||||
|
if (error)
|
||||||
|
return;
|
||||||
|
this.searchSystem.pushResults(this, results[0]);
|
||||||
|
},
|
||||||
|
|
||||||
|
getInitialResultSetAsync: function(terms) {
|
||||||
|
this._cancellable.cancel();
|
||||||
|
this._cancellable.reset();
|
||||||
|
try {
|
||||||
|
this._proxy.GetInitialResultSetRemote(terms,
|
||||||
|
Lang.bind(this, this._getResultsFinished),
|
||||||
|
this._cancellable);
|
||||||
|
} catch(e) {
|
||||||
|
log('Error calling GetInitialResultSet for provider %s: %s'.format( this.title, e.toString()));
|
||||||
|
this.searchSystem.pushResults(this, []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getSubsearchResultSetAsync: function(previousResults, newTerms) {
|
||||||
|
this._cancellable.cancel();
|
||||||
|
this._cancellable.reset();
|
||||||
|
try {
|
||||||
|
this._proxy.GetSubsearchResultSetRemote(previousResults, newTerms,
|
||||||
|
Lang.bind(this, this._getResultsFinished),
|
||||||
|
this._cancellable);
|
||||||
|
} catch(e) {
|
||||||
|
log('Error calling GetSubsearchResultSet for provider %s: %s'.format(this.title, e.toString()));
|
||||||
|
this.searchSystem.pushResults(this, []);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_getResultMetasFinished: function(results, error, callback) {
|
||||||
|
if (error) {
|
||||||
|
callback([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let metas = results[0];
|
||||||
|
let resultMetas = [];
|
||||||
|
for (let i = 0; i < metas.length; i++) {
|
||||||
|
for (let prop in metas[i])
|
||||||
|
metas[i][prop] = metas[i][prop].deep_unpack();
|
||||||
|
resultMetas.push({ id: metas[i]['id'],
|
||||||
|
name: metas[i]['name'],
|
||||||
|
createIcon: Lang.bind(this,
|
||||||
|
this.createIcon, metas[i]) });
|
||||||
|
}
|
||||||
|
callback(resultMetas);
|
||||||
|
},
|
||||||
|
|
||||||
|
getResultMetasAsync: function(ids, callback) {
|
||||||
|
this._cancellable.cancel();
|
||||||
|
this._cancellable.reset();
|
||||||
|
try {
|
||||||
|
this._proxy.GetResultMetasRemote(ids,
|
||||||
|
Lang.bind(this, this._getResultMetasFinished, callback),
|
||||||
|
this._cancellable);
|
||||||
|
} catch(e) {
|
||||||
|
log('Error calling GetResultMetas for provider %s: %s'.format(this.title, e.toString()));
|
||||||
|
callback([]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
activateResult: function(id) {
|
||||||
|
this._proxy.ActivateResultRemote(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
@ -30,11 +30,9 @@ const EXEC_ARG_KEY = 'exec-arg';
|
|||||||
|
|
||||||
const DIALOG_GROW_TIME = 0.1;
|
const DIALOG_GROW_TIME = 0.1;
|
||||||
|
|
||||||
function CommandCompleter() {
|
const CommandCompleter = new Lang.Class({
|
||||||
this._init();
|
Name: 'CommandCompleter',
|
||||||
}
|
|
||||||
|
|
||||||
CommandCompleter.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this._changedCount = 0;
|
this._changedCount = 0;
|
||||||
this._paths = GLib.getenv('PATH').split(':');
|
this._paths = GLib.getenv('PATH').split(':');
|
||||||
@ -162,16 +160,14 @@ CommandCompleter.prototype = {
|
|||||||
return common.substr(text.length);
|
return common.substr(text.length);
|
||||||
return common;
|
return common;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function RunDialog() {
|
const RunDialog = new Lang.Class({
|
||||||
this._init();
|
Name: 'RunDialog',
|
||||||
}
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
RunDialog.prototype = {
|
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'run-dialog' });
|
this.parent({ styleClass: 'run-dialog' });
|
||||||
|
|
||||||
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
|
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
|
||||||
this._terminalSettings = new Gio.Settings({ schema: TERMINAL_SCHEMA });
|
this._terminalSettings = new Gio.Settings({ schema: TERMINAL_SCHEMA });
|
||||||
@ -213,6 +209,8 @@ __proto__: ModalDialog.ModalDialog.prototype,
|
|||||||
let entry = new St.Entry({ style_class: 'run-dialog-entry' });
|
let entry = new St.Entry({ style_class: 'run-dialog-entry' });
|
||||||
ShellEntry.addContextMenu(entry);
|
ShellEntry.addContextMenu(entry);
|
||||||
|
|
||||||
|
entry.label_actor = label;
|
||||||
|
|
||||||
this._entryText = entry.clutter_text;
|
this._entryText = entry.clutter_text;
|
||||||
this.contentLayout.add(entry, { y_align: St.Align.START });
|
this.contentLayout.add(entry, { y_align: St.Align.START });
|
||||||
this.setInitialKeyFocus(this._entryText);
|
this.setInitialKeyFocus(this._entryText);
|
||||||
@ -246,7 +244,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
|
|||||||
let symbol = e.get_key_symbol();
|
let symbol = e.get_key_symbol();
|
||||||
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
|
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
|
||||||
this.popModal();
|
this.popModal();
|
||||||
if (Shell.get_event_state(e) & Clutter.ModifierType.CONTROL_MASK)
|
if (e.get_state() & Clutter.ModifierType.CONTROL_MASK)
|
||||||
this._run(o.get_text(), true);
|
this._run(o.get_text(), true);
|
||||||
else
|
else
|
||||||
this._run(o.get_text(), false);
|
this._run(o.get_text(), false);
|
||||||
@ -384,8 +382,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
|
|||||||
if (this._lockdownSettings.get_boolean(DISABLE_COMMAND_LINE_KEY))
|
if (this._lockdownSettings.get_boolean(DISABLE_COMMAND_LINE_KEY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ModalDialog.ModalDialog.prototype.open.call(this);
|
this.parent();
|
||||||
},
|
},
|
||||||
|
});
|
||||||
};
|
|
||||||
Signals.addSignalMethods(RunDialog.prototype);
|
Signals.addSignalMethods(RunDialog.prototype);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
@ -70,24 +69,21 @@ function waitLeisure() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const PerfHelperIface = {
|
const PerfHelperIface = <interface name="org.gnome.Shell.PerfHelper">
|
||||||
name: 'org.gnome.Shell.PerfHelper',
|
<method name="CreateWindow">
|
||||||
methods: [{ name: 'CreateWindow', inSignature: 'iibb', outSignature: '' },
|
<arg type="i" direction="in" />
|
||||||
{ name: 'WaitWindows', inSignature: '', outSignature: '' },
|
<arg type="i" direction="in" />
|
||||||
{ name: 'DestroyWindows', inSignature: '', outSignature: ''}]
|
<arg type="b" direction="in" />
|
||||||
};
|
<arg type="b" direction="in" />
|
||||||
|
</method>
|
||||||
|
<method name="WaitWindows" />
|
||||||
|
<method name="DestroyWindows" />
|
||||||
|
</interface>;
|
||||||
|
|
||||||
const PerfHelper = function () {
|
var PerfHelperProxy = Gio.DBusProxy.makeProxyWrapper(PerfHelperIface);
|
||||||
this._init();
|
function PerfHelper() {
|
||||||
};
|
return new PerfHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PerfHelper', '/org/gnome/Shell/PerfHelper');
|
||||||
|
|
||||||
PerfHelper.prototype = {
|
|
||||||
_init: function() {
|
|
||||||
DBus.session.proxifyObject(this, 'org.gnome.Shell.PerfHelper', '/org/gnome/Shell/PerfHelper');
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
DBus.proxifyPrototype(PerfHelper.prototype, PerfHelperIface);
|
|
||||||
|
|
||||||
let _perfHelper = null;
|
let _perfHelper = null;
|
||||||
function _getPerfHelper() {
|
function _getPerfHelper() {
|
||||||
|
181
js/ui/search.js
@ -23,15 +23,12 @@ const MatchType = {
|
|||||||
MULTIPLE_PREFIX: 4
|
MULTIPLE_PREFIX: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
function SearchResultDisplay(provider) {
|
const SearchResultDisplay = new Lang.Class({
|
||||||
this._init(provider);
|
Name: 'SearchResultDisplay',
|
||||||
}
|
|
||||||
|
|
||||||
SearchResultDisplay.prototype = {
|
|
||||||
_init: function(provider) {
|
_init: function(provider) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.actor = null;
|
this.actor = null;
|
||||||
this.selectionIndex = -1;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,20 +50,10 @@ SearchResultDisplay.prototype = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* clear:
|
* clear:
|
||||||
* Remove all results from this display and reset the selection index.
|
* Remove all results from this display.
|
||||||
*/
|
*/
|
||||||
clear: function() {
|
clear: function() {
|
||||||
this.actor.get_children().forEach(function (actor) { actor.destroy(); });
|
this.actor.get_children().forEach(function (actor) { actor.destroy(); });
|
||||||
this.selectionIndex = -1;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* getSelectionIndex:
|
|
||||||
*
|
|
||||||
* Returns the index of the selected actor, or -1 if none.
|
|
||||||
*/
|
|
||||||
getSelectionIndex: function() {
|
|
||||||
return this.selectionIndex;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,26 +64,7 @@ SearchResultDisplay.prototype = {
|
|||||||
getVisibleResultCount: function() {
|
getVisibleResultCount: function() {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
},
|
},
|
||||||
|
});
|
||||||
/**
|
|
||||||
* selectIndex:
|
|
||||||
* @index: Integer index
|
|
||||||
*
|
|
||||||
* Move selection to the given index.
|
|
||||||
* Return true if successful, false if no more results
|
|
||||||
* available.
|
|
||||||
*/
|
|
||||||
selectIndex: function() {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activate the currently selected search result.
|
|
||||||
*/
|
|
||||||
activateSelected: function() {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchProvider:
|
* SearchProvider:
|
||||||
@ -104,51 +72,19 @@ SearchResultDisplay.prototype = {
|
|||||||
* Subclass this object to add a new result type
|
* Subclass this object to add a new result type
|
||||||
* to the search system, then call registerProvider()
|
* to the search system, then call registerProvider()
|
||||||
* in SearchSystem with an instance.
|
* in SearchSystem with an instance.
|
||||||
|
* By default, search is synchronous and uses the
|
||||||
|
* getInitialResultSet()/getSubsearchResultSet() methods.
|
||||||
|
* For asynchronous search, set the async property to true
|
||||||
|
* and implement getInitialResultSetAsync()/getSubsearchResultSetAsync()
|
||||||
|
* instead.
|
||||||
*/
|
*/
|
||||||
function SearchProvider(title) {
|
const SearchProvider = new Lang.Class({
|
||||||
this._init(title);
|
Name: 'SearchProvider',
|
||||||
}
|
|
||||||
|
|
||||||
SearchProvider.prototype = {
|
|
||||||
_init: function(title) {
|
_init: function(title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.searchSystem = null;
|
this.searchSystem = null;
|
||||||
this.searchAsync = false;
|
this.async = false;
|
||||||
},
|
|
||||||
|
|
||||||
_asyncCancelled: function() {
|
|
||||||
},
|
|
||||||
|
|
||||||
startAsync: function() {
|
|
||||||
this.searchAsync = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
tryCancelAsync: function() {
|
|
||||||
if (!this.searchAsync)
|
|
||||||
return;
|
|
||||||
this._asyncCancelled();
|
|
||||||
this.searchAsync = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* addItems:
|
|
||||||
* @items: an array of result identifier strings representing
|
|
||||||
* items which match the last given search terms.
|
|
||||||
*
|
|
||||||
* This should be used for something that requires a bit more
|
|
||||||
* logic; it's designed to be an asyncronous way to add a result
|
|
||||||
* to the current search.
|
|
||||||
*/
|
|
||||||
addItems: function(items) {
|
|
||||||
if (!this.searchSystem)
|
|
||||||
throw new Error('Search provider not registered');
|
|
||||||
|
|
||||||
if (!items.length)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this.tryCancelAsync();
|
|
||||||
|
|
||||||
this.searchSystem.addProviderItems(this, items);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,6 +112,18 @@ SearchProvider.prototype = {
|
|||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getInitialResultSetAsync:
|
||||||
|
* @terms: Array of search terms, treated as logical AND
|
||||||
|
*
|
||||||
|
* Like getInitialResultSet(), but the method should return immediately
|
||||||
|
* without a return value - use SearchSystem.pushResults() when the
|
||||||
|
* corresponding results are ready.
|
||||||
|
*/
|
||||||
|
getInitialResultSetAsync: function(terms) {
|
||||||
|
throw new Error('Not implemented');
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getSubsearchResultSet:
|
* getSubsearchResultSet:
|
||||||
* @previousResults: Array of item identifiers
|
* @previousResults: Array of item identifiers
|
||||||
@ -194,14 +142,40 @@ SearchProvider.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getResultMeta:
|
* getSubsearchResultSetAsync:
|
||||||
* @id: Result identifier string
|
* @previousResults: Array of item identifiers
|
||||||
|
* @newTerms: Updated search terms
|
||||||
*
|
*
|
||||||
* Return an object with 'id', 'name', (both strings) and 'createIcon'
|
* Like getSubsearchResultSet(), but the method should return immediately
|
||||||
* (function(size) returning a Clutter.Texture) properties which describe
|
* without a return value - use SearchSystem.pushResults() when the
|
||||||
* the given search result.
|
* corresponding results are ready.
|
||||||
*/
|
*/
|
||||||
getResultMeta: function(id) {
|
getSubsearchResultSetAsync: function(previousResults, newTerms) {
|
||||||
|
throw new Error('Not implemented');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getResultMetas:
|
||||||
|
* @ids: Result identifier strings
|
||||||
|
*
|
||||||
|
* Return an array of objects with 'id', 'name', (both strings) and
|
||||||
|
* 'createIcon' (function(size) returning a Clutter.Texture) properties
|
||||||
|
* with the same number of members as @ids
|
||||||
|
*/
|
||||||
|
getResultMetas: function(ids) {
|
||||||
|
throw new Error('Not implemented');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getResultMetasAsync:
|
||||||
|
* @ids: Result identifier strings
|
||||||
|
* @callback: callback to pass the results to when ready
|
||||||
|
*
|
||||||
|
* Like getResultMetas(), but the method should return immediately
|
||||||
|
* without a return value - pass the results to the provided @callback
|
||||||
|
* when ready.
|
||||||
|
*/
|
||||||
|
getResultMetasAsync: function(ids, callback) {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -243,14 +217,12 @@ SearchProvider.prototype = {
|
|||||||
activateResult: function(id) {
|
activateResult: function(id) {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(SearchProvider.prototype);
|
Signals.addSignalMethods(SearchProvider.prototype);
|
||||||
|
|
||||||
function OpenSearchSystem() {
|
const OpenSearchSystem = new Lang.Class({
|
||||||
this._init();
|
Name: 'OpenSearchSystem',
|
||||||
}
|
|
||||||
|
|
||||||
OpenSearchSystem.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._providers = [];
|
this._providers = [];
|
||||||
global.settings.connect('changed::' + DISABLED_OPEN_SEARCH_PROVIDERS_KEY, Lang.bind(this, this._refresh));
|
global.settings.connect('changed::' + DISABLED_OPEN_SEARCH_PROVIDERS_KEY, Lang.bind(this, this._refresh));
|
||||||
@ -308,7 +280,7 @@ OpenSearchSystem.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_addProvider: function(fileName) {
|
_addProvider: function(fileName) {
|
||||||
let path = global.datadir + '/search_providers/' + fileName;
|
let path = global.datadir + '/open-search-providers/' + fileName;
|
||||||
let source = Shell.get_file_contents_utf8_sync(path);
|
let source = Shell.get_file_contents_utf8_sync(path);
|
||||||
let [success, name, url, langs, icon_uri] = Shell.parse_search_provider(source);
|
let [success, name, url, langs, icon_uri] = Shell.parse_search_provider(source);
|
||||||
let provider ={ name: name,
|
let provider ={ name: name,
|
||||||
@ -325,7 +297,7 @@ OpenSearchSystem.prototype = {
|
|||||||
_refresh: function() {
|
_refresh: function() {
|
||||||
this._providers = [];
|
this._providers = [];
|
||||||
let names = global.settings.get_strv(DISABLED_OPEN_SEARCH_PROVIDERS_KEY);
|
let names = global.settings.get_strv(DISABLED_OPEN_SEARCH_PROVIDERS_KEY);
|
||||||
let file = Gio.file_new_for_path(global.datadir + '/search_providers');
|
let file = Gio.file_new_for_path(global.datadir + '/open-search-providers');
|
||||||
FileUtils.listDirAsync(file, Lang.bind(this, function(files) {
|
FileUtils.listDirAsync(file, Lang.bind(this, function(files) {
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
let enabled = true;
|
let enabled = true;
|
||||||
@ -338,14 +310,12 @@ OpenSearchSystem.prototype = {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Signals.addSignalMethods(OpenSearchSystem.prototype);
|
Signals.addSignalMethods(OpenSearchSystem.prototype);
|
||||||
|
|
||||||
function SearchSystem() {
|
const SearchSystem = new Lang.Class({
|
||||||
this._init();
|
Name: 'SearchSystem',
|
||||||
}
|
|
||||||
|
|
||||||
SearchSystem.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._providers = [];
|
this._providers = [];
|
||||||
this.reset();
|
this.reset();
|
||||||
@ -377,8 +347,13 @@ SearchSystem.prototype = {
|
|||||||
this._previousResults = [];
|
this._previousResults = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
addProviderItems: function(provider, items) {
|
pushResults: function(provider, results) {
|
||||||
this.emit('search-updated', provider, items);
|
let i = this._providers.indexOf(provider);
|
||||||
|
if (i == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._previousResults[i] = [provider, results];
|
||||||
|
this.emit('search-updated', this._previousResults[i]);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSearch: function(searchString) {
|
updateSearch: function(searchString) {
|
||||||
@ -408,10 +383,14 @@ SearchSystem.prototype = {
|
|||||||
if (isSubSearch) {
|
if (isSubSearch) {
|
||||||
for (let i = 0; i < this._providers.length; i++) {
|
for (let i = 0; i < this._providers.length; i++) {
|
||||||
let [provider, previousResults] = this._previousResults[i];
|
let [provider, previousResults] = this._previousResults[i];
|
||||||
provider.tryCancelAsync();
|
|
||||||
try {
|
try {
|
||||||
|
if (provider.async) {
|
||||||
|
provider.getSubsearchResultSetAsync(previousResults, terms);
|
||||||
|
results.push([provider, []]);
|
||||||
|
} else {
|
||||||
let providerResults = provider.getSubsearchResultSet(previousResults, terms);
|
let providerResults = provider.getSubsearchResultSet(previousResults, terms);
|
||||||
results.push([provider, providerResults]);
|
results.push([provider, providerResults]);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
|
global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
|
||||||
}
|
}
|
||||||
@ -419,10 +398,14 @@ SearchSystem.prototype = {
|
|||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < this._providers.length; i++) {
|
for (let i = 0; i < this._providers.length; i++) {
|
||||||
let provider = this._providers[i];
|
let provider = this._providers[i];
|
||||||
provider.tryCancelAsync();
|
|
||||||
try {
|
try {
|
||||||
|
if (provider.async) {
|
||||||
|
provider.getInitialResultSetAsync(terms);
|
||||||
|
results.push([provider, []]);
|
||||||
|
} else {
|
||||||
let providerResults = provider.getInitialResultSet(terms);
|
let providerResults = provider.getInitialResultSet(terms);
|
||||||
results.push([provider, providerResults]);
|
results.push([provider, providerResults]);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
|
global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
|
||||||
}
|
}
|
||||||
@ -433,5 +416,5 @@ SearchSystem.prototype = {
|
|||||||
this._previousResults = results;
|
this._previousResults = results;
|
||||||
this.emit('search-completed', results);
|
this.emit('search-completed', results);
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(SearchSystem.prototype);
|
Signals.addSignalMethods(SearchSystem.prototype);
|
||||||
|
@ -15,11 +15,9 @@ const Search = imports.ui.search;
|
|||||||
const MAX_SEARCH_RESULTS_ROWS = 1;
|
const MAX_SEARCH_RESULTS_ROWS = 1;
|
||||||
|
|
||||||
|
|
||||||
function SearchResult(provider, metaInfo, terms) {
|
const SearchResult = new Lang.Class({
|
||||||
this._init(provider, metaInfo, terms);
|
Name: 'SearchResult',
|
||||||
}
|
|
||||||
|
|
||||||
SearchResult.prototype = {
|
|
||||||
_init: function(provider, metaInfo, terms) {
|
_init: function(provider, metaInfo, terms) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.metaInfo = metaInfo;
|
this.metaInfo = metaInfo;
|
||||||
@ -34,6 +32,7 @@ SearchResult.prototype = {
|
|||||||
if (content == null) {
|
if (content == null) {
|
||||||
content = new St.Bin({ style_class: 'search-result-content',
|
content = new St.Bin({ style_class: 'search-result-content',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
|
can_focus: true,
|
||||||
track_hover: true });
|
track_hover: true });
|
||||||
let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
|
let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
|
||||||
{ createIcon: this.metaInfo['createIcon'] });
|
{ createIcon: this.metaInfo['createIcon'] });
|
||||||
@ -97,96 +96,87 @@ SearchResult.prototype = {
|
|||||||
else
|
else
|
||||||
this.provider.activateResult(this.metaInfo.id, params);
|
this.provider.activateResult(this.metaInfo.id, params);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
function GridSearchResults(provider, grid) {
|
const GridSearchResults = new Lang.Class({
|
||||||
this._init(provider, grid);
|
Name: 'GridSearchResults',
|
||||||
}
|
Extends: Search.SearchResultDisplay,
|
||||||
|
|
||||||
GridSearchResults.prototype = {
|
|
||||||
__proto__: Search.SearchResultDisplay.prototype,
|
|
||||||
|
|
||||||
_init: function(provider, grid) {
|
_init: function(provider, grid) {
|
||||||
Search.SearchResultDisplay.prototype._init.call(this, provider);
|
this.parent(provider);
|
||||||
|
|
||||||
this._grid = grid || new IconGrid.IconGrid({ rowLimit: MAX_SEARCH_RESULTS_ROWS,
|
this._grid = grid || new IconGrid.IconGrid({ rowLimit: MAX_SEARCH_RESULTS_ROWS,
|
||||||
xAlign: St.Align.START });
|
xAlign: St.Align.START });
|
||||||
this.actor = new St.Bin({ x_align: St.Align.START });
|
this.actor = new St.Bin({ x_align: St.Align.START });
|
||||||
|
|
||||||
this.actor.set_child(this._grid.actor);
|
this.actor.set_child(this._grid.actor);
|
||||||
this.selectionIndex = -1;
|
|
||||||
this._width = 0;
|
this._width = 0;
|
||||||
this.actor.connect('notify::width', Lang.bind(this, function() {
|
this.actor.connect('notify::width', Lang.bind(this, function() {
|
||||||
this._width = this.actor.width;
|
this._width = this.actor.width;
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
||||||
this._tryAddResults();
|
let results = this.getResultsForDisplay();
|
||||||
|
if (results.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (provider.async) {
|
||||||
|
provider.getResultMetasAsync(results,
|
||||||
|
Lang.bind(this, this.renderResults));
|
||||||
|
} else {
|
||||||
|
let metas = provider.getResultMetas(results);
|
||||||
|
this.renderResults(metas);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
this._notDisplayedResult = [];
|
this._notDisplayedResult = [];
|
||||||
this._terms = [];
|
this._terms = [];
|
||||||
|
this._pendingClear = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_tryAddResults: function() {
|
getResultsForDisplay: function() {
|
||||||
|
let alreadyVisible = this._pendingClear ? 0 : this._grid.visibleItemsCount();
|
||||||
let canDisplay = this._grid.childrenInRow(this._width) * MAX_SEARCH_RESULTS_ROWS
|
let canDisplay = this._grid.childrenInRow(this._width) * MAX_SEARCH_RESULTS_ROWS
|
||||||
- this._grid.visibleItemsCount();
|
- alreadyVisible;
|
||||||
|
|
||||||
for (let i = Math.min(this._notDisplayedResult.length, canDisplay); i > 0; i--) {
|
let numResults = Math.min(this._notDisplayedResult.length, canDisplay);
|
||||||
let result = this._notDisplayedResult.shift();
|
|
||||||
let meta = this.provider.getResultMeta(result);
|
return this._notDisplayedResult.splice(0, numResults);
|
||||||
let display = new SearchResult(this.provider, meta, this._terms);
|
|
||||||
this._grid.addItem(display.actor);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getVisibleResultCount: function() {
|
getVisibleResultCount: function() {
|
||||||
return this._grid.visibleItemsCount();
|
return this._grid.visibleItemsCount();
|
||||||
},
|
},
|
||||||
|
|
||||||
renderResults: function(results, terms) {
|
setResults: function(results, terms) {
|
||||||
// copy the lists
|
// copy the lists
|
||||||
this._notDisplayedResult = results.slice(0);
|
this._notDisplayedResult = results.slice(0);
|
||||||
this._terms = terms.slice(0);
|
this._terms = terms.slice(0);
|
||||||
this._tryAddResults();
|
this._pendingClear = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
renderResults: function(metas) {
|
||||||
|
for (let i = 0; i < metas.length; i++) {
|
||||||
|
let display = new SearchResult(this.provider, metas[i], this._terms);
|
||||||
|
this._grid.addItem(display.actor);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function () {
|
clear: function () {
|
||||||
this._terms = [];
|
|
||||||
this._notDisplayedResult = [];
|
|
||||||
this._grid.removeAll();
|
this._grid.removeAll();
|
||||||
this.selectionIndex = -1;
|
this._pendingClear = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectIndex: function (index) {
|
getFirstResult: function() {
|
||||||
let nVisible = this.getVisibleResultCount();
|
if (this.getVisibleResultCount() > 0)
|
||||||
if (this.selectionIndex >= 0) {
|
return this._grid.getItemAtIndex(0)._delegate;
|
||||||
let prevActor = this._grid.getItemAtIndex(this.selectionIndex);
|
else
|
||||||
prevActor._delegate.setSelected(false);
|
return null;
|
||||||
}
|
}
|
||||||
this.selectionIndex = -1;
|
});
|
||||||
if (index >= nVisible)
|
|
||||||
return false;
|
|
||||||
else if (index < 0)
|
|
||||||
return false;
|
|
||||||
let targetActor = this._grid.getItemAtIndex(index);
|
|
||||||
targetActor._delegate.setSelected(true);
|
|
||||||
this.selectionIndex = index;
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
activateSelected: function() {
|
const SearchResults = new Lang.Class({
|
||||||
if (this.selectionIndex < 0)
|
Name: 'SearchResults',
|
||||||
return;
|
|
||||||
let targetActor = this._grid.getItemAtIndex(this.selectionIndex);
|
|
||||||
targetActor._delegate.activate();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function SearchResults(searchSystem, openSearchSystem) {
|
|
||||||
this._init(searchSystem, openSearchSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
SearchResults.prototype = {
|
|
||||||
_init: function(searchSystem, openSearchSystem) {
|
_init: function(searchSystem, openSearchSystem) {
|
||||||
this._searchSystem = searchSystem;
|
this._searchSystem = searchSystem;
|
||||||
this._searchSystem.connect('search-updated', Lang.bind(this, this._updateCurrentResults));
|
this._searchSystem.connect('search-updated', Lang.bind(this, this._updateCurrentResults));
|
||||||
@ -222,7 +212,6 @@ SearchResults.prototype = {
|
|||||||
|
|
||||||
this._statusText = new St.Label({ style_class: 'search-statustext' });
|
this._statusText = new St.Label({ style_class: 'search-statustext' });
|
||||||
this._content.add(this._statusText);
|
this._content.add(this._statusText);
|
||||||
this._selectedProvider = -1;
|
|
||||||
this._providers = this._searchSystem.getProviders();
|
this._providers = this._searchSystem.getProviders();
|
||||||
this._providerMeta = [];
|
this._providerMeta = [];
|
||||||
this._providerMetaResults = {};
|
this._providerMetaResults = {};
|
||||||
@ -236,10 +225,12 @@ SearchResults.prototype = {
|
|||||||
this._openSearchProviders = [];
|
this._openSearchProviders = [];
|
||||||
this._openSearchSystem.connect('changed', Lang.bind(this, this._updateOpenSearchProviderButtons));
|
this._openSearchSystem.connect('changed', Lang.bind(this, this._updateOpenSearchProviderButtons));
|
||||||
this._updateOpenSearchProviderButtons();
|
this._updateOpenSearchProviderButtons();
|
||||||
|
|
||||||
|
this._highlightDefault = false;
|
||||||
|
this._defaultResult = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOpenSearchProviderButtons: function() {
|
_updateOpenSearchProviderButtons: function() {
|
||||||
this._selectedOpenSearchButton = -1;
|
|
||||||
for (let i = 0; i < this._openSearchProviders.length; i++)
|
for (let i = 0; i < this._openSearchProviders.length; i++)
|
||||||
this._openSearchProviders[i].actor.destroy();
|
this._openSearchProviders[i].actor.destroy();
|
||||||
this._openSearchProviders = this._openSearchSystem.getProviders();
|
this._openSearchProviders = this._openSearchSystem.getProviders();
|
||||||
@ -247,18 +238,10 @@ SearchResults.prototype = {
|
|||||||
this._createOpenSearchProviderButton(this._openSearchProviders[i]);
|
this._createOpenSearchProviderButton(this._openSearchProviders[i]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOpenSearchButtonState: function() {
|
|
||||||
for (let i = 0; i < this._openSearchProviders.length; i++) {
|
|
||||||
if (i == this._selectedOpenSearchButton)
|
|
||||||
this._openSearchProviders[i].actor.add_style_pseudo_class('selected');
|
|
||||||
else
|
|
||||||
this._openSearchProviders[i].actor.remove_style_pseudo_class('selected');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_createOpenSearchProviderButton: function(provider) {
|
_createOpenSearchProviderButton: function(provider) {
|
||||||
let button = new St.Button({ style_class: 'dash-search-button',
|
let button = new St.Button({ style_class: 'dash-search-button',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
|
can_focus: true,
|
||||||
x_fill: true,
|
x_fill: true,
|
||||||
y_align: St.Align.MIDDLE });
|
y_align: St.Align.MIDDLE });
|
||||||
let bin = new St.Bin({ x_fill: false,
|
let bin = new St.Bin({ x_fill: false,
|
||||||
@ -274,6 +257,17 @@ SearchResults.prototype = {
|
|||||||
button.set_child(bin);
|
button.set_child(bin);
|
||||||
provider.actor = button;
|
provider.actor = button;
|
||||||
|
|
||||||
|
button.setSelected = function(selected) {
|
||||||
|
if (selected)
|
||||||
|
button.add_style_pseudo_class('selected');
|
||||||
|
else
|
||||||
|
button.remove_style_pseudo_class('selected');
|
||||||
|
};
|
||||||
|
button.activate = Lang.bind(this, function() {
|
||||||
|
this._openSearchSystem.activateResult(provider.id);
|
||||||
|
});
|
||||||
|
button.actor = button;
|
||||||
|
|
||||||
this._searchProvidersBox.add(button);
|
this._searchProvidersBox.add(button);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -296,7 +290,8 @@ SearchResults.prototype = {
|
|||||||
|
|
||||||
this._providerMeta.push({ provider: provider,
|
this._providerMeta.push({ provider: provider,
|
||||||
actor: providerBox,
|
actor: providerBox,
|
||||||
resultDisplay: resultDisplay });
|
resultDisplay: resultDisplay,
|
||||||
|
hasPendingResults: false });
|
||||||
this._content.add(providerBox);
|
this._content.add(providerBox);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -312,7 +307,6 @@ SearchResults.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_clearDisplay: function() {
|
_clearDisplay: function() {
|
||||||
this._selectedProvider = -1;
|
|
||||||
this._visibleResultsCount = 0;
|
this._visibleResultsCount = 0;
|
||||||
for (let i = 0; i < this._providerMeta.length; i++) {
|
for (let i = 0; i < this._providerMeta.length; i++) {
|
||||||
let meta = this._providerMeta[i];
|
let meta = this._providerMeta[i];
|
||||||
@ -321,8 +315,8 @@ SearchResults.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearDisplayForProvider: function(index) {
|
_clearDisplayForProvider: function(provider) {
|
||||||
let meta = this._providerMeta[index];
|
let meta = this._metaForProvider(provider);
|
||||||
meta.resultDisplay.clear();
|
meta.resultDisplay.clear();
|
||||||
meta.actor.hide();
|
meta.actor.hide();
|
||||||
},
|
},
|
||||||
@ -331,8 +325,6 @@ SearchResults.prototype = {
|
|||||||
this._searchSystem.reset();
|
this._searchSystem.reset();
|
||||||
this._statusText.hide();
|
this._statusText.hide();
|
||||||
this._clearDisplay();
|
this._clearDisplay();
|
||||||
this._selectedOpenSearchButton = -1;
|
|
||||||
this._updateOpenSearchButtonState();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
startingSearch: function() {
|
startingSearch: function() {
|
||||||
@ -349,13 +341,80 @@ SearchResults.prototype = {
|
|||||||
return this._providerMeta[this._providers.indexOf(provider)];
|
return this._providerMeta[this._providers.indexOf(provider)];
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCurrentResults: function(searchSystem, provider, results) {
|
_maybeSetInitialSelection: function() {
|
||||||
|
let newDefaultResult = null;
|
||||||
|
|
||||||
|
for (let i = 0; i < this._providerMeta.length; i++) {
|
||||||
|
let meta = this._providerMeta[i];
|
||||||
|
if (meta.hasPendingResults)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!meta.actor.visible)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
let firstResult = meta.resultDisplay.getFirstResult();
|
||||||
|
if (firstResult) {
|
||||||
|
newDefaultResult = firstResult;
|
||||||
|
break; // select this one!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newDefaultResult)
|
||||||
|
newDefaultResult = this._searchProvidersBox.get_first_child();
|
||||||
|
|
||||||
|
if (newDefaultResult != this._defaultResult) {
|
||||||
|
if (this._defaultResult)
|
||||||
|
this._defaultResult.setSelected(false);
|
||||||
|
if (newDefaultResult)
|
||||||
|
newDefaultResult.setSelected(this._highlightDefault);
|
||||||
|
|
||||||
|
this._defaultResult = newDefaultResult;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_updateCurrentResults: function(searchSystem, results) {
|
||||||
let terms = searchSystem.getTerms();
|
let terms = searchSystem.getTerms();
|
||||||
|
let [provider, providerResults] = results;
|
||||||
let meta = this._metaForProvider(provider);
|
let meta = this._metaForProvider(provider);
|
||||||
meta.resultDisplay.clear();
|
meta.hasPendingResults = false;
|
||||||
|
this._updateProviderResults(provider, providerResults, terms);
|
||||||
|
},
|
||||||
|
|
||||||
|
_updateProviderResults: function(provider, providerResults, terms) {
|
||||||
|
let meta = this._metaForProvider(provider);
|
||||||
|
if (providerResults.length == 0) {
|
||||||
|
this._clearDisplayForProvider(provider);
|
||||||
|
meta.resultDisplay.setResults([], []);
|
||||||
|
} else {
|
||||||
|
this._providerMetaResults[provider.title] = providerResults;
|
||||||
|
meta.resultDisplay.setResults(providerResults, terms);
|
||||||
|
let results = meta.resultDisplay.getResultsForDisplay();
|
||||||
|
|
||||||
|
if (provider.async) {
|
||||||
|
provider.getResultMetasAsync(results, Lang.bind(this,
|
||||||
|
function(metas) {
|
||||||
|
this._clearDisplayForProvider(provider);
|
||||||
meta.actor.show();
|
meta.actor.show();
|
||||||
meta.resultDisplay.renderResults(results, terms);
|
|
||||||
return true;
|
// Hinding drops the key focus if we have it
|
||||||
|
let focus = global.stage.get_key_focus();
|
||||||
|
this._content.hide();
|
||||||
|
|
||||||
|
meta.resultDisplay.renderResults(metas);
|
||||||
|
this._maybeSetInitialSelection();
|
||||||
|
|
||||||
|
this._content.show();
|
||||||
|
if (this._content.contains(focus))
|
||||||
|
global.stage.set_key_focus(focus);
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
let metas = provider.getResultMetas(results);
|
||||||
|
this._clearDisplayForProvider(provider);
|
||||||
|
meta.actor.show();
|
||||||
|
meta.resultDisplay.renderResults(metas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._maybeSetInitialSelection();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateResults: function(searchSystem, results) {
|
_updateResults: function(searchSystem, results) {
|
||||||
@ -363,127 +422,57 @@ SearchResults.prototype = {
|
|||||||
this._statusText.set_text(_("No matching results."));
|
this._statusText.set_text(_("No matching results."));
|
||||||
this._statusText.show();
|
this._statusText.show();
|
||||||
} else {
|
} else {
|
||||||
this._selectedOpenSearchButton = -1;
|
|
||||||
this._updateOpenSearchButtonState();
|
|
||||||
this._statusText.hide();
|
this._statusText.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
let terms = searchSystem.getTerms();
|
let terms = searchSystem.getTerms();
|
||||||
this._openSearchSystem.setSearchTerms(terms);
|
this._openSearchSystem.setSearchTerms(terms);
|
||||||
|
|
||||||
// To avoid CSS transitions causing flickering
|
// To avoid CSS transitions causing flickering when the first search
|
||||||
// of the selection when the first search result
|
// result stays the same, we hide the content while filling in the
|
||||||
// stays the same, we hide the content while
|
// results.
|
||||||
// filling in the results and setting the initial
|
|
||||||
// selection.
|
|
||||||
this._content.hide();
|
this._content.hide();
|
||||||
|
|
||||||
for (let i = 0; i < results.length; i++) {
|
for (let i = 0; i < results.length; i++) {
|
||||||
let [provider, providerResults] = results[i];
|
let [provider, providerResults] = results[i];
|
||||||
if (providerResults.length == 0) {
|
|
||||||
this._clearDisplayForProvider(i);
|
|
||||||
} else {
|
|
||||||
this._providerMetaResults[provider.title] = providerResults;
|
|
||||||
this._clearDisplayForProvider(i);
|
|
||||||
let meta = this._metaForProvider(provider);
|
let meta = this._metaForProvider(provider);
|
||||||
meta.actor.show();
|
meta.hasPendingResults = provider.async;
|
||||||
meta.resultDisplay.renderResults(providerResults, terms);
|
if (!meta.hasPendingResults)
|
||||||
|
this._updateProviderResults(provider, providerResults, terms);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (this._selectedOpenSearchButton == -1)
|
|
||||||
this.selectDown(false);
|
|
||||||
|
|
||||||
this._content.show();
|
this._content.show();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_modifyActorSelection: function(resultDisplay, up) {
|
activateDefault: function() {
|
||||||
let success;
|
if (this._defaultResult)
|
||||||
let index = resultDisplay.getSelectionIndex();
|
this._defaultResult.activate();
|
||||||
if (up && index == -1)
|
|
||||||
index = resultDisplay.getVisibleResultCount() - 1;
|
|
||||||
else if (up)
|
|
||||||
index = index - 1;
|
|
||||||
else
|
|
||||||
index = index + 1;
|
|
||||||
return resultDisplay.selectIndex(index);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
selectUp: function(recursing) {
|
highlightDefault: function(highlight) {
|
||||||
if (this._selectedOpenSearchButton == -1) {
|
this._highlightDefault = highlight;
|
||||||
for (let i = this._selectedProvider; i >= 0; i--) {
|
if (this._defaultResult)
|
||||||
let meta = this._providerMeta[i];
|
this._defaultResult.setSelected(highlight);
|
||||||
if (!meta.actor.visible)
|
|
||||||
continue;
|
|
||||||
let success = this._modifyActorSelection(meta.resultDisplay, true);
|
|
||||||
if (success) {
|
|
||||||
this._selectedProvider = i;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._selectedOpenSearchButton == -1)
|
|
||||||
this._selectedOpenSearchButton = this._openSearchProviders.length;
|
|
||||||
this._selectedOpenSearchButton--;
|
|
||||||
this._updateOpenSearchButtonState();
|
|
||||||
if (this._selectedOpenSearchButton >= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (this._providerMeta.length > 0 && !recursing) {
|
|
||||||
this._selectedProvider = this._providerMeta.length - 1;
|
|
||||||
this.selectUp(true);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
selectDown: function(recursing) {
|
navigateFocus: function(direction) {
|
||||||
let current = this._selectedProvider;
|
let rtl = this.actor.get_text_direction() == Clutter.TextDirection.RTL;
|
||||||
if (this._selectedOpenSearchButton == -1) {
|
if (direction == Gtk.DirectionType.TAB_BACKWARD ||
|
||||||
if (current == -1)
|
direction == (rtl ? Gtk.DirectionType.RIGHT
|
||||||
current = 0;
|
: Gtk.DirectionType.LEFT) ||
|
||||||
for (let i = current; i < this._providerMeta.length; i++) {
|
direction == Gtk.DirectionType.UP) {
|
||||||
let meta = this._providerMeta[i];
|
this.actor.navigate_focus(null, direction, false);
|
||||||
if (!meta.actor.visible)
|
|
||||||
continue;
|
|
||||||
let success = this._modifyActorSelection(meta.resultDisplay, false);
|
|
||||||
if (success) {
|
|
||||||
this._selectedProvider = i;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._selectedOpenSearchButton++;
|
|
||||||
|
|
||||||
if (this._selectedOpenSearchButton < this._openSearchProviders.length) {
|
|
||||||
this._updateOpenSearchButtonState();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._selectedOpenSearchButton = -1;
|
let from = this._defaultResult ? this._defaultResult.actor : null;
|
||||||
this._updateOpenSearchButtonState();
|
this.actor.navigate_focus(from, direction, false);
|
||||||
|
if (this._defaultResult) {
|
||||||
if (this._providerMeta.length > 0 && !recursing) {
|
// The default result appears focused, so navigate directly to the
|
||||||
this._selectedProvider = 0;
|
// next result.
|
||||||
this.selectDown(true);
|
this.actor.navigate_focus(global.stage.key_focus, direction, false);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
activateSelected: function() {
|
|
||||||
if (this._selectedOpenSearchButton != -1) {
|
|
||||||
let provider = this._openSearchProviders[this._selectedOpenSearchButton];
|
|
||||||
this._openSearchSystem.activateResult(provider.id);
|
|
||||||
Main.overview.hide();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
let current = this._selectedProvider;
|
|
||||||
if (current < 0)
|
|
||||||
return;
|
|
||||||
let meta = this._providerMeta[current];
|
|
||||||
let resultDisplay = meta.resultDisplay;
|
|
||||||
resultDisplay.activateSelected();
|
|
||||||
Main.overview.hide();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
@ -1,79 +1,94 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
|
|
||||||
const Config = imports.misc.config;
|
const Config = imports.misc.config;
|
||||||
const ExtensionSystem = imports.ui.extensionSystem;
|
const ExtensionSystem = imports.ui.extensionSystem;
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Flashspot = imports.ui.flashspot;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
const GnomeShellIface = {
|
const GnomeShellIface = <interface name="org.gnome.Shell">
|
||||||
name: 'org.gnome.Shell',
|
<method name="Eval">
|
||||||
methods: [{ name: 'Eval',
|
<arg type="s" direction="in" name="script" />
|
||||||
inSignature: 's',
|
<arg type="b" direction="out" name="success" />
|
||||||
outSignature: 'bs'
|
<arg type="s" direction="out" name="result" />
|
||||||
},
|
</method>
|
||||||
{ name: 'ListExtensions',
|
<method name="ListExtensions">
|
||||||
inSignature: '',
|
<arg type="a{sa{sv}}" direction="out" name="extensions" />
|
||||||
outSignature: 'a{sa{sv}}'
|
</method>
|
||||||
},
|
<method name="GetExtensionInfo">
|
||||||
{ name: 'GetExtensionInfo',
|
<arg type="s" direction="in" name="extension" />
|
||||||
inSignature: 's',
|
<arg type="a{sv}" direction="out" name="info" />
|
||||||
outSignature: 'a{sv}'
|
</method>
|
||||||
},
|
<method name="GetExtensionErrors">
|
||||||
{ name: 'GetExtensionErrors',
|
<arg type="s" direction="in" name="extension" />
|
||||||
inSignature: 's',
|
<arg type="as" direction="out" name="errors" />
|
||||||
outSignature: 'as'
|
</method>
|
||||||
},
|
<method name="ScreenshotArea">
|
||||||
{ name: 'ScreenshotArea',
|
<arg type="i" direction="in" name="x"/>
|
||||||
inSignature: 'iiiis',
|
<arg type="i" direction="in" name="y"/>
|
||||||
outSignature: 'b'
|
<arg type="i" direction="in" name="width"/>
|
||||||
},
|
<arg type="i" direction="in" name="height"/>
|
||||||
{ name: 'ScreenshotWindow',
|
<arg type="b" direction="in" name="flash"/>
|
||||||
inSignature: 'bs',
|
<arg type="s" direction="in" name="filename"/>
|
||||||
outSignature: 'b'
|
<arg type="b" direction="out" name="success"/>
|
||||||
},
|
</method>
|
||||||
{ name: 'Screenshot',
|
<method name="ScreenshotWindow">
|
||||||
inSignature: 's',
|
<arg type="b" direction="in" name="include_frame"/>
|
||||||
outSignature: 'b'
|
<arg type="b" direction="in" name="include_cursor"/>
|
||||||
},
|
<arg type="b" direction="in" name="flash"/>
|
||||||
{ name: 'EnableExtension',
|
<arg type="s" direction="in" name="filename"/>
|
||||||
inSignature: 's',
|
<arg type="b" direction="out" name="success"/>
|
||||||
outSignature: ''
|
</method>
|
||||||
},
|
<method name="Screenshot">
|
||||||
{ name: 'DisableExtension',
|
<arg type="b" direction="in" name="include_cursor"/>
|
||||||
inSignature: 's',
|
<arg type="b" direction="in" name="flash"/>
|
||||||
outSignature: ''
|
<arg type="s" direction="in" name="filename"/>
|
||||||
},
|
<arg type="b" direction="out" name="success"/>
|
||||||
{ name: 'InstallRemoteExtension',
|
</method>
|
||||||
inSignature: 'ss',
|
<method name="FlashArea">
|
||||||
outSignature: ''
|
<arg type="i" direction="in" name="x"/>
|
||||||
},
|
<arg type="i" direction="in" name="y"/>
|
||||||
{ name: 'UninstallExtension',
|
<arg type="i" direction="in" name="width"/>
|
||||||
inSignature: 's',
|
<arg type="i" direction="in" name="height"/>
|
||||||
outSignature: 'b'
|
</method>
|
||||||
}
|
<method name="EnableExtension">
|
||||||
],
|
<arg type="s" direction="in" name="uuid"/>
|
||||||
signals: [{ name: 'ExtensionStatusChanged',
|
</method>
|
||||||
inSignature: 'sis' }],
|
<method name="DisableExtension">
|
||||||
properties: [{ name: 'OverviewActive',
|
<arg type="s" direction="in" name="uuid"/>
|
||||||
signature: 'b',
|
</method>
|
||||||
access: 'readwrite' },
|
<method name="InstallRemoteExtension">
|
||||||
{ name: 'ApiVersion',
|
<arg type="s" direction="in" name="uuid"/>
|
||||||
signature: 'i',
|
<arg type="s" direction="in" name="version"/>
|
||||||
access: 'read' },
|
</method>
|
||||||
{ name: 'ShellVersion',
|
<method name="UninstallExtension">
|
||||||
signature: 's',
|
<arg type="s" direction="in" name="uuid"/>
|
||||||
access: 'read' }]
|
<arg type="b" direction="out" name="success"/>
|
||||||
};
|
</method>
|
||||||
|
<method name="LaunchExtensionPrefs">
|
||||||
|
<arg type="s" direction="in" name="uuid"/>
|
||||||
|
</method>
|
||||||
|
<property name="OverviewActive" type="b" access="readwrite" />
|
||||||
|
<property name="ApiVersion" type="i" access="read" />
|
||||||
|
<property name="ShellVersion" type="s" access="read" />
|
||||||
|
<signal name="ExtensionStatusChanged">
|
||||||
|
<arg type="s" name="uuid"/>
|
||||||
|
<arg type="i" name="state"/>
|
||||||
|
<arg type="s" name="error"/>
|
||||||
|
</signal>
|
||||||
|
</interface>;
|
||||||
|
|
||||||
function GnomeShell() {
|
const GnomeShell = new Lang.Class({
|
||||||
this._init();
|
Name: 'GnomeShellDBus',
|
||||||
}
|
|
||||||
|
|
||||||
GnomeShell.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
DBus.session.exportObject('/org/gnome/Shell', this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellIface, this);
|
||||||
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
||||||
ExtensionSystem.connect('extension-state-changed',
|
ExtensionSystem.connect('extension-state-changed',
|
||||||
Lang.bind(this, this._extensionStateChanged));
|
Lang.bind(this, this._extensionStateChanged));
|
||||||
},
|
},
|
||||||
@ -93,6 +108,9 @@ GnomeShell.prototype = {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Eval: function(code) {
|
Eval: function(code) {
|
||||||
|
if (!global.settings.get_boolean('development-tools'))
|
||||||
|
return [false, null];
|
||||||
|
|
||||||
let returnValue;
|
let returnValue;
|
||||||
let success;
|
let success;
|
||||||
try {
|
try {
|
||||||
@ -108,12 +126,23 @@ GnomeShell.prototype = {
|
|||||||
return [success, returnValue];
|
return [success, returnValue];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onScreenshotComplete: function(obj, result, area, flash, invocation) {
|
||||||
|
if (flash) {
|
||||||
|
let flashspot = new Flashspot.Flashspot(area);
|
||||||
|
flashspot.fire();
|
||||||
|
}
|
||||||
|
|
||||||
|
let retval = GLib.Variant.new('(b)', [result]);
|
||||||
|
invocation.return_value(retval);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ScreenshotArea:
|
* ScreenshotArea:
|
||||||
* @x: The X coordinate of the area
|
* @x: The X coordinate of the area
|
||||||
* @y: The Y coordinate of the area
|
* @y: The Y coordinate of the area
|
||||||
* @width: The width of the area
|
* @width: The width of the area
|
||||||
* @height: The height of the area
|
* @height: The height of the area
|
||||||
|
* @flash: Whether to flash the area or not
|
||||||
* @filename: The filename for the screenshot
|
* @filename: The filename for the screenshot
|
||||||
*
|
*
|
||||||
* Takes a screenshot of the passed in area and saves it
|
* Takes a screenshot of the passed in area and saves it
|
||||||
@ -121,13 +150,19 @@ GnomeShell.prototype = {
|
|||||||
* indicating whether the operation was successful or not.
|
* indicating whether the operation was successful or not.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ScreenshotAreaAsync : function (x, y, width, height, filename, callback) {
|
ScreenshotAreaAsync : function (params, invocation) {
|
||||||
global.screenshot_area (x, y, width, height, filename, function (obj, result) { callback(result); });
|
let [x, y, width, height, flash, filename, callback] = params;
|
||||||
|
let screenshot = new Shell.Screenshot();
|
||||||
|
screenshot.screenshot_area (x, y, width, height, filename,
|
||||||
|
Lang.bind(this, this._onScreenshotComplete,
|
||||||
|
flash, invocation));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ScreenshotWindow:
|
* ScreenshotWindow:
|
||||||
* @include_frame: Whether to include the frame or not
|
* @include_frame: Whether to include the frame or not
|
||||||
|
* @include_cursor: Whether to include the cursor image or not
|
||||||
|
* @flash: Whether to flash the window area or not
|
||||||
* @filename: The filename for the screenshot
|
* @filename: The filename for the screenshot
|
||||||
*
|
*
|
||||||
* Takes a screenshot of the focused window (optionally omitting the frame)
|
* Takes a screenshot of the focused window (optionally omitting the frame)
|
||||||
@ -135,33 +170,94 @@ GnomeShell.prototype = {
|
|||||||
* indicating whether the operation was successful or not.
|
* indicating whether the operation was successful or not.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ScreenshotWindow : function (include_frame, filename) {
|
ScreenshotWindowAsync : function (params, invocation) {
|
||||||
return global.screenshot_window (include_frame, filename);
|
let [include_frame, include_cursor, flash, filename] = params;
|
||||||
|
let screenshot = new Shell.Screenshot();
|
||||||
|
screenshot.screenshot_window (include_frame, include_cursor, filename,
|
||||||
|
Lang.bind(this, this._onScreenshotComplete,
|
||||||
|
flash, invocation));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screenshot:
|
* Screenshot:
|
||||||
* @filename: The filename for the screenshot
|
* @filename: The filename for the screenshot
|
||||||
|
* @include_cursor: Whether to include the cursor image or not
|
||||||
|
* @flash: Whether to flash the screen or not
|
||||||
*
|
*
|
||||||
* Takes a screenshot of the whole screen and saves it
|
* Takes a screenshot of the whole screen and saves it
|
||||||
* in @filename as png image, it returns a boolean
|
* in @filename as png image, it returns a boolean
|
||||||
* indicating whether the operation was successful or not.
|
* indicating whether the operation was successful or not.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ScreenshotAsync : function (filename, callback) {
|
ScreenshotAsync : function (params, invocation) {
|
||||||
global.screenshot(filename, function (obj, result) { callback(result); });
|
let [include_cursor, flash, filename] = params;
|
||||||
|
let screenshot = new Shell.Screenshot();
|
||||||
|
screenshot.screenshot(include_cursor, filename,
|
||||||
|
Lang.bind(this, this._onScreenshotComplete,
|
||||||
|
flash, invocation));
|
||||||
|
},
|
||||||
|
|
||||||
|
FlashArea: function(x, y, width, height) {
|
||||||
|
let flashspot = new Flashspot.Flashspot({ x : x, y : y, width: width, height: height});
|
||||||
|
flashspot.fire();
|
||||||
},
|
},
|
||||||
|
|
||||||
ListExtensions: function() {
|
ListExtensions: function() {
|
||||||
return ExtensionSystem.extensionMeta;
|
let out = {};
|
||||||
|
for (let uuid in ExtensionUtils.extensions) {
|
||||||
|
let dbusObj = this.GetExtensionInfo(uuid);
|
||||||
|
out[uuid] = dbusObj;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
},
|
},
|
||||||
|
|
||||||
GetExtensionInfo: function(uuid) {
|
GetExtensionInfo: function(uuid) {
|
||||||
return ExtensionSystem.extensionMeta[uuid] || {};
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
|
if (!extension)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
let obj = {};
|
||||||
|
Lang.copyProperties(extension.metadata, obj);
|
||||||
|
|
||||||
|
// Only serialize the properties that we actually need.
|
||||||
|
const serializedProperties = ["type", "state", "path", "error", "hasPrefs"];
|
||||||
|
|
||||||
|
serializedProperties.forEach(function(prop) {
|
||||||
|
obj[prop] = extension[prop];
|
||||||
|
});
|
||||||
|
|
||||||
|
let out = {};
|
||||||
|
for (let key in obj) {
|
||||||
|
let val = obj[key];
|
||||||
|
let type;
|
||||||
|
switch (typeof val) {
|
||||||
|
case 'string':
|
||||||
|
type = 's';
|
||||||
|
break;
|
||||||
|
case 'number':
|
||||||
|
type = 'd';
|
||||||
|
break;
|
||||||
|
case 'boolean':
|
||||||
|
type = 'b';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out[key] = GLib.Variant.new(type, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
},
|
},
|
||||||
|
|
||||||
GetExtensionErrors: function(uuid) {
|
GetExtensionErrors: function(uuid) {
|
||||||
return ExtensionSystem.errors[uuid] || [];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
|
if (!extension)
|
||||||
|
return [];
|
||||||
|
|
||||||
|
if (!extension.errors)
|
||||||
|
return [];
|
||||||
|
|
||||||
|
return extension.errors;
|
||||||
},
|
},
|
||||||
|
|
||||||
EnableExtension: function(uuid) {
|
EnableExtension: function(uuid) {
|
||||||
@ -186,6 +282,13 @@ GnomeShell.prototype = {
|
|||||||
return ExtensionSystem.uninstallExtensionFromUUID(uuid);
|
return ExtensionSystem.uninstallExtensionFromUUID(uuid);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
LaunchExtensionPrefs: function(uuid) {
|
||||||
|
let appSys = Shell.AppSystem.get_default();
|
||||||
|
let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
|
||||||
|
app.launch(global.display.get_current_time_roundtrip(),
|
||||||
|
['extension:///' + uuid], -1, null);
|
||||||
|
},
|
||||||
|
|
||||||
get OverviewActive() {
|
get OverviewActive() {
|
||||||
return Main.overview.visible;
|
return Main.overview.visible;
|
||||||
},
|
},
|
||||||
@ -202,12 +305,7 @@ GnomeShell.prototype = {
|
|||||||
ShellVersion: Config.PACKAGE_VERSION,
|
ShellVersion: Config.PACKAGE_VERSION,
|
||||||
|
|
||||||
_extensionStateChanged: function(_, newState) {
|
_extensionStateChanged: function(_, newState) {
|
||||||
DBus.session.emit_signal('/org/gnome/Shell',
|
this._dbusImpl.emit_signal('ExtensionStatusChanged',
|
||||||
'org.gnome.Shell',
|
GLib.Variant.new('(sis)', [newState.uuid, newState.state, newState.error]));
|
||||||
'ExtensionStatusChanged', 'sis',
|
|
||||||
[newState.uuid, newState.state, newState.error]);
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
DBus.conformExport(GnomeShell.prototype, GnomeShellIface);
|
|
||||||
|
|
||||||
|
@ -7,18 +7,14 @@ const Main = imports.ui.main;
|
|||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
|
|
||||||
|
const _EntryMenu = new Lang.Class({
|
||||||
function _EntryMenu(entry, params) {
|
Name: 'ShellEntryMenu',
|
||||||
this._init(entry, params);
|
Extends: PopupMenu.PopupMenu,
|
||||||
};
|
|
||||||
|
|
||||||
_EntryMenu.prototype = {
|
|
||||||
__proto__: PopupMenu.PopupMenu.prototype,
|
|
||||||
|
|
||||||
_init: function(entry, params) {
|
_init: function(entry, params) {
|
||||||
params = Params.parse (params, { isPassword: false });
|
params = Params.parse (params, { isPassword: false });
|
||||||
|
|
||||||
PopupMenu.PopupMenu.prototype._init.call(this, entry, 0, St.Side.TOP);
|
this.parent(entry, 0, St.Side.TOP);
|
||||||
|
|
||||||
this.actor.add_style_class_name('entry-context-menu');
|
this.actor.add_style_class_name('entry-context-menu');
|
||||||
|
|
||||||
@ -60,7 +56,7 @@ _EntryMenu.prototype = {
|
|||||||
if (!this.actor.navigate_focus(null, direction, false))
|
if (!this.actor.navigate_focus(null, direction, false))
|
||||||
this.actor.grab_key_focus();
|
this.actor.grab_key_focus();
|
||||||
|
|
||||||
PopupMenu.PopupMenu.prototype.open.call(this);
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCopyItem: function() {
|
_updateCopyItem: function() {
|
||||||
@ -103,8 +99,7 @@ _EntryMenu.prototype = {
|
|||||||
let visible = !!(this._entry.clutter_text.password_char);
|
let visible = !!(this._entry.clutter_text.password_char);
|
||||||
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
|
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
function _setMenuAlignment(entry, stageX) {
|
function _setMenuAlignment(entry, stageX) {
|
||||||
let [success, entryX, entryY] = entry.transform_stage_point(stageX, 0);
|
let [success, entryX, entryY] = entry.transform_stage_point(stageX, 0);
|
||||||
|
@ -50,11 +50,9 @@ function _setLabelsForMessage(dialog, message) {
|
|||||||
|
|
||||||
/* -------------------------------------------------------- */
|
/* -------------------------------------------------------- */
|
||||||
|
|
||||||
function ListItem(app) {
|
const ListItem = new Lang.Class({
|
||||||
this._init(app);
|
Name: 'ListItem',
|
||||||
}
|
|
||||||
|
|
||||||
ListItem.prototype = {
|
|
||||||
_init: function(app) {
|
_init: function(app) {
|
||||||
this._app = app;
|
this._app = app;
|
||||||
|
|
||||||
@ -86,14 +84,12 @@ ListItem.prototype = {
|
|||||||
this.emit('activate');
|
this.emit('activate');
|
||||||
this._app.activate();
|
this._app.activate();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(ListItem.prototype);
|
Signals.addSignalMethods(ListItem.prototype);
|
||||||
|
|
||||||
function ShellMountOperation(source, params) {
|
const ShellMountOperation = new Lang.Class({
|
||||||
this._init(source, params);
|
Name: 'ShellMountOperation',
|
||||||
}
|
|
||||||
|
|
||||||
ShellMountOperation.prototype = {
|
|
||||||
_init: function(source, params) {
|
_init: function(source, params) {
|
||||||
params = Params.parse(params, { reaskPassword: false });
|
params = Params.parse(params, { reaskPassword: false });
|
||||||
|
|
||||||
@ -190,17 +186,14 @@ ShellMountOperation.prototype = {
|
|||||||
|
|
||||||
this._processesDialog.update(message, processes, choices);
|
this._processesDialog.update(message, processes, choices);
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
|
|
||||||
function ShellMountQuestionDialog(icon) {
|
const ShellMountQuestionDialog = new Lang.Class({
|
||||||
this._init(icon);
|
Name: 'ShellMountQuestionDialog',
|
||||||
}
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
ShellMountQuestionDialog.prototype = {
|
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
|
||||||
|
|
||||||
_init: function(icon) {
|
_init: function(icon) {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'mount-question-dialog' });
|
this.parent({ styleClass: 'mount-question-dialog' });
|
||||||
|
|
||||||
let mainContentLayout = new St.BoxLayout();
|
let mainContentLayout = new St.BoxLayout();
|
||||||
this.contentLayout.add(mainContentLayout, { x_fill: true,
|
this.contentLayout.add(mainContentLayout, { x_fill: true,
|
||||||
@ -218,6 +211,8 @@ ShellMountQuestionDialog.prototype = {
|
|||||||
{ y_align: St.Align.START });
|
{ y_align: St.Align.START });
|
||||||
|
|
||||||
this.subjectLabel = new St.Label({ style_class: 'mount-question-dialog-subject' });
|
this.subjectLabel = new St.Label({ style_class: 'mount-question-dialog-subject' });
|
||||||
|
this.subjectLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
|
this.subjectLabel.clutter_text.line_wrap = true;
|
||||||
|
|
||||||
messageLayout.add(this.subjectLabel,
|
messageLayout.add(this.subjectLabel,
|
||||||
{ y_fill: false,
|
{ y_fill: false,
|
||||||
@ -236,19 +231,16 @@ ShellMountQuestionDialog.prototype = {
|
|||||||
_setLabelsForMessage(this, message);
|
_setLabelsForMessage(this, message);
|
||||||
_setButtonsForChoices(this, choices);
|
_setButtonsForChoices(this, choices);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
|
Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
|
||||||
|
|
||||||
function ShellMountPasswordSource(message, icon, reaskPassword) {
|
const ShellMountPasswordSource = new Lang.Class({
|
||||||
this._init(message, icon, reaskPassword);
|
Name: 'ShellMountPasswordSource',
|
||||||
}
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
ShellMountPasswordSource.prototype = {
|
|
||||||
__proto__: MessageTray.Source.prototype,
|
|
||||||
|
|
||||||
_init: function(message, icon, reaskPassword) {
|
_init: function(message, icon, reaskPassword) {
|
||||||
let strings = message.split('\n');
|
let strings = message.split('\n');
|
||||||
MessageTray.Source.prototype._init.call(this, strings[0]);
|
this.parent(strings[0]);
|
||||||
|
|
||||||
this._notification = new ShellMountPasswordNotification(this, strings, icon, reaskPassword);
|
this._notification = new ShellMountPasswordNotification(this, strings, icon, reaskPassword);
|
||||||
|
|
||||||
@ -256,21 +248,15 @@ ShellMountPasswordSource.prototype = {
|
|||||||
Main.messageTray.add(this);
|
Main.messageTray.add(this);
|
||||||
this.notify(this._notification);
|
this.notify(this._notification);
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
Signals.addSignalMethods(ShellMountPasswordSource.prototype);
|
Signals.addSignalMethods(ShellMountPasswordSource.prototype);
|
||||||
|
|
||||||
function ShellMountPasswordNotification(source, strings, icon, reaskPassword) {
|
const ShellMountPasswordNotification = new Lang.Class({
|
||||||
this._init(source, strings, icon, reaskPassword);
|
Name: 'ShellMountPasswordNotification',
|
||||||
}
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
ShellMountPasswordNotification.prototype = {
|
|
||||||
__proto__: MessageTray.Notification.prototype,
|
|
||||||
|
|
||||||
_init: function(source, strings, icon, reaskPassword) {
|
_init: function(source, strings, icon, reaskPassword) {
|
||||||
MessageTray.Notification.prototype._init.call(this, source,
|
this.parent(source, strings[0], null, { customContent: true, icon: icon });
|
||||||
strings[0], null,
|
|
||||||
{ customContent: true,
|
|
||||||
icon: icon });
|
|
||||||
|
|
||||||
// set the notification to transient and urgent, so that it
|
// set the notification to transient and urgent, so that it
|
||||||
// expands out
|
// expands out
|
||||||
@ -305,17 +291,14 @@ ShellMountPasswordNotification.prototype = {
|
|||||||
|
|
||||||
this.source.emit('password-ready', text);
|
this.source.emit('password-ready', text);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function ShellProcessesDialog(icon) {
|
const ShellProcessesDialog = new Lang.Class({
|
||||||
this._init(icon);
|
Name: 'ShellProcessesDialog',
|
||||||
}
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
ShellProcessesDialog.prototype = {
|
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
|
||||||
|
|
||||||
_init: function(icon) {
|
_init: function(icon) {
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'show-processes-dialog' });
|
this.parent({ styleClass: 'show-processes-dialog' });
|
||||||
|
|
||||||
let mainContentLayout = new St.BoxLayout();
|
let mainContentLayout = new St.BoxLayout();
|
||||||
this.contentLayout.add(mainContentLayout, { x_fill: true,
|
this.contentLayout.add(mainContentLayout, { x_fill: true,
|
||||||
@ -376,7 +359,7 @@ ShellProcessesDialog.prototype = {
|
|||||||
|
|
||||||
_setAppsForPids: function(pids) {
|
_setAppsForPids: function(pids) {
|
||||||
// remove all the items
|
// remove all the items
|
||||||
this._applicationList.destroy_children();
|
this._applicationList.destroy_all_children();
|
||||||
|
|
||||||
pids.forEach(Lang.bind(this, function(pid) {
|
pids.forEach(Lang.bind(this, function(pid) {
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
@ -401,5 +384,5 @@ ShellProcessesDialog.prototype = {
|
|||||||
_setLabelsForMessage(this, message);
|
_setLabelsForMessage(this, message);
|
||||||
_setButtonsForChoices(this, choices);
|
_setButtonsForChoices(this, choices);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Signals.addSignalMethods(ShellProcessesDialog.prototype);
|
Signals.addSignalMethods(ShellProcessesDialog.prototype);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
|
||||||
const DBus = imports.dbus;
|
const GDesktopEnums = imports.gi.GDesktopEnums;
|
||||||
const GConf = imports.gi.GConf;
|
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
@ -30,8 +29,8 @@ const DPI_FACTOR_LARGE = 1.25;
|
|||||||
const DPI_FACTOR_LARGER = 1.5;
|
const DPI_FACTOR_LARGER = 1.5;
|
||||||
const DPI_FACTOR_LARGEST = 2.0;
|
const DPI_FACTOR_LARGEST = 2.0;
|
||||||
|
|
||||||
const KEY_META_DIR = '/apps/metacity/general';
|
const WM_SCHEMA = 'org.gnome.desktop.wm.preferences';
|
||||||
const KEY_VISUAL_BELL = KEY_META_DIR + '/visual_bell';
|
const KEY_VISUAL_BELL = 'visual-bell';
|
||||||
|
|
||||||
const DESKTOP_INTERFACE_SCHEMA = 'org.gnome.desktop.interface';
|
const DESKTOP_INTERFACE_SCHEMA = 'org.gnome.desktop.interface';
|
||||||
const KEY_GTK_THEME = 'gtk-theme';
|
const KEY_GTK_THEME = 'gtk-theme';
|
||||||
@ -40,19 +39,12 @@ const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor';
|
|||||||
|
|
||||||
const HIGH_CONTRAST_THEME = 'HighContrast';
|
const HIGH_CONTRAST_THEME = 'HighContrast';
|
||||||
|
|
||||||
function ATIndicator() {
|
const ATIndicator = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ATIndicator',
|
||||||
}
|
Extends: PanelMenu.SystemStatusButton,
|
||||||
|
|
||||||
ATIndicator.prototype = {
|
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'preferences-desktop-accessibility', null);
|
this.parent('preferences-desktop-accessibility', _("Accessibility"));
|
||||||
|
|
||||||
let client = GConf.Client.get_default();
|
|
||||||
client.add_dir(KEY_META_DIR, GConf.ClientPreloadType.PRELOAD_ONELEVEL, null);
|
|
||||||
client.notify_add(KEY_META_DIR, Lang.bind(this, this._keyChanged), null, null);
|
|
||||||
|
|
||||||
let highContrast = this._buildHCItem();
|
let highContrast = this._buildHCItem();
|
||||||
this.menu.addMenuItem(highContrast);
|
this.menu.addMenuItem(highContrast);
|
||||||
@ -72,7 +64,7 @@ ATIndicator.prototype = {
|
|||||||
'screen-keyboard-enabled');
|
'screen-keyboard-enabled');
|
||||||
this.menu.addMenuItem(screenKeyboard);
|
this.menu.addMenuItem(screenKeyboard);
|
||||||
|
|
||||||
let visualBell = this._buildItemGConf(_("Visual Alerts"), client, KEY_VISUAL_BELL);
|
let visualBell = this._buildItem(_("Visual Alerts"), WM_SCHEMA, KEY_VISUAL_BELL);
|
||||||
this.menu.addMenuItem(visualBell);
|
this.menu.addMenuItem(visualBell);
|
||||||
|
|
||||||
let stickyKeys = this._buildItem(_("Sticky Keys"), A11Y_SCHEMA, KEY_STICKY_KEYS_ENABLED);
|
let stickyKeys = this._buildItem(_("Sticky Keys"), A11Y_SCHEMA, KEY_STICKY_KEYS_ENABLED);
|
||||||
@ -102,22 +94,6 @@ ATIndicator.prototype = {
|
|||||||
return widget;
|
return widget;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildItemGConf: function(string, client, key) {
|
|
||||||
function on_get() {
|
|
||||||
return client.get_bool(key);
|
|
||||||
}
|
|
||||||
let widget = this._buildItemExtended(string,
|
|
||||||
client.get_bool(key),
|
|
||||||
client.key_is_writable(key),
|
|
||||||
function(enabled) {
|
|
||||||
client.set_bool(key, enabled);
|
|
||||||
});
|
|
||||||
this.connect('gconf-changed', function() {
|
|
||||||
widget.setToggleState(client.get_bool(key));
|
|
||||||
});
|
|
||||||
return widget;
|
|
||||||
},
|
|
||||||
|
|
||||||
_buildItem: function(string, schema, key) {
|
_buildItem: function(string, schema, key) {
|
||||||
let settings = new Gio.Settings({ schema: schema });
|
let settings = new Gio.Settings({ schema: schema });
|
||||||
let widget = this._buildItemExtended(string,
|
let widget = this._buildItemExtended(string,
|
||||||
@ -191,10 +167,5 @@ ATIndicator.prototype = {
|
|||||||
widget.setToggleState(active);
|
widget.setToggleState(active);
|
||||||
});
|
});
|
||||||
return widget;
|
return widget;
|
||||||
},
|
|
||||||
|
|
||||||
_keyChanged: function() {
|
|
||||||
this.emit('gconf-changed');
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(ATIndicator.prototype);
|
|
||||||
|
@ -23,17 +23,13 @@ const ConnectionState = {
|
|||||||
CONNECTING: 3
|
CONNECTING: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
function Indicator() {
|
const Indicator = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'BTIndicator',
|
||||||
}
|
Extends: PanelMenu.SystemStatusButton,
|
||||||
|
|
||||||
Indicator.prototype = {
|
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'bluetooth-disabled', null);
|
this.parent('bluetooth-disabled', _("Bluetooth"));
|
||||||
|
|
||||||
GLib.spawn_command_line_sync ('pkill -f "^bluetooth-applet$"');
|
|
||||||
this._applet = new GnomeBluetoothApplet.Applet();
|
this._applet = new GnomeBluetoothApplet.Applet();
|
||||||
|
|
||||||
this._killswitch = new PopupMenu.PopupSwitchMenuItem(_("Bluetooth"), false);
|
this._killswitch = new PopupMenu.PopupSwitchMenuItem(_("Bluetooth"), false);
|
||||||
@ -110,10 +106,7 @@ Indicator.prototype = {
|
|||||||
/* TRANSLATORS: this means that bluetooth was disabled by hardware rfkill */
|
/* TRANSLATORS: this means that bluetooth was disabled by hardware rfkill */
|
||||||
this._killswitch.setStatus(_("hardware disabled"));
|
this._killswitch.setStatus(_("hardware disabled"));
|
||||||
|
|
||||||
if (has_adapter)
|
this.actor.visible = has_adapter;
|
||||||
this.actor.show();
|
|
||||||
else
|
|
||||||
this.actor.hide();
|
|
||||||
|
|
||||||
if (on) {
|
if (on) {
|
||||||
this._discoverable.actor.show();
|
this._discoverable.actor.show();
|
||||||
@ -185,7 +178,7 @@ Indicator.prototype = {
|
|||||||
|
|
||||||
// update connected property
|
// update connected property
|
||||||
if (device.can_connect)
|
if (device.can_connect)
|
||||||
item._connectedMenuitem.setToggleState(device.connected);
|
item._connectedMenuItem.setToggleState(device.connected);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createDeviceItem: function(device) {
|
_createDeviceItem: function(device) {
|
||||||
@ -204,9 +197,10 @@ Indicator.prototype = {
|
|||||||
|
|
||||||
_buildDeviceSubMenu: function(item, device) {
|
_buildDeviceSubMenu: function(item, device) {
|
||||||
if (device.can_connect) {
|
if (device.can_connect) {
|
||||||
|
let menuitem = new PopupMenu.PopupSwitchMenuItem(_("Connection"), device.connected);
|
||||||
item._connected = device.connected;
|
item._connected = device.connected;
|
||||||
item._connectedMenuitem = new PopupMenu.PopupSwitchMenuItem(_("Connection"), device.connected);
|
item._connectedMenuItem = menuitem;
|
||||||
item._connectedMenuitem.connect('toggled', Lang.bind(this, function() {
|
menuitem.connect('toggled', Lang.bind(this, function() {
|
||||||
if (item._connected > ConnectionState.CONNECTED) {
|
if (item._connected > ConnectionState.CONNECTED) {
|
||||||
// operation already in progress, revert
|
// operation already in progress, revert
|
||||||
// (should not happen anyway)
|
// (should not happen anyway)
|
||||||
@ -241,7 +235,7 @@ Indicator.prototype = {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
item.menu.addMenuItem(item._connectedMenuitem);
|
item.menu.addMenuItem(menuitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device.capabilities & GnomeBluetoothApplet.Capabilities.OBEX_PUSH) {
|
if (device.capabilities & GnomeBluetoothApplet.Capabilities.OBEX_PUSH) {
|
||||||
@ -334,17 +328,14 @@ Indicator.prototype = {
|
|||||||
_cancelRequest: function() {
|
_cancelRequest: function() {
|
||||||
this._source.destroy();
|
this._source.destroy();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function Source() {
|
const Source = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'BluetoothSource',
|
||||||
}
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
Source.prototype = {
|
|
||||||
__proto__: MessageTray.Source.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
MessageTray.Source.prototype._init.call(this, _("Bluetooth"));
|
this.parent(_("Bluetooth"));
|
||||||
|
|
||||||
this._setSummaryIcon(this.createNotificationIcon());
|
this._setSummaryIcon(this.createNotificationIcon());
|
||||||
},
|
},
|
||||||
@ -358,7 +349,7 @@ Source.prototype = {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
MessageTray.Source.prototype.notify.call(this, notification);
|
this.parent(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
createNotificationIcon: function() {
|
createNotificationIcon: function() {
|
||||||
@ -366,18 +357,14 @@ Source.prototype = {
|
|||||||
icon_type: St.IconType.SYMBOLIC,
|
icon_type: St.IconType.SYMBOLIC,
|
||||||
icon_size: this.ICON_SIZE });
|
icon_size: this.ICON_SIZE });
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function AuthNotification() {
|
const AuthNotification = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'AuthNotification',
|
||||||
}
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
AuthNotification.prototype = {
|
|
||||||
__proto__: MessageTray.Notification.prototype,
|
|
||||||
|
|
||||||
_init: function(source, applet, device_path, name, long_name, uuid) {
|
_init: function(source, applet, device_path, name, long_name, uuid) {
|
||||||
MessageTray.Notification.prototype._init.call(this,
|
this.parent(source,
|
||||||
source,
|
|
||||||
_("Bluetooth"),
|
_("Bluetooth"),
|
||||||
_("Authorization request from %s").format(name),
|
_("Authorization request from %s").format(name),
|
||||||
{ customContent: true });
|
{ customContent: true });
|
||||||
@ -406,18 +393,14 @@ AuthNotification.prototype = {
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function ConfirmNotification() {
|
const ConfirmNotification = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'ConfirmNotification',
|
||||||
}
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
ConfirmNotification.prototype = {
|
|
||||||
__proto__: MessageTray.Notification.prototype,
|
|
||||||
|
|
||||||
_init: function(source, applet, device_path, name, long_name, pin) {
|
_init: function(source, applet, device_path, name, long_name, pin) {
|
||||||
MessageTray.Notification.prototype._init.call(this,
|
this.parent(source,
|
||||||
source,
|
|
||||||
_("Bluetooth"),
|
_("Bluetooth"),
|
||||||
_("Pairing confirmation for %s").format(name),
|
_("Pairing confirmation for %s").format(name),
|
||||||
{ customContent: true });
|
{ customContent: true });
|
||||||
@ -439,18 +422,14 @@ ConfirmNotification.prototype = {
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function PinNotification() {
|
const PinNotification = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PinNotification',
|
||||||
}
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
PinNotification.prototype = {
|
|
||||||
__proto__: MessageTray.Notification.prototype,
|
|
||||||
|
|
||||||
_init: function(source, applet, device_path, name, long_name, numeric) {
|
_init: function(source, applet, device_path, name, long_name, numeric) {
|
||||||
MessageTray.Notification.prototype._init.call(this,
|
this.parent(source,
|
||||||
source,
|
|
||||||
_("Bluetooth"),
|
_("Bluetooth"),
|
||||||
_("Pairing request for %s").format(name),
|
_("Pairing request for %s").format(name),
|
||||||
{ customContent: true });
|
{ customContent: true });
|
||||||
@ -502,7 +481,7 @@ PinNotification.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
grabFocus: function(lockTray) {
|
grabFocus: function(lockTray) {
|
||||||
MessageTray.Notification.prototype.grabFocus.call(this, lockTray);
|
this.parent(lockTray);
|
||||||
global.stage.set_key_focus(this._entry);
|
global.stage.set_key_focus(this._entry);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
584
js/ui/status/candidatePanel.js
Normal file
@ -0,0 +1,584 @@
|
|||||||
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Red Hat, Inc.
|
||||||
|
* Copyright 2012 Peng Huang <shawn.p.huang@gmail.com>
|
||||||
|
* Copyright 2012 Takao Fujiwara <tfujiwar@redhat.com>
|
||||||
|
* Copyright 2012 Tiger Soldier <tigersoldi@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT ANY
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const St = imports.gi.St;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
|
const IBus = imports.gi.IBus;
|
||||||
|
const Lang = imports.lang;
|
||||||
|
const Signals = imports.signals;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
|
|
||||||
|
const BoxPointer = imports.ui.boxpointer;
|
||||||
|
const Main = imports.ui.main;
|
||||||
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
|
|
||||||
|
const ORIENTATION_HORIZONTAL = 0;
|
||||||
|
const ORIENTATION_VERTICAL = 1;
|
||||||
|
const ORIENTATION_SYSTEM = 2;
|
||||||
|
|
||||||
|
const StCandidateArea = new Lang.Class({
|
||||||
|
Name: 'StCandidateArea',
|
||||||
|
|
||||||
|
_init: function(orientation) {
|
||||||
|
this.actor = new St.BoxLayout({ style_class: 'candidate-area' });
|
||||||
|
this._orientation = orientation;
|
||||||
|
this._labels = [];
|
||||||
|
this._labelBoxes = [];
|
||||||
|
this._createUI();
|
||||||
|
},
|
||||||
|
|
||||||
|
_removeOldWidgets: function() {
|
||||||
|
this.actor.destroy_all_children();
|
||||||
|
this._labels = [];
|
||||||
|
this._labelBoxes = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
_createUI: function() {
|
||||||
|
let vbox = null;
|
||||||
|
let hbox = null;
|
||||||
|
if (this._orientation == ORIENTATION_VERTICAL) {
|
||||||
|
vbox = new St.BoxLayout({ vertical: true,
|
||||||
|
style_class: 'candidate-vertical' });
|
||||||
|
this.actor.add_child(vbox,
|
||||||
|
{ expand: true,
|
||||||
|
x_fill: true,
|
||||||
|
y_fill: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
hbox = new St.BoxLayout({ vertical: false,
|
||||||
|
style_class: 'candidate-horizontal' });
|
||||||
|
this.actor.add_child(hbox,
|
||||||
|
{ expand: true,
|
||||||
|
x_fill: true,
|
||||||
|
y_fill: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 16; i++) {
|
||||||
|
let label1 = new St.Label({ text: '1234567890abcdef'.charAt(i) + '.',
|
||||||
|
style_class: 'popup-menu-item',
|
||||||
|
reactive: true });
|
||||||
|
|
||||||
|
let label2 = new St.Label({ text: '' ,
|
||||||
|
style_class: 'popup-menu-item',
|
||||||
|
reactive: true });
|
||||||
|
|
||||||
|
if (this._orientation == ORIENTATION_VERTICAL) {
|
||||||
|
let candidateHBox = new St.BoxLayout({vertical: false});
|
||||||
|
let labelBox = new St.Bin({ style_class: 'candidate-hlabel-content' });
|
||||||
|
labelBox.set_child(label1);
|
||||||
|
labelBox.set_fill(true, true);
|
||||||
|
let textBox = new St.Bin({ style_class: 'candidate-htext-content' });
|
||||||
|
|
||||||
|
textBox.set_child(label2);
|
||||||
|
textBox.set_fill(true, true);
|
||||||
|
candidateHBox.add_child(labelBox,
|
||||||
|
{ expand: false,
|
||||||
|
x_fill: false,
|
||||||
|
y_fill: true
|
||||||
|
});
|
||||||
|
candidateHBox.add_child(textBox,
|
||||||
|
{ expand: true,
|
||||||
|
x_fill: true,
|
||||||
|
y_fill: true
|
||||||
|
});
|
||||||
|
vbox.add_child(candidateHBox);
|
||||||
|
this._labelBoxes.push(candidateHBox);
|
||||||
|
} else {
|
||||||
|
let candidateHBox = new St.BoxLayout({ style_class: 'candidate-vcontent',
|
||||||
|
vertical: false });
|
||||||
|
candidateHBox.add_child(label1);
|
||||||
|
candidateHBox.add_child(label2);
|
||||||
|
hbox.add_child(candidateHBox);
|
||||||
|
this._labelBoxes.push(candidateHBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._labels.push([label1, label2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this._labels.length; i++) {
|
||||||
|
for(let j = 0; j < this._labels[i].length; j++) {
|
||||||
|
let widget = this._labels[i][j];
|
||||||
|
widget.candidateIndex = i;
|
||||||
|
widget.connect('button-press-event',
|
||||||
|
Lang.bind(this, function (widget, event) {
|
||||||
|
this._candidateClickedCB(widget, event);
|
||||||
|
}));
|
||||||
|
widget.connect('enter-event',
|
||||||
|
function(widget, event) {
|
||||||
|
widget.add_style_pseudo_class('hover');
|
||||||
|
});
|
||||||
|
widget.connect('leave-event',
|
||||||
|
function(widget, event) {
|
||||||
|
widget.remove_style_pseudo_class('hover');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_recreateUI: function() {
|
||||||
|
this._removeOldWidgets();
|
||||||
|
this._createUI();
|
||||||
|
},
|
||||||
|
|
||||||
|
_candidateClickedCB: function(widget, event) {
|
||||||
|
this.emit('candidate-clicked',
|
||||||
|
widget.candidateIndex,
|
||||||
|
event.get_button(),
|
||||||
|
event.get_state());
|
||||||
|
},
|
||||||
|
|
||||||
|
setLabels: function(labels) {
|
||||||
|
if (!labels || labels.length == 0) {
|
||||||
|
for (let i = 0; i < 16; i++) {
|
||||||
|
this._labels[i][0].set_text('1234567890abcdef'.charAt(i) + '.');
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < labels.length && i < this._labels.length; i++) {
|
||||||
|
/* Use a ClutterActor attribute of Shell's theme instead of
|
||||||
|
* Pango.AttrList for the lookup window GUI and
|
||||||
|
* can ignore 'attrs' simply from IBus engines?
|
||||||
|
*/
|
||||||
|
let [text, attrs] = labels[i];
|
||||||
|
this._labels[i][0].set_text(text);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setCandidates: function(candidates, focusCandidate, showCursor) {
|
||||||
|
if (focusCandidate == undefined) {
|
||||||
|
focusCandidate = 0;
|
||||||
|
}
|
||||||
|
if (showCursor == undefined) {
|
||||||
|
showCursor = true;
|
||||||
|
}
|
||||||
|
if (candidates.length > this._labels.length) {
|
||||||
|
assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < candidates.length; i++) {
|
||||||
|
/* Use a ClutterActor attribute of Shell's theme instead of
|
||||||
|
* Pango.AttrList for the lookup window GUI and
|
||||||
|
* can ignore 'attrs' simply from IBus engines?
|
||||||
|
*/
|
||||||
|
let [text, attrs] = candidates[i];
|
||||||
|
if (i == focusCandidate && showCursor) {
|
||||||
|
this._labels[i][1].add_style_pseudo_class('active');
|
||||||
|
} else {
|
||||||
|
this._labels[i][1].remove_style_pseudo_class('active');
|
||||||
|
}
|
||||||
|
this._labels[i][1].set_text(text);
|
||||||
|
this._labelBoxes[i].show();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = this._labelBoxes.length - 1; i >= candidates.length; i--) {
|
||||||
|
this._labelBoxes[i].hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setOrientation: function(orientation) {
|
||||||
|
if (orientation == this._orientation)
|
||||||
|
return;
|
||||||
|
this._orientation = orientation;
|
||||||
|
this._recreateUI();
|
||||||
|
},
|
||||||
|
|
||||||
|
showAll: function() {
|
||||||
|
this.actor.show();
|
||||||
|
},
|
||||||
|
|
||||||
|
hideAll: function() {
|
||||||
|
this.actor.hide();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
Signals.addSignalMethods(StCandidateArea.prototype);
|
||||||
|
|
||||||
|
const CandidatePanel = new Lang.Class({
|
||||||
|
Name: 'CandidatePanel',
|
||||||
|
|
||||||
|
_init: function() {
|
||||||
|
this._orientation = ORIENTATION_VERTICAL;
|
||||||
|
this._currentOrientation = this._orientation;
|
||||||
|
this._preeditVisible = false;
|
||||||
|
this._auxStringVisible = false;
|
||||||
|
this._lookupTableVisible = false;
|
||||||
|
this._lookupTable = null;
|
||||||
|
|
||||||
|
this._cursorLocation = [0, 0, 0, 0];
|
||||||
|
this._movedCursorLocation = null;
|
||||||
|
|
||||||
|
this._initSt();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
_initSt: function() {
|
||||||
|
this._arrowSide = St.Side.TOP;
|
||||||
|
this._arrowAlignment = 0.0;
|
||||||
|
this._boxPointer = new BoxPointer.BoxPointer(this._arrowSide,
|
||||||
|
{ x_fill: true,
|
||||||
|
y_fill: true,
|
||||||
|
x_align: St.Align.START });
|
||||||
|
this.actor = this._boxPointer.actor;
|
||||||
|
this.actor._delegate = this;
|
||||||
|
this.actor.style_class = 'popup-menu-boxpointer';
|
||||||
|
this.actor.add_style_class_name('popup-menu');
|
||||||
|
this.actor.add_style_class_name('candidate-panel');
|
||||||
|
this._cursorActor = new Shell.GenericContainer();
|
||||||
|
Main.uiGroup.add_actor(this.actor);
|
||||||
|
Main.uiGroup.add_actor(this._cursorActor);
|
||||||
|
|
||||||
|
this._stCandidatePanel = new St.BoxLayout({ style_class: 'candidate-panel',
|
||||||
|
vertical: true });
|
||||||
|
this._boxPointer.bin.set_child(this._stCandidatePanel);
|
||||||
|
|
||||||
|
this._stPreeditLabel = new St.Label({ style_class: 'popup-menu-item',
|
||||||
|
text: '' });
|
||||||
|
if (!this._preeditVisible) {
|
||||||
|
this._stPreeditLabel.hide();
|
||||||
|
}
|
||||||
|
this._stAuxLabel = new St.Label({ style_class: 'popup-menu-item',
|
||||||
|
text: '' });
|
||||||
|
if (!this._auxVisible) {
|
||||||
|
this._stAuxLabel.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._separator = new PopupMenu.PopupSeparatorMenuItem();
|
||||||
|
if (!this._preeditVisible && !this._auxVisible) {
|
||||||
|
this._separator.actor.hide();
|
||||||
|
}
|
||||||
|
// create candidates area
|
||||||
|
this._stCandidateArea = new StCandidateArea(this._currentOrientation);
|
||||||
|
this._stCandidateArea.connect('candidate-clicked',
|
||||||
|
Lang.bind(this, function(x, i, b, s) {
|
||||||
|
this.emit('candidate-clicked', i, b, s);}));
|
||||||
|
this.updateLookupTable(this._lookupTable, this._lookupTableVisible);
|
||||||
|
|
||||||
|
// TODO: page up/down GUI
|
||||||
|
|
||||||
|
this._packAllStWidgets();
|
||||||
|
this._isVisible = true;
|
||||||
|
this.hideAll();
|
||||||
|
this._checkShowStates();
|
||||||
|
},
|
||||||
|
|
||||||
|
_packAllStWidgets: function() {
|
||||||
|
this._stCandidatePanel.add_child(this._stPreeditLabel,
|
||||||
|
{ x_fill: true,
|
||||||
|
y_fill: false,
|
||||||
|
x_align: St.Align.MIDDLE,
|
||||||
|
y_align: St.Align.START });
|
||||||
|
this._stCandidatePanel.add_child(this._stAuxLabel,
|
||||||
|
{ x_fill: true,
|
||||||
|
y_fill: false,
|
||||||
|
x_align: St.Align.MIDDLE,
|
||||||
|
y_align: St.Align.MIDDLE });
|
||||||
|
this._stCandidatePanel.add_child(this._separator.actor,
|
||||||
|
{ x_fill: true,
|
||||||
|
y_fill: false,
|
||||||
|
x_align: St.Align.MIDDLE,
|
||||||
|
y_align: St.Align.MIDDLE });
|
||||||
|
this._stCandidatePanel.add_child(this._stCandidateArea.actor,
|
||||||
|
{ x_fill: true,
|
||||||
|
y_fill: false,
|
||||||
|
x_align: St.Align.MIDDLE,
|
||||||
|
y_align: St.Align.END });
|
||||||
|
},
|
||||||
|
|
||||||
|
showPreeditText: function() {
|
||||||
|
this._preeditVisible = true;
|
||||||
|
this._stPreeditLabel.show();
|
||||||
|
this._checkShowStates();
|
||||||
|
},
|
||||||
|
|
||||||
|
hidePreeditText: function() {
|
||||||
|
this._preeditVisible = false;
|
||||||
|
this._checkShowStates();
|
||||||
|
this._stPreeditLabel.hide();
|
||||||
|
},
|
||||||
|
|
||||||
|
updatePreeditText: function(text, cursorPos, visible) {
|
||||||
|
if (visible) {
|
||||||
|
this.showPreeditText();
|
||||||
|
} else {
|
||||||
|
this.hidePreeditText();
|
||||||
|
}
|
||||||
|
let str = text.get_text();
|
||||||
|
this._stPreeditLabel.set_text(str);
|
||||||
|
|
||||||
|
let attrs = text.get_attributes();
|
||||||
|
for (let i = 0; attrs != null && attrs.get(i) != null; i++) {
|
||||||
|
let attr = attrs.get(i);
|
||||||
|
if (attr.get_attr_type() == IBus.AttrType.BACKGROUND) {
|
||||||
|
let startIndex = attr.get_start_index();
|
||||||
|
let endIndex = attr.get_end_index();
|
||||||
|
let len = GLib.utf8_strlen(str, -1);
|
||||||
|
let markup = '';
|
||||||
|
if (startIndex == 0 &&
|
||||||
|
endIndex == GLib.utf8_strlen(str, -1)) {
|
||||||
|
markup = markup.concat(str);
|
||||||
|
} else {
|
||||||
|
if (startIndex > 0) {
|
||||||
|
markup = markup.concat(GLib.utf8_substring(str,
|
||||||
|
0,
|
||||||
|
startIndex));
|
||||||
|
}
|
||||||
|
if (startIndex != endIndex) {
|
||||||
|
markup = markup.concat('<span background=\"#555555\">');
|
||||||
|
markup = markup.concat(GLib.utf8_substring(str,
|
||||||
|
startIndex,
|
||||||
|
endIndex));
|
||||||
|
markup = markup.concat('</span>');
|
||||||
|
}
|
||||||
|
if (endIndex < len) {
|
||||||
|
markup = markup.concat(GLib.utf8_substring(str,
|
||||||
|
endIndex,
|
||||||
|
len));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let clutter_text = this._stPreeditLabel.get_clutter_text();
|
||||||
|
clutter_text.set_markup(markup);
|
||||||
|
clutter_text.queue_redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
showAuxiliaryText: function() {
|
||||||
|
this._auxStringVisible = true;
|
||||||
|
this._stAuxLabel.show();
|
||||||
|
this._checkShowStates();
|
||||||
|
},
|
||||||
|
|
||||||
|
hideAuxiliaryText: function() {
|
||||||
|
this._auxStringVisible = false;
|
||||||
|
this._checkShowStates();
|
||||||
|
this._stAuxLabel.hide();
|
||||||
|
},
|
||||||
|
|
||||||
|
updateAuxiliaryText: function(text, show) {
|
||||||
|
if (show) {
|
||||||
|
this.showAuxiliaryText();
|
||||||
|
} else {
|
||||||
|
this.hideAuxiliaryText();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._stAuxLabel.set_text(text.get_text());
|
||||||
|
},
|
||||||
|
|
||||||
|
_refreshLabels: function() {
|
||||||
|
let newLabels = [];
|
||||||
|
for (let i = 0; this._lookupTable.get_label(i) != null; i++) {
|
||||||
|
let label = this._lookupTable.get_label(i);
|
||||||
|
newLabels.push([label.get_text(), label.get_attributes()]);
|
||||||
|
}
|
||||||
|
this._stCandidateArea.setLabels(newLabels);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
_getCandidatesInCurrentPage: function() {
|
||||||
|
let cursorPos = this._lookupTable.get_cursor_pos();
|
||||||
|
let pageSize = this._lookupTable.get_page_size();
|
||||||
|
let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
|
||||||
|
let startIndex = page * pageSize;
|
||||||
|
let endIndex = Math.min((page + 1) * pageSize,
|
||||||
|
this._lookupTable.get_number_of_candidates());
|
||||||
|
let candidates = [];
|
||||||
|
for (let i = startIndex; i < endIndex; i++) {
|
||||||
|
candidates.push(this._lookupTable.get_candidate(i));
|
||||||
|
}
|
||||||
|
return candidates;
|
||||||
|
},
|
||||||
|
|
||||||
|
_getCursorPosInCurrentPage: function() {
|
||||||
|
let cursorPos = this._lookupTable.get_cursor_pos();
|
||||||
|
let pageSize = this._lookupTable.get_page_size();
|
||||||
|
let posInPage = cursorPos % pageSize;
|
||||||
|
return posInPage;
|
||||||
|
},
|
||||||
|
|
||||||
|
_refreshCandidates: function() {
|
||||||
|
let candidates = this._getCandidatesInCurrentPage();
|
||||||
|
let newCandidates = [];
|
||||||
|
for (let i = 0; i < candidates.length; i++) {
|
||||||
|
let candidate = candidates[i];
|
||||||
|
newCandidates.push([candidate.get_text(),
|
||||||
|
candidate.get_attributes()]);
|
||||||
|
}
|
||||||
|
this._stCandidateArea.setCandidates(newCandidates,
|
||||||
|
this._getCursorPosInCurrentPage(),
|
||||||
|
this._lookupTable.is_cursor_visible());
|
||||||
|
},
|
||||||
|
|
||||||
|
updateLookupTable: function(lookupTable, visible) {
|
||||||
|
// hide lookup table
|
||||||
|
if (!visible) {
|
||||||
|
this.hideLookupTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._lookupTable = lookupTable || new IBus.LookupTable();
|
||||||
|
let orientation = this._lookupTable.get_orientation();
|
||||||
|
if (orientation != ORIENTATION_HORIZONTAL &&
|
||||||
|
orientation != ORIENTATION_VERTICAL) {
|
||||||
|
orientation = this._orientation;
|
||||||
|
}
|
||||||
|
this.setCurrentOrientation(orientation);
|
||||||
|
this._refreshCandidates();
|
||||||
|
this._refreshLabels();
|
||||||
|
|
||||||
|
// show lookup table
|
||||||
|
if (visible) {
|
||||||
|
this.showLookupTable();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
showLookupTable: function() {
|
||||||
|
this._lookupTableVisible = true;
|
||||||
|
this._stCandidateArea.showAll();
|
||||||
|
this._checkShowStates();
|
||||||
|
},
|
||||||
|
|
||||||
|
hideLookupTable: function() {
|
||||||
|
this._lookupTableVisible = false;
|
||||||
|
this._checkShowStates();
|
||||||
|
this._stCandidateArea.hideAll();
|
||||||
|
},
|
||||||
|
|
||||||
|
pageUpLookupTable: function() {
|
||||||
|
this._lookupTable.page_up();
|
||||||
|
this._refreshCandidates();
|
||||||
|
},
|
||||||
|
|
||||||
|
pageDownLookup_table: function() {
|
||||||
|
this._lookupTable.page_down();
|
||||||
|
this._refreshCandidates();
|
||||||
|
},
|
||||||
|
|
||||||
|
cursorUpLookupTable: function() {
|
||||||
|
this._lookupTable.cursor_up();
|
||||||
|
this._refreshCandidates();
|
||||||
|
},
|
||||||
|
|
||||||
|
cursorDownLookupTable: function() {
|
||||||
|
this._lookupTable.cursor_down();
|
||||||
|
this._refreshCandidates();
|
||||||
|
},
|
||||||
|
|
||||||
|
setCursorLocation: function(x, y, w, h) {
|
||||||
|
// if cursor location is changed, we reset the moved cursor location
|
||||||
|
if (this._cursorLocation.join() != [x, y, w, h].join()) {
|
||||||
|
this._cursorLocation = [x, y, w, h];
|
||||||
|
this._movedCursorLocation = null;
|
||||||
|
this._checkPosition();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_checkShowStates: function() {
|
||||||
|
this._checkSeparatorShowStates();
|
||||||
|
if (this._preeditVisible ||
|
||||||
|
this._auxStringVisible ||
|
||||||
|
this._lookupTableVisible) {
|
||||||
|
this._checkPosition();
|
||||||
|
this.showAll();
|
||||||
|
this.emit('show');
|
||||||
|
} else {
|
||||||
|
this.hideAll();
|
||||||
|
this.emit('hide');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_checkSeparatorShowStates: function() {
|
||||||
|
if (this._preeditVisible || this._auxStringVisible) {
|
||||||
|
this._separator.actor.show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this._separator.actor.hide();
|
||||||
|
},
|
||||||
|
|
||||||
|
reset: function() {
|
||||||
|
let text = IBus.Text.new_from_string('');
|
||||||
|
this.updatePreeditText(text, 0, false);
|
||||||
|
text = IBus.Text.new_from_string('');
|
||||||
|
this.updateAuxiliaryText(text, false);
|
||||||
|
this.updateLookupTable(null, false);
|
||||||
|
this.hideAll();
|
||||||
|
},
|
||||||
|
|
||||||
|
setCurrentOrientation: function(orientation) {
|
||||||
|
if (this._currentOrientation == orientation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._currentOrientation = orientation;
|
||||||
|
this._stCandidateArea.setOrientation(orientation);
|
||||||
|
},
|
||||||
|
|
||||||
|
setOrientation: function(orientation) {
|
||||||
|
this._orientation = orientation;
|
||||||
|
this.updateLookupTable(this._lookupTable, this._lookupTableVisible);
|
||||||
|
},
|
||||||
|
|
||||||
|
getCurrentOrientation: function() {
|
||||||
|
return this._currentOrientation;
|
||||||
|
},
|
||||||
|
|
||||||
|
_checkPosition: function() {
|
||||||
|
let cursorLocation = this._movedCursorLocation || this._cursorLocation;
|
||||||
|
let [cursorX, cursorY, cursorWidth, cursorHeight] = cursorLocation;
|
||||||
|
|
||||||
|
let windowRight = cursorX + cursorWidth + this.actor.get_width();
|
||||||
|
let windowBottom = cursorY + cursorHeight + this.actor.get_height();
|
||||||
|
|
||||||
|
this._cursorActor.set_position(cursorX, cursorY);
|
||||||
|
this._cursorActor.set_size(cursorWidth, cursorHeight);
|
||||||
|
|
||||||
|
let monitor = Main.layoutManager.findMonitorForActor(this._cursorActor);
|
||||||
|
let [sx, sy] = [monitor.x + monitor.width, monitor.y + monitor.height];
|
||||||
|
|
||||||
|
if (windowBottom > sy) {
|
||||||
|
this._arrowSide = St.Side.BOTTOM;
|
||||||
|
} else {
|
||||||
|
this._arrowSide = St.Side.TOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._boxPointer._arrowSide = this._arrowSide;
|
||||||
|
this._boxPointer.setArrowOrigin(this._arrowSide);
|
||||||
|
this._boxPointer.setPosition(this._cursorActor, this._arrowAlignment);
|
||||||
|
},
|
||||||
|
|
||||||
|
showAll: function() {
|
||||||
|
if (!this._isVisible) {
|
||||||
|
this.actor.opacity = 255;
|
||||||
|
this.actor.show();
|
||||||
|
this._isVisible = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
hideAll: function() {
|
||||||
|
if (this._isVisible) {
|
||||||
|
this.actor.opacity = 0;
|
||||||
|
this.actor.hide();
|
||||||
|
this._isVisible = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
move: function(x, y) {
|
||||||
|
this.actor.set_position(x, y);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Signals.addSignalMethods(CandidatePanel.prototype);
|
@ -2,51 +2,56 @@
|
|||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const GdkPixbuf = imports.gi.GdkPixbuf;
|
const GdkPixbuf = imports.gi.GdkPixbuf;
|
||||||
const Gkbd = imports.gi.Gkbd;
|
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
|
const Meta = imports.gi.Meta;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
|
||||||
|
try {
|
||||||
|
var IBus = imports.gi.IBus;
|
||||||
|
const CandidatePanel = imports.ui.status.candidatePanel;
|
||||||
|
} catch (e) {
|
||||||
|
var IBus = null;
|
||||||
|
}
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const PanelMenu = imports.ui.panelMenu;
|
const PanelMenu = imports.ui.panelMenu;
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
|
|
||||||
function LayoutMenuItem() {
|
const DESKTOP_INPUT_SOURCES_KEYBINDINGS_SCHEMA = 'org.gnome.desktop.input-sources.keybindings';
|
||||||
this._init.apply(this, arguments);
|
const DESKTOP_INPUT_SOURCES_SCHEMA = 'org.gnome.desktop.input-sources';
|
||||||
}
|
const KEY_CURRENT_IS = 'current';
|
||||||
|
const KEY_INPUT_SOURCES = 'sources';
|
||||||
|
|
||||||
LayoutMenuItem.prototype = {
|
const LayoutMenuItem = new Lang.Class({
|
||||||
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
|
Name: 'LayoutMenuItem',
|
||||||
|
Extends: PopupMenu.PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function(config, id, indicator, long_name) {
|
_init: function(name, shortName, xkbLayout, xkbVariant, ibusEngine) {
|
||||||
PopupMenu.PopupBaseMenuItem.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this._config = config;
|
this.label = new St.Label({ text: name });
|
||||||
this._id = id;
|
this.indicator = new St.Label({ text: shortName });
|
||||||
this.label = new St.Label({ text: long_name });
|
|
||||||
this.indicator = indicator;
|
|
||||||
this.addActor(this.label);
|
this.addActor(this.label);
|
||||||
this.addActor(this.indicator);
|
this.addActor(this.indicator);
|
||||||
},
|
|
||||||
|
|
||||||
activate: function(event) {
|
this.sourceName = name;
|
||||||
PopupMenu.PopupBaseMenuItem.prototype.activate.call(this);
|
this.shortName = shortName;
|
||||||
this._config.lock_group(this._id);
|
this.xkbLayout = xkbLayout;
|
||||||
|
this.xkbVariant = xkbVariant;
|
||||||
|
this.ibusEngine = ibusEngine;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function XKBIndicator() {
|
const InputSourceIndicator = new Lang.Class({
|
||||||
this._init.call(this);
|
Name: 'InputSourceIndicator',
|
||||||
}
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
XKBIndicator.prototype = {
|
|
||||||
__proto__: PanelMenu.Button.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.Button.prototype._init.call(this, St.Align.START);
|
this.parent(0.0, _("Keyboard"));
|
||||||
|
|
||||||
this._container = new Shell.GenericContainer();
|
this._container = new Shell.GenericContainer();
|
||||||
this._container.connect('get-preferred-width', Lang.bind(this, this._containerGetPreferredWidth));
|
this._container.connect('get-preferred-width', Lang.bind(this, this._containerGetPreferredWidth));
|
||||||
@ -55,61 +60,237 @@ XKBIndicator.prototype = {
|
|||||||
this.actor.add_actor(this._container);
|
this.actor.add_actor(this._container);
|
||||||
this.actor.add_style_class_name('panel-status-button');
|
this.actor.add_style_class_name('panel-status-button');
|
||||||
|
|
||||||
this._iconActor = new St.Icon({ icon_name: 'keyboard', icon_type: St.IconType.SYMBOLIC, style_class: 'system-status-icon' });
|
|
||||||
this._container.add_actor(this._iconActor);
|
|
||||||
this._labelActors = [ ];
|
this._labelActors = [ ];
|
||||||
this._layoutItems = [ ];
|
this._layoutItems = [ ];
|
||||||
|
|
||||||
this._showFlags = false;
|
this._settings = new Gio.Settings({ schema: DESKTOP_INPUT_SOURCES_SCHEMA });
|
||||||
this._config = Gkbd.Configuration.get();
|
this._settings.connect('changed::' + KEY_CURRENT_IS, Lang.bind(this, this._currentISChanged));
|
||||||
this._config.connect('changed', Lang.bind(this, this._syncConfig));
|
this._settings.connect('changed::' + KEY_INPUT_SOURCES, Lang.bind(this, this._inputSourcesChanged));
|
||||||
this._config.connect('group-changed', Lang.bind(this, this._syncGroup));
|
|
||||||
this._config.start_listen();
|
|
||||||
|
|
||||||
this._syncConfig();
|
if (IBus)
|
||||||
|
this._ibusInit();
|
||||||
|
|
||||||
|
this._inputSourcesChanged();
|
||||||
|
|
||||||
if (global.session_type == Shell.SessionType.USER) {
|
if (global.session_type == Shell.SessionType.USER) {
|
||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||||
this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, function() {
|
this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, function() {
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
Util.spawn(['gkbd-keyboard-display', '-g', String(this._config.get_current_group() + 1)]);
|
let description = this._selectedLayout.xkbLayout;
|
||||||
|
if (this._selectedLayout.xkbVariant.length > 0)
|
||||||
|
description = description + '\t' + this._selectedLayout.xkbVariant;
|
||||||
|
Util.spawn(['gkbd-keyboard-display', '-l', description]);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
this.menu.addSettingsAction(_("Region and Language Settings"), 'gnome-region-panel.desktop');
|
this.menu.addSettingsAction(_("Region and Language Settings"), 'gnome-region-panel.desktop');
|
||||||
|
|
||||||
|
global.display.add_keybinding('switch-next',
|
||||||
|
new Gio.Settings({ schema: DESKTOP_INPUT_SOURCES_KEYBINDINGS_SCHEMA }),
|
||||||
|
Meta.KeyBindingFlags.NONE,
|
||||||
|
Lang.bind(this, this._switchNext));
|
||||||
|
global.display.add_keybinding('switch-previous',
|
||||||
|
new Gio.Settings({ schema: DESKTOP_INPUT_SOURCES_KEYBINDINGS_SCHEMA }),
|
||||||
|
Meta.KeyBindingFlags.NONE,
|
||||||
|
Lang.bind(this, this._switchPrevious));
|
||||||
},
|
},
|
||||||
|
|
||||||
_adjustGroupNames: function(names) {
|
_ibusInit: function() {
|
||||||
// Disambiguate duplicate names with a subscript
|
IBus.init();
|
||||||
// This is O(N^2) to avoid sorting names
|
this._ibus = new IBus.Bus();
|
||||||
// but N <= 4 so who cares?
|
if (!this._ibus.is_connected()) {
|
||||||
|
log('ibus-daemon is not running');
|
||||||
for (let i = 0; i < names.length; i++) {
|
return;
|
||||||
let name = names[i];
|
|
||||||
let cnt = 0;
|
|
||||||
for (let j = i + 1; j < names.length; j++) {
|
|
||||||
if (names[j] == name) {
|
|
||||||
cnt++;
|
|
||||||
// U+2081 SUBSCRIPT ONE
|
|
||||||
names[j] = name + String.fromCharCode(0x2081 + cnt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cnt != 0)
|
|
||||||
names[i] = name + '\u2081';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return names;
|
this._ibus.request_name(IBus.SERVICE_PANEL,
|
||||||
|
IBus.BusNameFlag.ALLOW_REPLACEMENT |
|
||||||
|
IBus.BusNameFlag.REPLACE_EXISTING);
|
||||||
|
this._panel = new IBus.PanelService({ connection: this._ibus.get_connection(),
|
||||||
|
object_path: IBus.PATH_PANEL });
|
||||||
|
this._ibusInitPanelService();
|
||||||
|
|
||||||
|
this._candidatePanel = new CandidatePanel.CandidatePanel();
|
||||||
|
this._ibusInitCandidatePanel();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncConfig: function() {
|
_ibusInitCandidatePanel: function() {
|
||||||
this._showFlags = this._config.if_flags_shown();
|
this._candidatePanel.connect('cursor-up',
|
||||||
if (this._showFlags) {
|
Lang.bind(this, function(widget) {
|
||||||
this._container.set_skip_paint(this._iconActor, false);
|
this.cursorUp();
|
||||||
} else {
|
}));
|
||||||
this._container.set_skip_paint(this._iconActor, true);
|
this._candidatePanel.connect('cursor-down',
|
||||||
|
Lang.bind(this, function(widget) {
|
||||||
|
this.cursorDown();
|
||||||
|
}));
|
||||||
|
this._candidatePanel.connect('page-up',
|
||||||
|
Lang.bind(this, function(widget) {
|
||||||
|
this.pageUp();
|
||||||
|
}));
|
||||||
|
this._candidatePanel.connect('page-down',
|
||||||
|
Lang.bind(this, function(widget) {
|
||||||
|
this.pageDown();
|
||||||
|
}));
|
||||||
|
this._candidatePanel.connect('candidate-clicked',
|
||||||
|
Lang.bind(this, function(widget, index, button, state) {
|
||||||
|
this.candidateClicked(index, button, state);
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
_ibusInitPanelService: function() {
|
||||||
|
this._panel.connect('set-cursor-location',
|
||||||
|
Lang.bind(this, this.setCursorLocation));
|
||||||
|
this._panel.connect('update-preedit-text',
|
||||||
|
Lang.bind(this, this.updatePreeditText));
|
||||||
|
this._panel.connect('show-preedit-text',
|
||||||
|
Lang.bind(this, this.showPreeditText));
|
||||||
|
this._panel.connect('hide-preedit-text',
|
||||||
|
Lang.bind(this, this.hidePreeditText));
|
||||||
|
this._panel.connect('update-auxiliary-text',
|
||||||
|
Lang.bind(this, this.updateAuxiliaryText));
|
||||||
|
this._panel.connect('show-auxiliary-text',
|
||||||
|
Lang.bind(this, this.showAuxiliaryText));
|
||||||
|
this._panel.connect('hide-auxiliary-text',
|
||||||
|
Lang.bind(this, this.hideAuxiliaryText));
|
||||||
|
this._panel.connect('update-lookup-table',
|
||||||
|
Lang.bind(this, this.updateLookupTable));
|
||||||
|
this._panel.connect('show-lookup-table',
|
||||||
|
Lang.bind(this, this.showLookupTable));
|
||||||
|
this._panel.connect('hide-lookup-table',
|
||||||
|
Lang.bind(this, this.hideLookupTable));
|
||||||
|
this._panel.connect('page-up-lookup-table',
|
||||||
|
Lang.bind(this, this.pageUpLookupTable));
|
||||||
|
this._panel.connect('page-down-lookup-table',
|
||||||
|
Lang.bind(this, this.pageDownLookupTable));
|
||||||
|
this._panel.connect('cursor-up-lookup-table',
|
||||||
|
Lang.bind(this, this.cursorUpLookupTable));
|
||||||
|
this._panel.connect('cursor-down-lookup-table',
|
||||||
|
Lang.bind(this, this.cursorDownLookupTable));
|
||||||
|
this._panel.connect('focus-in', Lang.bind(this, this.focusIn));
|
||||||
|
this._panel.connect('focus-out', Lang.bind(this, this.focusOut));
|
||||||
|
},
|
||||||
|
|
||||||
|
setCursorLocation: function(panel, x, y, w, h) {
|
||||||
|
this._candidatePanel.setCursorLocation(x, y, w, h);
|
||||||
|
},
|
||||||
|
|
||||||
|
updatePreeditText: function(panel, text, cursorPos, visible) {
|
||||||
|
this._candidatePanel.updatePreeditText(text, cursorPos, visible);
|
||||||
|
},
|
||||||
|
|
||||||
|
showPreeditText: function(panel) {
|
||||||
|
this._candidatePanel.showPreeditText();
|
||||||
|
},
|
||||||
|
|
||||||
|
hidePreeditText: function(panel) {
|
||||||
|
this._candidatePanel.hidePreeditText();
|
||||||
|
},
|
||||||
|
|
||||||
|
updateAuxiliaryText: function(panel, text, visible) {
|
||||||
|
this._candidatePanel.updateAuxiliaryText(text, visible);
|
||||||
|
},
|
||||||
|
|
||||||
|
showAuxiliaryText: function(panel) {
|
||||||
|
this._candidatePanel.showAuxiliaryText();
|
||||||
|
},
|
||||||
|
|
||||||
|
hideAuxiliaryText: function(panel) {
|
||||||
|
this._candidatePanel.hideAuxiliaryText();
|
||||||
|
},
|
||||||
|
|
||||||
|
updateLookupTable: function(panel, lookupTable, visible) {
|
||||||
|
this._candidatePanel.updateLookupTable(lookupTable, visible);
|
||||||
|
},
|
||||||
|
|
||||||
|
showLookupTable: function(panel) {
|
||||||
|
this._candidatePanel.showLookupTable();
|
||||||
|
},
|
||||||
|
|
||||||
|
hideLookupTable: function(panel) {
|
||||||
|
this._candidatePanel.hideLookupTable();
|
||||||
|
},
|
||||||
|
|
||||||
|
pageUpLookupTable: function(panel) {
|
||||||
|
this._candidatePanel.pageUpLookupTable();
|
||||||
|
},
|
||||||
|
|
||||||
|
pageDownLookupTable: function(panel) {
|
||||||
|
this._candidatePanel.pageDownLookupTable();
|
||||||
|
},
|
||||||
|
|
||||||
|
cursorUpLookupTable: function(panel) {
|
||||||
|
this._candidatePanel.cursorUpLookupTable();
|
||||||
|
},
|
||||||
|
|
||||||
|
cursorDownLookupTable: function(panel) {
|
||||||
|
this._candidatePanel.cursorDownLookupTable();
|
||||||
|
},
|
||||||
|
|
||||||
|
focusIn: function(panel, path) {
|
||||||
|
},
|
||||||
|
|
||||||
|
focusOut: function(panel, path) {
|
||||||
|
this._candidatePanel.reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
cursorUp: function() {
|
||||||
|
this._panel.cursor_up();
|
||||||
|
},
|
||||||
|
|
||||||
|
cursorDown: function() {
|
||||||
|
this._panel.cursor_down();
|
||||||
|
},
|
||||||
|
|
||||||
|
pageUp: function() {
|
||||||
|
this._panel.page_up();
|
||||||
|
},
|
||||||
|
|
||||||
|
pageDown: function() {
|
||||||
|
this._panel.page_down();
|
||||||
|
},
|
||||||
|
|
||||||
|
candidateClicked: function(index, button, state) {
|
||||||
|
this._panel.candidate_clicked(index, button, state);
|
||||||
|
},
|
||||||
|
|
||||||
|
_currentISChanged: function() {
|
||||||
|
let source = this._settings.get_value(KEY_CURRENT_IS);
|
||||||
|
let name = source.get_child_value(0).get_string()[0];
|
||||||
|
|
||||||
|
if (this._selectedLayout) {
|
||||||
|
this._selectedLayout.setShowDot(false);
|
||||||
|
this._selectedLayout = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let groups = this._config.get_group_names();
|
if (this._selectedLabel) {
|
||||||
if (groups.length > 1) {
|
this._container.set_skip_paint(this._selectedLabel, true);
|
||||||
|
this._selectedLabel = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this._layoutItems.length; ++i) {
|
||||||
|
let item = this._layoutItems[i];
|
||||||
|
if (item.sourceName == name) {
|
||||||
|
item.setShowDot(true);
|
||||||
|
this._selectedLayout = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this._labelActors.length; ++i) {
|
||||||
|
let actor = this._labelActors[i];
|
||||||
|
if (actor.sourceName == name) {
|
||||||
|
this._selectedLabel = actor;
|
||||||
|
this._container.set_skip_paint(actor, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this._selectedLayout || !this._selectedLabel)
|
||||||
|
this._layoutItems[0].activate();
|
||||||
|
},
|
||||||
|
|
||||||
|
_inputSourcesChanged: function() {
|
||||||
|
let sources = this._settings.get_value(KEY_INPUT_SOURCES);
|
||||||
|
if (sources.n_children() > 1) {
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
} else {
|
} else {
|
||||||
this.menu.close();
|
this.menu.close();
|
||||||
@ -122,55 +303,69 @@ XKBIndicator.prototype = {
|
|||||||
for (let i = 0; i < this._labelActors.length; i++)
|
for (let i = 0; i < this._labelActors.length; i++)
|
||||||
this._labelActors[i].destroy();
|
this._labelActors[i].destroy();
|
||||||
|
|
||||||
let short_names = this._adjustGroupNames(this._config.get_short_group_names());
|
|
||||||
|
|
||||||
this._selectedLayout = null;
|
this._selectedLayout = null;
|
||||||
this._layoutItems = [ ];
|
this._layoutItems = [ ];
|
||||||
this._selectedLabel = null;
|
this._selectedLabel = null;
|
||||||
this._labelActors = [ ];
|
this._labelActors = [ ];
|
||||||
for (let i = 0; i < groups.length; i++) {
|
|
||||||
let icon_name = this._config.get_group_name(i);
|
for (let i = 0; i < sources.n_children(); ++i) {
|
||||||
let actor;
|
let name = sources.get_child_value(i).get_child_value(0).get_string()[0];
|
||||||
if (this._showFlags)
|
let shortName = sources.get_child_value(i).get_child_value(1).get_string()[0];
|
||||||
actor = new St.Icon({ icon_name: icon_name, icon_type: St.IconType.SYMBOLIC, style_class: 'popup-menu-icon' });
|
let xkbLayout = sources.get_child_value(i).get_child_value(2).get_string()[0];
|
||||||
else
|
let xkbVariant = sources.get_child_value(i).get_child_value(3).get_string()[0];
|
||||||
actor = new St.Label({ text: short_names[i] });
|
let ibusEngine = sources.get_child_value(i).get_child_value(4).get_string()[0];
|
||||||
let item = new LayoutMenuItem(this._config, i, actor, groups[i]);
|
|
||||||
item._short_group_name = short_names[i];
|
let item = new LayoutMenuItem(name, shortName, xkbLayout, xkbVariant, ibusEngine);
|
||||||
item._icon_name = icon_name;
|
|
||||||
this._layoutItems.push(item);
|
this._layoutItems.push(item);
|
||||||
this.menu.addMenuItem(item, i);
|
this.menu.addMenuItem(item, i);
|
||||||
|
item.connect('activate', Lang.bind(this, function() {
|
||||||
|
if (this._selectedLayout == null || item.sourceName != this._selectedLayout.sourceName) {
|
||||||
|
let name = GLib.Variant.new_string(item.sourceName);
|
||||||
|
let shortName = GLib.Variant.new_string(item.shortName);
|
||||||
|
let xkbLayout = GLib.Variant.new_string(item.xkbLayout);
|
||||||
|
let xkbVariant = GLib.Variant.new_string(item.xkbVariant);
|
||||||
|
let ibusEngine = GLib.Variant.new_string(item.ibusEngine);
|
||||||
|
let tuple = GLib.Variant.new_tuple([name, shortName, xkbLayout, xkbVariant, ibusEngine], 5);
|
||||||
|
this._settings.set_value(KEY_CURRENT_IS, tuple);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
let shortLabel = new St.Label({ text: short_names[i] });
|
let shortLabel = new St.Label({ text: shortName });
|
||||||
|
shortLabel.sourceName = name;
|
||||||
this._labelActors.push(shortLabel);
|
this._labelActors.push(shortLabel);
|
||||||
this._container.add_actor(shortLabel);
|
this._container.add_actor(shortLabel);
|
||||||
this._container.set_skip_paint(shortLabel, true);
|
this._container.set_skip_paint(shortLabel, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._syncGroup();
|
this._currentISChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncGroup: function() {
|
_switchNext: function() {
|
||||||
let selected = this._config.get_current_group();
|
if (!this._selectedLayout || !this._selectedLabel) {
|
||||||
|
this._layoutItems[0].activate();
|
||||||
if (this._selectedLayout) {
|
return;
|
||||||
this._selectedLayout.setShowDot(false);
|
|
||||||
this._selectedLayout = null;
|
|
||||||
}
|
}
|
||||||
|
for (let i = 0; i < this._layoutItems.length; ++i) {
|
||||||
if (this._selectedLabel) {
|
let item = this._layoutItems[i];
|
||||||
this._container.set_skip_paint(this._selectedLabel, true);
|
if (item.sourceName == this._selectedLayout.sourceName) {
|
||||||
this._selectedLabel = null;
|
this._layoutItems[(++i == this._layoutItems.length) ? 0 : i].activate();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
let item = this._layoutItems[selected];
|
_switchPrevious: function() {
|
||||||
item.setShowDot(true);
|
if (!this._selectedLayout || !this._selectedLabel) {
|
||||||
|
this._layoutItems[0].activate();
|
||||||
this._iconActor.icon_name = item._icon_name;
|
return;
|
||||||
this._selectedLabel = this._labelActors[selected];
|
}
|
||||||
this._container.set_skip_paint(this._selectedLabel, this._showFlags);
|
for (let i = 0; i < this._layoutItems.length; ++i) {
|
||||||
|
let item = this._layoutItems[i];
|
||||||
this._selectedLayout = item;
|
if (item.sourceName == this._selectedLayout.sourceName) {
|
||||||
|
this._layoutItems[(--i == -1) ? (this._layoutItems.length - 1) : i].activate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_containerGetPreferredWidth: function(container, for_height, alloc) {
|
_containerGetPreferredWidth: function(container, for_height, alloc) {
|
||||||
@ -178,16 +373,12 @@ XKBIndicator.prototype = {
|
|||||||
// for the height of all children, but we ignore the results
|
// for the height of all children, but we ignore the results
|
||||||
// for those we don't actually display.
|
// for those we don't actually display.
|
||||||
let max_min_width = 0, max_natural_width = 0;
|
let max_min_width = 0, max_natural_width = 0;
|
||||||
if (this._showFlags)
|
|
||||||
[max_min_width, max_natural_width] = this._iconActor.get_preferred_width(for_height);
|
|
||||||
|
|
||||||
for (let i = 0; i < this._labelActors.length; i++) {
|
for (let i = 0; i < this._labelActors.length; i++) {
|
||||||
let [min_width, natural_width] = this._labelActors[i].get_preferred_width(for_height);
|
let [min_width, natural_width] = this._labelActors[i].get_preferred_width(for_height);
|
||||||
if (!this._showFlags) {
|
|
||||||
max_min_width = Math.max(max_min_width, min_width);
|
max_min_width = Math.max(max_min_width, min_width);
|
||||||
max_natural_width = Math.max(max_natural_width, natural_width);
|
max_natural_width = Math.max(max_natural_width, natural_width);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
alloc.min_size = max_min_width;
|
alloc.min_size = max_min_width;
|
||||||
alloc.natural_size = max_natural_width;
|
alloc.natural_size = max_natural_width;
|
||||||
@ -195,16 +386,12 @@ XKBIndicator.prototype = {
|
|||||||
|
|
||||||
_containerGetPreferredHeight: function(container, for_width, alloc) {
|
_containerGetPreferredHeight: function(container, for_width, alloc) {
|
||||||
let max_min_height = 0, max_natural_height = 0;
|
let max_min_height = 0, max_natural_height = 0;
|
||||||
if (this._showFlags)
|
|
||||||
[max_min_height, max_natural_height] = this._iconActor.get_preferred_height(for_width);
|
|
||||||
|
|
||||||
for (let i = 0; i < this._labelActors.length; i++) {
|
for (let i = 0; i < this._labelActors.length; i++) {
|
||||||
let [min_height, natural_height] = this._labelActors[i].get_preferred_height(for_width);
|
let [min_height, natural_height] = this._labelActors[i].get_preferred_height(for_width);
|
||||||
if (!this._showFlags) {
|
|
||||||
max_min_height = Math.max(max_min_height, min_height);
|
max_min_height = Math.max(max_min_height, min_height);
|
||||||
max_natural_height = Math.max(max_natural_height, natural_height);
|
max_natural_height = Math.max(max_natural_height, natural_height);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
alloc.min_size = max_min_height;
|
alloc.min_size = max_min_height;
|
||||||
alloc.natural_size = max_natural_height;
|
alloc.natural_size = max_natural_height;
|
||||||
@ -217,8 +404,7 @@ XKBIndicator.prototype = {
|
|||||||
box.y2 -= box.y1;
|
box.y2 -= box.y1;
|
||||||
box.y1 = 0;
|
box.y1 = 0;
|
||||||
|
|
||||||
this._iconActor.allocate_align_fill(box, 0.5, 0, false, false, flags);
|
|
||||||
for (let i = 0; i < this._labelActors.length; i++)
|
for (let i = 0; i < this._labelActors.length; i++)
|
||||||
this._labelActors[i].allocate_align_fill(box, 0.5, 0, false, false, flags);
|
this._labelActors[i].allocate_align_fill(box, 0.5, 0, false, false, flags);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
const ByteArray = imports.byteArray;
|
const ByteArray = imports.byteArray;
|
||||||
const DBus = imports.dbus;
|
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const GObject = imports.gi.GObject;
|
const GObject = imports.gi.GObject;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
@ -98,15 +97,12 @@ function ssidToLabel(ssid) {
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
function NMNetworkMenuItem() {
|
const NMNetworkMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMNetworkMenuItem',
|
||||||
}
|
Extends: PopupMenu.PopupBaseMenuItem,
|
||||||
|
|
||||||
NMNetworkMenuItem.prototype = {
|
|
||||||
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function(accessPoints, title, params) {
|
_init: function(accessPoints, title, params) {
|
||||||
PopupMenu.PopupBaseMenuItem.prototype._init.call(this, params);
|
this.parent(params);
|
||||||
|
|
||||||
accessPoints = sortAccessPoints(accessPoints);
|
accessPoints = sortAccessPoints(accessPoints);
|
||||||
this.bestAP = accessPoints[0];
|
this.bestAP = accessPoints[0];
|
||||||
@ -117,6 +113,7 @@ NMNetworkMenuItem.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._label = new St.Label({ text: title });
|
this._label = new St.Label({ text: title });
|
||||||
|
this.actor.label_actor = this._label;
|
||||||
this.addActor(this._label);
|
this.addActor(this._label);
|
||||||
this._icons = new St.BoxLayout({ style_class: 'nm-menu-item-icons' });
|
this._icons = new St.BoxLayout({ style_class: 'nm-menu-item-icons' });
|
||||||
this.addActor(this._icons, { align: St.Align.END });
|
this.addActor(this._icons, { align: St.Align.END });
|
||||||
@ -185,21 +182,18 @@ NMNetworkMenuItem.prototype = {
|
|||||||
apObj.updateId = 0;
|
apObj.updateId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupMenu.PopupBaseMenuItem.prototype.destroy.call(this);
|
this.parent();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMWiredSectionTitleMenuItem() {
|
const NMWiredSectionTitleMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMWiredSectionTitleMenuItem',
|
||||||
}
|
Extends: PopupMenu.PopupSwitchMenuItem,
|
||||||
|
|
||||||
NMWiredSectionTitleMenuItem.prototype = {
|
|
||||||
__proto__: PopupMenu.PopupSwitchMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function(label, params) {
|
_init: function(label, params) {
|
||||||
params = params || { };
|
params = params || { };
|
||||||
params.style_class = 'popup-subtitle-menu-item';
|
params.style_class = 'popup-subtitle-menu-item';
|
||||||
PopupMenu.PopupSwitchMenuItem.prototype._init.call(this, label, false, params);
|
this.parent(label, false, params);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateForDevice: function(device) {
|
updateForDevice: function(device) {
|
||||||
@ -212,7 +206,7 @@ NMWiredSectionTitleMenuItem.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
activate: function(event) {
|
activate: function(event) {
|
||||||
PopupMenu.PopupSwitchMenuItem.prototype.activate.call(this, event);
|
this.parent(event);
|
||||||
|
|
||||||
if (!this._device) {
|
if (!this._device) {
|
||||||
log('Section title activated when there is more than one device, should be non reactive');
|
log('Section title activated when there is more than one device, should be non reactive');
|
||||||
@ -231,19 +225,16 @@ NMWiredSectionTitleMenuItem.prototype = {
|
|||||||
else
|
else
|
||||||
this._device.deactivate();
|
this._device.deactivate();
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMWirelessSectionTitleMenuItem() {
|
const NMWirelessSectionTitleMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMWirelessSectionTitleMenuItem',
|
||||||
}
|
Extends: PopupMenu.PopupSwitchMenuItem,
|
||||||
|
|
||||||
NMWirelessSectionTitleMenuItem.prototype = {
|
|
||||||
__proto__: PopupMenu.PopupSwitchMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function(client, property, title, params) {
|
_init: function(client, property, title, params) {
|
||||||
params = params || { };
|
params = params || { };
|
||||||
params.style_class = 'popup-subtitle-menu-item';
|
params.style_class = 'popup-subtitle-menu-item';
|
||||||
PopupMenu.PopupSwitchMenuItem.prototype._init.call(this, title, false, params);
|
this.parent(title, false, params);
|
||||||
|
|
||||||
this._client = client;
|
this._client = client;
|
||||||
this._property = property + '_enabled';
|
this._property = property + '_enabled';
|
||||||
@ -259,9 +250,11 @@ NMWirelessSectionTitleMenuItem.prototype = {
|
|||||||
updateForDevice: function(device) {
|
updateForDevice: function(device) {
|
||||||
// we show the switch
|
// we show the switch
|
||||||
// - if there not just one device
|
// - if there not just one device
|
||||||
// - if the switch is off
|
// - if the switch is off (but it can be turned on)
|
||||||
// - if the device is activated or disconnected
|
// - if the device is activated or disconnected
|
||||||
if (device && this._softwareEnabled && this._hardwareEnabled) {
|
if (!this._hardwareEnabled) {
|
||||||
|
this.setStatus(_("hardware disabled"));
|
||||||
|
} else if (device && this._softwareEnabled) {
|
||||||
let text = device.getStatusLabel();
|
let text = device.getStatusLabel();
|
||||||
this.setStatus(text);
|
this.setStatus(text);
|
||||||
} else
|
} else
|
||||||
@ -269,7 +262,7 @@ NMWirelessSectionTitleMenuItem.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
activate: function(event) {
|
activate: function(event) {
|
||||||
PopupMenu.PopupSwitchMenuItem.prototype.activate.call(this, event);
|
this.parent(event);
|
||||||
|
|
||||||
this._client[this._setEnabledFunc](this._switch.state);
|
this._client[this._setEnabledFunc](this._switch.state);
|
||||||
},
|
},
|
||||||
@ -286,13 +279,12 @@ NMWirelessSectionTitleMenuItem.prototype = {
|
|||||||
|
|
||||||
this.emit('enabled-changed', enabled);
|
this.emit('enabled-changed', enabled);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMDevice() {
|
const NMDevice = new Lang.Class({
|
||||||
throw new TypeError('Instantanting abstract class NMDevice');
|
Name: 'NMDevice',
|
||||||
}
|
Abstract: true,
|
||||||
|
|
||||||
NMDevice.prototype = {
|
|
||||||
_init: function(client, device, connections) {
|
_init: function(client, device, connections) {
|
||||||
this.device = device;
|
this.device = device;
|
||||||
if (device) {
|
if (device) {
|
||||||
@ -338,7 +330,7 @@ NMDevice.prototype = {
|
|||||||
}
|
}
|
||||||
this.section = new PopupMenu.PopupMenuSection();
|
this.section = new PopupMenu.PopupMenuSection();
|
||||||
|
|
||||||
this._createSection();
|
this._deferredWorkId = Main.initializeDeferredWork(this.section.actor, Lang.bind(this, this._createSection));
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
@ -405,16 +397,29 @@ NMDevice.prototype = {
|
|||||||
this._activeConnection = activeConnection;
|
this._activeConnection = activeConnection;
|
||||||
|
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
},
|
},
|
||||||
|
|
||||||
checkConnection: function(connection) {
|
checkConnection: function(connection) {
|
||||||
let exists = this._findConnection(connection._uuid) != -1;
|
let pos = this._findConnection(connection._uuid);
|
||||||
|
let exists = pos != -1;
|
||||||
let valid = this.connectionValid(connection);
|
let valid = this.connectionValid(connection);
|
||||||
|
|
||||||
if (exists && !valid)
|
if (exists && !valid)
|
||||||
this.removeConnection(connection);
|
this.removeConnection(connection);
|
||||||
else if (!exists && valid)
|
else if (!exists && valid)
|
||||||
this.addConnection(connection);
|
this.addConnection(connection);
|
||||||
|
else if (exists && valid) {
|
||||||
|
// propagate changes and update the UI
|
||||||
|
|
||||||
|
if (this._connections[pos].timestamp != connection._timestamp) {
|
||||||
|
this._connections[pos].timestamp = connection._timestamp;
|
||||||
|
this._connections.sort(this._connectionSortFunction);
|
||||||
|
|
||||||
|
this._clearSection();
|
||||||
|
this._queueCreateSection();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addConnection: function(connection) {
|
addConnection: function(connection) {
|
||||||
@ -429,7 +434,7 @@ NMDevice.prototype = {
|
|||||||
this._connections.sort(this._connectionSortFunction);
|
this._connections.sort(this._connectionSortFunction);
|
||||||
|
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
},
|
},
|
||||||
|
|
||||||
removeConnection: function(connection) {
|
removeConnection: function(connection) {
|
||||||
@ -453,7 +458,7 @@ NMDevice.prototype = {
|
|||||||
// (or in the case of NMDeviceWired, we want to hide
|
// (or in the case of NMDeviceWired, we want to hide
|
||||||
// the only explicit connection)
|
// the only explicit connection)
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -537,6 +542,11 @@ NMDevice.prototype = {
|
|||||||
return -1;
|
return -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_queueCreateSection: function() {
|
||||||
|
this._clearSection();
|
||||||
|
Main.queueDeferredWork(this._deferredWorkId);
|
||||||
|
},
|
||||||
|
|
||||||
_clearSection: function() {
|
_clearSection: function() {
|
||||||
// Clear everything
|
// Clear everything
|
||||||
this.section.removeAll();
|
this.section.removeAll();
|
||||||
@ -631,7 +641,7 @@ NMDevice.prototype = {
|
|||||||
this._updateStatusItem();
|
this._updateStatusItem();
|
||||||
|
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
this.emit('state-changed');
|
this.emit('state-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -674,36 +684,30 @@ NMDevice.prototype = {
|
|||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(NMDevice.prototype);
|
Signals.addSignalMethods(NMDevice.prototype);
|
||||||
|
|
||||||
|
|
||||||
function NMDeviceWired() {
|
const NMDeviceWired = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMDeviceWired',
|
||||||
}
|
Extends: NMDevice,
|
||||||
|
|
||||||
NMDeviceWired.prototype = {
|
|
||||||
__proto__: NMDevice.prototype,
|
|
||||||
|
|
||||||
_init: function(client, device, connections) {
|
_init: function(client, device, connections) {
|
||||||
this._autoConnectionName = _("Auto Ethernet");
|
this._autoConnectionName = _("Auto Ethernet");
|
||||||
this.category = NMConnectionCategory.WIRED;
|
this.category = NMConnectionCategory.WIRED;
|
||||||
|
|
||||||
NMDevice.prototype._init.call(this, client, device, connections);
|
this.parent(client, device, connections);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createSection: function() {
|
_createSection: function() {
|
||||||
NMDevice.prototype._createSection.call(this);
|
this.parent();
|
||||||
|
|
||||||
// if we have only one connection (normal or automatic)
|
// if we have only one connection (normal or automatic)
|
||||||
// we hide the connection list, and use the switch to control
|
// we hide the connection list, and use the switch to control
|
||||||
// the device
|
// the device
|
||||||
// we can do it here because addConnection and removeConnection
|
// we can do it here because addConnection and removeConnection
|
||||||
// both call _createSection at some point
|
// both call _createSection at some point
|
||||||
if (this._connections.length <= 1)
|
this.section.actor.visible = this._connections.length > 1;
|
||||||
this.section.actor.hide();
|
|
||||||
else
|
|
||||||
this.section.actor.show();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_createAutomaticConnection: function() {
|
_createAutomaticConnection: function() {
|
||||||
@ -718,14 +722,11 @@ NMDeviceWired.prototype = {
|
|||||||
}));
|
}));
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMDeviceModem() {
|
const NMDeviceModem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMDeviceModem',
|
||||||
}
|
Extends: NMDevice,
|
||||||
|
|
||||||
NMDeviceModem.prototype = {
|
|
||||||
__proto__: NMDevice.prototype,
|
|
||||||
|
|
||||||
_init: function(client, device, connections) {
|
_init: function(client, device, connections) {
|
||||||
let is_wwan = false;
|
let is_wwan = false;
|
||||||
@ -774,7 +775,7 @@ NMDeviceModem.prototype = {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
NMDevice.prototype._init.call(this, client, device, connections);
|
this.parent(client, device, connections);
|
||||||
},
|
},
|
||||||
|
|
||||||
setEnabled: function(enabled) {
|
setEnabled: function(enabled) {
|
||||||
@ -787,7 +788,7 @@ NMDeviceModem.prototype = {
|
|||||||
this.statusItem.setStatus(this.getStatusLabel());
|
this.statusItem.setStatus(this.getStatusLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
NMDevice.prototype.setEnabled.call(this, enabled);
|
this.parent(enabled);
|
||||||
},
|
},
|
||||||
|
|
||||||
get connected() {
|
get connected() {
|
||||||
@ -804,7 +805,7 @@ NMDeviceModem.prototype = {
|
|||||||
this._signalQualityId = 0;
|
this._signalQualityId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NMDevice.prototype.destroy.call(this);
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSignalIcon: function() {
|
_getSignalIcon: function() {
|
||||||
@ -825,13 +826,13 @@ NMDeviceModem.prototype = {
|
|||||||
this.section.addMenuItem(this._operatorItem);
|
this.section.addMenuItem(this._operatorItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
NMDevice.prototype._createSection.call(this);
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearSection: function() {
|
_clearSection: function() {
|
||||||
this._operatorItem = null;
|
this._operatorItem = null;
|
||||||
|
|
||||||
NMDevice.prototype._clearSection.call(this);
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createAutomaticConnection: function() {
|
_createAutomaticConnection: function() {
|
||||||
@ -841,14 +842,11 @@ NMDeviceModem.prototype = {
|
|||||||
'connect-3g', this.device.get_path()]);
|
'connect-3g', this.device.get_path()]);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMDeviceBluetooth() {
|
const NMDeviceBluetooth = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMDeviceBluetooth',
|
||||||
}
|
Extends: NMDevice,
|
||||||
|
|
||||||
NMDeviceBluetooth.prototype = {
|
|
||||||
__proto__: NMDevice.prototype,
|
|
||||||
|
|
||||||
_init: function(client, device, connections) {
|
_init: function(client, device, connections) {
|
||||||
this._autoConnectionName = this._makeConnectionName(device);
|
this._autoConnectionName = this._makeConnectionName(device);
|
||||||
@ -856,7 +854,7 @@ NMDeviceBluetooth.prototype = {
|
|||||||
|
|
||||||
this.category = NMConnectionCategory.WWAN;
|
this.category = NMConnectionCategory.WWAN;
|
||||||
|
|
||||||
NMDevice.prototype._init.call(this, client, device, connections);
|
this.parent(client, device, connections);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createAutomaticConnection: function() {
|
_createAutomaticConnection: function() {
|
||||||
@ -884,25 +882,27 @@ NMDeviceBluetooth.prototype = {
|
|||||||
this._autoConnectionName = this._makeConnectionName(this.device);
|
this._autoConnectionName = this._makeConnectionName(this.device);
|
||||||
|
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
|
this._updateStatusItem();
|
||||||
|
},
|
||||||
|
|
||||||
|
_getDescription: function() {
|
||||||
|
return this.device.name || _("Bluetooth");
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
// Not a real device, but I save a lot code this way
|
// Not a real device, but I save a lot code this way
|
||||||
function NMDeviceVPN() {
|
const NMDeviceVPN = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMDeviceVPN',
|
||||||
}
|
Extends: NMDevice,
|
||||||
|
|
||||||
NMDeviceVPN.prototype = {
|
|
||||||
__proto__: NMDevice.prototype,
|
|
||||||
|
|
||||||
_init: function(client) {
|
_init: function(client) {
|
||||||
// Disable autoconnections
|
// Disable autoconnections
|
||||||
this._autoConnectionName = null;
|
this._autoConnectionName = null;
|
||||||
this.category = NMConnectionCategory.VPN;
|
this.category = NMConnectionCategory.VPN;
|
||||||
|
|
||||||
NMDevice.prototype._init.call(this, client, null, [ ]);
|
this.parent(client, null, [ ]);
|
||||||
},
|
},
|
||||||
|
|
||||||
connectionValid: function(connection) {
|
connectionValid: function(connection) {
|
||||||
@ -918,7 +918,7 @@ NMDeviceVPN.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setActiveConnection: function(activeConnection) {
|
setActiveConnection: function(activeConnection) {
|
||||||
NMDevice.prototype.setActiveConnection.call(this, activeConnection);
|
this.parent(activeConnection);
|
||||||
|
|
||||||
this.emit('active-connection-changed');
|
this.emit('active-connection-changed');
|
||||||
},
|
},
|
||||||
@ -935,14 +935,11 @@ NMDeviceVPN.prototype = {
|
|||||||
getStatusLabel: function() {
|
getStatusLabel: function() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMDeviceWireless() {
|
const NMDeviceWireless = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMDeviceWireless',
|
||||||
}
|
Extends: NMDevice,
|
||||||
|
|
||||||
NMDeviceWireless.prototype = {
|
|
||||||
__proto__: NMDevice.prototype,
|
|
||||||
|
|
||||||
_init: function(client, device, connections) {
|
_init: function(client, device, connections) {
|
||||||
this.category = NMConnectionCategory.WIRELESS;
|
this.category = NMConnectionCategory.WIRELESS;
|
||||||
@ -1014,7 +1011,7 @@ NMDeviceWireless.prototype = {
|
|||||||
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
|
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
|
||||||
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
|
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
|
||||||
|
|
||||||
NMDevice.prototype._init.call(this, client, device, validConnections);
|
this.parent(client, device, validConnections);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
@ -1034,17 +1031,12 @@ NMDeviceWireless.prototype = {
|
|||||||
this._apRemovedId = 0;
|
this._apRemovedId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NMDevice.prototype.destroy.call(this);
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
setEnabled: function(enabled) {
|
setEnabled: function(enabled) {
|
||||||
if (enabled) {
|
this.statusItem.actor.visible = enabled;
|
||||||
this.statusItem.actor.show();
|
this.section.actor.visible = enabled;
|
||||||
this.section.actor.show();
|
|
||||||
} else {
|
|
||||||
this.statusItem.actor.hide();
|
|
||||||
this.section.actor.hide();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate: function() {
|
||||||
@ -1104,10 +1096,10 @@ NMDeviceWireless.prototype = {
|
|||||||
let activeAp = this.device.active_access_point;
|
let activeAp = this.device.active_access_point;
|
||||||
|
|
||||||
if (activeAp) {
|
if (activeAp) {
|
||||||
let pos = this._findNetwork(activeAp);
|
let res = this._findExistingNetwork(activeAp);
|
||||||
|
|
||||||
if (pos != -1)
|
if (res != null)
|
||||||
this._activeNetwork = this._networks[pos];
|
this._activeNetwork = this._networks[res.network];
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't refresh the view here, setActiveConnection will
|
// we don't refresh the view here, setActiveConnection will
|
||||||
@ -1181,6 +1173,18 @@ NMDeviceWireless.prototype = {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_findExistingNetwork: function(accessPoint) {
|
||||||
|
for (let i = 0; i < this._networks.length; i++) {
|
||||||
|
let apObj = this._networks[i];
|
||||||
|
for (let j = 0; j < apObj.accessPoints.length; j++) {
|
||||||
|
if (apObj.accessPoints[j] == accessPoint)
|
||||||
|
return { network: i, ap: j };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
_findNetwork: function(accessPoint) {
|
_findNetwork: function(accessPoint) {
|
||||||
if (accessPoint.get_ssid() == null)
|
if (accessPoint.get_ssid() == null)
|
||||||
return -1;
|
return -1;
|
||||||
@ -1223,7 +1227,6 @@ NMDeviceWireless.prototype = {
|
|||||||
accessPoints: [ accessPoint ]
|
accessPoints: [ accessPoint ]
|
||||||
};
|
};
|
||||||
apObj.ssidText = ssidToLabel(apObj.ssid);
|
apObj.ssidText = ssidToLabel(apObj.ssid);
|
||||||
needsupdate = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if this enables new connections for this group
|
// check if this enables new connections for this group
|
||||||
@ -1238,57 +1241,26 @@ NMDeviceWireless.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needsupdate) {
|
if (pos == -1 || needsupdate) {
|
||||||
if (apObj.item)
|
|
||||||
apObj.item.destroy();
|
|
||||||
|
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
this._networks.splice(pos, 1);
|
this._networks.splice(pos, 1);
|
||||||
|
pos = Util.insertSorted(this._networks, apObj, this._networkSortFunction);
|
||||||
|
|
||||||
if (this._networks.length == 0) {
|
|
||||||
// only network in the list
|
|
||||||
this._networks.push(apObj);
|
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip networks that should appear earlier
|
|
||||||
let menuPos = 0;
|
|
||||||
for (pos = 0;
|
|
||||||
pos < this._networks.length &&
|
|
||||||
this._networkSortFunction(this._networks[pos], apObj) < 0; ++pos) {
|
|
||||||
if (this._networks[pos] != this._activeNetwork)
|
|
||||||
menuPos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// (re-)add the network
|
|
||||||
this._networks.splice(pos, 0, apObj);
|
|
||||||
|
|
||||||
if (this._shouldShowConnectionList()) {
|
|
||||||
menuPos += (this._activeConnectionItem ? 1 : 0);
|
|
||||||
this._createNetworkItem(apObj, menuPos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_accessPointRemoved: function(device, accessPoint) {
|
_accessPointRemoved: function(device, accessPoint) {
|
||||||
let pos = this._findNetwork(accessPoint);
|
let res = this._findExistingNetwork(accessPoint);
|
||||||
|
|
||||||
if (pos == -1) {
|
if (res == null) {
|
||||||
log('Removing an access point that was never added');
|
log('Removing an access point that was never added');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let apObj = this._networks[pos];
|
let apObj = this._networks[res.network];
|
||||||
let i = apObj.accessPoints.indexOf(accessPoint);
|
apObj.accessPoints.splice(res.ap, 1);
|
||||||
|
|
||||||
if (i == -1) {
|
|
||||||
log('Removing an access point that was never added');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
apObj.accessPoints.splice(i, 1);
|
|
||||||
|
|
||||||
if (apObj.accessPoints.length == 0) {
|
if (apObj.accessPoints.length == 0) {
|
||||||
if (this._activeNetwork == apObj)
|
if (this._activeNetwork == apObj)
|
||||||
@ -1302,22 +1274,26 @@ NMDeviceWireless.prototype = {
|
|||||||
// we removed an item in the main menu, and we have a more submenu
|
// we removed an item in the main menu, and we have a more submenu
|
||||||
// we need to extract the first item in more and move it to the submenu
|
// we need to extract the first item in more and move it to the submenu
|
||||||
|
|
||||||
let apObj = this._overflowItem.menu.firstMenuItem;
|
let item = this._overflowItem.menu.firstMenuItem;
|
||||||
if (apObj.item) {
|
if (item && item._apObj) {
|
||||||
apObj.item.destroy();
|
item.destroy();
|
||||||
|
// clear the cycle, and allow the construction of the new item
|
||||||
|
item._apObj.item = null;
|
||||||
|
|
||||||
this._createNetworkItem(apObj, NUM_VISIBLE_NETWORKS-1);
|
this._createNetworkItem(item._apObj, NUM_VISIBLE_NETWORKS-1);
|
||||||
|
} else {
|
||||||
|
log('The more... menu was existing and empty! This should not happen');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This can happen if the removed connection is from the overflow
|
// This can happen if the removed connection is from the overflow
|
||||||
// menu, or if we just moved the last connection out from the menu
|
// menu, or if we just moved the last connection out from the menu
|
||||||
if (this._overflowItem.menu.length == 0) {
|
if (this._overflowItem.menu.numMenuItems == 0) {
|
||||||
this._overflowItem.destroy();
|
this._overflowItem.destroy();
|
||||||
this._overflowItem = null;
|
this._overflowItem = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._networks.splice(pos, 1);
|
this._networks.splice(res.network, 1);
|
||||||
|
|
||||||
} else if (apObj.item)
|
} else if (apObj.item)
|
||||||
apObj.item.updateAccessPoints(apObj.accessPoints);
|
apObj.item.updateAccessPoints(apObj.accessPoints);
|
||||||
@ -1339,7 +1315,7 @@ NMDeviceWireless.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_clearSection: function() {
|
_clearSection: function() {
|
||||||
NMDevice.prototype._clearSection.call(this);
|
this.parent();
|
||||||
|
|
||||||
for (let i = 0; i < this._networks.length; i++)
|
for (let i = 0; i < this._networks.length; i++)
|
||||||
this._networks[i].item = null;
|
this._networks[i].item = null;
|
||||||
@ -1358,7 +1334,7 @@ NMDeviceWireless.prototype = {
|
|||||||
let obj = this._connections[pos];
|
let obj = this._connections[pos];
|
||||||
this._connections.splice(pos, 1);
|
this._connections.splice(pos, 1);
|
||||||
|
|
||||||
let anyauto = false, forceupdate = false;
|
let forceupdate = false;
|
||||||
for (let i = 0; i < this._networks.length; i++) {
|
for (let i = 0; i < this._networks.length; i++) {
|
||||||
let apObj = this._networks[i];
|
let apObj = this._networks[i];
|
||||||
let connections = apObj.connections;
|
let connections = apObj.connections;
|
||||||
@ -1366,16 +1342,14 @@ NMDeviceWireless.prototype = {
|
|||||||
if (connections[k]._uuid == connection._uuid) {
|
if (connections[k]._uuid == connection._uuid) {
|
||||||
// remove the connection from the access point group
|
// remove the connection from the access point group
|
||||||
connections.splice(k);
|
connections.splice(k);
|
||||||
anyauto = connections.length == 0;
|
forceupdate = forceupdate || connections.length == 0;
|
||||||
|
|
||||||
if (anyauto) {
|
if (forceupdate)
|
||||||
// this potentially changes the sorting order
|
|
||||||
forceupdate = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
if (apObj.item) {
|
if (apObj.item) {
|
||||||
if (apObj.item instanceof PopupMenu.PopupSubMenuMenuItem) {
|
if (apObj.item instanceof PopupMenu.PopupSubMenuMenuItem) {
|
||||||
let items = apObj.item.menu.getMenuItems();
|
let items = apObj.item.menu._getMenuItems();
|
||||||
if (items.length == 2) {
|
if (items.length == 2) {
|
||||||
// we need to update the connection list to convert this to a normal item
|
// we need to update the connection list to convert this to a normal item
|
||||||
forceupdate = true;
|
forceupdate = true;
|
||||||
@ -1397,10 +1371,10 @@ NMDeviceWireless.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forceupdate || anyauto) {
|
if (forceupdate) {
|
||||||
this._networks.sort(this._networkSortFunction);
|
this._networks.sort(this._networkSortFunction);
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1433,13 +1407,13 @@ NMDeviceWireless.prototype = {
|
|||||||
if (forceupdate) {
|
if (forceupdate) {
|
||||||
this._networks.sort(this._networkSortFunction);
|
this._networks.sort(this._networkSortFunction);
|
||||||
this._clearSection();
|
this._clearSection();
|
||||||
this._createSection();
|
this._queueCreateSection();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createActiveConnectionItem: function() {
|
_createActiveConnectionItem: function() {
|
||||||
let icon, title;
|
let icon, title;
|
||||||
if (this._activeConnection._connection) {
|
if (this._activeConnection && this._activeConnection._connection) {
|
||||||
let connection = this._activeConnection._connection;
|
let connection = this._activeConnection._connection;
|
||||||
if (this._activeNetwork)
|
if (this._activeNetwork)
|
||||||
this._activeConnectionItem = new NMNetworkMenuItem(this._activeNetwork.accessPoints, undefined,
|
this._activeConnectionItem = new NMNetworkMenuItem(this._activeNetwork.accessPoints, undefined,
|
||||||
@ -1489,18 +1463,16 @@ NMDeviceWireless.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(apObj.connections.length > 0) {
|
if(apObj.connections.length > 0) {
|
||||||
if (apObj.connections.length == 1)
|
if (apObj.connections.length == 1) {
|
||||||
apObj.item = this._createAPItem(apObj.connections[0], apObj, false);
|
apObj.item = this._createAPItem(apObj.connections[0], apObj, false);
|
||||||
else {
|
} else {
|
||||||
let title = apObj.ssidText;
|
let title = apObj.ssidText;
|
||||||
apObj.item = new PopupMenu.PopupSubMenuMenuItem(title);
|
apObj.item = new PopupMenu.PopupSubMenuMenuItem(title);
|
||||||
apObj.item._apObj = apObj;
|
|
||||||
for (let i = 0; i < apObj.connections.length; i++)
|
for (let i = 0; i < apObj.connections.length; i++)
|
||||||
apObj.item.menu.addMenuItem(this._createAPItem(apObj.connections[i], apObj, true));
|
apObj.item.menu.addMenuItem(this._createAPItem(apObj.connections[i], apObj, true));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
apObj.item = new NMNetworkMenuItem(apObj.accessPoints);
|
apObj.item = new NMNetworkMenuItem(apObj.accessPoints);
|
||||||
apObj.item._apObj = apObj;
|
|
||||||
apObj.item.connect('activate', Lang.bind(this, function() {
|
apObj.item.connect('activate', Lang.bind(this, function() {
|
||||||
let accessPoints = sortAccessPoints(apObj.accessPoints);
|
let accessPoints = sortAccessPoints(apObj.accessPoints);
|
||||||
if ( (accessPoints[0]._secType == NMAccessPointSecurity.WPA2_ENT)
|
if ( (accessPoints[0]._secType == NMAccessPointSecurity.WPA2_ENT)
|
||||||
@ -1515,6 +1487,8 @@ NMDeviceWireless.prototype = {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
apObj.item._apObj = apObj;
|
||||||
|
|
||||||
if (position < NUM_VISIBLE_NETWORKS) {
|
if (position < NUM_VISIBLE_NETWORKS) {
|
||||||
apObj.isMore = false;
|
apObj.isMore = false;
|
||||||
this.section.addMenuItem(apObj.item, position);
|
this.section.addMenuItem(apObj.item, position);
|
||||||
@ -1532,7 +1506,7 @@ NMDeviceWireless.prototype = {
|
|||||||
if (!this._shouldShowConnectionList())
|
if (!this._shouldShowConnectionList())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(this._activeConnection) {
|
if (this._activeNetwork) {
|
||||||
this._createActiveConnectionItem();
|
this._createActiveConnectionItem();
|
||||||
this.section.addMenuItem(this._activeConnectionItem);
|
this.section.addMenuItem(this._activeConnectionItem);
|
||||||
}
|
}
|
||||||
@ -1541,22 +1515,22 @@ NMDeviceWireless.prototype = {
|
|||||||
|
|
||||||
for(let j = 0; j < this._networks.length; j++) {
|
for(let j = 0; j < this._networks.length; j++) {
|
||||||
let apObj = this._networks[j];
|
let apObj = this._networks[j];
|
||||||
if (apObj == this._activeNetwork)
|
if (apObj == this._activeNetwork) {
|
||||||
|
activeOffset--;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
this._createNetworkItem(apObj, j + activeOffset);
|
this._createNetworkItem(apObj, j + activeOffset);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMApplet() {
|
const NMApplet = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'NMApplet',
|
||||||
}
|
Extends: PanelMenu.SystemStatusButton,
|
||||||
NMApplet.prototype = {
|
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'network-error');
|
this.parent('network-offline', _("Network"));
|
||||||
|
|
||||||
this._client = NMClient.Client.new();
|
this._client = NMClient.Client.new();
|
||||||
|
|
||||||
@ -1822,6 +1796,7 @@ NMApplet.prototype = {
|
|||||||
let activating = null;
|
let activating = null;
|
||||||
let default_ip4 = null;
|
let default_ip4 = null;
|
||||||
let default_ip6 = null;
|
let default_ip6 = null;
|
||||||
|
let active_vpn = null;
|
||||||
for (let i = 0; i < this._activeConnections.length; i++) {
|
for (let i = 0; i < this._activeConnections.length; i++) {
|
||||||
let a = this._activeConnections[i];
|
let a = this._activeConnections[i];
|
||||||
|
|
||||||
@ -1851,6 +1826,8 @@ NMApplet.prototype = {
|
|||||||
default_ip4 = a;
|
default_ip4 = a;
|
||||||
if (a.default6)
|
if (a.default6)
|
||||||
default_ip6 = a;
|
default_ip6 = a;
|
||||||
|
if (a._type == 'vpn')
|
||||||
|
active_vpn = a;
|
||||||
|
|
||||||
if (a.state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
if (a.state == NetworkManager.ActiveConnectionState.ACTIVATING)
|
||||||
activating = a;
|
activating = a;
|
||||||
@ -1859,7 +1836,7 @@ NMApplet.prototype = {
|
|||||||
if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME) {
|
if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME) {
|
||||||
// find a good device to be considered primary
|
// find a good device to be considered primary
|
||||||
a._primaryDevice = null;
|
a._primaryDevice = null;
|
||||||
let devices = a.get_devices();
|
let devices = a.get_devices() || [];
|
||||||
for (let j = 0; j < devices.length; j++) {
|
for (let j = 0; j < devices.length; j++) {
|
||||||
let d = devices[j];
|
let d = devices[j];
|
||||||
if (d._delegate) {
|
if (d._delegate) {
|
||||||
@ -1881,7 +1858,7 @@ NMApplet.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._mainConnection = activating || default_ip4 || default_ip6 || this._activeConnections[0] || null;
|
this._mainConnection = activating || active_vpn || default_ip4 || default_ip6 || this._activeConnections[0] || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyActivated: function(activeConnection) {
|
_notifyActivated: function(activeConnection) {
|
||||||
@ -2056,10 +2033,11 @@ NMApplet.prototype = {
|
|||||||
}
|
}
|
||||||
this.setIcon('network-wireless-connected');
|
this.setIcon('network-wireless-connected');
|
||||||
} else {
|
} else {
|
||||||
if (this._accessPointUpdateId && this._activeAccessPoint != ap) {
|
if (this._activeAccessPoint != ap) {
|
||||||
|
if (this._accessPointUpdateId)
|
||||||
this._activeAccessPoint.disconnect(this._accessPointUpdateId);
|
this._activeAccessPoint.disconnect(this._accessPointUpdateId);
|
||||||
this._activeAccessPoint = ap;
|
this._activeAccessPoint = ap;
|
||||||
this._activeAccessPointUpdateId = ap.connect('notify::strength', Lang.bind(function() {
|
this._activeAccessPointUpdateId = ap.connect('notify::strength', Lang.bind(this, function() {
|
||||||
this.setIcon('network-wireless-signal-' + signalToIcon(ap.strength));
|
this.setIcon('network-wireless-signal-' + signalToIcon(ap.strength));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -2086,7 +2064,8 @@ NMApplet.prototype = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._mobileUpdateId && this._mobileUpdateDevice != dev) {
|
if (dev.mobileDevice != this._mobileUpdateDevice) {
|
||||||
|
if (this._mobileUpdateId)
|
||||||
this._mobileUpdateDevice.disconnect(this._mobileUpdateId);
|
this._mobileUpdateDevice.disconnect(this._mobileUpdateId);
|
||||||
this._mobileUpdateDevice = dev.mobileDevice;
|
this._mobileUpdateDevice = dev.mobileDevice;
|
||||||
this._mobileUpdateId = dev.mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
|
this._mobileUpdateId = dev.mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
|
||||||
@ -2120,17 +2099,14 @@ NMApplet.prototype = {
|
|||||||
this._mobileUpdateId = 0;
|
this._mobileUpdateId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function NMMessageTraySource() {
|
const NMMessageTraySource = new Lang.Class({
|
||||||
this._init();
|
Name: 'NMMessageTraySource',
|
||||||
}
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
NMMessageTraySource.prototype = {
|
|
||||||
__proto__: MessageTray.Source.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
MessageTray.Source.prototype._init.call(this, _("Network Manager"));
|
this.parent(_("Network Manager"));
|
||||||
|
|
||||||
let icon = new St.Icon({ icon_name: 'network-transmit-receive',
|
let icon = new St.Icon({ icon_name: 'network-transmit-receive',
|
||||||
icon_type: St.IconType.SYMBOLIC,
|
icon_type: St.IconType.SYMBOLIC,
|
||||||
@ -2138,4 +2114,4 @@ NMMessageTraySource.prototype = {
|
|||||||
});
|
});
|
||||||
this._setSummaryIcon(icon);
|
this._setSummaryIcon(icon);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|