Compare commits
936 Commits
matthiasc/
...
use-catchs
Author | SHA1 | Date | |
---|---|---|---|
|
bf1abac977 | ||
|
1a9edecdb4 | ||
|
564ae4bdb1 | ||
|
e4215ec4c7 | ||
|
74f8c59236 | ||
|
dd0c43b7ba | ||
|
9de7390ea0 | ||
|
81e113d8aa | ||
|
b26f4d5429 | ||
|
0a59429dc8 | ||
|
70ae073394 | ||
|
6421355065 | ||
|
536966e848 | ||
|
1c44910dfe | ||
|
bf9bb71813 | ||
|
75915bc782 | ||
|
618891a41a | ||
|
0d82fcf76f | ||
|
0091de63b4 | ||
|
338d6adb10 | ||
|
c4c155d698 | ||
|
b9016229c1 | ||
|
cf257e6676 | ||
|
62ed769e74 | ||
|
f3a0357ab0 | ||
|
1d8ac79296 | ||
|
374c776749 | ||
|
8c9e1e7444 | ||
|
73d81d7178 | ||
|
84355ccbff | ||
|
b2c92392fc | ||
|
9e06e830b7 | ||
|
62a4a356c9 | ||
|
1e4c6cde10 | ||
|
372db8d239 | ||
|
d57e6b754f | ||
|
3b1300632d | ||
|
4b1ea7c4a1 | ||
|
74a452df6c | ||
|
45046a53eb | ||
|
918996b047 | ||
|
b6eb85ee72 | ||
|
44741e1b77 | ||
|
eef1818cee | ||
|
fcaa6e98d0 | ||
|
f48a1e4069 | ||
|
c21b9bec95 | ||
|
659ec97456 | ||
|
42cc15bb74 | ||
|
8e452b2b54 | ||
|
740559a54f | ||
|
75cf990f74 | ||
|
612d2ea1f0 | ||
|
d58136e23d | ||
|
256c9c9873 | ||
|
fd568e63c2 | ||
|
797b3bd1b1 | ||
|
32a1cd13c8 | ||
|
1338dcddcb | ||
|
911a71c705 | ||
|
701a0dabd0 | ||
|
4dc1aea2ad | ||
|
09fa3886ba | ||
|
bb7d5b2de6 | ||
|
d906242c78 | ||
|
d9e8223b03 | ||
|
b79797ea97 | ||
|
5bfc95321e | ||
|
c0efadc0f3 | ||
|
ef837f0415 | ||
|
944607f240 | ||
|
43781652b3 | ||
|
9729a060f5 | ||
|
43ec96684a | ||
|
66e0f8505e | ||
|
22c914b7f5 | ||
|
fd7d61887c | ||
|
bdaf346128 | ||
|
6af7704858 | ||
|
7ff326e700 | ||
|
c890d5991c | ||
|
d27f9abbca | ||
|
08f58122d1 | ||
|
17dcb10707 | ||
|
2ac51ad827 | ||
|
2e72b663b0 | ||
|
e61f516a7c | ||
|
f71c9a2146 | ||
|
7428731e5b | ||
|
6043ed8c89 | ||
|
f394375719 | ||
|
ae2a914f07 | ||
|
cd9bee83ef | ||
|
ca0f136deb | ||
|
c0191c7225 | ||
|
d5114cc18d | ||
|
40d7092f4a | ||
|
dc963dcbcb | ||
|
c4d350c260 | ||
|
54e4bf8b75 | ||
|
0540337531 | ||
|
86acb13057 | ||
|
11314cf0b4 | ||
|
37ce545d72 | ||
|
85764ce505 | ||
|
ff5cdbaf03 | ||
|
420c4e1f16 | ||
|
a498aca3ab | ||
|
4eacfdba60 | ||
|
4fefea7471 | ||
|
bc132dae54 | ||
|
5822cdbc95 | ||
|
6a7a0f0b8a | ||
|
1948f8a07f | ||
|
8eb807d7f4 | ||
|
125ed52ccb | ||
|
e915a1aa7f | ||
|
7a9501b1fb | ||
|
81e88c1d9e | ||
|
f4511ff91c | ||
|
f00e2e2146 | ||
|
5a5b30681e | ||
|
ab5e62ddab | ||
|
936f3f1ad9 | ||
|
865b29500c | ||
|
7039f31391 | ||
|
ed67d9c103 | ||
|
5377026e61 | ||
|
40f3da19ae | ||
|
d4e069a629 | ||
|
a416650f6b | ||
|
e5d088208a | ||
|
3ef7772552 | ||
|
24ce38bb36 | ||
|
6315cd977c | ||
|
9770e064e8 | ||
|
2437622b5f | ||
|
bb8c818ba1 | ||
|
dd2e1e4867 | ||
|
5f630481db | ||
|
da6253eadc | ||
|
c6b261afa0 | ||
|
e07827e976 | ||
|
5a8f90357d | ||
|
a674832658 | ||
|
2031bcd388 | ||
|
4e157b33dc | ||
|
174c9a938e | ||
|
ec81ccd5f9 | ||
|
8acd60fda9 | ||
|
bcd0a9e5d8 | ||
|
5b35c5fb19 | ||
|
1dcb68c8e3 | ||
|
bca6113539 | ||
|
e35c000b4a | ||
|
29d7d652c4 | ||
|
581f224b61 | ||
|
aabb713594 | ||
|
a0af12e492 | ||
|
19c2cc1296 | ||
|
9b42edbef4 | ||
|
303e023c36 | ||
|
5e35ca5692 | ||
|
667b3b117d | ||
|
cb7c903594 | ||
|
e6e2d6b45a | ||
|
fa0a88ae22 | ||
|
17cdc13847 | ||
|
d40d4d5fae | ||
|
131e2f6e43 | ||
|
b3786b7b07 | ||
|
6cf8f1cdf2 | ||
|
79c2c3e353 | ||
|
ae7cefd97d | ||
|
35708162cc | ||
|
e29e569d6f | ||
|
3d7343144f | ||
|
3c44e9c563 | ||
|
8a13d18655 | ||
|
9786185cc0 | ||
|
22ac6d3148 | ||
|
97e0f1108d | ||
|
0ae7f794a3 | ||
|
15bd2a2a5c | ||
|
28c1e74220 | ||
|
e694a4137c | ||
|
005f9a995e | ||
|
e48a1d2df0 | ||
|
6191404656 | ||
|
6037d08bd8 | ||
|
bcc5e475fc | ||
|
a0cdb544ed | ||
|
80cddd4cc1 | ||
|
f4561d3fd5 | ||
|
c5963b960a | ||
|
df4c57c001 | ||
|
2b0e9542cb | ||
|
b49fd47276 | ||
|
bdb1d87859 | ||
|
d1b1b5bd9b | ||
|
283fc9d7e4 | ||
|
d8753a9fa3 | ||
|
a9858c6662 | ||
|
0279e1c76b | ||
|
cce3ff6f04 | ||
|
221786dda3 | ||
|
aacb06dbee | ||
|
ea887959bd | ||
|
4c78f628db | ||
|
0228c89011 | ||
|
b4508be3c9 | ||
|
dded2ddb21 | ||
|
e9afb63a01 | ||
|
3a0fdffe5e | ||
|
ff51d7b838 | ||
|
ef22c4a4fa | ||
|
ebaf533a31 | ||
|
88dcd2597a | ||
|
0d0807fc44 | ||
|
7226878916 | ||
|
afa9d9aa8c | ||
|
28a3911b15 | ||
|
94696490dc | ||
|
dbc6a94daf | ||
|
0a9acd10d2 | ||
|
3340a5ee04 | ||
|
5e2aeee9b0 | ||
|
9b0a5b1fde | ||
|
540cffee89 | ||
|
e0b95c6234 | ||
|
40c32bbef6 | ||
|
d0b192325a | ||
|
e16d108b68 | ||
|
f8b8c90c3d | ||
|
823219d429 | ||
|
102acd2581 | ||
|
82253d1a0a | ||
|
19b93fc9f7 | ||
|
e9d03d06fe | ||
|
63fb2126db | ||
|
90080d5bec | ||
|
be5b03224c | ||
|
091289a85d | ||
|
17710709f9 | ||
|
6fafc8b811 | ||
|
bc20fe3cca | ||
|
8cbca4f693 | ||
|
6e9de7f271 | ||
|
aa1b9531c1 | ||
|
66fa530574 | ||
|
e5247b7cbb | ||
|
da0955feeb | ||
|
2335953c5d | ||
|
42902085e5 | ||
|
230107cd84 | ||
|
b69dc3d054 | ||
|
a85fc0008c | ||
|
2bf9ae005f | ||
|
4650f7ec14 | ||
|
5dd0262a56 | ||
|
b13e1a5a7b | ||
|
ce1cd67fa4 | ||
|
eb5329d389 | ||
|
5b41612f28 | ||
|
473ed75ed5 | ||
|
3760d44f18 | ||
|
79f0687929 | ||
|
c80a612af7 | ||
|
358b698efa | ||
|
0f7b2159b6 | ||
|
7f565806a8 | ||
|
1d49f933e9 | ||
|
1d1d9de09e | ||
|
d1aacc01d4 | ||
|
2a3d3ec079 | ||
|
c60fba0267 | ||
|
75ad180c78 | ||
|
765fe201ce | ||
|
3469c639f6 | ||
|
d642bfc8ce | ||
|
c6a7b39ee1 | ||
|
112883186c | ||
|
57a213a4ea | ||
|
dbbc9b5c58 | ||
|
e18de295c6 | ||
|
4eaf08e964 | ||
|
2d5b44703c | ||
|
19c6ef38fe | ||
|
4f5e3b7b0d | ||
|
95cd8c1eb9 | ||
|
dfb16019f8 | ||
|
bef86d48af | ||
|
d1d269ea6b | ||
|
3d807f4b00 | ||
|
9654fff6e0 | ||
|
8a67899e0f | ||
|
bb30a23004 | ||
|
3faa7feb7c | ||
|
d099276b89 | ||
|
56afa05b97 | ||
|
c6fdfeae7e | ||
|
8725fd308b | ||
|
c40e23bde6 | ||
|
afcb9c0e63 | ||
|
fd1033f974 | ||
|
16505a4d1e | ||
|
a1ec68422f | ||
|
f8060b859d | ||
|
0c0ced1374 | ||
|
bfd8c5383f | ||
|
4d88e3af17 | ||
|
b694771728 | ||
|
51d6ec5131 | ||
|
7625ccd6fa | ||
|
95e2a2b4b3 | ||
|
4e774eddb9 | ||
|
35325ea11a | ||
|
5673310364 | ||
|
2d72ba21ce | ||
|
e0786a4a00 | ||
|
0b21883518 | ||
|
1ccab92813 | ||
|
f6d9e15c16 | ||
|
cd0b9a2359 | ||
|
96500816bc | ||
|
9d60047616 | ||
|
a95012caa3 | ||
|
51d55e4fbc | ||
|
05255bfc90 | ||
|
41ef2c5f34 | ||
|
4dfd413e0b | ||
|
6724d4250f | ||
|
8cd2f615ad | ||
|
517a34bdc8 | ||
|
658719a205 | ||
|
c27f811462 | ||
|
3590923c8b | ||
|
1b7004ffc7 | ||
|
85c713127e | ||
|
87a8fda163 | ||
|
79e6269058 | ||
|
6cf04c505f | ||
|
14900efe38 | ||
|
04c3c659f5 | ||
|
8557aaf327 | ||
|
052962a760 | ||
|
278fbcbbb4 | ||
|
26542778f7 | ||
|
a712ffa2ab | ||
|
12450cfcef | ||
|
71373ff6fb | ||
|
1fa9261fe3 | ||
|
c212dd4ec0 | ||
|
2ae1f40da2 | ||
|
0c82aa314c | ||
|
9e5ddeaa8a | ||
|
4e3251872c | ||
|
c13d70479b | ||
|
ecd50891ff | ||
|
71cec2ef5d | ||
|
83e9b5b408 | ||
|
f4a6a99b7c | ||
|
dd0c364938 | ||
|
2eec82c32a | ||
|
9212d95b0f | ||
|
29ba8f0819 | ||
|
8f7edb8a7d | ||
|
dcf37412c1 | ||
|
d6c35ab02f | ||
|
66df338087 | ||
|
d1718355cd | ||
|
bb3675b3c7 | ||
|
36711b6691 | ||
|
dc8adcda0e | ||
|
883a43ddd7 | ||
|
5ff2b8535f | ||
|
750f9917e3 | ||
|
e77d82eaac | ||
|
4babdcd662 | ||
|
f5b0cab5cf | ||
|
1d7b273669 | ||
|
774d431525 | ||
|
845afdbcd8 | ||
|
b58bad557b | ||
|
6dfd92b191 | ||
|
d7c4f93c76 | ||
|
0b0f7dc9c0 | ||
|
df19049dde | ||
|
edc2adbb5b | ||
|
2ff74eb667 | ||
|
cfd3651003 | ||
|
7c252e3830 | ||
|
d44d9ad40d | ||
|
9c8bceb691 | ||
|
21a1413bf3 | ||
|
8870ec5e7b | ||
|
c46f262d6e | ||
|
edc1c28236 | ||
|
f454c6f9d0 | ||
|
cf5a6a003a | ||
|
d2291abe2a | ||
|
5ce0098adc | ||
|
46a8a3fe31 | ||
|
c6ada2a329 | ||
|
a7d665f28b | ||
|
69bb4f8beb | ||
|
06f28af80f | ||
|
e60d6f70bf | ||
|
9126132e42 | ||
|
8562c623d3 | ||
|
2b8aeed4d8 | ||
|
ce89f1eda1 | ||
|
f561000124 | ||
|
93c9600145 | ||
|
31726cdc95 | ||
|
39eeb2a723 | ||
|
a06339fb48 | ||
|
0e1afbbdad | ||
|
a42738729b | ||
|
d6e352e862 | ||
|
f7eb5f8897 | ||
|
7398323b82 | ||
|
4ee82e8175 | ||
|
cebe469898 | ||
|
bbb15f65a7 | ||
|
b3a874c4d1 | ||
|
f49d267187 | ||
|
2c306f75c4 | ||
|
d7cd28c641 | ||
|
92cb629640 | ||
|
1492e8cf0e | ||
|
0ae46040a4 | ||
|
1d1e1a0068 | ||
|
1e3df88ee0 | ||
|
e818e98187 | ||
|
b4050482ec | ||
|
942a90cd64 | ||
|
20c1fb0a0a | ||
|
7972dc8776 | ||
|
7cb0dd9039 | ||
|
a5058c605f | ||
|
70b0bdd5e3 | ||
|
2d72cd00e3 | ||
|
95a533e8e1 | ||
|
0eb36cb823 | ||
|
c8d51a7b98 | ||
|
c77600f1e9 | ||
|
64b8d8b3e4 | ||
|
83682d919f | ||
|
6ed1cd63b6 | ||
|
cb320849de | ||
|
9659d3f78a | ||
|
1f3327d326 | ||
|
15325fe546 | ||
|
4152e90e7e | ||
|
c211fdcf42 | ||
|
af63893377 | ||
|
3304df7042 | ||
|
df85ef1754 | ||
|
a7e25f2c73 | ||
|
1c583edfb7 | ||
|
89c10e092a | ||
|
4bdd94fd3f | ||
|
5a55f6ff7b | ||
|
af07cfea5f | ||
|
348a38a876 | ||
|
0d98bab82b | ||
|
992c5fade7 | ||
|
75d09d5ab3 | ||
|
1c49371edf | ||
|
94d17a6809 | ||
|
9605e49fbf | ||
|
43816ba8d9 | ||
|
71be1751c6 | ||
|
ed13e6a41e | ||
|
7fe7d5ab4f | ||
|
4340f75304 | ||
|
0add626822 | ||
|
793ea05f4a | ||
|
638ea2d6fc | ||
|
c959f9c701 | ||
|
f8a303b0e5 | ||
|
ddda963f81 | ||
|
9bf50e5650 | ||
|
acc57ea799 | ||
|
1c8471c38f | ||
|
17208ca7fa | ||
|
1c16cb751f | ||
|
127612d213 | ||
|
4ad401f3fa | ||
|
888a65c1fb | ||
|
3d65178f37 | ||
|
891027f0c3 | ||
|
5f00675de4 | ||
|
be03613e30 | ||
|
d17e51df06 | ||
|
5ecf1431f0 | ||
|
28a9fa2486 | ||
|
7cf61e6a4b | ||
|
0d608c492d | ||
|
7bc553a5cc | ||
|
934946acfc | ||
|
3a9b824ce5 | ||
|
501b2b43ef | ||
|
aea253bc60 | ||
|
4fed32315c | ||
|
d19e60a40d | ||
|
e0c7d7daeb | ||
|
64ed69c56f | ||
|
2a962e1c9a | ||
|
74662776d4 | ||
|
0b2833f69c | ||
|
41b458fba7 | ||
|
f716daa483 | ||
|
415946eb0f | ||
|
65b79d2585 | ||
|
e976825342 | ||
|
b489a1f6b5 | ||
|
2f65459fcc | ||
|
f5af18738b | ||
|
b37b85333d | ||
|
76f2396764 | ||
|
547842e7f0 | ||
|
ebaea07286 | ||
|
0822de1971 | ||
|
954a144336 | ||
|
bf24da0d80 | ||
|
d743e757ec | ||
|
746a40bbfe | ||
|
d1cab4fbdd | ||
|
7a58a6a097 | ||
|
371cdf3250 | ||
|
1087ff48f0 | ||
|
15982ab6d2 | ||
|
0dc6ee2c44 | ||
|
f136a6f51f | ||
|
6ab13a6303 | ||
|
358f66482d | ||
|
0d3fa01be2 | ||
|
e0d1aac8a5 | ||
|
fc31f3d629 | ||
|
9564cba492 | ||
|
90eec6734f | ||
|
72e14bd6dd | ||
|
99bb8bb3f7 | ||
|
ff42c94174 | ||
|
20388f83f5 | ||
|
c97979873a | ||
|
d6955d4427 | ||
|
85706dc39d | ||
|
07166a55ee | ||
|
2dfa5ac804 | ||
|
8c66e2ff66 | ||
|
d761e3cf2c | ||
|
360ffb8e87 | ||
|
731b672875 | ||
|
d5a31daa41 | ||
|
554954d126 | ||
|
73477b5abf | ||
|
62803c19f5 | ||
|
643d873f47 | ||
|
b0d40403e1 | ||
|
12170acf46 | ||
|
38648855b0 | ||
|
96452a2e46 | ||
|
46eb054337 | ||
|
4a2050e220 | ||
|
3c68db8e47 | ||
|
9912c80d70 | ||
|
2f792396d7 | ||
|
6730b26b43 | ||
|
6e83d1f54e | ||
|
fb9db7fede | ||
|
7991032aeb | ||
|
0cbc857ea4 | ||
|
398c1d1ad7 | ||
|
94982dbab7 | ||
|
4dc2ab61c9 | ||
|
13d3afa56e | ||
|
3dd0e6d0b1 | ||
|
11db6ad574 | ||
|
ebcef256ab | ||
|
b12b06e917 | ||
|
a27c3039d0 | ||
|
0ee3370afc | ||
|
c2b5997437 | ||
|
f02a17805e | ||
|
a481733b40 | ||
|
cf0175ffce | ||
|
e5600ab99b | ||
|
257fd990d1 | ||
|
12a23162b3 | ||
|
0b11e78064 | ||
|
e8026e29b6 | ||
|
ee1a868913 | ||
|
488722e7c4 | ||
|
7df070d681 | ||
|
abf8cbeaea | ||
|
c0de580d46 | ||
|
144114bf40 | ||
|
c68fe1053a | ||
|
4d012a6d95 | ||
|
c1eedf6845 | ||
|
9722bb4d9e | ||
|
ad3514216d | ||
|
59fce30200 | ||
|
2e80658251 | ||
|
53e74c365b | ||
|
047709e911 | ||
|
7e355cbe1e | ||
|
3eab58816b | ||
|
c7c71137b2 | ||
|
ec34675019 | ||
|
85fb015b45 | ||
|
d40b1d31b5 | ||
|
5fd03f3297 | ||
|
a3a66be76e | ||
|
3bb3bc2982 | ||
|
a7ac16098a | ||
|
3b35ae870c | ||
|
d0abe5a919 | ||
|
26200c0f7e | ||
|
07bf9045fb | ||
|
e4a3746755 | ||
|
1772d23f8e | ||
|
e07b9605bc | ||
|
fc47e79cb6 | ||
|
2a92ee22da | ||
|
23dcf36ec9 | ||
|
b5f256937f | ||
|
cab1dcb696 | ||
|
25ea17a6fc | ||
|
4a2bbed157 | ||
|
7629f6d533 | ||
|
230ce9bfde | ||
|
2736633a60 | ||
|
1755e07af7 | ||
|
a610bb89a0 | ||
|
2040b7ecdf | ||
|
cc35cc6c4e | ||
|
9a82aadca7 | ||
|
23e185e674 | ||
|
971ee2d28a | ||
|
efd4169fa2 | ||
|
b52ad33031 | ||
|
5926008647 | ||
|
459af3acab | ||
|
cc50be971d | ||
|
3294557717 | ||
|
470349c902 | ||
|
bf06cad5d9 | ||
|
2e8de6bd88 | ||
|
7f04faf30d | ||
|
4fa891b55d | ||
|
254007a142 | ||
|
1b846e29c7 | ||
|
a2876b5cb4 | ||
|
5f8258109e | ||
|
6a4277a9a9 | ||
|
f4e001c91a | ||
|
3285f52dc8 | ||
|
400a5b4e1f | ||
|
42a4940671 | ||
|
ecc329fa2a | ||
|
5fc5e52f52 | ||
|
1d8e62fb01 | ||
|
09faa582e3 | ||
|
a85ba95b20 | ||
|
2050120098 | ||
|
b213b01200 | ||
|
ac1f242b6c | ||
|
ebbb729aea | ||
|
bbabec3f18 | ||
|
dded144313 | ||
|
3f59566729 | ||
|
e0420bae09 | ||
|
a3b452725b | ||
|
d5f0256f8b | ||
|
9cdf9847c2 | ||
|
fa85ec5cf5 | ||
|
0ce32cd4b5 | ||
|
756b84033a | ||
|
5a9b54df96 | ||
|
d7ba281c15 | ||
|
c6c87b97c2 | ||
|
2fa9dddea6 | ||
|
72d4a83af8 | ||
|
f4d9e4032f | ||
|
fcf502a686 | ||
|
6e494b93ce | ||
|
9458c1cc47 | ||
|
9190e95df9 | ||
|
e10aedccc6 | ||
|
a63d03810f | ||
|
d2c5e3f2b3 | ||
|
2ef4be21c8 | ||
|
2cbaa568b5 | ||
|
d8ac144923 | ||
|
606daab475 | ||
|
ec5829c401 | ||
|
d3a8597a93 | ||
|
29cf11fb6e | ||
|
6ca245306b | ||
|
4a9b4ad720 | ||
|
36689d1884 | ||
|
0243736003 | ||
|
450899ef4c | ||
|
c6c9ca6009 | ||
|
99ec400c2a | ||
|
da9b4d778b | ||
|
252e29c373 | ||
|
6266bcafee | ||
|
d90f79de0e | ||
|
790db8db53 | ||
|
38b1fbb261 | ||
|
cd7bb0200a | ||
|
05d9e0c1c8 | ||
|
b7be6ee00d | ||
|
604d4a1cb2 | ||
|
b68d54cdbc | ||
|
bc0182fa3e | ||
|
19bae10b45 | ||
|
4060febd7f | ||
|
9a4458ba33 | ||
|
40b65b2608 | ||
|
6c4c93b8d0 | ||
|
4c5df54e39 | ||
|
2ce6ac00cf | ||
|
98f3112158 | ||
|
9a27614b41 | ||
|
29abefbe61 | ||
|
81c8a2bb4b | ||
|
d187ff858c | ||
|
e57d6ec359 | ||
|
eb5c76210e | ||
|
fc22b75a06 | ||
|
43000abeff | ||
|
f7ab6f665d | ||
|
72bb7fc701 | ||
|
cdc263f796 | ||
|
ccb9dcc86b | ||
|
68d6671413 | ||
|
dd1c0c0b22 | ||
|
a46cfd3ff4 | ||
|
706d464ae6 | ||
|
b6d9f3facb | ||
|
06c6d62629 | ||
|
32b8fe40bb | ||
|
1e8be87026 | ||
|
cbc6244bc5 | ||
|
ac0fcc55a6 | ||
|
3d642460e7 | ||
|
82664003c0 | ||
|
b9a1cb74a1 | ||
|
dc1c1e8af9 | ||
|
83eac3f33a | ||
|
296f0844df | ||
|
e17b5f337d | ||
|
c36ad5f474 | ||
|
b7777add36 | ||
|
609383f93c | ||
|
a9e0cf77a0 | ||
|
86b58529fd | ||
|
2fee3793b4 | ||
|
03b773f45a | ||
|
8adcf95300 | ||
|
0b6df9efe7 | ||
|
01f31665b8 | ||
|
0d87f8cd62 | ||
|
52c1fb8dfe | ||
|
732578eb53 | ||
|
1124f2507d | ||
|
d37511f76b | ||
|
55d29d08a1 | ||
|
ae446e8f4a | ||
|
c56e9b2031 | ||
|
93978544c0 | ||
|
1b612cd5db | ||
|
3a1d69ca29 | ||
|
9af74629f6 | ||
|
59d85d42cf | ||
|
2c75ba5509 | ||
|
58628f9a9e | ||
|
da1ce01a6f | ||
|
654956223d | ||
|
382fa01301 | ||
|
572861be27 | ||
|
5a173df3da | ||
|
3ea069a8d3 | ||
|
25f6da5e89 | ||
|
566f75af82 | ||
|
a382dfd3bd | ||
|
823ee58332 | ||
|
55120a25db | ||
|
14faec3ce2 | ||
|
82fe6fbc62 | ||
|
c63087a563 | ||
|
ea0fc7619d | ||
|
f2ed1656b4 | ||
|
2f27d29247 | ||
|
ef6babf896 | ||
|
7f9570b95b | ||
|
d8d8a71a7a | ||
|
2ff3e3d1e4 | ||
|
73f4f518b8 | ||
|
6e9dbba130 | ||
|
706aa93ab5 | ||
|
54deed9a5a | ||
|
0e70ddcab3 | ||
|
f2bdb1fb87 | ||
|
ec9fd76c87 | ||
|
bacaa5eb9a | ||
|
9a297516ba | ||
|
e9bff53015 | ||
|
3078b180fe | ||
|
556997f9df | ||
|
d375dce9f5 | ||
|
d7266b25ba | ||
|
2a43ce1705 | ||
|
3324a6e6b3 | ||
|
46423e614d | ||
|
f7b73b2e01 | ||
|
c85e424279 | ||
|
b146c48e23 | ||
|
3176d69009 | ||
|
89f7d841ab | ||
|
7e2fceebca | ||
|
1e00c887ec | ||
|
561d3c68a0 | ||
|
03601cb794 | ||
|
3108b8b4d3 | ||
|
d1afe32762 | ||
|
603dd72b09 | ||
|
e81ba8924a | ||
|
8832ab45d9 | ||
|
87d6e17bc7 | ||
|
a5033cd79b | ||
|
44cbf3d605 | ||
|
fb6288791e | ||
|
2160f52cbf | ||
|
8825e621c9 | ||
|
e22abd73f2 | ||
|
f77d4d7fc0 | ||
|
8243133ca7 | ||
|
63a4345d2c | ||
|
56685a483d | ||
|
b23f793753 | ||
|
2b19e2fc1f | ||
|
703f8b8136 | ||
|
5b18968867 | ||
|
e8c4e1205a | ||
|
bf5c540357 | ||
|
c03383d3e5 | ||
|
eaaa287078 | ||
|
554defaf1a | ||
|
659fe52b7b | ||
|
0970077af9 | ||
|
814c88fbc1 | ||
|
3b24c8a0a4 | ||
|
e34c7e6796 | ||
|
8c608e9c1c | ||
|
283c3b70dd | ||
|
93599c2c48 | ||
|
080e625090 | ||
|
26696a741e | ||
|
a209e54b8f | ||
|
8921dadaa1 | ||
|
47232acbd8 | ||
|
cbad8ec2e4 | ||
|
800170b47d | ||
|
97c5cb3514 | ||
|
081afc0477 | ||
|
e807fc3be0 | ||
|
a1bd3389ed | ||
|
03a3b5a0b1 | ||
|
1ee2d9a5fa | ||
|
2e07fcd680 | ||
|
d3365d5a60 | ||
|
9dbf99d91a | ||
|
0154a7f528 | ||
|
add47bebc6 | ||
|
514b62223d | ||
|
7884ab6161 | ||
|
bc542c5304 | ||
|
d66ac4981e | ||
|
9b647a47d1 | ||
|
b67ffe9650 | ||
|
2c519b006d | ||
|
852429d163 | ||
|
ee9c6bbf75 | ||
|
d9ece94377 | ||
|
486fbce42b | ||
|
ed92026632 | ||
|
05e614feb7 | ||
|
14059afdf1 | ||
|
9b294eb94e | ||
|
96d42cf1cc | ||
|
4786a16696 | ||
|
14bb12125f | ||
|
07e8dafcea | ||
|
ab67a81f11 | ||
|
aa76f7e210 | ||
|
0c15463e41 | ||
|
5df1356295 | ||
|
95fc81c565 | ||
|
378e594f75 | ||
|
86c7fceb09 | ||
|
b5e20a3e37 | ||
|
75a30b1f98 | ||
|
c64a021af4 | ||
|
9b64635925 | ||
|
7b76be5360 | ||
|
2e2336ffce | ||
|
76d80ef516 | ||
|
287d80bd36 | ||
|
77072b3eaa | ||
|
c7833bb090 | ||
|
899024cef7 | ||
|
4da3edd42e | ||
|
6b59626817 | ||
|
7c02ae00c2 | ||
|
80e29a3627 | ||
|
26163a4f30 | ||
|
dbd88fc210 | ||
|
2de31e4cac | ||
|
1bff328895 | ||
|
facf78a5b6 | ||
|
6b19fcd859 | ||
|
ca784e3e1a | ||
|
314c8558d7 | ||
|
af30a7fe06 | ||
|
9ffd7d1970 | ||
|
cb906c80eb | ||
|
96ce0eb600 | ||
|
0e476c1f28 | ||
|
130bd5937c |
@@ -16,11 +16,11 @@ stages:
|
||||
|
||||
# Common variables
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes"
|
||||
FEATURE_FLAGS: "-Dcloudproviders=true"
|
||||
COMMON_MESON_FLAGS: "--fatal-meson-warnings -Dgtk:werror=true"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v20"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v22"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19"
|
||||
|
||||
@@ -68,11 +68,13 @@ style-check-diff:
|
||||
fedora-x86_64:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
script:
|
||||
- meson subprojects update
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
-Dprofiler=true
|
||||
-Dsysprof=enabled
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
@@ -82,14 +84,38 @@ fedora-x86_64:
|
||||
release-build:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- meson subprojects update
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
|
||||
installed-tests:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--prefix=/usr --libdir=/usr/lib64 -Dinstall-tests=true"
|
||||
script:
|
||||
- meson subprojects update
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
_build
|
||||
- ninja -C _build
|
||||
- sudo ninja -C _build install
|
||||
- dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24"
|
||||
gnome-desktop-testing-runner
|
||||
--report-directory=_build/installed-tests-report/failed/
|
||||
--parallel=0
|
||||
gtk-4.0
|
||||
artifacts:
|
||||
paths:
|
||||
- "_build/installed-tests-report/"
|
||||
|
||||
|
||||
.mingw-defaults:
|
||||
stage: build
|
||||
tags:
|
||||
@@ -109,6 +135,7 @@ release-build:
|
||||
|
||||
msys2-mingw64:
|
||||
extends: .mingw-defaults
|
||||
needs: []
|
||||
variables:
|
||||
MSYSTEM: "MINGW64"
|
||||
CHERE_INVOKING: "yes"
|
||||
@@ -139,37 +166,44 @@ msys2-mingw64:
|
||||
|
||||
flatpak-manual:demo:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak-master:demo:
|
||||
extends: .flatpak-master
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak-manual:widget-factory:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak-master:widget-factory:
|
||||
extends: .flatpak-master
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak-manual:icon-browser:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak-master:icon-browser:
|
||||
extends: .flatpak-master
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
stage: analysis
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug"
|
||||
script:
|
||||
@@ -184,8 +218,9 @@ static-scan:
|
||||
# since it is incompatible with asan
|
||||
asan-build:
|
||||
image: $FEDORA_IMAGE
|
||||
tags: [ privileged ]
|
||||
tags: [ asan ]
|
||||
stage: analysis
|
||||
needs: []
|
||||
variables:
|
||||
script:
|
||||
- CC=clang meson --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=false _build
|
||||
@@ -199,6 +234,7 @@ asan-build:
|
||||
reference:
|
||||
image: $DOCS_IMAGE
|
||||
stage: docs
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
@@ -214,6 +250,7 @@ reference:
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
needs: ['reference']
|
||||
script:
|
||||
- mv _reference/ public/
|
||||
artifacts:
|
||||
|
@@ -29,6 +29,7 @@ RUN dnf -y install \
|
||||
glib2-static \
|
||||
glibc-devel \
|
||||
glibc-headers \
|
||||
gnome-desktop-testing \
|
||||
gobject-introspection-devel \
|
||||
graphene-devel \
|
||||
gstreamer1-devel \
|
||||
@@ -75,7 +76,6 @@ RUN dnf -y install \
|
||||
python3-wheel \
|
||||
redhat-rpm-config \
|
||||
sassc \
|
||||
sysprof-devel \
|
||||
systemtap-sdt-devel \
|
||||
vulkan-devel \
|
||||
wayland-devel \
|
||||
|
@@ -1,8 +1,11 @@
|
||||
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v20
|
||||
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v21
|
||||
|
||||
# Enable sudo for wheel users
|
||||
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
|
||||
|
||||
ARG HOST_USER_ID=5555
|
||||
ENV HOST_USER_ID ${HOST_USER_ID}
|
||||
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
|
||||
RUN useradd -u $HOST_USER_ID -G wheel -ms /bin/bash user
|
||||
|
||||
USER user
|
||||
WORKDIR /home/user
|
||||
|
@@ -12,13 +12,13 @@ export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp
|
||||
|
||||
case "${backend}" in
|
||||
x11)
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
|
||||
meson test -C ${builddir} \
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--wrap catchsegv \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
# Store the exit code for the CI run, but always
|
||||
@@ -37,8 +37,8 @@ case "${backend}" in
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--wrap catchsegv \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
exit_code=$?
|
||||
@@ -56,8 +56,8 @@ case "${backend}" in
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--wrap catchsegv \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-opengl
|
||||
|
||||
# don't let Broadway failures fail the run, for now
|
||||
|
@@ -33,17 +33,29 @@ pacman --noconfirm -S --needed \
|
||||
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
|
||||
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner-v2/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
|
||||
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
|
||||
|
||||
# https://github.com/msys2/MINGW-packages/pull/6465
|
||||
pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-brotli
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
|
||||
|
||||
if ! pkg-config --atleast-version=2.65.0 glib-2.0; then
|
||||
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
|
||||
meson setup _glib_build _glib
|
||||
meson compile -C _glib_build
|
||||
meson install -C _glib_build
|
||||
fi
|
||||
pkg-config --modversion glib-2.0
|
||||
|
||||
if ! pkg-config --atleast-version=1.45.4 pango; then
|
||||
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
|
||||
meson setup _pango_build _pango
|
||||
meson compile -C _pango_build
|
||||
meson install -C _pango_build
|
||||
fi
|
||||
pkg-config --modversion pango
|
||||
|
||||
# Build
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
@@ -54,9 +66,9 @@ meson \
|
||||
-Dx11-backend=false \
|
||||
-Dwayland-backend=false \
|
||||
-Dwin32-backend=true \
|
||||
-Dvulkan=no \
|
||||
-Dvulkan=disabled \
|
||||
-Dintrospection=false \
|
||||
--werror \
|
||||
-Dgtk:werror=true \
|
||||
_build
|
||||
unset CCACHE_DISABLE
|
||||
|
||||
|
64
NEWS
64
NEWS
@@ -1,7 +1,54 @@
|
||||
Overview of Changes in GTK 3.99.1
|
||||
=================================
|
||||
|
||||
* GtkGridLayout: Rename left-/top-attach to column/row
|
||||
|
||||
* Drop GtkAccelLabel - it is no longer used
|
||||
|
||||
* GtkTextView:
|
||||
- Fix redraw issues with selections
|
||||
- Make insert-emoji replace the selection
|
||||
|
||||
* GtkTreeView:
|
||||
- Fix selection handling in cell editables
|
||||
|
||||
* CSS:
|
||||
- Hexadecimal colors can now specify alpha
|
||||
|
||||
* Documentation:
|
||||
- Refresh the widget gallery
|
||||
- Add images for new widgets to the gallery
|
||||
- Fix many cross-references
|
||||
|
||||
* Demos:
|
||||
- Numerous crash- and bug fixes
|
||||
|
||||
* Fix build with cups < 2.3
|
||||
|
||||
* win32:
|
||||
- Default to the GL renderer when we can
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Polish
|
||||
Romanian
|
||||
Spanish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in GTK 3.99.0
|
||||
=================================
|
||||
|
||||
* Add GtkEditableLabel
|
||||
* Remove the old accessibility implementation and
|
||||
add the foundations for a new one that is based
|
||||
on ARIA. The relevant widget api is GtkAccessible,
|
||||
the backend implementations will use GtkATContext.
|
||||
Currently, there is just a nascent test backend.
|
||||
|
||||
* Update the GTK headers to use char *, int, float and
|
||||
double instead of the corresponding GLib types.
|
||||
|
||||
* Add GtkEditableLabel, a label that can be edited
|
||||
|
||||
* Add GtkBookmarkList, a list model for bookmarks
|
||||
|
||||
@@ -35,6 +82,15 @@ Overview of Changes in GTK 3.99.0
|
||||
|
||||
* GtkFilterListModel:
|
||||
- Add incremental filtering
|
||||
- Add a boolean filter, GtkBoolFilter
|
||||
|
||||
* GtkSortListModel:
|
||||
- Use timsort
|
||||
- Add various tweaks that massively speed up sorting
|
||||
- Add incremental sorting
|
||||
|
||||
* GtkWidget:
|
||||
- Massively speed up action handling
|
||||
|
||||
* GtkEntry:
|
||||
- Make entry completion work again
|
||||
@@ -43,12 +99,18 @@ Overview of Changes in GTK 3.99.0
|
||||
* Inspector:
|
||||
- Improve list model support
|
||||
- Add direct navigation between objects
|
||||
- Show accessibility information
|
||||
|
||||
* GDK:
|
||||
- Compress scroll events
|
||||
- Keep a scroll history
|
||||
- Clean up GdkDevice api
|
||||
- Drop the master/slave device split
|
||||
- Move axes to GdkDeviceTool
|
||||
- Change monitor workarea to be per-backend API
|
||||
- Improve frame clock accuracy
|
||||
- Add a new macOS backend
|
||||
- Add an ANGLE-based GLES renderer for Windows
|
||||
|
||||
* GSK:
|
||||
- Use GL_ARB_framebuffer_object
|
||||
|
@@ -56,7 +56,6 @@ building for:
|
||||
- [Pango](https://download.gnome.org/sources/pango)
|
||||
- [Epoxy](https://github.com/anholt/libepoxy)
|
||||
- [Graphene](https://github.com/ebassi/graphene)
|
||||
- [ATK](https://download.gnome.org/sources/atk)
|
||||
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
|
||||
|
||||
If you are building the X11 backend, you will also need:
|
||||
@@ -70,7 +69,6 @@ If you are building the X11 backend, you will also need:
|
||||
- xcursor
|
||||
- xdamage
|
||||
- xcomposite
|
||||
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
|
||||
|
||||
If you are building the Wayland backend, you will also need:
|
||||
|
||||
|
@@ -1,29 +1,38 @@
|
||||
{
|
||||
"app-id": "org.gtk.Demo4",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "gtk4-demo",
|
||||
"tags": ["devel", "development", "nightly"],
|
||||
"desktop-file-name-prefix": "(Development) ",
|
||||
"finish-args": [
|
||||
"app-id" : "org.gtk.Demo4",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "master",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"command" : "gtk4-demo",
|
||||
"tags" : [
|
||||
"devel",
|
||||
"development",
|
||||
"nightly"
|
||||
],
|
||||
"desktop-file-name-prefix" : "(Development) ",
|
||||
"finish-args" : [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
|
||||
"--talk-name=org.gtk.vfs",
|
||||
"--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup": [
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig", "/share/pkgconfig",
|
||||
"/lib/pkgconfig",
|
||||
"/share/pkgconfig",
|
||||
"/share/aclocal",
|
||||
"/man", "/share/man", "/share/gtk-doc",
|
||||
"*.la", ".a",
|
||||
"/man",
|
||||
"/share/man",
|
||||
"/share/gtk-doc",
|
||||
"*.la",
|
||||
".a",
|
||||
"/lib/girepository-1.0",
|
||||
"/share/gir-1.0",
|
||||
"/share/doc"
|
||||
],
|
||||
"modules": [
|
||||
"modules" : [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "autotools",
|
||||
@@ -39,18 +48,18 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "graphene",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"name" : "graphene",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources": [
|
||||
"sources" : [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/ebassi/graphene.git"
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/ebassi/graphene.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -58,7 +67,7 @@
|
||||
"name" : "libsass",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts": [
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
@@ -73,7 +82,7 @@
|
||||
"name" : "sassc",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts": [
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
@@ -85,18 +94,25 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gtk",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
"name" : "gtk",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized"
|
||||
],
|
||||
"sources": [
|
||||
"sources" : [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"GSK_RENDERER" : "opengl"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,29 +1,38 @@
|
||||
{
|
||||
"app-id": "org.gtk.IconBrowser4",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "gtk4-icon-browser",
|
||||
"tags": ["devel", "development", "nightly"],
|
||||
"desktop-file-name-prefix": "(Development) ",
|
||||
"finish-args": [
|
||||
"app-id" : "org.gtk.IconBrowser4",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "master",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"command" : "gtk4-icon-browser",
|
||||
"tags" : [
|
||||
"devel",
|
||||
"development",
|
||||
"nightly"
|
||||
],
|
||||
"desktop-file-name-prefix" : "(Development) ",
|
||||
"finish-args" : [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
|
||||
"--talk-name=org.gtk.vfs",
|
||||
"--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup": [
|
||||
"cleanup" : [
|
||||
"/include",
|
||||
"/lib/pkgconfig", "/share/pkgconfig",
|
||||
"/lib/pkgconfig",
|
||||
"/share/pkgconfig",
|
||||
"/share/aclocal",
|
||||
"/man", "/share/man", "/share/gtk-doc",
|
||||
"*.la", ".a",
|
||||
"/man",
|
||||
"/share/man",
|
||||
"/share/gtk-doc",
|
||||
"*.la",
|
||||
".a",
|
||||
"/lib/girepository-1.0",
|
||||
"/share/gir-1.0",
|
||||
"/share/doc"
|
||||
],
|
||||
"modules": [
|
||||
"modules" : [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "autotools",
|
||||
@@ -39,18 +48,18 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "graphene",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"name" : "graphene",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources": [
|
||||
"sources" : [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/ebassi/graphene.git"
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/ebassi/graphene.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -58,7 +67,7 @@
|
||||
"name" : "libsass",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts": [
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
@@ -73,7 +82,7 @@
|
||||
"name" : "sassc",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts": [
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
@@ -85,18 +94,24 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gtk",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
"name" : "gtk",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized"
|
||||
],
|
||||
"sources": [
|
||||
"sources" : [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -98,7 +98,9 @@
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib"
|
||||
"--libdir=/app/lib",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
@@ -110,7 +112,10 @@
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''"
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"GDK_DEBUG" : "vulkan-disable",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@
|
||||
#mesondefine HAVE_SYS_PARAM_H
|
||||
|
||||
/* Have the sysprof-capture library */
|
||||
#mesondefine HAVE_SYSPROF_CAPTURE
|
||||
#mesondefine HAVE_SYSPROF
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#mesondefine HAVE_SYS_STAT_H
|
||||
|
@@ -81,11 +81,11 @@ constraint_editor_application_activate (GApplication *app)
|
||||
static void
|
||||
constraint_editor_application_open (GApplication *app,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint)
|
||||
int n_files,
|
||||
const char *hint)
|
||||
{
|
||||
ConstraintEditorWindow *win;
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n_files; i++)
|
||||
{
|
||||
|
@@ -193,7 +193,7 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
gint response,
|
||||
int response,
|
||||
ConstraintEditorWindow *self)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
@@ -285,7 +285,7 @@ serialize_model (GListModel *list)
|
||||
|
||||
static void
|
||||
save_response_cb (GtkNativeDialog *dialog,
|
||||
gint response,
|
||||
int response,
|
||||
ConstraintEditorWindow *self)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
|
@@ -13,8 +13,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Target</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -23,8 +23,8 @@
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -32,8 +32,8 @@
|
||||
<object class="GtkComboBoxText" id="target_attr">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -41,8 +41,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Relation</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -50,8 +50,8 @@
|
||||
<object class="GtkComboBoxText" id="relation">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -59,8 +59,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Source</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -69,8 +69,8 @@
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -79,8 +79,8 @@
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="source_attr_changed" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -88,8 +88,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Multiplier</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -97,8 +97,8 @@
|
||||
<object class="GtkEntry" id="multiplier">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -106,8 +106,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Constant</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">5</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -115,8 +115,8 @@
|
||||
<object class="GtkEntry" id="constant">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">5</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -124,16 +124,16 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Strength</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">6</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="strength">
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">6</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -141,8 +141,8 @@
|
||||
<object class="GtkLabel" id="preview">
|
||||
<property name="xalign">0</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">7</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">7</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
<attributes>
|
||||
@@ -155,8 +155,8 @@
|
||||
<property name="label">Create</property>
|
||||
<signal name="clicked" handler="create_constraint"/>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">8</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">8</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -174,28 +174,25 @@ constraint_view_init (ConstraintView *self)
|
||||
manager = gtk_constraint_layout_new ();
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (self), manager);
|
||||
|
||||
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
|
||||
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
|
||||
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
|
||||
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
|
||||
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
|
||||
children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
list = g_list_store_new (G_TYPE_LIST_MODEL);
|
||||
g_list_store_append (list, children);
|
||||
g_list_store_append (list, guides);
|
||||
g_list_store_append (list, constraints);
|
||||
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
|
||||
g_object_unref (children);
|
||||
g_object_unref (guides);
|
||||
g_object_unref (constraints);
|
||||
g_object_unref (all_children);
|
||||
g_object_unref (all_constraints);
|
||||
g_object_unref (list);
|
||||
|
||||
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
|
||||
|
||||
controller = (GtkEventController *)gtk_gesture_drag_new ();
|
||||
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
|
||||
|
@@ -55,8 +55,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Name</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -64,8 +64,8 @@
|
||||
<object class="GtkEntry" id="name">
|
||||
<property name="max-width-chars">20</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -74,8 +74,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Min Size</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -84,8 +84,8 @@
|
||||
<property name="adjustment">min_width_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -94,8 +94,8 @@
|
||||
<property name="adjustment">min_height_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -103,8 +103,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Nat Size</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -113,8 +113,8 @@
|
||||
<property name="adjustment">nat_width_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -123,8 +123,8 @@
|
||||
<property name="adjustment">nat_height_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -132,8 +132,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Max Size</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -142,8 +142,8 @@
|
||||
<property name="adjustment">max_width_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -152,8 +152,8 @@
|
||||
<property name="adjustment">max_height_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -161,16 +161,16 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Strength</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="strength">
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -180,8 +180,8 @@
|
||||
<property name="label">Create</property>
|
||||
<signal name="clicked" handler="create_guide"/>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">5</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -34,7 +33,7 @@ static void create_window (GApplication *app, const char *contents);
|
||||
static void
|
||||
show_action_dialog (GSimpleAction *action)
|
||||
{
|
||||
const gchar *name;
|
||||
const char *name;
|
||||
GtkWidget *dialog;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
@@ -58,9 +57,9 @@ show_action_infobar (GSimpleAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
DemoApplicationWindow *window = data;
|
||||
gchar *text;
|
||||
const gchar *name;
|
||||
const gchar *value;
|
||||
char *text;
|
||||
const char *name;
|
||||
const char *value;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
value = g_variant_get_string (parameter, NULL);
|
||||
@@ -92,7 +91,7 @@ activate_new (GSimpleAction *action,
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
gint response_id,
|
||||
int response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFileChooserNative *native = user_data;
|
||||
@@ -185,7 +184,7 @@ activate_about (GSimpleAction *action,
|
||||
{
|
||||
GtkWidget *window = user_data;
|
||||
|
||||
const gchar *authors[] = {
|
||||
const char *authors[] = {
|
||||
"Peter Mattis",
|
||||
"Spencer Kimball",
|
||||
"Josh MacDonald",
|
||||
@@ -193,7 +192,7 @@ activate_about (GSimpleAction *action,
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *documentors[] = {
|
||||
const char *documentors[] = {
|
||||
"Owen Taylor",
|
||||
"Tony Gale",
|
||||
"Matthias Clasen <mclasen@redhat.com>",
|
||||
@@ -244,9 +243,9 @@ static void
|
||||
update_statusbar (GtkTextBuffer *buffer,
|
||||
DemoApplicationWindow *window)
|
||||
{
|
||||
gchar *msg;
|
||||
gint row, col;
|
||||
gint count;
|
||||
char *msg;
|
||||
int row, col;
|
||||
int count;
|
||||
GtkTextIter iter;
|
||||
|
||||
/* clear any previous message, underflow is allowed */
|
||||
|
@@ -31,8 +31,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -54,8 +54,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -70,8 +70,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -79,8 +79,8 @@
|
||||
<object class="GtkStatusbar" id="status">
|
||||
<property name="hexpand">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -16,8 +16,8 @@ static GtkWidget *placeholder;
|
||||
|
||||
static void
|
||||
on_name_appeared (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
const gchar *name_owner,
|
||||
const char *name,
|
||||
const char *name_owner,
|
||||
gpointer user_data)
|
||||
{
|
||||
name_seen = TRUE;
|
||||
@@ -25,7 +25,7 @@ on_name_appeared (GDBusConnection *connection,
|
||||
|
||||
static void
|
||||
on_name_vanished (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
const char *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (!name_seen)
|
||||
@@ -55,7 +55,7 @@ do_application_demo (GtkWidget *toplevel)
|
||||
|
||||
if (placeholder == NULL)
|
||||
{
|
||||
const gchar *command;
|
||||
const char *command;
|
||||
GError *error = NULL;
|
||||
|
||||
if (g_file_test ("./gtk4-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))
|
||||
|
@@ -12,7 +12,7 @@ static GtkWidget *progress_bar = NULL;
|
||||
static gboolean
|
||||
apply_changes_gradually (gpointer data)
|
||||
{
|
||||
gdouble fraction;
|
||||
double fraction;
|
||||
|
||||
/* Work, work, work... */
|
||||
fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar));
|
||||
@@ -47,8 +47,8 @@ on_assistant_close_cancel (GtkWidget *widget, gpointer data)
|
||||
static void
|
||||
on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
|
||||
{
|
||||
gint current_page, n_pages;
|
||||
gchar *title;
|
||||
int current_page, n_pages;
|
||||
char *title;
|
||||
|
||||
current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
|
||||
n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget));
|
||||
@@ -70,8 +70,8 @@ on_entry_changed (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT (data);
|
||||
GtkWidget *current_page;
|
||||
gint page_number;
|
||||
const gchar *text;
|
||||
int page_number;
|
||||
const char *text;
|
||||
|
||||
page_number = gtk_assistant_get_current_page (assistant);
|
||||
current_page = gtk_assistant_get_nth_page (assistant, page_number);
|
||||
|
@@ -8,6 +8,10 @@
|
||||
<property name="default-height">300</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">12</property>
|
||||
<child>
|
||||
@@ -18,8 +22,8 @@
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -29,8 +33,8 @@
|
||||
<property name="has-frame">1</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -40,8 +44,8 @@
|
||||
<property name="hexpand">1</property>
|
||||
<property name="stack">stack</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -67,8 +71,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Duck</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -76,8 +80,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Background</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -87,8 +91,8 @@
|
||||
<class name="duck"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -98,8 +102,8 @@
|
||||
<class name="gradient"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -108,8 +112,8 @@
|
||||
<property name="label" translatable="yes">
|
||||
Blended picture</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -121,8 +125,8 @@ Blended picture</property>
|
||||
<class name="blend0"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -146,8 +150,8 @@ Blended picture</property>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Red</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -155,8 +159,8 @@ Blended picture</property>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Blue</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -166,8 +170,8 @@ Blended picture</property>
|
||||
<class name="red"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -177,8 +181,8 @@ Blended picture</property>
|
||||
<class name="blue"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -187,8 +191,8 @@ Blended picture</property>
|
||||
<property name="label" translatable="yes">
|
||||
Blended picture</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -200,8 +204,8 @@ Blended picture</property>
|
||||
<class name="blend1"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -228,8 +232,8 @@ Blended picture</property>
|
||||
<class name="cyan"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -239,8 +243,8 @@ Blended picture</property>
|
||||
<class name="magenta"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -250,8 +254,8 @@ Blended picture</property>
|
||||
<class name="yellow"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -262,8 +266,8 @@ Blended picture</property>
|
||||
<class name="blend2"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -275,8 +279,8 @@ Blended picture</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -288,8 +292,8 @@ Blended picture</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -301,8 +305,8 @@ Blended picture</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -314,8 +318,8 @@ Blended picture</property>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -324,8 +328,8 @@ Blended picture</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -132,10 +132,10 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
|
||||
gboolean is_left, is_right, is_top, is_bottom;
|
||||
gboolean has_left, has_right, has_top, has_bottom;
|
||||
|
||||
has_left = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
has_right = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
has_top = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
has_bottom = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
has_left = gtk_widget_has_css_class (child, "left");
|
||||
has_right = gtk_widget_has_css_class (child, "right");
|
||||
has_top = gtk_widget_has_css_class (child, "top");
|
||||
has_bottom = gtk_widget_has_css_class (child, "bottom");
|
||||
|
||||
is_left = is_right = is_top = is_bottom = FALSE;
|
||||
|
||||
@@ -158,24 +158,24 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
|
||||
is_bottom = (child_allocation->y + child_allocation->height == height);
|
||||
|
||||
if (has_left && !is_left)
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
gtk_widget_remove_css_class (child, "left");
|
||||
else if (!has_left && is_left)
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_LEFT);
|
||||
gtk_widget_add_css_class (child, "left");
|
||||
|
||||
if (has_right && !is_right)
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
gtk_widget_remove_css_class (child, "right");
|
||||
else if (!has_right && is_right)
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_RIGHT);
|
||||
gtk_widget_add_css_class (child, "right");
|
||||
|
||||
if (has_top && !is_top)
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
gtk_widget_remove_css_class (child, "top");
|
||||
else if (!has_top && is_top)
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_TOP);
|
||||
gtk_widget_add_css_class (child, "top");
|
||||
|
||||
if (has_bottom && !is_bottom)
|
||||
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_widget_remove_css_class (child, "bottom");
|
||||
else if (!has_bottom && is_bottom)
|
||||
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_widget_add_css_class (child, "bottom");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -21,15 +21,38 @@ about_activate (GSimpleAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *window = user_data;
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *about_dlg;
|
||||
|
||||
builder = g_object_get_data (G_OBJECT (window), "builder");
|
||||
about_dlg = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW (about_dlg), GTK_WINDOW (window));
|
||||
gtk_window_set_hide_on_close (GTK_WINDOW (about_dlg), TRUE);
|
||||
g_signal_connect (about_dlg, "response", G_CALLBACK (gtk_widget_hide), NULL);
|
||||
gtk_widget_show (about_dlg);
|
||||
about_dlg = GTK_WIDGET (g_object_get_data (G_OBJECT (window), "about"));
|
||||
gtk_window_present (GTK_WINDOW (about_dlg));
|
||||
}
|
||||
|
||||
static void
|
||||
remove_timeout (gpointer data)
|
||||
{
|
||||
guint id = GPOINTER_TO_UINT (data);
|
||||
|
||||
g_source_remove (id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pop_status (gpointer data)
|
||||
{
|
||||
gtk_statusbar_pop (GTK_STATUSBAR (data), 0);
|
||||
g_object_set_data (G_OBJECT (data), "timeout", NULL);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
status_message (GtkStatusbar *status,
|
||||
const char *text)
|
||||
{
|
||||
guint id;
|
||||
|
||||
gtk_statusbar_push (GTK_STATUSBAR (status), 0, text);
|
||||
id = g_timeout_add (5000, pop_status, status);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (status), "timeout", GUINT_TO_POINTER (id), remove_timeout);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -37,7 +60,10 @@ help_activate (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_print ("Help not available\n");
|
||||
GtkWidget *status;
|
||||
|
||||
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
|
||||
status_message (GTK_STATUSBAR (status), "Help not available");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -45,7 +71,13 @@ not_implemented (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_print ("Action “%s” not implemented\n", g_action_get_name (G_ACTION (action)));
|
||||
GtkWidget *status;
|
||||
char *text;
|
||||
|
||||
text = g_strdup_printf ("Action “%s” not implemented", g_action_get_name (G_ACTION (action)));
|
||||
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
|
||||
status_message (GTK_STATUSBAR (status), text);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
@@ -70,6 +102,8 @@ do_builder (GtkWidget *do_widget)
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *about;
|
||||
GtkWidget *status;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
|
||||
|
||||
@@ -83,6 +117,16 @@ do_builder (GtkWidget *do_widget)
|
||||
window);
|
||||
gtk_widget_insert_action_group (window, "win", actions);
|
||||
|
||||
about = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW (about), GTK_WINDOW (window));
|
||||
gtk_window_set_hide_on_close (GTK_WINDOW (about), TRUE);
|
||||
g_signal_connect (about, "response", G_CALLBACK (gtk_widget_hide), NULL);
|
||||
g_object_set_data_full (G_OBJECT (window), "about",
|
||||
about, (GDestroyNotify)gtk_window_destroy);
|
||||
|
||||
status = GTK_WIDGET (gtk_builder_get_object (builder, "statusbar1"));
|
||||
g_object_set_data (G_OBJECT (window), "status", status);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ create_icon_store (void)
|
||||
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store;
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
@@ -77,7 +77,7 @@ set_sensitive (GtkCellLayout *cell_layout,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
gint *indices;
|
||||
int *indices;
|
||||
gboolean sensitive;
|
||||
|
||||
path = gtk_tree_model_get_path (tree_model, iter);
|
||||
@@ -175,7 +175,7 @@ create_capital_store (void)
|
||||
|
||||
GtkTreeIter iter, iter2;
|
||||
GtkTreeStore *store;
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
store = gtk_tree_store_new (1, G_TYPE_STRING);
|
||||
|
||||
|
@@ -38,14 +38,14 @@ struct {
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
static void
|
||||
update_css_for_blend_mode (GtkCssProvider *provider,
|
||||
const gchar *blend_mode)
|
||||
const char *blend_mode)
|
||||
{
|
||||
GBytes *bytes;
|
||||
gchar *css;
|
||||
char *css;
|
||||
|
||||
bytes = g_resources_lookup_data ("/css_blendmodes/css_blendmodes.css", 0, NULL);
|
||||
|
||||
css = g_strdup_printf ((gchar*) g_bytes_get_data (bytes, NULL),
|
||||
css = g_strdup_printf ((char *) g_bytes_get_data (bytes, NULL),
|
||||
blend_mode,
|
||||
blend_mode,
|
||||
blend_mode);
|
||||
@@ -62,7 +62,7 @@ row_activated (GtkListBox *listbox,
|
||||
GtkListBoxRow *row,
|
||||
GtkCssProvider *provider)
|
||||
{
|
||||
const gchar *blend_mode;
|
||||
const char *blend_mode;
|
||||
|
||||
blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id;
|
||||
|
||||
@@ -75,7 +75,7 @@ setup_listbox (GtkBuilder *builder,
|
||||
{
|
||||
GtkWidget *normal_row;
|
||||
GtkWidget *listbox;
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
normal_row = NULL;
|
||||
listbox = gtk_list_box_new ();
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<property name="name">default</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="default_cursor_image">
|
||||
<property name="texture">resource:///cursors/default_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/default_cursor.png</property>
|
||||
<property name="hotspot-x">5</property>
|
||||
<property name="hotspot-y">5</property>
|
||||
</object>
|
||||
@@ -13,7 +13,7 @@
|
||||
<property name="fallback">default_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="default_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/default_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/default_cursor.png</property>
|
||||
<property name="hotspot-x">5</property>
|
||||
<property name="hotspot-y">5</property>
|
||||
<property name="fallback">default_cursor</property>
|
||||
@@ -22,21 +22,21 @@
|
||||
<property name="name">none</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="none_cursor_image">
|
||||
<property name="texture">resource:///cursors/none_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/none_cursor.png</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="none_cursor_fallback">
|
||||
<property name="name">none</property>
|
||||
<property name="fallback">none_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="none_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/none_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/none_cursor.png</property>
|
||||
<property name="fallback">none_cursor</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="gtk-logo_cursor">
|
||||
<property name="name">gtk-logo</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="gtk-logo_cursor_image">
|
||||
<property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/gtk_logo_cursor.png</property>
|
||||
<property name="hotspot-x">18</property>
|
||||
<property name="hotspot-y">2</property>
|
||||
</object>
|
||||
@@ -45,7 +45,7 @@
|
||||
<property name="fallback">gtk-logo_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="gtk-logo_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/gtk_logo_cursor.png</property>
|
||||
<property name="hotspot-x">18</property>
|
||||
<property name="hotspot-y">2</property>
|
||||
<property name="fallback">gtk-logo_cursor</property>
|
||||
@@ -54,7 +54,7 @@
|
||||
<property name="name">context-menu</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="context-menu_cursor_image">
|
||||
<property name="texture">resource:///cursors/context_menu_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/context_menu_cursor.png</property>
|
||||
<property name="hotspot-x">5</property>
|
||||
<property name="hotspot-y">5</property>
|
||||
</object>
|
||||
@@ -63,7 +63,7 @@
|
||||
<property name="fallback">context-menu_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="context-menu_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/context_menu_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/context_menu_cursor.png</property>
|
||||
<property name="hotspot-x">5</property>
|
||||
<property name="hotspot-y">5</property>
|
||||
<property name="fallback">context-menu_cursor</property>
|
||||
@@ -72,7 +72,7 @@
|
||||
<property name="name">help</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="help_cursor_image">
|
||||
<property name="texture">resource:///cursors/help_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/help_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">27</property>
|
||||
</object>
|
||||
@@ -81,7 +81,7 @@
|
||||
<property name="fallback">help_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="help_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/help_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/help_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">27</property>
|
||||
<property name="fallback">help_cursor</property>
|
||||
@@ -90,7 +90,7 @@
|
||||
<property name="name">pointer</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="pointer_cursor_image">
|
||||
<property name="texture">resource:///cursors/pointer_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/pointer_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">9</property>
|
||||
</object>
|
||||
@@ -99,7 +99,7 @@
|
||||
<property name="fallback">pointer_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="pointer_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/pointer_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/pointer_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">9</property>
|
||||
<property name="fallback">pointer_cursor</property>
|
||||
@@ -108,7 +108,7 @@
|
||||
<property name="name">progress</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="progress_cursor_image">
|
||||
<property name="texture">resource:///cursors/progress_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/progress_cursor.png</property>
|
||||
<property name="hotspot-x">5</property>
|
||||
<property name="hotspot-y">4</property>
|
||||
</object>
|
||||
@@ -117,7 +117,7 @@
|
||||
<property name="fallback">progress_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="progress_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/progress_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/progress_cursor.png</property>
|
||||
<property name="hotspot-x">5</property>
|
||||
<property name="hotspot-y">4</property>
|
||||
<property name="fallback">progress_cursor</property>
|
||||
@@ -126,7 +126,7 @@
|
||||
<property name="name">wait</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="wait_cursor_image">
|
||||
<property name="texture">resource:///cursors/wait_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/wait_cursor.png</property>
|
||||
<property name="hotspot-x">11</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
</object>
|
||||
@@ -135,7 +135,7 @@
|
||||
<property name="fallback">wait_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="wait_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/wait_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/wait_cursor.png</property>
|
||||
<property name="hotspot-x">11</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
<property name="fallback">wait_cursor</property>
|
||||
@@ -144,7 +144,7 @@
|
||||
<property name="name">cell</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="cell_cursor_image">
|
||||
<property name="texture">resource:///cursors/cell_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/cell_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
</object>
|
||||
@@ -153,7 +153,7 @@
|
||||
<property name="fallback">cell_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="cell_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/cell_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/cell_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
<property name="fallback">cell_cursor</property>
|
||||
@@ -162,7 +162,7 @@
|
||||
<property name="name">crosshair</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="crosshair_cursor_image">
|
||||
<property name="texture">resource:///cursors/crosshair_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/crosshair_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
</object>
|
||||
@@ -171,7 +171,7 @@
|
||||
<property name="fallback">crosshair_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="crosshair_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/crosshair_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/crosshair_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
<property name="fallback">crosshair_cursor</property>
|
||||
@@ -180,7 +180,7 @@
|
||||
<property name="name">text</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="text_cursor_image">
|
||||
<property name="texture">resource:///cursors/text_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/text_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
</object>
|
||||
@@ -189,7 +189,7 @@
|
||||
<property name="fallback">text_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="text_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/text_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/text_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
<property name="fallback">text_cursor</property>
|
||||
@@ -198,7 +198,7 @@
|
||||
<property name="name">vertical-text</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="vertical-text_cursor_image">
|
||||
<property name="texture">resource:///cursors/vertical_text_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/vertical_text_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
</object>
|
||||
@@ -207,7 +207,7 @@
|
||||
<property name="fallback">vertical-text_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="vertical-text_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/vertical_text_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/vertical_text_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
<property name="fallback">vertical-text_cursor</property>
|
||||
@@ -216,7 +216,7 @@
|
||||
<property name="name">alias</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="alias_cursor_image">
|
||||
<property name="texture">resource:///cursors/alias_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/alias_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
</object>
|
||||
@@ -225,7 +225,7 @@
|
||||
<property name="fallback">alias_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="alias_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/alias_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/alias_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
<property name="fallback">alias_cursor</property>
|
||||
@@ -234,7 +234,7 @@
|
||||
<property name="name">copy</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="copy_cursor_image">
|
||||
<property name="texture">resource:///cursors/copy_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/copy_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
</object>
|
||||
@@ -243,7 +243,7 @@
|
||||
<property name="fallback">copy_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="copy_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/copy_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/copy_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
<property name="fallback">copy_cursor</property>
|
||||
@@ -252,7 +252,7 @@
|
||||
<property name="name">move</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="move_cursor_image">
|
||||
<property name="texture">resource:///cursors/move_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/move_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
</object>
|
||||
@@ -261,7 +261,7 @@
|
||||
<property name="fallback">move_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="move_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/move_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/move_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
<property name="fallback">move_cursor</property>
|
||||
@@ -270,7 +270,7 @@
|
||||
<property name="name">no-drop</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="no-drop_cursor_image">
|
||||
<property name="texture">resource:///cursors/no_drop_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/no_drop_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
</object>
|
||||
@@ -279,7 +279,7 @@
|
||||
<property name="fallback">no-drop_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="no-drop_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/no_drop_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/no_drop_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
<property name="fallback">no-drop_cursor</property>
|
||||
@@ -288,7 +288,7 @@
|
||||
<property name="name">not-allowed</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="not-allowed_cursor_image">
|
||||
<property name="texture">resource:///cursors/not_allowed_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/not_allowed_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
</object>
|
||||
@@ -297,7 +297,7 @@
|
||||
<property name="fallback">not-allowed_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="not-allowed_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/not_allowed_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/not_allowed_cursor.png</property>
|
||||
<property name="hotspot-x">12</property>
|
||||
<property name="hotspot-y">11</property>
|
||||
<property name="fallback">not-allowed_cursor</property>
|
||||
@@ -306,7 +306,7 @@
|
||||
<property name="name">grab</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="grab_cursor_image">
|
||||
<property name="texture">resource:///cursors/grab_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/grab_cursor.png</property>
|
||||
<property name="hotspot-x">10</property>
|
||||
<property name="hotspot-y">6</property>
|
||||
</object>
|
||||
@@ -315,7 +315,7 @@
|
||||
<property name="fallback">grab_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="grab_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/grab_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/grab_cursor.png</property>
|
||||
<property name="hotspot-x">10</property>
|
||||
<property name="hotspot-y">6</property>
|
||||
<property name="fallback">grab_cursor</property>
|
||||
@@ -324,7 +324,7 @@
|
||||
<property name="name">grabbing</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="grabbing_cursor_image">
|
||||
<property name="texture">resource:///cursors/grabbing_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/grabbing_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">14</property>
|
||||
</object>
|
||||
@@ -333,7 +333,7 @@
|
||||
<property name="fallback">grabbing_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="grabbing_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/grabbing_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/grabbing_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">14</property>
|
||||
<property name="fallback">grabbing_cursor</property>
|
||||
@@ -342,7 +342,7 @@
|
||||
<property name="name">all-scroll</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="all-scroll_cursor_image">
|
||||
<property name="texture">resource:///cursors/all_scroll_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/all_scroll_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
</object>
|
||||
@@ -351,7 +351,7 @@
|
||||
<property name="fallback">all-scroll_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="all-scroll_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/all_scroll_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/all_scroll_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
<property name="fallback">all-scroll_cursor</property>
|
||||
@@ -360,7 +360,7 @@
|
||||
<property name="name">col-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="col-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/col_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/col_resize_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
</object>
|
||||
@@ -369,7 +369,7 @@
|
||||
<property name="fallback">col-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="col-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/col_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/col_resize_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
<property name="fallback">col-resize_cursor</property>
|
||||
@@ -378,7 +378,7 @@
|
||||
<property name="name">row-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="row-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/row_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/row_resize_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
</object>
|
||||
@@ -387,7 +387,7 @@
|
||||
<property name="fallback">row-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="row-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/row_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/row_resize_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
<property name="fallback">row-resize_cursor</property>
|
||||
@@ -396,7 +396,7 @@
|
||||
<property name="name">n-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="n-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/n_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/n_resize_cursor.png</property>
|
||||
<property name="hotspot-x">17</property>
|
||||
<property name="hotspot-y">7</property>
|
||||
</object>
|
||||
@@ -405,7 +405,7 @@
|
||||
<property name="fallback">n-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="n-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/n_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/n_resize_cursor.png</property>
|
||||
<property name="hotspot-x">17</property>
|
||||
<property name="hotspot-y">7</property>
|
||||
<property name="fallback">n-resize_cursor</property>
|
||||
@@ -414,7 +414,7 @@
|
||||
<property name="name">e-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="e-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/e_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/e_resize_cursor.png</property>
|
||||
<property name="hotspot-x">25</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
</object>
|
||||
@@ -423,7 +423,7 @@
|
||||
<property name="fallback">e-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="e-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/e_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/e_resize_cursor.png</property>
|
||||
<property name="hotspot-x">25</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
<property name="fallback">e-resize_cursor</property>
|
||||
@@ -432,7 +432,7 @@
|
||||
<property name="name">s-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="s-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/s_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/s_resize_cursor.png</property>
|
||||
<property name="hotspot-x">17</property>
|
||||
<property name="hotspot-y">23</property>
|
||||
</object>
|
||||
@@ -441,7 +441,7 @@
|
||||
<property name="fallback">s-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="s-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/s_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/s_resize_cursor.png</property>
|
||||
<property name="hotspot-x">17</property>
|
||||
<property name="hotspot-y">23</property>
|
||||
<property name="fallback">s-resize_cursor</property>
|
||||
@@ -450,7 +450,7 @@
|
||||
<property name="name">w-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="w-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/w_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/w_resize_cursor.png</property>
|
||||
<property name="hotspot-x">8</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
</object>
|
||||
@@ -459,7 +459,7 @@
|
||||
<property name="fallback">w-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="w-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/w_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/w_resize_cursor.png</property>
|
||||
<property name="hotspot-x">8</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
<property name="fallback">w-resize_cursor</property>
|
||||
@@ -468,7 +468,7 @@
|
||||
<property name="name">ne-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="ne-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/ne_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/ne_resize_cursor.png</property>
|
||||
<property name="hotspot-x">20</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
</object>
|
||||
@@ -477,7 +477,7 @@
|
||||
<property name="fallback">ne-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="ne-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/ne_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/ne_resize_cursor.png</property>
|
||||
<property name="hotspot-x">20</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
<property name="fallback">ne-resize_cursor</property>
|
||||
@@ -486,7 +486,7 @@
|
||||
<property name="name">nw-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="nw-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/nw_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/nw_resize_cursor.png</property>
|
||||
<property name="hotspot-x">13</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
</object>
|
||||
@@ -495,7 +495,7 @@
|
||||
<property name="fallback">nw-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="nw-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/nw_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/nw_resize_cursor.png</property>
|
||||
<property name="hotspot-x">13</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
<property name="fallback">nw-resize_cursor</property>
|
||||
@@ -504,7 +504,7 @@
|
||||
<property name="name">se-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="se-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/se_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/se_resize_cursor.png</property>
|
||||
<property name="hotspot-x">19</property>
|
||||
<property name="hotspot-y">19</property>
|
||||
</object>
|
||||
@@ -513,7 +513,7 @@
|
||||
<property name="fallback">se-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="se-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/se_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/se_resize_cursor.png</property>
|
||||
<property name="hotspot-x">19</property>
|
||||
<property name="hotspot-y">19</property>
|
||||
<property name="fallback">se-resize_cursor</property>
|
||||
@@ -522,7 +522,7 @@
|
||||
<property name="name">sw-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="sw-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/sw_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/sw_resize_cursor.png</property>
|
||||
<property name="hotspot-x">13</property>
|
||||
<property name="hotspot-y">19</property>
|
||||
</object>
|
||||
@@ -531,7 +531,7 @@
|
||||
<property name="fallback">sw-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="sw-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/sw_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/sw_resize_cursor.png</property>
|
||||
<property name="hotspot-x">13</property>
|
||||
<property name="hotspot-y">19</property>
|
||||
<property name="fallback">sw-resize_cursor</property>
|
||||
@@ -540,7 +540,7 @@
|
||||
<property name="name">ew-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="ew-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/ew_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/ew_resize_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
</object>
|
||||
@@ -549,7 +549,7 @@
|
||||
<property name="fallback">ew-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="ew-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/ew_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/ew_resize_cursor.png</property>
|
||||
<property name="hotspot-x">16</property>
|
||||
<property name="hotspot-y">15</property>
|
||||
<property name="fallback">ew-resize_cursor</property>
|
||||
@@ -558,7 +558,7 @@
|
||||
<property name="name">ns-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="ns-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/ns_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/ns_resize_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
</object>
|
||||
@@ -567,7 +567,7 @@
|
||||
<property name="fallback">ns-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="ns-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/ns_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/ns_resize_cursor.png</property>
|
||||
<property name="hotspot-x">15</property>
|
||||
<property name="hotspot-y">17</property>
|
||||
<property name="fallback">ns-resize_cursor</property>
|
||||
@@ -576,7 +576,7 @@
|
||||
<property name="name">nesw-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="nesw-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/nesw_resize_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">14</property>
|
||||
</object>
|
||||
@@ -585,7 +585,7 @@
|
||||
<property name="fallback">nesw-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="nesw-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/nesw_resize_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">14</property>
|
||||
<property name="fallback">nesw-resize_cursor</property>
|
||||
@@ -594,7 +594,7 @@
|
||||
<property name="name">nwse-resize</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="nwse-resize_cursor_image">
|
||||
<property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/nwse_resize_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">14</property>
|
||||
</object>
|
||||
@@ -603,7 +603,7 @@
|
||||
<property name="fallback">nwse-resize_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="nwse-resize_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/nwse_resize_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">14</property>
|
||||
<property name="fallback">nwse-resize_cursor</property>
|
||||
@@ -612,7 +612,7 @@
|
||||
<property name="name">zoom-in</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="zoom-in_cursor_image">
|
||||
<property name="texture">resource:///cursors/zoom_in_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/zoom_in_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
</object>
|
||||
@@ -621,7 +621,7 @@
|
||||
<property name="fallback">zoom-in_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="zoom-in_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/zoom_in_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/zoom_in_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
<property name="fallback">zoom-in_cursor</property>
|
||||
@@ -630,7 +630,7 @@
|
||||
<property name="name">zoom-out</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="zoom-out_cursor_image">
|
||||
<property name="texture">resource:///cursors/zoom_out_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/zoom_out_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
</object>
|
||||
@@ -639,7 +639,7 @@
|
||||
<property name="fallback">zoom-out_cursor_image</property>
|
||||
</object>
|
||||
<object class="GdkCursor" id="zoom-out_cursor_image_fallback">
|
||||
<property name="texture">resource:///cursors/zoom_out_cursor.png</property>
|
||||
<property name="texture">resource:///cursors/images/zoom_out_cursor.png</property>
|
||||
<property name="hotspot-x">14</property>
|
||||
<property name="hotspot-y">13</property>
|
||||
<property name="fallback">zoom-out_cursor</property>
|
||||
@@ -682,7 +682,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/default_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/default_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -742,7 +742,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/none_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/none_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -802,7 +802,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/gtk_logo_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/gtk_logo_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -875,7 +875,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/context_menu_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/context_menu_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -935,7 +935,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/help_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/help_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -995,7 +995,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/pointer_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/pointer_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1055,7 +1055,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/progress_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/progress_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1115,7 +1115,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/wait_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/wait_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1188,7 +1188,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/cell_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/cell_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1248,7 +1248,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/crosshair_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/crosshair_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1308,7 +1308,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/text_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/text_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1368,7 +1368,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/vertical_text_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/vertical_text_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1441,7 +1441,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/alias_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/alias_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1501,7 +1501,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/copy_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/copy_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1561,7 +1561,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/move_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/move_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1621,7 +1621,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/no_drop_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/no_drop_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1681,7 +1681,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/not_allowed_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/not_allowed_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1741,7 +1741,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/grab_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/grab_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1801,7 +1801,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/grabbing_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/grabbing_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1874,7 +1874,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/all_scroll_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/all_scroll_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1934,7 +1934,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/col_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/col_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1994,7 +1994,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/row_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/row_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2054,7 +2054,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/n_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/n_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2114,7 +2114,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/e_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/e_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2174,7 +2174,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/s_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/s_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2234,7 +2234,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/w_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/w_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2294,7 +2294,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/ne_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/ne_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2354,7 +2354,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/nw_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/nw_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2414,7 +2414,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/sw_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/sw_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2474,7 +2474,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/se_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/se_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2534,7 +2534,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/ew_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/ew_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2594,7 +2594,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/ns_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/ns_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2654,7 +2654,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/nesw_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/nesw_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2714,7 +2714,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/nwse_resize_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/nwse_resize_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2787,7 +2787,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/zoom_in_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/zoom_in_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2847,7 +2847,7 @@
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="paintable">resource:///cursors/zoom_out_cursor.png</property>
|
||||
<property name="paintable">resource:///cursors/images/zoom_out_cursor.png</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@@ -51,6 +51,8 @@
|
||||
<file>cssview.css</file>
|
||||
<file>reset.css</file>
|
||||
<file>background.jpg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/css_pixbufs/images">
|
||||
<file>apple-red.png</file>
|
||||
<file>gnome-applets.png</file>
|
||||
<file>gnome-calendar.png</file>
|
||||
@@ -67,6 +69,8 @@
|
||||
</gresource>
|
||||
<gresource prefix="/cursors">
|
||||
<file>cursors.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/cursors/images">
|
||||
<file>alias_cursor.png</file>
|
||||
<file>all_scroll_cursor.png</file>
|
||||
<file>cell_cursor.png</file>
|
||||
@@ -124,6 +128,14 @@
|
||||
<file>gnome-fs-directory.png</file>
|
||||
<file>gnome-fs-regular.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/layoutmanager">
|
||||
<file>demolayout.h</file>
|
||||
<file>demolayout.c</file>
|
||||
<file>demowidget.h</file>
|
||||
<file>demowidget.c</file>
|
||||
<file>demochild.h</file>
|
||||
<file>demochild.c</file>
|
||||
</gresource>
|
||||
<gresource prefix="/listview_filebrowser">
|
||||
<file>listview_filebrowser.ui</file>
|
||||
<file>listview_filebrowser.css</file>
|
||||
@@ -165,17 +177,6 @@
|
||||
<file>floppybuddy.gif</file>
|
||||
<file>gtk-logo.webm</file>
|
||||
</gresource>
|
||||
<gresource prefix="/pixbufs">
|
||||
<file>apple-red.png</file>
|
||||
<file>background.jpg</file>
|
||||
<file>gnome-applets.png</file>
|
||||
<file>gnome-calendar.png</file>
|
||||
<file>gnome-foot.png</file>
|
||||
<file>gnome-gmush.png</file>
|
||||
<file>gnome-gimp.png</file>
|
||||
<file>gnome-gsame.png</file>
|
||||
<file>gnu-keys.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/sources">
|
||||
<file>application_demo.c</file>
|
||||
<file>assistant.c</file>
|
||||
@@ -217,8 +218,10 @@
|
||||
<file>iconview_edit.c</file>
|
||||
<file>images.c</file>
|
||||
<file>infobar.c</file>
|
||||
<file>layoutmanager.c</file>
|
||||
<file>links.c</file>
|
||||
<file>listbox.c</file>
|
||||
<file>listbox2.c</file>
|
||||
<file>listview_applauncher.c</file>
|
||||
<file>listview_colors.c</file>
|
||||
<file>listview_clocks.c</file>
|
||||
@@ -229,7 +232,6 @@
|
||||
<file>listview_words.c</file>
|
||||
<file>list_store.c</file>
|
||||
<file>markup.c</file>
|
||||
<file>modelbutton.c</file>
|
||||
<file>overlay.c</file>
|
||||
<file>overlay2.c</file>
|
||||
<file>paint.c</file>
|
||||
@@ -241,7 +243,6 @@
|
||||
<file>password_entry.c</file>
|
||||
<file>peg_solitaire.c</file>
|
||||
<file>pickers.c</file>
|
||||
<file>pixbufs.c</file>
|
||||
<file>printing.c</file>
|
||||
<file>revealer.c</file>
|
||||
<file>rotated_text.c</file>
|
||||
@@ -279,6 +280,9 @@
|
||||
<file>messages.txt</file>
|
||||
<file>apple-red.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/listbox2">
|
||||
<file>listbox2.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/glarea">
|
||||
<file>glarea-gl.fs.glsl</file>
|
||||
<file>glarea-gl.vs.glsl</file>
|
||||
@@ -310,9 +314,6 @@
|
||||
<gresource prefix="/scale">
|
||||
<file>scale.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/modelbutton">
|
||||
<file>modelbutton.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/tagged_entry">
|
||||
<file>demotaggedentry.c</file>
|
||||
<file>demotaggedentry.h</file>
|
||||
|
@@ -95,9 +95,6 @@
|
||||
<property name="program-name" translatable="yes">Builder demo</property>
|
||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||
<property name="modal">True</property>
|
||||
<accessibility>
|
||||
<relation target="window1" type="subwindow-of"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default-height">250</property>
|
||||
@@ -113,11 +110,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar1">
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-toolbar">
|
||||
<property name="AtkObject::accessible-name">The toolbar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
@@ -174,14 +166,6 @@
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="model">liststore1</property>
|
||||
<property name="tooltip-column">3</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-treeview">
|
||||
<property name="AtkObject::accessible-name">Name list</property>
|
||||
<property name="AtkObject::accessible-description">
|
||||
A list of person with name, surname and age columns
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column1">
|
||||
<property name="title">Name</property>
|
||||
|
72
demos/gtk-demo/demochild.c
Normal file
72
demos/gtk-demo/demochild.c
Normal file
@@ -0,0 +1,72 @@
|
||||
#include "demochild.h"
|
||||
|
||||
/* This is a trivial child widget just for demo purposes.
|
||||
* It draws a 32x32 square in fixed color.
|
||||
*/
|
||||
|
||||
struct _DemoChild
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
GdkRGBA color;
|
||||
};
|
||||
|
||||
struct _DemoChildClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (DemoChild, demo_child, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
demo_child_init (DemoChild *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
demo_child_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
DemoChild *self = DEMO_CHILD (widget);
|
||||
int width, height;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
gtk_snapshot_append_color (snapshot, &self->color,
|
||||
&GRAPHENE_RECT_INIT(0, 0, width, height));
|
||||
}
|
||||
|
||||
static void
|
||||
demo_child_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
*minimum = *natural = 32;
|
||||
}
|
||||
|
||||
static void
|
||||
demo_child_class_init (DemoChildClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
widget_class->snapshot = demo_child_snapshot;
|
||||
widget_class->measure = demo_child_measure;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
demo_child_new (const char *color)
|
||||
{
|
||||
DemoChild *self;
|
||||
|
||||
self = g_object_new (DEMO_TYPE_CHILD,
|
||||
"tooltip-text", color,
|
||||
NULL);
|
||||
|
||||
gdk_rgba_parse (&self->color, color);
|
||||
|
||||
return GTK_WIDGET (self);
|
||||
}
|
8
demos/gtk-demo/demochild.h
Normal file
8
demos/gtk-demo/demochild.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define DEMO_TYPE_CHILD (demo_child_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (DemoChild, demo_child, DEMO, CHILD, GtkWidget)
|
||||
|
||||
GtkWidget * demo_child_new (const char *color);
|
@@ -17,7 +17,7 @@ G_DEFINE_TYPE(DemoImage, demo_image, GTK_TYPE_WIDGET)
|
||||
static GdkPaintable *
|
||||
get_image_paintable (GtkImage *image)
|
||||
{
|
||||
const gchar *icon_name;
|
||||
const char *icon_name;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIconPaintable *icon;
|
||||
|
||||
|
189
demos/gtk-demo/demolayout.c
Normal file
189
demos/gtk-demo/demolayout.c
Normal file
@@ -0,0 +1,189 @@
|
||||
#include "demolayout.h"
|
||||
|
||||
struct _DemoLayout
|
||||
{
|
||||
GtkLayoutManager parent_instance;
|
||||
|
||||
float position;
|
||||
int pos[16];
|
||||
};
|
||||
|
||||
struct _DemoLayoutClass
|
||||
{
|
||||
GtkLayoutManagerClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (DemoLayout, demo_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
static void
|
||||
demo_layout_measure (GtkLayoutManager *layout_manager,
|
||||
GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
GtkWidget *child;
|
||||
int minimum_size = 0;
|
||||
int natural_size = 0;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
int child_min = 0, child_nat = 0;
|
||||
|
||||
if (!gtk_widget_should_layout (child))
|
||||
continue;
|
||||
|
||||
gtk_widget_measure (child, orientation, -1,
|
||||
&child_min, &child_nat,
|
||||
NULL, NULL);
|
||||
minimum_size = MAX (minimum_size, child_min);
|
||||
natural_size = MAX (natural_size, child_nat);
|
||||
}
|
||||
|
||||
/* A back-of-a-napkin calculation to reserve enough
|
||||
* space for arranging 16 children in a circle.
|
||||
*/
|
||||
*minimum = 16 * minimum_size / G_PI + minimum_size;
|
||||
*natural = 16 * natural_size / G_PI + natural_size;
|
||||
}
|
||||
|
||||
static void
|
||||
demo_layout_allocate (GtkLayoutManager *layout_manager,
|
||||
GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
DemoLayout *self = DEMO_LAYOUT (layout_manager);
|
||||
GtkWidget *child;
|
||||
int i;
|
||||
int child_width = 0;
|
||||
int child_height = 0;
|
||||
int x0, y0;
|
||||
float r;
|
||||
float t;
|
||||
|
||||
t = self->position;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
GtkRequisition child_req;
|
||||
|
||||
if (!gtk_widget_should_layout (child))
|
||||
continue;
|
||||
|
||||
gtk_widget_get_preferred_size (child, &child_req, NULL);
|
||||
|
||||
child_width = MAX (child_width, child_req.width);
|
||||
child_height = MAX (child_height, child_req.height);
|
||||
}
|
||||
|
||||
/* the center of our layout */
|
||||
x0 = (width / 2);
|
||||
y0 = (height / 2);
|
||||
|
||||
/* the radius for our circle of children */
|
||||
r = 8 * child_width / G_PI;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget), i = 0;
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child), i++)
|
||||
{
|
||||
GtkRequisition child_req;
|
||||
float a = self->pos[i] * G_PI / 8;
|
||||
int gx, gy;
|
||||
int cx, cy;
|
||||
int x, y;
|
||||
|
||||
if (!gtk_widget_should_layout (child))
|
||||
continue;
|
||||
|
||||
gtk_widget_get_preferred_size (child, &child_req, NULL);
|
||||
|
||||
/* The grid position of child. */
|
||||
gx = x0 + (i % 4 - 2) * child_width;
|
||||
gy = y0 + (i / 4 - 2) * child_height;
|
||||
|
||||
/* The circle position of child. Note that we
|
||||
* are adjusting the position by half the child size
|
||||
* to place the center of child on a centered circle.
|
||||
* This assumes that the children don't use align flags
|
||||
* or uneven margins that would shift the center.
|
||||
*/
|
||||
cx = x0 + sin (a) * r - child_req.width / 2;
|
||||
cy = y0 + cos (a) * r - child_req.height / 2;
|
||||
|
||||
/* we interpolate between the two layouts according to
|
||||
* the position value that has been set on the layout.
|
||||
*/
|
||||
x = t * cx + (1 - t) * gx;
|
||||
y = t * cy + (1 - t) * gy;
|
||||
|
||||
gtk_widget_size_allocate (child,
|
||||
&(const GtkAllocation){ x, y, child_width, child_height},
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
static GtkSizeRequestMode
|
||||
demo_layout_get_request_mode (GtkLayoutManager *layout_manager,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
demo_layout_class_init (DemoLayoutClass *klass)
|
||||
{
|
||||
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
|
||||
|
||||
layout_class->get_request_mode = demo_layout_get_request_mode;
|
||||
layout_class->measure = demo_layout_measure;
|
||||
layout_class->allocate = demo_layout_allocate;
|
||||
}
|
||||
|
||||
static void
|
||||
demo_layout_init (DemoLayout *self)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
self->pos[i] = i;
|
||||
}
|
||||
|
||||
GtkLayoutManager *
|
||||
demo_layout_new (void)
|
||||
{
|
||||
return g_object_new (DEMO_TYPE_LAYOUT, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
demo_layout_set_position (DemoLayout *layout,
|
||||
float position)
|
||||
{
|
||||
layout->position = position;
|
||||
}
|
||||
|
||||
/* Shuffle the circle positions of the children.
|
||||
* Should be called when we are in the grid layout.
|
||||
*/
|
||||
void
|
||||
demo_layout_shuffle (DemoLayout *layout)
|
||||
{
|
||||
int i, j, tmp;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
j = g_random_int_range (0, i + 1);
|
||||
tmp = layout->pos[i];
|
||||
layout->pos[i] = layout->pos[j];
|
||||
layout->pos[j] = tmp;
|
||||
}
|
||||
}
|
13
demos/gtk-demo/demolayout.h
Normal file
13
demos/gtk-demo/demolayout.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define DEMO_TYPE_LAYOUT (demo_layout_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (DemoLayout, demo_layout, DEMO, LAYOUT, GtkLayoutManager)
|
||||
|
||||
GtkLayoutManager * demo_layout_new (void);
|
||||
|
||||
void demo_layout_set_position (DemoLayout *layout,
|
||||
float position);
|
||||
void demo_layout_shuffle (DemoLayout *layout);
|
@@ -23,14 +23,12 @@
|
||||
#include "demotaggedentry.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtk-a11y.h>
|
||||
|
||||
struct _DemoTaggedEntry
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *box;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *text;
|
||||
};
|
||||
|
||||
struct _DemoTaggedEntryClass
|
||||
@@ -46,15 +44,10 @@ G_DEFINE_TYPE_WITH_CODE (DemoTaggedEntry, demo_tagged_entry, GTK_TYPE_WIDGET,
|
||||
static void
|
||||
demo_tagged_entry_init (DemoTaggedEntry *entry)
|
||||
{
|
||||
entry->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_parent (entry->box, GTK_WIDGET (entry));
|
||||
|
||||
entry->entry = gtk_text_new ();
|
||||
gtk_widget_set_hexpand (entry->entry, TRUE);
|
||||
gtk_widget_set_vexpand (entry->entry, TRUE);
|
||||
gtk_widget_set_hexpand (entry->box, FALSE);
|
||||
gtk_widget_set_vexpand (entry->box, FALSE);
|
||||
gtk_box_append (GTK_BOX (entry->box), entry->entry);
|
||||
entry->text = gtk_text_new ();
|
||||
gtk_widget_set_hexpand (entry->text, TRUE);
|
||||
gtk_widget_set_vexpand (entry->text, TRUE);
|
||||
gtk_widget_set_parent (entry->text, GTK_WIDGET (entry));
|
||||
gtk_editable_init_delegate (GTK_EDITABLE (entry));
|
||||
}
|
||||
|
||||
@@ -62,12 +55,15 @@ static void
|
||||
demo_tagged_entry_dispose (GObject *object)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (object);
|
||||
GtkWidget *child;
|
||||
|
||||
if (entry->entry)
|
||||
if (entry->text)
|
||||
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
|
||||
|
||||
g_clear_pointer (&entry->entry, gtk_widget_unparent);
|
||||
g_clear_pointer (&entry->box, gtk_widget_unparent);
|
||||
while ((child = gtk_widget_get_first_child (GTK_WIDGET (entry))))
|
||||
gtk_widget_unparent (child);
|
||||
|
||||
entry->text = NULL;
|
||||
|
||||
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -101,7 +97,7 @@ demo_tagged_entry_grab_focus (GtkWidget *widget)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
|
||||
|
||||
return gtk_widget_grab_focus (entry->entry);
|
||||
return gtk_widget_grab_focus (entry->text);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -118,15 +114,14 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
|
||||
|
||||
gtk_editable_install_properties (object_class, 1);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
gtk_widget_class_set_css_name (widget_class, "entry");
|
||||
}
|
||||
|
||||
static GtkEditable *
|
||||
demo_tagged_entry_get_delegate (GtkEditable *editable)
|
||||
{
|
||||
return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->entry);
|
||||
return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->text);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -147,7 +142,7 @@ demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
gtk_box_append (GTK_BOX (entry->box), tag);
|
||||
gtk_widget_set_parent (tag, GTK_WIDGET (entry));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -157,10 +152,7 @@ demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
if (sibling == NULL)
|
||||
gtk_box_append (GTK_BOX (entry->box), tag);
|
||||
else
|
||||
gtk_box_insert_child_after (GTK_BOX (entry->box), tag, sibling);
|
||||
gtk_widget_insert_after (tag, GTK_WIDGET (entry), sibling);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -169,7 +161,7 @@ demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
gtk_box_remove (GTK_BOX (entry->box), tag);
|
||||
gtk_widget_unparent (tag);
|
||||
}
|
||||
|
||||
struct _DemoTaggedEntryTag
|
||||
|
121
demos/gtk-demo/demowidget.c
Normal file
121
demos/gtk-demo/demowidget.c
Normal file
@@ -0,0 +1,121 @@
|
||||
#include "demowidget.h"
|
||||
#include "demolayout.h"
|
||||
|
||||
/* parent widget */
|
||||
|
||||
struct _DemoWidget
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
gboolean backward; /* whether we go 0 -> 1 or 1 -> 0 */
|
||||
gint64 start_time; /* time the transition started */
|
||||
guint tick_id; /* our tick cb */
|
||||
};
|
||||
|
||||
struct _DemoWidgetClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (DemoWidget, demo_widget, GTK_TYPE_WIDGET)
|
||||
|
||||
/* The widget is controlling the transition by calling
|
||||
* demo_layout_set_position() in a tick callback.
|
||||
*
|
||||
* We take half a second to go from one layout to the other.
|
||||
*/
|
||||
|
||||
#define DURATION (0.5 * G_TIME_SPAN_SECOND)
|
||||
|
||||
static gboolean
|
||||
transition (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer data)
|
||||
{
|
||||
DemoWidget *self = DEMO_WIDGET (widget);
|
||||
DemoLayout *demo_layout = DEMO_LAYOUT (gtk_widget_get_layout_manager (widget));
|
||||
gint64 now = g_get_monotonic_time ();
|
||||
|
||||
gtk_widget_queue_allocate (widget);
|
||||
|
||||
if (self->backward)
|
||||
demo_layout_set_position (demo_layout, 1.0 - (now - self->start_time) / DURATION);
|
||||
else
|
||||
demo_layout_set_position (demo_layout, (now - self->start_time) / DURATION);
|
||||
|
||||
if (now - self->start_time >= DURATION)
|
||||
{
|
||||
self->backward = !self->backward;
|
||||
demo_layout_set_position (demo_layout, self->backward ? 1.0 : 0.0);
|
||||
/* keep things interesting by shuffling the positions */
|
||||
if (!self->backward)
|
||||
demo_layout_shuffle (demo_layout);
|
||||
self->tick_id = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clicked (GtkGestureClick *gesture,
|
||||
guint n_press,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data)
|
||||
{
|
||||
DemoWidget *self = data;
|
||||
|
||||
if (self->tick_id != 0)
|
||||
return;
|
||||
|
||||
self->start_time = g_get_monotonic_time ();
|
||||
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self), transition, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_widget_init (DemoWidget *self)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gesture = gtk_gesture_click_new ();
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
static void
|
||||
demo_widget_dispose (GObject *object)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
|
||||
gtk_widget_unparent (child);
|
||||
|
||||
G_OBJECT_CLASS (demo_widget_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_widget_class_init (DemoWidgetClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = demo_widget_dispose;
|
||||
|
||||
/* here is where we use our custom layout manager */
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, DEMO_TYPE_LAYOUT);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
demo_widget_new (void)
|
||||
{
|
||||
return g_object_new (DEMO_TYPE_WIDGET, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
demo_widget_add_child (DemoWidget *self,
|
||||
GtkWidget *child)
|
||||
{
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (self));
|
||||
}
|
11
demos/gtk-demo/demowidget.h
Normal file
11
demos/gtk-demo/demowidget.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define DEMO_TYPE_WIDGET (demo_widget_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (DemoWidget, demo_widget, DEMO, WIDGET, GtkWidget)
|
||||
|
||||
GtkWidget * demo_widget_new (void);
|
||||
|
||||
void demo_widget_add_child (DemoWidget *self,
|
||||
GtkWidget *child);
|
@@ -16,7 +16,7 @@ message_dialog_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
static gint i = 1;
|
||||
static int i = 1;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
|
@@ -153,6 +153,30 @@ click_done (GtkGesture *gesture)
|
||||
gtk_widget_insert_after (item, canvas, last_child);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
theme_is_dark (void)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
char *theme;
|
||||
gboolean prefer_dark;
|
||||
gboolean dark;
|
||||
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_get (settings,
|
||||
"gtk-theme-name", &theme,
|
||||
"gtk-application-prefer-dark-theme", &prefer_dark,
|
||||
NULL);
|
||||
|
||||
if ((strcmp (theme, "Adwaita") == 0 && prefer_dark) || strcmp (theme, "HighContrastInverse") == 0)
|
||||
dark = TRUE;
|
||||
else
|
||||
dark = FALSE;
|
||||
|
||||
g_free (theme);
|
||||
|
||||
return dark;
|
||||
}
|
||||
|
||||
static void
|
||||
canvas_item_init (CanvasItem *item)
|
||||
{
|
||||
@@ -180,7 +204,11 @@ canvas_item_init (CanvasItem *item)
|
||||
gtk_widget_set_name (item->label, id);
|
||||
g_free (id);
|
||||
|
||||
gdk_rgba_parse (&rgba, "yellow");
|
||||
if (theme_is_dark ())
|
||||
gdk_rgba_parse (&rgba, "blue");
|
||||
else
|
||||
gdk_rgba_parse (&rgba, "yellow");
|
||||
|
||||
set_color (item, &rgba);
|
||||
|
||||
item->angle = 0;
|
||||
@@ -538,7 +566,6 @@ canvas_new (void)
|
||||
canvas = gtk_fixed_new ();
|
||||
gtk_widget_set_hexpand (canvas, TRUE);
|
||||
gtk_widget_set_vexpand (canvas, TRUE);
|
||||
gtk_widget_add_css_class (canvas, "frame");
|
||||
|
||||
source = gtk_drag_source_new ();
|
||||
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
|
||||
@@ -597,6 +624,83 @@ css_button_new (const char *class)
|
||||
return button;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
GdkRGBA color;
|
||||
} ColorSwatch;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
} ColorSwatchClass;
|
||||
|
||||
G_DEFINE_TYPE (ColorSwatch, color_swatch, GTK_TYPE_WIDGET)
|
||||
|
||||
static GdkContentProvider *
|
||||
color_swatch_drag_prepare (GtkDragSource *source,
|
||||
double x,
|
||||
double y,
|
||||
ColorSwatch *swatch)
|
||||
{
|
||||
return gdk_content_provider_new_typed (GDK_TYPE_RGBA, &swatch->color);
|
||||
}
|
||||
|
||||
static void
|
||||
color_swatch_init (ColorSwatch *swatch)
|
||||
{
|
||||
GtkDragSource *source = gtk_drag_source_new ();
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (color_swatch_drag_prepare), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (source));
|
||||
}
|
||||
|
||||
static void
|
||||
color_swatch_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
ColorSwatch *swatch = (ColorSwatch *)widget;
|
||||
float w = gtk_widget_get_width (widget);
|
||||
float h = gtk_widget_get_height (widget);
|
||||
|
||||
gtk_snapshot_append_color (snapshot, &swatch->color,
|
||||
&GRAPHENE_RECT_INIT(0, 0, w, h));
|
||||
}
|
||||
|
||||
void
|
||||
color_swatch_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum_size,
|
||||
int *natural_size,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
*minimum_size = *natural_size = 48;
|
||||
else
|
||||
*minimum_size = *natural_size = 32;
|
||||
}
|
||||
|
||||
static void
|
||||
color_swatch_class_init (ColorSwatchClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
widget_class->snapshot = color_swatch_snapshot;
|
||||
widget_class->measure = color_swatch_measure;
|
||||
gtk_widget_class_set_css_name (widget_class, "colorswatch");
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
color_swatch_new (const char *color)
|
||||
{
|
||||
ColorSwatch *swatch = g_object_new (color_swatch_get_type (), NULL);
|
||||
|
||||
gdk_rgba_parse (&swatch->color, color);
|
||||
|
||||
return GTK_WIDGET (swatch);
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
@@ -659,6 +763,8 @@ do_dnd (GtkWidget *do_widget)
|
||||
y += 100;
|
||||
}
|
||||
|
||||
gtk_box_append (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
@@ -670,18 +776,7 @@ do_dnd (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
|
||||
|
||||
for (i = 0; colors[i]; i++)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
GtkWidget *swatch;
|
||||
|
||||
gdk_rgba_parse (&rgba, colors[i]);
|
||||
|
||||
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
|
||||
"rgba", &rgba,
|
||||
"selectable", FALSE,
|
||||
NULL);
|
||||
gtk_box_append (GTK_BOX (box3), swatch);
|
||||
}
|
||||
gtk_box_append (GTK_BOX (box3), color_swatch_new (colors[i]));
|
||||
|
||||
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow1"));
|
||||
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow2"));
|
||||
|
@@ -64,8 +64,8 @@ scribble_draw (GtkDrawingArea *da,
|
||||
/* Draw a rectangle on the screen */
|
||||
static void
|
||||
draw_brush (GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
GdkRectangle update_rect;
|
||||
cairo_t *cr;
|
||||
|
@@ -254,7 +254,7 @@ do_dropdown (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (box, 10);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
button = gtk_drop_down_new ();
|
||||
button = gtk_drop_down_new (NULL, NULL);
|
||||
|
||||
model = G_LIST_MODEL (pango_cairo_font_map_get_default ());
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (button), model);
|
||||
|
@@ -16,9 +16,9 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint number;
|
||||
gchar *product;
|
||||
gint yummy;
|
||||
int number;
|
||||
char *product;
|
||||
int yummy;
|
||||
}
|
||||
Item;
|
||||
|
||||
@@ -74,7 +74,7 @@ add_items (void)
|
||||
static GtkTreeModel *
|
||||
create_items_model (void)
|
||||
{
|
||||
gint i = 0;
|
||||
int i = 0;
|
||||
GtkListStore *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
@@ -109,7 +109,7 @@ static GtkTreeModel *
|
||||
create_numbers_model (void)
|
||||
{
|
||||
#define N_NUMBERS 10
|
||||
gint i = 0;
|
||||
int i = 0;
|
||||
GtkListStore *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
@@ -192,7 +192,7 @@ remove_item (GtkWidget *widget, gpointer data)
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
{
|
||||
gint i;
|
||||
int i;
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
@@ -211,7 +211,7 @@ separator_row (GtkTreeModel *model,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
gint idx;
|
||||
int idx;
|
||||
|
||||
path = gtk_tree_model_get_path (model, iter);
|
||||
idx = gtk_tree_path_get_indices (path)[0];
|
||||
@@ -224,7 +224,7 @@ separator_row (GtkTreeModel *model,
|
||||
static void
|
||||
editing_started (GtkCellRenderer *cell,
|
||||
GtkCellEditable *editable,
|
||||
const gchar *path,
|
||||
const char *path,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable),
|
||||
@@ -233,15 +233,15 @@ editing_started (GtkCellRenderer *cell,
|
||||
|
||||
static void
|
||||
cell_edited (GtkCellRendererText *cell,
|
||||
const gchar *path_string,
|
||||
const gchar *new_text,
|
||||
const char *path_string,
|
||||
const char *new_text,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModel *model = (GtkTreeModel *)data;
|
||||
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
|
||||
GtkTreeIter iter;
|
||||
|
||||
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
|
||||
int column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
@@ -249,7 +249,7 @@ cell_edited (GtkCellRendererText *cell,
|
||||
{
|
||||
case COLUMN_ITEM_NUMBER:
|
||||
{
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
i = gtk_tree_path_get_indices (path)[0];
|
||||
g_array_index (articles, Item, i).number = atoi (new_text);
|
||||
@@ -261,8 +261,8 @@ cell_edited (GtkCellRendererText *cell,
|
||||
|
||||
case COLUMN_ITEM_PRODUCT:
|
||||
{
|
||||
gint i;
|
||||
gchar *old_text;
|
||||
int i;
|
||||
char *old_text;
|
||||
|
||||
gtk_tree_model_get (model, &iter, column, &old_text, -1);
|
||||
g_free (old_text);
|
||||
|
@@ -13,7 +13,7 @@
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
response_cb (GtkDialog *dialog, gint response_id)
|
||||
response_cb (GtkDialog *dialog, int response_id)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
window = NULL;
|
||||
@@ -35,6 +35,10 @@ do_expander (GtkWidget *do_widget)
|
||||
GtkWidget *sw;
|
||||
GtkWidget *tv;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
GtkTextTag *tag;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@@ -64,12 +68,25 @@ do_expander (GtkWidget *do_widget)
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||
gtk_widget_set_vexpand (sw, TRUE);
|
||||
|
||||
tv = gtk_text_view_new ();
|
||||
|
||||
g_object_set (tv,
|
||||
"left-margin", 10,
|
||||
"right-margin", 10,
|
||||
"top-margin", 10,
|
||||
"bottom-margin", 10,
|
||||
NULL);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (tv), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD);
|
||||
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer),
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (tv), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (tv), 2);
|
||||
|
||||
gtk_text_buffer_set_text (buffer,
|
||||
"Finally, the full story with all details. "
|
||||
"And all the inside information, including "
|
||||
"error codes, etc etc. Pages of information, "
|
||||
@@ -77,7 +94,22 @@ do_expander (GtkWidget *do_widget)
|
||||
"or even resize the window - it works !\n"
|
||||
"A second paragraph will contain even more "
|
||||
"innuendo, just to make you scroll down or "
|
||||
"resize the window. Do it already !", -1);
|
||||
"resize the window.\n"
|
||||
"Do it already!\n", -1);
|
||||
|
||||
gtk_text_buffer_get_end_iter (buffer, &start);
|
||||
paintable = GDK_PAINTABLE (gdk_texture_new_from_resource ("/cursors/images/gtk_logo_cursor.png"));
|
||||
gtk_text_buffer_insert_paintable (buffer, &start, paintable);
|
||||
g_object_unref (paintable);
|
||||
gtk_text_iter_backward_char (&start);
|
||||
|
||||
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
||||
"pixels-above-lines", 200,
|
||||
"justification", GTK_JUSTIFY_RIGHT,
|
||||
NULL);
|
||||
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
|
||||
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
|
||||
gtk_expander_set_child (GTK_EXPANDER (expander), sw);
|
||||
gtk_box_append (GTK_BOX (area), expander);
|
||||
|
@@ -22,8 +22,8 @@ format_number (GtkTreeViewColumn *col,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
gint num;
|
||||
gchar *text;
|
||||
int num;
|
||||
char *text;
|
||||
|
||||
gtk_tree_model_get (model, iter, GPOINTER_TO_INT (data), &num, -1);
|
||||
text = g_strdup_printf ("%d", num);
|
||||
@@ -35,11 +35,11 @@ static void
|
||||
filter_modify_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
GValue *value,
|
||||
gint column,
|
||||
int column,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModelFilter *filter_model = GTK_TREE_MODEL_FILTER (model);
|
||||
gint width, height;
|
||||
int width, height;
|
||||
GtkTreeModel *child_model;
|
||||
GtkTreeIter child_iter;
|
||||
|
||||
@@ -75,7 +75,7 @@ visible_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
gint width;
|
||||
int width;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
WIDTH_COLUMN, &width,
|
||||
|
@@ -45,12 +45,9 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -83,12 +80,9 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -133,12 +127,9 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -149,12 +140,9 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -165,12 +153,9 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -197,12 +182,9 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -209,7 +209,7 @@ set_widget_type (GtkFishbowl *fishbowl,
|
||||
widget_types[selected_widget_type].name);
|
||||
}
|
||||
|
||||
void
|
||||
G_MODULE_EXPORT void
|
||||
fishbowl_next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -224,7 +224,7 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
void
|
||||
G_MODULE_EXPORT void
|
||||
fishbowl_prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -239,7 +239,7 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
void
|
||||
G_MODULE_EXPORT void
|
||||
fishbowl_changes_toggled_cb (GtkToggleButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ fishbowl_changes_toggled_cb (GtkToggleButton *button,
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-allow");
|
||||
}
|
||||
|
||||
char *
|
||||
G_MODULE_EXPORT char *
|
||||
format_header_cb (GObject *object,
|
||||
guint count,
|
||||
double fps)
|
||||
|
@@ -29,7 +29,7 @@ draw_color (GtkDrawingArea *drawingarea,
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
color_swatch_new (const gchar *color)
|
||||
color_swatch_new (const char *color)
|
||||
{
|
||||
GtkWidget *button, *area;
|
||||
|
||||
@@ -48,7 +48,7 @@ do_flowbox (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *scrolled, *flowbox;
|
||||
const gchar *colors[] = {
|
||||
const char *colors[] = {
|
||||
"AliceBlue",
|
||||
"AntiqueWhite",
|
||||
"AntiqueWhite1",
|
||||
@@ -716,7 +716,7 @@ do_flowbox (GtkWidget *do_widget)
|
||||
"YellowGreen",
|
||||
NULL
|
||||
};
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
|
@@ -130,6 +130,10 @@ static const char *
|
||||
get_feature_display_name (unsigned int tag)
|
||||
{
|
||||
int i;
|
||||
static char buf[5] = { 0, };
|
||||
|
||||
if (tag == MAKE_TAG ('x', 'x', 'x', 'x'))
|
||||
return _("Default");
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (open_type_layout_features); i++)
|
||||
{
|
||||
@@ -137,7 +141,10 @@ get_feature_display_name (unsigned int tag)
|
||||
return g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
hb_tag_to_string (tag, buf);
|
||||
g_warning ("unknown OpenType layout feature tag: %s", buf);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void update_display (void);
|
||||
@@ -295,7 +302,7 @@ update_display (void)
|
||||
GList *l;
|
||||
PangoAttrList *attrs;
|
||||
PangoAttribute *attr;
|
||||
gint ins, bound;
|
||||
int ins, bound;
|
||||
guint start, end;
|
||||
PangoLanguage *lang;
|
||||
char *font_desc;
|
||||
@@ -479,7 +486,7 @@ update_script_combo (void)
|
||||
{
|
||||
GtkListStore *store;
|
||||
hb_font_t *hb_font;
|
||||
gint i, j, k;
|
||||
int i, j, k;
|
||||
PangoFont *pango_font;
|
||||
GHashTable *tags;
|
||||
GHashTableIter iter;
|
||||
@@ -593,7 +600,7 @@ update_script_combo (void)
|
||||
static void
|
||||
update_features (void)
|
||||
{
|
||||
gint i, j;
|
||||
int i, j;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
guint script_index, lang_index;
|
||||
@@ -728,8 +735,8 @@ static void
|
||||
entry_activated (GtkEntry *entry,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
gdouble value;
|
||||
gchar *err = NULL;
|
||||
double value;
|
||||
char *err = NULL;
|
||||
|
||||
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
|
||||
if (err != NULL)
|
||||
@@ -939,7 +946,7 @@ instance_changed (GtkComboBox *combo)
|
||||
{
|
||||
Axis *axis;
|
||||
Axis akey;
|
||||
gdouble value;
|
||||
double value;
|
||||
|
||||
value = coords[ai[i].axis_index];
|
||||
|
||||
@@ -1285,8 +1292,7 @@ do_font_features (GtkWidget *do_widget)
|
||||
"palt",
|
||||
"twid",
|
||||
"qwid", NULL });
|
||||
add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss00",
|
||||
"ss01",
|
||||
add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss01",
|
||||
"ss02",
|
||||
"ss03",
|
||||
"ss04",
|
||||
|
458
demos/gtk-demo/fontify.c
Normal file
458
demos/gtk-demo/fontify.c
Normal file
@@ -0,0 +1,458 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#ifdef HAVE_GIO_UNIX
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the guts of gtk_text_buffer_insert_markup,
|
||||
* copied here so we can make an incremental version.
|
||||
*/
|
||||
static void
|
||||
insert_tags_for_attributes (GtkTextBuffer *buffer,
|
||||
PangoAttrIterator *iter,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
GtkTextTagTable *table;
|
||||
PangoAttribute *attr;
|
||||
GtkTextTag *tag;
|
||||
char name[256];
|
||||
|
||||
table = gtk_text_buffer_get_tag_table (buffer);
|
||||
|
||||
#define STRING_ATTR(pango_attr_name, attr_name) \
|
||||
attr = pango_attr_iterator_get (iter, pango_attr_name); \
|
||||
if (attr) \
|
||||
{ \
|
||||
const char *string = ((PangoAttrString*)attr)->value; \
|
||||
g_snprintf (name, 256, #attr_name "=%s", string); \
|
||||
tag = gtk_text_tag_table_lookup (table, name); \
|
||||
if (!tag) \
|
||||
{ \
|
||||
tag = gtk_text_tag_new (name); \
|
||||
g_object_set (tag, #attr_name, string, NULL); \
|
||||
gtk_text_tag_table_add (table, tag); \
|
||||
g_object_unref (tag); \
|
||||
} \
|
||||
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
|
||||
}
|
||||
|
||||
#define INT_ATTR(pango_attr_name, attr_name) \
|
||||
attr = pango_attr_iterator_get (iter, pango_attr_name); \
|
||||
if (attr) \
|
||||
{ \
|
||||
int value = ((PangoAttrInt*)attr)->value; \
|
||||
g_snprintf (name, 256, #attr_name "=%d", value); \
|
||||
tag = gtk_text_tag_table_lookup (table, name); \
|
||||
if (!tag) \
|
||||
{ \
|
||||
tag = gtk_text_tag_new (name); \
|
||||
g_object_set (tag, #attr_name, value, NULL); \
|
||||
gtk_text_tag_table_add (table, tag); \
|
||||
g_object_unref (tag); \
|
||||
} \
|
||||
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
|
||||
}
|
||||
|
||||
#define FLOAT_ATTR(pango_attr_name, attr_name) \
|
||||
attr = pango_attr_iterator_get (iter, pango_attr_name); \
|
||||
if (attr) \
|
||||
{ \
|
||||
float value = ((PangoAttrFloat*)attr)->value; \
|
||||
g_snprintf (name, 256, #attr_name "=%g", value); \
|
||||
tag = gtk_text_tag_table_lookup (table, name); \
|
||||
if (!tag) \
|
||||
{ \
|
||||
tag = gtk_text_tag_new (name); \
|
||||
g_object_set (tag, #attr_name, value, NULL); \
|
||||
gtk_text_tag_table_add (table, tag); \
|
||||
g_object_unref (tag); \
|
||||
} \
|
||||
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
|
||||
}
|
||||
|
||||
#define RGBA_ATTR(pango_attr_name, attr_name) \
|
||||
attr = pango_attr_iterator_get (iter, pango_attr_name); \
|
||||
if (attr) \
|
||||
{ \
|
||||
PangoColor *color; \
|
||||
GdkRGBA rgba; \
|
||||
color = &((PangoAttrColor*)attr)->color; \
|
||||
rgba.red = color->red / 65535.; \
|
||||
rgba.green = color->green / 65535.; \
|
||||
rgba.blue = color->blue / 65535.; \
|
||||
rgba.alpha = 1.; \
|
||||
char *str = gdk_rgba_to_string (&rgba); \
|
||||
g_snprintf (name, 256, #attr_name "=%s", str); \
|
||||
g_free (str); \
|
||||
tag = gtk_text_tag_table_lookup (table, name); \
|
||||
if (!tag) \
|
||||
{ \
|
||||
tag = gtk_text_tag_new (name); \
|
||||
g_object_set (tag, #attr_name, &rgba, NULL); \
|
||||
gtk_text_tag_table_add (table, tag); \
|
||||
g_object_unref (tag); \
|
||||
} \
|
||||
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
|
||||
}
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_LANGUAGE);
|
||||
if (attr)
|
||||
{
|
||||
const char *language = pango_language_to_string (((PangoAttrLanguage*)attr)->value);
|
||||
g_snprintf (name, 256, "language=%s", language);
|
||||
tag = gtk_text_tag_table_lookup (table, name);
|
||||
if (!tag)
|
||||
{
|
||||
tag = gtk_text_tag_new (name);
|
||||
g_object_set (tag, "language", language, NULL);
|
||||
gtk_text_tag_table_add (table, tag);
|
||||
g_object_unref (tag);
|
||||
}
|
||||
gtk_text_buffer_apply_tag (buffer, tag, start, end);
|
||||
}
|
||||
|
||||
STRING_ATTR (PANGO_ATTR_FAMILY, family)
|
||||
INT_ATTR (PANGO_ATTR_STYLE, style)
|
||||
INT_ATTR (PANGO_ATTR_WEIGHT, weight)
|
||||
INT_ATTR (PANGO_ATTR_VARIANT, variant)
|
||||
INT_ATTR (PANGO_ATTR_STRETCH, stretch)
|
||||
INT_ATTR (PANGO_ATTR_SIZE, size)
|
||||
|
||||
attr = pango_attr_iterator_get (iter, PANGO_ATTR_FONT_DESC);
|
||||
if (attr)
|
||||
{
|
||||
PangoFontDescription *desc = ((PangoAttrFontDesc*)attr)->desc;
|
||||
char *str = pango_font_description_to_string (desc);
|
||||
g_snprintf (name, 256, "font-desc=%s", str);
|
||||
g_free (str);
|
||||
tag = gtk_text_tag_table_lookup (table, name);
|
||||
if (!tag)
|
||||
{
|
||||
tag = gtk_text_tag_new (name);
|
||||
g_object_set (tag, "font-desc", desc, NULL);
|
||||
gtk_text_tag_table_add (table, tag);
|
||||
g_object_unref (tag);
|
||||
}
|
||||
gtk_text_buffer_apply_tag (buffer, tag, start, end);
|
||||
}
|
||||
|
||||
RGBA_ATTR (PANGO_ATTR_FOREGROUND, foreground_rgba)
|
||||
RGBA_ATTR (PANGO_ATTR_BACKGROUND, background_rgba)
|
||||
INT_ATTR (PANGO_ATTR_UNDERLINE, underline)
|
||||
RGBA_ATTR (PANGO_ATTR_UNDERLINE_COLOR, underline_rgba)
|
||||
INT_ATTR (PANGO_ATTR_OVERLINE, overline)
|
||||
RGBA_ATTR (PANGO_ATTR_OVERLINE_COLOR, overline_rgba)
|
||||
INT_ATTR (PANGO_ATTR_STRIKETHROUGH, strikethrough)
|
||||
RGBA_ATTR (PANGO_ATTR_STRIKETHROUGH_COLOR, strikethrough_rgba)
|
||||
INT_ATTR (PANGO_ATTR_RISE, rise)
|
||||
FLOAT_ATTR (PANGO_ATTR_SCALE, scale)
|
||||
INT_ATTR (PANGO_ATTR_FALLBACK, fallback)
|
||||
INT_ATTR (PANGO_ATTR_LETTER_SPACING, letter_spacing)
|
||||
STRING_ATTR (PANGO_ATTR_FONT_FEATURES, font_features)
|
||||
INT_ATTR (PANGO_ATTR_ALLOW_BREAKS, allow_breaks)
|
||||
INT_ATTR (PANGO_ATTR_SHOW, show_spaces)
|
||||
INT_ATTR (PANGO_ATTR_INSERT_HYPHENS, insert_hyphens)
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GMarkupParseContext *parser;
|
||||
char *markup;
|
||||
gsize pos;
|
||||
gsize len;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
GtkTextMark *mark;
|
||||
PangoAttrList *attributes;
|
||||
char *text;
|
||||
PangoAttrIterator *attr;
|
||||
} MarkupData;
|
||||
|
||||
static void
|
||||
free_markup_data (MarkupData *mdata)
|
||||
{
|
||||
g_free (mdata->markup);
|
||||
g_clear_pointer (&mdata->parser, g_markup_parse_context_free);
|
||||
gtk_text_buffer_delete_mark (mdata->buffer, mdata->mark);
|
||||
g_clear_pointer (&mdata->attr, pango_attr_iterator_destroy);
|
||||
g_clear_pointer (&mdata->attributes, pango_attr_list_unref);
|
||||
g_free (mdata->text);
|
||||
g_object_unref (mdata->buffer);
|
||||
g_free (mdata);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
insert_markup_idle (gpointer data)
|
||||
{
|
||||
MarkupData *mdata = data;
|
||||
gint64 begin;
|
||||
|
||||
begin = g_get_monotonic_time ();
|
||||
|
||||
do
|
||||
{
|
||||
int start, end;
|
||||
int start_offset;
|
||||
GtkTextIter start_iter;
|
||||
|
||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||
{
|
||||
g_idle_add (insert_markup_idle, data);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
pango_attr_iterator_range (mdata->attr, &start, &end);
|
||||
|
||||
if (end == G_MAXINT) /* last chunk */
|
||||
end = start - 1; /* resulting in -1 to be passed to _insert */
|
||||
|
||||
start_offset = gtk_text_iter_get_offset (&mdata->iter);
|
||||
gtk_text_buffer_insert (mdata->buffer, &mdata->iter, mdata->text + start, end - start);
|
||||
gtk_text_buffer_get_iter_at_offset (mdata->buffer, &start_iter, start_offset);
|
||||
|
||||
insert_tags_for_attributes (mdata->buffer, mdata->attr, &start_iter, &mdata->iter);
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (mdata->buffer, &mdata->iter, mdata->mark);
|
||||
}
|
||||
while (pango_attr_iterator_next (mdata->attr));
|
||||
|
||||
free_markup_data (mdata);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_markup_idle (gpointer data)
|
||||
{
|
||||
MarkupData *mdata = data;
|
||||
gint64 begin;
|
||||
GError *error = NULL;
|
||||
|
||||
begin = g_get_monotonic_time ();
|
||||
|
||||
do {
|
||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||
{
|
||||
g_idle_add (parse_markup_idle, data);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
if (!g_markup_parse_context_parse (mdata->parser,
|
||||
mdata->markup + mdata->pos,
|
||||
MIN (4096, mdata->len - mdata->pos),
|
||||
&error))
|
||||
{
|
||||
g_warning ("Invalid markup string: %s", error->message);
|
||||
g_error_free (error);
|
||||
free_markup_data (mdata);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
mdata->pos += 4096;
|
||||
} while (mdata->pos < mdata->len);
|
||||
|
||||
if (!pango_markup_parser_finish (mdata->parser,
|
||||
&mdata->attributes,
|
||||
&mdata->text,
|
||||
NULL,
|
||||
&error))
|
||||
{
|
||||
g_warning ("Invalid markup string: %s", error->message);
|
||||
g_error_free (error);
|
||||
free_markup_data (mdata);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
if (!mdata->attributes)
|
||||
{
|
||||
gtk_text_buffer_insert (mdata->buffer, &mdata->iter, mdata->text, -1);
|
||||
free_markup_data (mdata);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
mdata->attr = pango_attr_list_get_iterator (mdata->attributes);
|
||||
insert_markup_idle (data);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
/* Takes a ref on @buffer while it is operating,
|
||||
* and consumes @markup.
|
||||
*/
|
||||
static void
|
||||
insert_markup (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
char *markup,
|
||||
int len)
|
||||
{
|
||||
MarkupData *data;
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
|
||||
|
||||
data = g_new0 (MarkupData, 1);
|
||||
|
||||
data->buffer = g_object_ref (buffer);
|
||||
data->iter = *iter;
|
||||
data->markup = markup;
|
||||
data->len = len;
|
||||
|
||||
data->parser = pango_markup_parser_new (0);
|
||||
data->pos = 0;
|
||||
|
||||
/* create mark with right gravity */
|
||||
data->mark = gtk_text_buffer_create_mark (buffer, NULL, iter, FALSE);
|
||||
|
||||
parse_markup_idle (data);
|
||||
}
|
||||
|
||||
static void
|
||||
fontify_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GSubprocess *subprocess = G_SUBPROCESS (source);
|
||||
GtkTextBuffer *buffer = data;
|
||||
GBytes *stdout_buf = NULL;
|
||||
GBytes *stderr_buf = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_subprocess_communicate_finish (subprocess,
|
||||
result,
|
||||
&stdout_buf,
|
||||
&stderr_buf,
|
||||
&error))
|
||||
{
|
||||
g_clear_pointer (&stdout_buf, g_bytes_unref);
|
||||
g_clear_pointer (&stderr_buf, g_bytes_unref);
|
||||
|
||||
g_warning ("%s", error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
g_object_unref (subprocess);
|
||||
g_object_unref (buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_subprocess_get_exit_status (subprocess) != 0)
|
||||
{
|
||||
if (stderr_buf)
|
||||
g_warning ("%s", (char *)g_bytes_get_data (stderr_buf, NULL));
|
||||
g_clear_pointer (&stderr_buf, g_bytes_unref);
|
||||
}
|
||||
|
||||
g_object_unref (subprocess);
|
||||
|
||||
g_clear_pointer (&stderr_buf, g_bytes_unref);
|
||||
|
||||
if (stdout_buf)
|
||||
{
|
||||
char *markup;
|
||||
gsize len;
|
||||
char *p;
|
||||
GtkTextIter start;
|
||||
|
||||
gtk_text_buffer_set_text (buffer, "", 0);
|
||||
|
||||
/* highlight puts a span with font and size around its output,
|
||||
* which we don't want.
|
||||
*/
|
||||
markup = g_bytes_unref_to_data (stdout_buf, &len);
|
||||
for (p = markup + strlen ("<span "); *p != '>'; p++) *p = ' ';
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &start);
|
||||
insert_markup (buffer, &start, markup, len);
|
||||
}
|
||||
|
||||
g_object_unref (buffer);
|
||||
}
|
||||
|
||||
void
|
||||
fontify (const char *format,
|
||||
GtkTextBuffer *source_buffer)
|
||||
{
|
||||
GSubprocess *subprocess;
|
||||
char *format_arg;
|
||||
GtkSettings *settings;
|
||||
char *theme;
|
||||
gboolean prefer_dark;
|
||||
const char *style_arg;
|
||||
const char *text;
|
||||
GtkTextIter start, end;
|
||||
GBytes *bytes;
|
||||
GError *error = NULL;
|
||||
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_get (settings,
|
||||
"gtk-theme-name", &theme,
|
||||
"gtk-application-prefer-dark-theme", &prefer_dark,
|
||||
NULL);
|
||||
|
||||
if (prefer_dark || strcmp (theme, "HighContrastInverse") == 0)
|
||||
style_arg = "--style=edit-vim-dark";
|
||||
else
|
||||
style_arg = "--style=edit-kwrite";
|
||||
|
||||
g_free (theme);
|
||||
|
||||
format_arg = g_strconcat ("--syntax=", format, NULL);
|
||||
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE |
|
||||
G_SUBPROCESS_FLAGS_STDOUT_PIPE |
|
||||
G_SUBPROCESS_FLAGS_STDERR_PIPE,
|
||||
&error,
|
||||
"highlight",
|
||||
format_arg,
|
||||
"--out-format=pango",
|
||||
style_arg,
|
||||
NULL);
|
||||
g_free (format_arg);
|
||||
|
||||
if (!subprocess)
|
||||
{
|
||||
if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
|
||||
{
|
||||
static gboolean warned = FALSE;
|
||||
|
||||
if (!warned)
|
||||
{
|
||||
warned = TRUE;
|
||||
g_message ("For syntax highlighting, install the “highlight” program");
|
||||
}
|
||||
}
|
||||
else
|
||||
g_warning ("%s", error->message);
|
||||
|
||||
g_clear_error (&error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
|
||||
bytes = g_bytes_new_static (text, strlen (text));
|
||||
|
||||
#ifdef HAVE_GIO_UNIX
|
||||
/* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */
|
||||
if (G_IS_UNIX_OUTPUT_STREAM (g_subprocess_get_stdin_pipe (subprocess)))
|
||||
{
|
||||
GOutputStream *stdin_pipe = g_subprocess_get_stdin_pipe (subprocess);
|
||||
int fd = g_unix_output_stream_get_fd (G_UNIX_OUTPUT_STREAM (stdin_pipe));
|
||||
fcntl (fd, F_SETFL, O_NONBLOCK);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_subprocess_communicate_async (subprocess,
|
||||
bytes,
|
||||
NULL,
|
||||
fontify_finish,
|
||||
g_object_ref (source_buffer));
|
||||
}
|
6
demos/gtk-demo/fontify.h
Normal file
6
demos/gtk-demo/fontify.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void fontify (const char *format,
|
||||
GtkTextBuffer *buffer);
|
@@ -36,11 +36,11 @@ adjustment_get_normalized_value (GtkAdjustment *adj)
|
||||
|
||||
static void
|
||||
val_to_xy (GtkFontPlane *plane,
|
||||
gint *x,
|
||||
gint *y)
|
||||
int *x,
|
||||
int *y)
|
||||
{
|
||||
gdouble u, v;
|
||||
gint width, height;
|
||||
double u, v;
|
||||
int width, height;
|
||||
|
||||
width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
|
||||
height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
|
||||
@@ -57,8 +57,8 @@ plane_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkFontPlane *plane = GTK_FONT_PLANE (widget);
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
int x, y;
|
||||
int width, height;
|
||||
cairo_t *cr;
|
||||
|
||||
val_to_xy (plane, &x, &y);
|
||||
@@ -125,11 +125,11 @@ adjustment_set_normalized_value (GtkAdjustment *adj,
|
||||
|
||||
static void
|
||||
update_value (GtkFontPlane *plane,
|
||||
gint x,
|
||||
gint y)
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (plane);
|
||||
gdouble u, v;
|
||||
double u, v;
|
||||
|
||||
u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1);
|
||||
v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
|
||||
@@ -142,8 +142,8 @@ update_value (GtkFontPlane *plane,
|
||||
|
||||
static void
|
||||
plane_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
gdouble start_x,
|
||||
gdouble start_y,
|
||||
double start_x,
|
||||
double start_y,
|
||||
GtkFontPlane *plane)
|
||||
{
|
||||
guint button;
|
||||
@@ -164,11 +164,11 @@ plane_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
|
||||
static void
|
||||
plane_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
GtkFontPlane *plane)
|
||||
{
|
||||
gdouble start_x, start_y;
|
||||
double start_x, start_y;
|
||||
|
||||
gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture),
|
||||
&start_x, &start_y);
|
||||
@@ -177,8 +177,8 @@ plane_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
|
||||
static void
|
||||
plane_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
GtkFontPlane *plane)
|
||||
{
|
||||
set_cross_cursor (GTK_WIDGET (plane), FALSE);
|
||||
|
@@ -19,13 +19,7 @@ static GtkWidget *show_extents = NULL;
|
||||
|
||||
static PangoContext *context;
|
||||
|
||||
static int scale = 10;
|
||||
|
||||
static void
|
||||
on_destroy (gpointer data)
|
||||
{
|
||||
window = NULL;
|
||||
}
|
||||
static int scale = 9;
|
||||
|
||||
static void
|
||||
update_image (void)
|
||||
@@ -251,9 +245,7 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (on_destroy), NULL);
|
||||
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
|
||||
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
|
||||
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
|
||||
@@ -276,6 +268,8 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
|
||||
update_image ();
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -6,164 +6,11 @@
|
||||
<property name="page-increment">4</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">300</property>
|
||||
<property name="title">Font rendering</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="margin-top">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="column-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="label">Text</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="text">Fonts render</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="label">Font</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font_button">
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hinting</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="hinting">
|
||||
<property name="active">0</property>
|
||||
<property name="valign">center</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="slight">Slight</item>
|
||||
<item translatable="yes" id="medium">Medium</item>
|
||||
<item translatable="yes" id="full">Full</item>
|
||||
</items>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hint_metrics">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hint Metrics</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_extents">
|
||||
<property name="active">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Show Extents</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_grid">
|
||||
<property name="active">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Show Grid</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="up_button">
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="down_button">
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<property name="default-width">1080</property>
|
||||
<property name="default-height">430</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<child type="title">
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
@@ -183,17 +30,180 @@
|
||||
<property name="group">text_radio</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column-span">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="halign">center</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="column-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="label">Text</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="text">Fonts render</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="label">Font</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font_button">
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hinting</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="hinting">
|
||||
<property name="active">0</property>
|
||||
<property name="valign">center</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="slight">Slight</item>
|
||||
<item translatable="yes" id="medium">Medium</item>
|
||||
<item translatable="yes" id="full">Full</item>
|
||||
</items>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hint_metrics">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hint Metrics</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_extents">
|
||||
<property name="active">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Show Extents</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">5</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="show_grid">
|
||||
<property name="active">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Show Grid</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">5</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="up_button">
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">6</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="down_button">
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">6</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">1</property>
|
||||
<layout>
|
||||
<property name="column">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="propagate-natural-height">1</property>
|
||||
<property name="has-frame">1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
@@ -203,11 +213,6 @@
|
||||
<property name="can-shrink">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column-span">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
static GtkGesture *rotate = NULL;
|
||||
static GtkGesture *zoom = NULL;
|
||||
static gdouble swipe_x = 0;
|
||||
static gdouble swipe_y = 0;
|
||||
static double swipe_x = 0;
|
||||
static double swipe_y = 0;
|
||||
static gboolean long_pressed = FALSE;
|
||||
|
||||
static gboolean
|
||||
@@ -26,8 +26,8 @@ touchpad_swipe_gesture_begin (GtkGesture *gesture,
|
||||
|
||||
static void
|
||||
swipe_gesture_swept (GtkGestureSwipe *gesture,
|
||||
gdouble velocity_x,
|
||||
gdouble velocity_y,
|
||||
double velocity_x,
|
||||
double velocity_y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
swipe_x = velocity_x / 10;
|
||||
@@ -37,8 +37,8 @@ swipe_gesture_swept (GtkGestureSwipe *gesture,
|
||||
|
||||
static void
|
||||
long_press_gesture_pressed (GtkGestureLongPress *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
long_pressed = TRUE;
|
||||
@@ -56,8 +56,8 @@ long_press_gesture_end (GtkGesture *gesture,
|
||||
|
||||
static void
|
||||
rotation_angle_changed (GtkGestureRotate *gesture,
|
||||
gdouble angle,
|
||||
gdouble delta,
|
||||
double angle,
|
||||
double delta,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_queue_draw (widget);
|
||||
@@ -65,7 +65,7 @@ rotation_angle_changed (GtkGestureRotate *gesture,
|
||||
|
||||
static void
|
||||
zoom_scale_changed (GtkGestureZoom *gesture,
|
||||
gdouble scale,
|
||||
double scale,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_queue_draw (widget);
|
||||
@@ -93,8 +93,8 @@ drawing_area_draw (GtkDrawingArea *area,
|
||||
{
|
||||
cairo_pattern_t *pat;
|
||||
cairo_matrix_t matrix;
|
||||
gdouble angle, scale;
|
||||
gdouble x_center, y_center;
|
||||
double angle, scale;
|
||||
double x_center, y_center;
|
||||
|
||||
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
precision highp float;
|
||||
|
||||
void main() {
|
||||
float lerpVal = gl_FragCoord.y / 500.0f;
|
||||
float lerpVal = gl_FragCoord.y / 500.0;
|
||||
|
||||
gl_FragColor = mix(vec4(1.0f, 0.85f, 0.35f, 1.0f), vec4(0.2f, 0.2f, 0.2f, 1.0f), lerpVal);
|
||||
gl_FragColor = mix(vec4(1.0, 0.85, 0.35, 1.0), vec4(0.2, 0.2, 0.2, 1.0), lerpVal);
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ gtk_fishbowl_measure (GtkWidget *widget,
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
GtkFishbowlChild *child;
|
||||
gint child_min, child_nat;
|
||||
int child_min, child_nat;
|
||||
|
||||
*minimum = 0;
|
||||
*natural = 0;
|
||||
|
@@ -305,7 +305,7 @@ create_gear (GLfloat inner_radius,
|
||||
/* Create the 7 points (only x,y coords) used to draw a tooth */
|
||||
struct point p[7];
|
||||
|
||||
/* Calculate needed sin/cos for varius angles */
|
||||
/* Calculate needed sin/cos for various angles */
|
||||
sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
|
||||
sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
|
||||
sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
|
||||
@@ -800,7 +800,7 @@ gtk_gears_realize (GtkWidget *widget)
|
||||
priv->LightSourcePosition_location = glGetUniformLocation(program, "LightSourcePosition");
|
||||
priv->MaterialColor_location = glGetUniformLocation(program, "MaterialColor");
|
||||
|
||||
/* Set the LightSourcePosition uniform which is constant throught the program */
|
||||
/* Set the LightSourcePosition uniform which is constant throughout the program */
|
||||
glUniform4fv(priv->LightSourcePosition_location, 1, priv->LightSourcePosition);
|
||||
|
||||
/* make the gears */
|
||||
|
@@ -18,7 +18,7 @@ static void
|
||||
insert_link (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
const char *text,
|
||||
gint page)
|
||||
int page)
|
||||
{
|
||||
GtkTextTag *tag;
|
||||
|
||||
@@ -35,7 +35,7 @@ insert_link (GtkTextBuffer *buffer,
|
||||
*/
|
||||
static void
|
||||
show_page (GtkTextBuffer *buffer,
|
||||
gint page)
|
||||
int page)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
|
||||
@@ -91,7 +91,7 @@ follow_if_link (GtkWidget *text_view,
|
||||
for (tagp = tags; tagp != NULL; tagp = tagp->next)
|
||||
{
|
||||
GtkTextTag *tag = tagp->data;
|
||||
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
int page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
|
||||
if (page != 0)
|
||||
{
|
||||
@@ -134,14 +134,14 @@ key_pressed (GtkEventController *controller,
|
||||
}
|
||||
|
||||
static void set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
gint x,
|
||||
gint y);
|
||||
int x,
|
||||
int y);
|
||||
|
||||
static void
|
||||
released_cb (GtkGestureClick *gesture,
|
||||
guint n_press,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *text_view)
|
||||
{
|
||||
GtkTextIter start, end, iter;
|
||||
@@ -168,8 +168,8 @@ released_cb (GtkGestureClick *gesture,
|
||||
|
||||
static void
|
||||
motion_cb (GtkEventControllerMotion *controller,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
double x,
|
||||
double y,
|
||||
GtkTextView *text_view)
|
||||
{
|
||||
set_cursor_if_appropriate (text_view, x, y);
|
||||
@@ -183,8 +183,8 @@ static gboolean hovering_over_link = FALSE;
|
||||
*/
|
||||
static void
|
||||
set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
gint x,
|
||||
gint y)
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
GSList *tags = NULL, *tagp = NULL;
|
||||
GtkTextIter iter;
|
||||
@@ -196,7 +196,7 @@ set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
for (tagp = tags; tagp != NULL; tagp = tagp->next)
|
||||
{
|
||||
GtkTextTag *tag = tagp->data;
|
||||
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
int page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
|
||||
if (page != 0)
|
||||
{
|
||||
|
@@ -75,10 +75,10 @@ populate_icons (void)
|
||||
static char *content;
|
||||
static gsize content_len;
|
||||
|
||||
extern void fontify (GtkTextBuffer *buffer);
|
||||
extern void fontify (const char *format, GtkTextBuffer *buffer);
|
||||
|
||||
static void
|
||||
populate_text (gboolean hilight)
|
||||
populate_text (gboolean highlight)
|
||||
{
|
||||
GtkWidget *textview;
|
||||
GtkTextBuffer *buffer;
|
||||
@@ -94,8 +94,8 @@ populate_text (gboolean hilight)
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, content, (int)content_len);
|
||||
|
||||
if (hilight)
|
||||
fontify (buffer);
|
||||
if (highlight)
|
||||
fontify ("c", buffer);
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
@@ -153,14 +153,20 @@ populate_list (void)
|
||||
}
|
||||
|
||||
extern GtkWidget *create_color_grid (void);
|
||||
extern GListModel *gtk_color_list_new (guint size);
|
||||
|
||||
static void
|
||||
populate_grid (void)
|
||||
{
|
||||
GtkWidget *list;
|
||||
GtkNoSelection *selection;
|
||||
|
||||
list = create_color_grid ();
|
||||
|
||||
selection = gtk_no_selection_new (gtk_color_list_new (2097152));
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (list), G_LIST_MODEL (selection));
|
||||
g_object_unref (selection);
|
||||
|
||||
hincrement = 0;
|
||||
vincrement = 5;
|
||||
|
||||
@@ -220,7 +226,7 @@ set_widget_type (int type)
|
||||
tick_cb = gtk_widget_add_tick_callback (window, scroll_cb, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
G_MODULE_EXPORT void
|
||||
iconscroll_next_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -235,7 +241,7 @@ iconscroll_next_clicked_cb (GtkButton *source,
|
||||
set_widget_type (new_index);
|
||||
}
|
||||
|
||||
void
|
||||
G_MODULE_EXPORT void
|
||||
iconscroll_prev_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -249,7 +255,7 @@ iconscroll_prev_clicked_cb (GtkButton *source,
|
||||
set_widget_type (new_index);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
G_MODULE_EXPORT GtkWidget *
|
||||
do_iconscroll (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
|
@@ -25,7 +25,7 @@ enum
|
||||
|
||||
|
||||
static GdkPixbuf *file_pixbuf, *folder_pixbuf;
|
||||
gchar *parent;
|
||||
char *parent;
|
||||
GtkWidget *up_button;
|
||||
|
||||
/* Loads the images for the demo and returns whether the operation succeeded */
|
||||
@@ -47,7 +47,7 @@ static void
|
||||
fill_store (GtkListStore *store)
|
||||
{
|
||||
GDir *dir;
|
||||
const gchar *name;
|
||||
const char *name;
|
||||
GtkTreeIter iter;
|
||||
|
||||
/* First clear the store */
|
||||
@@ -62,7 +62,7 @@ fill_store (GtkListStore *store)
|
||||
name = g_dir_read_name (dir);
|
||||
while (name != NULL)
|
||||
{
|
||||
gchar *path, *display_name;
|
||||
char *path, *display_name;
|
||||
gboolean is_dir;
|
||||
|
||||
/* We ignore hidden files that start with a '.' */
|
||||
@@ -90,14 +90,14 @@ fill_store (GtkListStore *store)
|
||||
g_dir_close (dir);
|
||||
}
|
||||
|
||||
static gint
|
||||
static int
|
||||
sort_func (GtkTreeModel *model,
|
||||
GtkTreeIter *a,
|
||||
GtkTreeIter *b,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean is_dir_a, is_dir_b;
|
||||
gchar *name_a, *name_b;
|
||||
char *name_a, *name_b;
|
||||
int ret;
|
||||
|
||||
/* We need this function because we want to sort
|
||||
@@ -158,7 +158,7 @@ item_activated (GtkIconView *icon_view,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkListStore *store;
|
||||
gchar *path;
|
||||
char *path;
|
||||
GtkTreeIter iter;
|
||||
gboolean is_dir;
|
||||
|
||||
@@ -192,7 +192,7 @@ up_clicked (GtkButton *item,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkListStore *store;
|
||||
gchar *dir_name;
|
||||
char *dir_name;
|
||||
|
||||
store = GTK_LIST_STORE (user_data);
|
||||
|
||||
|
@@ -19,8 +19,8 @@ static void
|
||||
fill_store (GtkListStore *store)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
const gchar *text[] = { "Red", "Green", "Blue", "Yellow" };
|
||||
gint i;
|
||||
const char *text[] = { "Red", "Green", "Blue", "Yellow" };
|
||||
int i;
|
||||
|
||||
/* First clear the store */
|
||||
gtk_list_store_clear (store);
|
||||
@@ -49,7 +49,7 @@ set_cell_color (GtkCellLayout *cell_layout,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
gchar *text;
|
||||
char *text;
|
||||
GdkRGBA color;
|
||||
guint32 pixel = 0;
|
||||
GdkPixbuf *pixbuf;
|
||||
@@ -60,10 +60,10 @@ set_cell_color (GtkCellLayout *cell_layout,
|
||||
|
||||
if (gdk_rgba_parse (&color, text))
|
||||
pixel =
|
||||
((gint)(color.red * 255)) << 24 |
|
||||
((gint)(color.green * 255)) << 16 |
|
||||
((gint)(color.blue * 255)) << 8 |
|
||||
((gint)(color.alpha * 255));
|
||||
((int)(color.red * 255)) << 24 |
|
||||
((int)(color.green * 255)) << 16 |
|
||||
((int)(color.blue * 255)) << 8 |
|
||||
((int)(color.alpha * 255));
|
||||
|
||||
g_free (text);
|
||||
|
||||
@@ -77,8 +77,8 @@ set_cell_color (GtkCellLayout *cell_layout,
|
||||
|
||||
static void
|
||||
edited (GtkCellRendererText *cell,
|
||||
gchar *path_string,
|
||||
gchar *text,
|
||||
char *path_string,
|
||||
char *text,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
|
@@ -43,10 +43,10 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
|
||||
static void
|
||||
progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
@@ -58,7 +58,7 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
}
|
||||
|
||||
static gint
|
||||
static int
|
||||
progressive_timeout (gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
@@ -240,11 +240,11 @@ progressive_timeout (gpointer data)
|
||||
|
||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area-prepared",
|
||||
G_CALLBACK (progressive_prepared_callback), picture);
|
||||
g_signal_connect_object (pixbuf_loader, "area-prepared",
|
||||
G_CALLBACK (progressive_prepared_callback), picture, 0);
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area-updated",
|
||||
G_CALLBACK (progressive_updated_callback), picture);
|
||||
g_signal_connect_object (pixbuf_loader, "area-updated",
|
||||
G_CALLBACK (progressive_updated_callback), picture, 0);
|
||||
}
|
||||
|
||||
/* leave timeout installed */
|
||||
@@ -261,14 +261,16 @@ start_progressive_loading (GtkWidget *picture)
|
||||
* The timeout simply simulates a slow data source by inserting
|
||||
* pauses in the reading process.
|
||||
*/
|
||||
load_timeout = g_timeout_add (150, progressive_timeout, picture);
|
||||
load_timeout = g_timeout_add (1500, progressive_timeout, picture);
|
||||
g_source_set_name_by_id (load_timeout, "[gtk] progressive_timeout");
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_callback (GObject *object,
|
||||
gpointer data)
|
||||
cleanup_callback (gpointer data,
|
||||
GObject *former_object)
|
||||
{
|
||||
*(gpointer**)data = NULL;
|
||||
|
||||
if (load_timeout)
|
||||
{
|
||||
g_source_remove (load_timeout);
|
||||
@@ -327,10 +329,7 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Images");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (cleanup_callback), NULL);
|
||||
g_object_weak_ref (G_OBJECT (window), cleanup_callback, &window);
|
||||
|
||||
base_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_widget_set_margin_start (base_vbox, 16);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
static void
|
||||
on_bar_response (GtkInfoBar *info_bar,
|
||||
gint response_id,
|
||||
int response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
61
demos/gtk-demo/layoutmanager.c
Normal file
61
demos/gtk-demo/layoutmanager.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Layout Manager
|
||||
*
|
||||
* This examples shows a simple example of a custom layout manager
|
||||
* and a widget using it. The layout manager places the children
|
||||
* of the widget in a grid or a circle, or something in between.
|
||||
*
|
||||
* The widget is animating the transition between the two layouts.
|
||||
* Click to start the transition.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "demowidget.h"
|
||||
#include "demochild.h"
|
||||
|
||||
|
||||
GtkWidget *
|
||||
do_layoutmanager (GtkWidget *parent)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *child;
|
||||
const char *color[] = {
|
||||
"red", "orange", "yellow", "green",
|
||||
"blue", "grey", "magenta", "lime",
|
||||
"yellow", "firebrick", "aqua", "purple",
|
||||
"tomato", "pink", "thistle", "maroon"
|
||||
};
|
||||
int i;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Layout Manager");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 600);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
widget = demo_widget_new ();
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
child = demo_child_new (color[i]);
|
||||
gtk_widget_set_margin_start (child, 4);
|
||||
gtk_widget_set_margin_end (child, 4);
|
||||
gtk_widget_set_margin_top (child, 4);
|
||||
gtk_widget_set_margin_bottom (child, 4);
|
||||
demo_widget_add_child (DEMO_WIDGET (widget), child);
|
||||
}
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), widget);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
|
||||
}
|
@@ -9,7 +9,7 @@
|
||||
|
||||
static void
|
||||
response_cb (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
int response_id,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
@@ -17,7 +17,7 @@ response_cb (GtkWidget *dialog,
|
||||
|
||||
static gboolean
|
||||
activate_link (GtkWidget *label,
|
||||
const gchar *uri,
|
||||
const char *uri,
|
||||
gpointer data)
|
||||
{
|
||||
if (g_strcmp0 (uri, "keynav") == 0)
|
||||
|
@@ -47,7 +47,7 @@ static Bug bugs[] =
|
||||
{ FALSE, 56925, "Normal", "Gtkcalender size" },
|
||||
{ FALSE, 56221, "Normal", "Selectable label needs right-click copy menu" },
|
||||
{ TRUE, 50939, "Normal", "Add shift clicking to GtkTextView" },
|
||||
{ FALSE, 6112, "Enhancement","netscape-like collapsable toolbars" },
|
||||
{ FALSE, 6112, "Enhancement","netscape-like collapsible toolbars" },
|
||||
{ FALSE, 1, "Normal", "First bug :=)" },
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ spinner_timeout (gpointer data)
|
||||
static GtkTreeModel *
|
||||
create_model (void)
|
||||
{
|
||||
gint i = 0;
|
||||
int i = 0;
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* List Box
|
||||
/* List Box/Complex list
|
||||
*
|
||||
* GtkListBox allows lists with complicated layouts, using
|
||||
* regular widgets supporting sorting and filtering.
|
||||
|
@@ -26,8 +26,8 @@
|
||||
<property name="margin-end">8</property>
|
||||
<property name="icon-name">image-missing</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="row-span">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -71,8 +71,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -84,12 +84,9 @@
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="0">Message</property>
|
||||
<property name="wrap">1</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -114,8 +111,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -168,8 +165,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -184,27 +181,17 @@
|
||||
<property name="margin-bottom">2</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<child>
|
||||
<object class="GtkLabel" id="n_reshares_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
<object class="GtkLabel" id="n_reshares_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
Reshares</property>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label_item"/>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame2">
|
||||
<child>
|
||||
<object class="GtkLabel" id="n_favorites_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
<object class="GtkLabel" id="n_favorites_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
FAVORITES</property>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label_item"/>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -234,8 +221,8 @@ FAVORITES</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
71
demos/gtk-demo/listbox2.c
Normal file
71
demos/gtk-demo/listbox2.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/* List Box/Controls
|
||||
*
|
||||
* GtkListBox is well-suited for creating “button strips” — lists of
|
||||
* controls for use in preference dialogs or settings panels. To create
|
||||
* this style of list, use the .rich-list style class.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window;
|
||||
static GtkWidget *switch_widget;
|
||||
static GtkWidget *check;
|
||||
static GtkWidget *image;
|
||||
|
||||
static void
|
||||
row_activated (GtkListBox *list,
|
||||
GtkListBoxRow *row)
|
||||
{
|
||||
if (gtk_widget_is_ancestor (switch_widget, GTK_WIDGET (row)))
|
||||
{
|
||||
gtk_switch_set_active (GTK_SWITCH (switch_widget),
|
||||
!gtk_switch_get_active (GTK_SWITCH (switch_widget)));
|
||||
}
|
||||
else if (gtk_widget_is_ancestor (check, GTK_WIDGET (row)))
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
|
||||
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
|
||||
}
|
||||
else if (gtk_widget_is_ancestor (image, GTK_WIDGET (row)))
|
||||
{
|
||||
gtk_widget_set_opacity (image,
|
||||
1.0 - gtk_widget_get_opacity (image));
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_listbox2 (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilderScope *scope;
|
||||
GtkBuilder *builder;
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope),
|
||||
"row_activated", G_CALLBACK (row_activated));
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
|
||||
gtk_builder_add_from_resource (builder, "/listbox2/listbox2.ui", NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "switch"));
|
||||
check = GTK_WIDGET (gtk_builder_get_object (builder, "check"));
|
||||
image = GTK_WIDGET (gtk_builder_get_object (builder, "image"));
|
||||
|
||||
g_object_unref (builder);
|
||||
g_object_unref (scope);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
298
demos/gtk-demo/listbox2.ui
Normal file
298
demos/gtk-demo/listbox2.ui
Normal file
@@ -0,0 +1,298 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="title" translatable="yes">List Box — Controls</property>
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-height">200</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="scroll-to-focus">1</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-start">60</property>
|
||||
<property name="margin-end">60</property>
|
||||
<property name="margin-top">30</property>
|
||||
<property name="margin-bottom">30</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Group 1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<style>
|
||||
<class name="title-2"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<property name="show-separators">1</property>
|
||||
<signal name="row-activated" handler="row_activated"/>
|
||||
<style>
|
||||
<class name="rich-list"/>
|
||||
</style>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel" id="switch_label">
|
||||
<property name="label" translatable="yes">Switch</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel" id="check_label">
|
||||
<property name="label" translatable="yes">Check</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="check">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel" id="image_label">
|
||||
<property name="label" translatable="yes">Click here!</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image">
|
||||
<property name="icon-name">object-select-symbolic</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="opacity">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-top">30</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="label">Group 2</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="title-2"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<property name="show-separators">1</property>
|
||||
<style>
|
||||
<class name="rich-list"/>
|
||||
</style>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel" id="scale_label">
|
||||
<property name="label" translatable="yes">Scale</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-value">0</property>
|
||||
<property name="width-request">150</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="value">50</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel" id="spin_label">
|
||||
<property name="label" translatable="yes">Spinbutton</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="value">50</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel" id="dropdown_label">
|
||||
<property name="label" translatable="yes">Dropdown</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropDown">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="model">
|
||||
<object class="GtkStringList">
|
||||
<items>
|
||||
<item>Choice 1</item>
|
||||
<item>Choice 2</item>
|
||||
<item>Choice 3</item>
|
||||
<item>Choice 4</item>
|
||||
</items>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<property name="activatable">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel" id="entry_label">
|
||||
<property name="label" translatable="yes">Entry</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="placeholder-text">Type here…</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
<property name="mode">horizontal</property>
|
||||
<widgets>
|
||||
<widget name="switch_label"/>
|
||||
<widget name="check_label"/>
|
||||
<widget name="image_label"/>
|
||||
<widget name="scale_label"/>
|
||||
<widget name="spin_label"/>
|
||||
<widget name="dropdown_label"/>
|
||||
<widget name="entry_label"/>
|
||||
</widgets>
|
||||
</object>
|
||||
</interface>
|
@@ -166,14 +166,6 @@ do_listview_applauncher (GtkWidget *do_widget)
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL);
|
||||
|
||||
/* Create the list widget here.
|
||||
*/
|
||||
list = gtk_list_view_new_with_factory (factory);
|
||||
/* We connect the activate signal here. It's the function we defined
|
||||
* above for launching the selected application.
|
||||
*/
|
||||
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
|
||||
|
||||
/* And of course we need to set the data model. Here we call the function
|
||||
* we wrote above that gives us the list of applications. Then we set
|
||||
* it on the list widget.
|
||||
@@ -181,8 +173,15 @@ do_listview_applauncher (GtkWidget *do_widget)
|
||||
* to create as many listitems as it needs to show itself to the user.
|
||||
*/
|
||||
model = create_application_list ();
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (list), model);
|
||||
g_object_unref (model);
|
||||
|
||||
/* Create the list widget here.
|
||||
*/
|
||||
list = gtk_list_view_new_with_factory (model, factory);
|
||||
|
||||
/* We connect the activate signal here. It's the function we defined
|
||||
* above for launching the selected application.
|
||||
*/
|
||||
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
|
||||
|
||||
/* List widgets should always be contained in a #GtkScrolledWindow,
|
||||
* because otherwise they might get too large or they might not
|
||||
|
@@ -101,7 +101,7 @@ gtk_clock_snapshot (GdkPaintable *paintable,
|
||||
(GdkRGBA [4]) { BLACK, BLACK, BLACK, BLACK });
|
||||
|
||||
/* Next, draw the hour hand.
|
||||
* We do this using tranforms again: Instead of computing where the angle
|
||||
* We do this using transforms again: Instead of computing where the angle
|
||||
* points to, we just rotate everything and then draw the hand as if it
|
||||
* was :00. We don't even need to care about am/pm here because rotations
|
||||
* just work.
|
||||
@@ -463,7 +463,6 @@ do_listview_clocks (GtkWidget *do_widget)
|
||||
GtkWidget *gridview, *sw;
|
||||
GtkListItemFactory *factory;
|
||||
GListModel *model;
|
||||
GtkNoSelection *selection;
|
||||
|
||||
/* This is the normal window setup code every demo does */
|
||||
window = gtk_window_new ();
|
||||
@@ -485,16 +484,12 @@ do_listview_clocks (GtkWidget *do_widget)
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
|
||||
|
||||
gridview = gtk_grid_view_new_with_factory (factory);
|
||||
model = G_LIST_MODEL (gtk_no_selection_new (create_clocks_model ()));
|
||||
gridview = gtk_grid_view_new_with_factory (model, factory);
|
||||
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
|
||||
model = create_clocks_model ();
|
||||
selection = gtk_no_selection_new (model);
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), G_LIST_MODEL (selection));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gridview);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (model);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -79,7 +79,7 @@ gtk_color_paintable_init (GdkPaintableInterface *iface)
|
||||
|
||||
/*
|
||||
* Finally, we define the type. The important part is adding the paintable
|
||||
* interface, so GTK knows that this object can indeed be drawm.
|
||||
* interface, so GTK knows that this object can indeed be drawn.
|
||||
*/
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkColor, gtk_color, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
@@ -89,14 +89,14 @@ static GParamSpec *color_properties[N_COLOR_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
rgb_to_hsv (GdkRGBA *rgba,
|
||||
gdouble *h_out,
|
||||
gdouble *s_out,
|
||||
gdouble *v_out)
|
||||
double *h_out,
|
||||
double *s_out,
|
||||
double *v_out)
|
||||
{
|
||||
gdouble red, green, blue;
|
||||
gdouble h, s, v;
|
||||
gdouble min, max;
|
||||
gdouble delta;
|
||||
double red, green, blue;
|
||||
double h, s, v;
|
||||
double min, max;
|
||||
double delta;
|
||||
|
||||
red = rgba->red;
|
||||
green = rgba->green;
|
||||
@@ -226,7 +226,7 @@ gtk_color_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_COLOR:
|
||||
self->color = *(GdkRGBA *) g_value_dup_boxed (value);
|
||||
self->color = *(GdkRGBA *) g_value_get_boxed (value);
|
||||
rgb_to_hsv (&self->color, &h, &s, &v);
|
||||
self->h = round (360 * h);
|
||||
self->s = round (100 * s);
|
||||
@@ -523,7 +523,7 @@ gtk_color_list_init (GtkColorList *self)
|
||||
g_bytes_unref (data);
|
||||
}
|
||||
|
||||
static GListModel *
|
||||
GListModel *
|
||||
gtk_color_list_new (guint size)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_COLOR_LIST,
|
||||
@@ -662,9 +662,8 @@ create_color_grid (void)
|
||||
{
|
||||
GtkWidget *gridview;
|
||||
GtkListItemFactory *factory;
|
||||
GListModel *model, *selection;
|
||||
|
||||
gridview = gtk_grid_view_new ();
|
||||
gridview = gtk_grid_view_new (NULL);
|
||||
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
|
||||
@@ -676,13 +675,6 @@ create_color_grid (void)
|
||||
gtk_grid_view_set_max_columns (GTK_GRID_VIEW (gridview), 24);
|
||||
gtk_grid_view_set_enable_rubberband (GTK_GRID_VIEW (gridview), TRUE);
|
||||
|
||||
model = G_LIST_MODEL (gtk_sort_list_model_new (gtk_color_list_new (0), NULL));
|
||||
|
||||
selection = G_LIST_MODEL (gtk_multi_selection_new (model));
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), selection);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (model);
|
||||
|
||||
return gridview;
|
||||
}
|
||||
|
||||
@@ -835,6 +827,22 @@ update_selection_average (GListModel *model,
|
||||
g_object_unref (color);
|
||||
}
|
||||
|
||||
static void
|
||||
update_progress_cb (GtkSortListModel *model,
|
||||
GParamSpec *pspec,
|
||||
GtkProgressBar *progress)
|
||||
{
|
||||
guint total;
|
||||
guint pending;
|
||||
|
||||
total = g_list_model_get_n_items (G_LIST_MODEL (model));
|
||||
total = MAX (total, 1); /* avoid div by 0 below */
|
||||
pending = gtk_sort_list_model_get_pending (model);
|
||||
|
||||
gtk_widget_set_visible (GTK_WIDGET (progress), pending != 0);
|
||||
gtk_progress_bar_set_fraction (progress, (total - pending) / (double) total);
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
@@ -842,10 +850,11 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
{
|
||||
if (window == NULL)
|
||||
{
|
||||
GtkWidget *header, *gridview, *sw, *box, *dropdown;
|
||||
GtkMultiSelection *selection;
|
||||
GtkSortListModel *sort_model;
|
||||
GtkWidget *header, *overlay, *gridview, *sw, *box, *dropdown;
|
||||
GtkListItemFactory *factory;
|
||||
GListStore *factories;
|
||||
GListModel *model;
|
||||
GtkSorter *sorter;
|
||||
GtkSorter *multi_sorter;
|
||||
GListStore *sorters;
|
||||
@@ -863,6 +872,7 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
GtkWidget *selection_average_picture;
|
||||
GtkWidget *selection_info_toggle;
|
||||
GtkWidget *selection_info_revealer;
|
||||
GtkWidget *progress;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
@@ -872,6 +882,10 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
|
||||
sort_model = gtk_sort_list_model_new (gtk_color_list_new (0), NULL);
|
||||
gtk_sort_list_model_set_incremental (sort_model, TRUE);
|
||||
selection = gtk_multi_selection_new (G_LIST_MODEL (sort_model));
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Colors");
|
||||
header = gtk_header_bar_new ();
|
||||
@@ -882,8 +896,17 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer*)&window);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_window_set_child (GTK_WINDOW (window), overlay);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
|
||||
|
||||
progress = gtk_progress_bar_new ();
|
||||
gtk_widget_set_hexpand (progress, TRUE);
|
||||
gtk_widget_set_valign (progress, GTK_ALIGN_START);
|
||||
g_signal_connect (sort_model, "notify::pending", G_CALLBACK (update_progress_cb), progress);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), progress);
|
||||
|
||||
selection_info_revealer = gtk_revealer_new ();
|
||||
gtk_box_append (GTK_BOX (box), selection_info_revealer);
|
||||
@@ -927,7 +950,7 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_selection_listitem_cb), NULL);
|
||||
selection_view = gtk_grid_view_new_with_factory (factory);
|
||||
selection_view = gtk_grid_view_new_with_factory (NULL, factory);
|
||||
gtk_widget_add_css_class (selection_view, "compact");
|
||||
gtk_grid_view_set_max_columns (GTK_GRID_VIEW (selection_view), 200);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), selection_view);
|
||||
@@ -936,23 +959,19 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
gtk_box_append (GTK_BOX (box), sw);
|
||||
|
||||
gridview = create_color_grid ();
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), G_LIST_MODEL (selection));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gridview);
|
||||
gtk_widget_set_hexpand (sw, TRUE);
|
||||
gtk_widget_set_vexpand (sw, TRUE);
|
||||
model = gtk_grid_view_get_model (GTK_GRID_VIEW (gridview));
|
||||
|
||||
selection_filter = G_LIST_MODEL (gtk_selection_filter_model_new (GTK_SELECTION_MODEL (model)));
|
||||
selection_filter = G_LIST_MODEL (gtk_selection_filter_model_new (GTK_SELECTION_MODEL (selection)));
|
||||
g_signal_connect (selection_filter, "items-changed", G_CALLBACK (update_selection_count), selection_size_label);
|
||||
g_signal_connect (selection_filter, "items-changed", G_CALLBACK (update_selection_average), selection_average_picture);
|
||||
|
||||
no_selection = G_LIST_MODEL (gtk_no_selection_new (selection_filter));
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (selection_view), no_selection);
|
||||
g_object_unref (selection_filter);
|
||||
g_object_unref (no_selection);
|
||||
|
||||
model = gtk_multi_selection_get_model (GTK_MULTI_SELECTION (model));
|
||||
g_object_ref (model);
|
||||
|
||||
selection_info_toggle = gtk_toggle_button_new ();
|
||||
gtk_button_set_icon_name (GTK_BUTTON (selection_info_toggle), "emblem-important-symbolic");
|
||||
gtk_widget_set_tooltip_text (selection_info_toggle, "Show selection info");
|
||||
@@ -965,7 +984,7 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
button = gtk_button_new_with_mnemonic ("_Refill");
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (refill),
|
||||
gtk_sort_list_model_get_model (GTK_SORT_LIST_MODEL (model)));
|
||||
gtk_sort_list_model_get_model (sort_model));
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
|
||||
|
||||
@@ -980,15 +999,13 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
gtk_label_set_width_chars (GTK_LABEL (label), len + 2);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 1);
|
||||
|
||||
g_signal_connect (gtk_grid_view_get_model (GTK_GRID_VIEW (gridview)),
|
||||
"items-changed", G_CALLBACK (items_changed_cb), label);
|
||||
g_signal_connect (selection, "items-changed", G_CALLBACK (items_changed_cb), label);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), label);
|
||||
|
||||
dropdown = gtk_drop_down_new ();
|
||||
gtk_drop_down_set_from_strings (GTK_DROP_DOWN (dropdown), (const char *[]) { "8", "64", "512", "4096", "32768", "262144", "2097152", "16777216", NULL });
|
||||
dropdown = gtk_drop_down_new_from_strings ((const char * const[]) { "8", "64", "512", "4096", "32768", "262144", "2097152", "16777216", NULL });
|
||||
g_signal_connect (dropdown, "notify::selected",
|
||||
G_CALLBACK (limit_changed_cb),
|
||||
gtk_sort_list_model_get_model (GTK_SORT_LIST_MODEL (model)));
|
||||
gtk_sort_list_model_get_model (sort_model));
|
||||
g_signal_connect (dropdown, "notify::selected",
|
||||
G_CALLBACK (limit_changed_cb2),
|
||||
label);
|
||||
@@ -1063,24 +1080,19 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
g_list_store_append (sorters, multi_sorter);
|
||||
g_object_unref (multi_sorter);
|
||||
|
||||
dropdown = gtk_drop_down_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new ("Sort by:"));
|
||||
gtk_box_append (GTK_BOX (box), dropdown);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
|
||||
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (dropdown), expression);
|
||||
gtk_expression_unref (expression);
|
||||
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (sorters));
|
||||
g_object_unref (sorters);
|
||||
dropdown = gtk_drop_down_new (G_LIST_MODEL (sorters), expression);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new ("Sort by:"));
|
||||
gtk_box_append (GTK_BOX (box), dropdown);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
|
||||
|
||||
g_object_bind_property (dropdown, "selected-item", model, "sorter", G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (dropdown, "selected-item", sort_model, "sorter", G_BINDING_SYNC_CREATE);
|
||||
|
||||
factories = g_list_store_new (GTK_TYPE_LIST_ITEM_FACTORY);
|
||||
|
||||
@@ -1094,25 +1106,20 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
set_title (factory, "Everything");
|
||||
g_list_store_append (factories, factory);
|
||||
|
||||
dropdown = gtk_drop_down_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new ("Show:"));
|
||||
gtk_box_append (GTK_BOX (box), dropdown);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
|
||||
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (dropdown), expression);
|
||||
gtk_expression_unref (expression);
|
||||
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (factories));
|
||||
g_object_unref (factories);
|
||||
dropdown = gtk_drop_down_new (G_LIST_MODEL (factories), expression);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new ("Show:"));
|
||||
gtk_box_append (GTK_BOX (box), dropdown);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
|
||||
|
||||
g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE);
|
||||
g_object_unref (model);
|
||||
|
||||
g_object_unref (selection);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -5,6 +5,10 @@
|
||||
* It demonstrates how to implement support for trees with GtkListView.
|
||||
* It also shows how to set up sorting and filtering for columns in a
|
||||
* GtkColumnView.
|
||||
*
|
||||
* It also demonstrates different styles of list. The tree on the left
|
||||
* uses the .navigation-sidebar style class, the list on the right uses
|
||||
* the .data-table style class.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -214,7 +218,6 @@ transform_settings_to_keys (GBinding *binding,
|
||||
GtkSortListModel *sort_model;
|
||||
GtkFilterListModel *filter_model;
|
||||
GtkFilter *filter;
|
||||
GtkNoSelection *selection_model;
|
||||
char **keys;
|
||||
guint i;
|
||||
|
||||
@@ -242,21 +245,13 @@ transform_settings_to_keys (GBinding *binding,
|
||||
g_object_unref (settings);
|
||||
|
||||
sort_model = gtk_sort_list_model_new (G_LIST_MODEL (store),
|
||||
gtk_column_view_get_sorter (GTK_COLUMN_VIEW (data)));
|
||||
g_object_unref (store);
|
||||
g_object_ref (gtk_column_view_get_sorter (GTK_COLUMN_VIEW (data))));
|
||||
|
||||
filter = gtk_string_filter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name"));
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (sort_model), filter);
|
||||
g_object_unref (sort_model);
|
||||
|
||||
g_set_object (¤t_filter, filter);
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (sort_model), filter);
|
||||
|
||||
g_object_unref (filter);
|
||||
|
||||
selection_model = gtk_no_selection_new (G_LIST_MODEL (filter_model));
|
||||
g_object_unref (filter_model);
|
||||
|
||||
g_value_take_object (to_value, selection_model);
|
||||
g_value_take_object (to_value, gtk_no_selection_new (G_LIST_MODEL (filter_model)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -367,6 +362,8 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
g_object_unref (scope);
|
||||
|
||||
gtk_builder_add_from_resource (builder, "/listview_settings/listview_settings.ui", NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
@@ -403,8 +400,8 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
g_object_unref (actions);
|
||||
|
||||
model = create_settings_model (NULL, NULL);
|
||||
treemodel = gtk_tree_list_model_new (FALSE,
|
||||
model,
|
||||
treemodel = gtk_tree_list_model_new (model,
|
||||
FALSE,
|
||||
TRUE,
|
||||
create_settings_model,
|
||||
NULL,
|
||||
@@ -418,8 +415,6 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
columnview, NULL);
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
|
||||
g_object_unref (selection);
|
||||
g_object_unref (treemodel);
|
||||
g_object_unref (model);
|
||||
|
||||
name_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "name_column"));
|
||||
sorter = gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name"));
|
||||
|
@@ -20,6 +20,9 @@
|
||||
<object class="GtkScrolledWindow">
|
||||
<child>
|
||||
<object class="GtkListView" id="listview">
|
||||
<style>
|
||||
<class name="navigation-sidebar"/>
|
||||
</style>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes"><![CDATA[
|
||||
@@ -73,6 +76,9 @@
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkColumnView" id="columnview">
|
||||
<style>
|
||||
<class name="data-table"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkColumnViewColumn" id="name_column">
|
||||
<property name="title">Name</property>
|
||||
|
@@ -281,20 +281,16 @@ GtkWidget *
|
||||
create_weather_view (void)
|
||||
{
|
||||
GtkWidget *listview;
|
||||
GListModel *model, *selection;
|
||||
GListModel *model;
|
||||
GtkListItemFactory *factory;
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_widget), NULL);
|
||||
listview = gtk_list_view_new_with_factory (factory);
|
||||
model = G_LIST_MODEL (gtk_no_selection_new (create_weather_model ()));
|
||||
listview = gtk_list_view_new_with_factory (model, factory);
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (listview), GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_list_view_set_show_separators (GTK_LIST_VIEW (listview), TRUE);
|
||||
model = create_weather_model ();
|
||||
selection = G_LIST_MODEL (gtk_no_selection_new (model));
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), selection);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (model);
|
||||
|
||||
return listview;
|
||||
}
|
||||
|
@@ -65,6 +65,7 @@ read_lines_cb (GObject *object,
|
||||
{
|
||||
g_print ("Could not read data: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
g_object_unref (stringlist);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,6 +75,7 @@ read_lines_cb (GObject *object,
|
||||
{
|
||||
if (size)
|
||||
gtk_string_list_take (stringlist, g_utf8_make_valid (buffer, size));
|
||||
g_object_unref (stringlist);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,6 +123,7 @@ file_is_open_cb (GObject *file,
|
||||
{
|
||||
g_print ("Could not open file: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (data);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -134,7 +137,7 @@ load_file (GtkStringList *list,
|
||||
GFile *file)
|
||||
{
|
||||
gtk_string_list_splice (list, 0, g_list_model_get_n_items (G_LIST_MODEL (list)), NULL);
|
||||
g_file_read_async (file, G_PRIORITY_HIGH_IDLE, NULL, file_is_open_cb, list);
|
||||
g_file_read_async (file, G_PRIORITY_HIGH_IDLE, NULL, file_is_open_cb, g_object_ref (list));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -157,7 +160,6 @@ do_listview_words (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *header, *listview, *sw, *vbox, *search_entry, *open_button, *overlay;
|
||||
GtkFilterListModel *filter_model;
|
||||
GtkNoSelection *selection;
|
||||
GtkStringList *stringlist;
|
||||
GtkFilter *filter;
|
||||
GFile *file;
|
||||
@@ -175,6 +177,7 @@ do_listview_words (GtkWidget *do_widget)
|
||||
stringlist = gtk_string_list_new ((const char **) words);
|
||||
g_strfreev (words);
|
||||
}
|
||||
g_object_unref (file);
|
||||
|
||||
filter = gtk_string_filter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string"));
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (stringlist), filter);
|
||||
@@ -215,18 +218,15 @@ do_listview_words (GtkWidget *do_widget)
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
|
||||
listview = gtk_list_view_new_with_factory (
|
||||
G_LIST_MODEL (gtk_no_selection_new (G_LIST_MODEL (filter_model))),
|
||||
gtk_builder_list_item_factory_new_from_bytes (NULL,
|
||||
g_bytes_new_static (factory_text, strlen (factory_text))));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
|
||||
selection = gtk_no_selection_new (G_LIST_MODEL (filter_model));
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
|
||||
g_object_unref (selection);
|
||||
|
||||
g_signal_connect (filter_model, "items-changed", G_CALLBACK (update_title_cb), progress);
|
||||
g_signal_connect (filter_model, "notify::pending", G_CALLBACK (update_title_cb), progress);
|
||||
update_title_cb (filter_model);
|
||||
|
||||
g_object_unref (filter_model);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -9,11 +9,12 @@
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "demos.h"
|
||||
#include "fontify.h"
|
||||
|
||||
static GtkWidget *info_view;
|
||||
static GtkWidget *source_view;
|
||||
|
||||
static gchar *current_file = NULL;
|
||||
static char *current_file = NULL;
|
||||
|
||||
static GtkWidget *notebook;
|
||||
static GtkSingleSelection *selection;
|
||||
@@ -141,15 +142,21 @@ activate_about (GSimpleAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
const gchar *authors[] = {
|
||||
const char *authors[] = {
|
||||
"The GTK Team",
|
||||
NULL
|
||||
};
|
||||
char *version;
|
||||
char *os_name;
|
||||
char *os_version;
|
||||
GString *s;
|
||||
|
||||
s = g_string_new ("");
|
||||
|
||||
os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
|
||||
os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
|
||||
if (os_name && os_version)
|
||||
g_string_append_printf (s, "OS\t%s %s\n\n", os_name, os_version);
|
||||
g_string_append (s, "System libraries\n");
|
||||
g_string_append_printf (s, "\tGLib\t%d.%d.%d\n",
|
||||
glib_major_version,
|
||||
@@ -184,6 +191,8 @@ activate_about (GSimpleAction *action,
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
g_free (version);
|
||||
g_free (os_name);
|
||||
g_free (os_version);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -226,377 +235,10 @@ activate_run (GSimpleAction *action,
|
||||
gtk_demo_run (demo, window);
|
||||
}
|
||||
|
||||
/* Stupid syntax highlighting.
|
||||
*
|
||||
* No regex was used in the making of this highlighting.
|
||||
* It should only work for simple cases. This is good, as
|
||||
* that's all we should have in the demos.
|
||||
*/
|
||||
/* This code should not be used elsewhere, except perhaps as an example of how
|
||||
* to iterate through a text buffer.
|
||||
*/
|
||||
enum {
|
||||
STATE_NORMAL,
|
||||
STATE_IN_COMMENT
|
||||
};
|
||||
|
||||
static const char *tokens[] =
|
||||
{
|
||||
"/*",
|
||||
"\"",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *types[] =
|
||||
{
|
||||
"static",
|
||||
"const ",
|
||||
"void",
|
||||
"gint",
|
||||
" int ",
|
||||
" char ",
|
||||
"gchar ",
|
||||
"gfloat",
|
||||
"float",
|
||||
"double",
|
||||
"gint8",
|
||||
"gint16",
|
||||
"gint32",
|
||||
"guint",
|
||||
"guint8",
|
||||
"guint16",
|
||||
"guint32",
|
||||
"guchar",
|
||||
"glong",
|
||||
"gboolean" ,
|
||||
"gshort",
|
||||
"gushort",
|
||||
"gulong",
|
||||
"gdouble",
|
||||
"gldouble",
|
||||
"gpointer",
|
||||
"NULL",
|
||||
"GList",
|
||||
"GSList",
|
||||
"FALSE",
|
||||
"TRUE",
|
||||
"FILE ",
|
||||
"GtkColorSelection ",
|
||||
"GtkWidget ",
|
||||
"GtkButton ",
|
||||
"GdkColor ",
|
||||
"GdkRectangle ",
|
||||
"GdkEventExpose ",
|
||||
"GdkGC ",
|
||||
"GdkPixbufLoader ",
|
||||
"GdkPixbuf ",
|
||||
"GError",
|
||||
"size_t",
|
||||
"GtkAboutDialog ",
|
||||
"GtkAction ",
|
||||
"GtkActionEntry ",
|
||||
"GtkRadioActionEntry ",
|
||||
"GtkIconFactory ",
|
||||
"GtkTextBuffer ",
|
||||
"GtkStatusbar ",
|
||||
"GtkTextIter ",
|
||||
"GtkTextMark ",
|
||||
"GdkEventWindowState ",
|
||||
"GtkActionGroup ",
|
||||
"GtkUIManager ",
|
||||
"GtkRadioAction ",
|
||||
"GtkActionClass ",
|
||||
"GtkToggleActionEntry ",
|
||||
"GtkAssistant ",
|
||||
"GtkBuilder ",
|
||||
"GtkSizeGroup ",
|
||||
"GtkTreeModel ",
|
||||
"GtkTreeSelection ",
|
||||
"GdkDisplay ",
|
||||
"GdkScreen ",
|
||||
"GdkSurface ",
|
||||
"GdkEventButton ",
|
||||
"GdkCursor ",
|
||||
"GtkTreeIter ",
|
||||
"GtkTreeViewColumn ",
|
||||
"GdkDisplayManager ",
|
||||
"GdkClipboard ",
|
||||
"GtkIconSize ",
|
||||
"GtkImage ",
|
||||
"GdkDragContext ",
|
||||
"GtkSelectionData ",
|
||||
"GtkDialog ",
|
||||
"GtkMenuItem ",
|
||||
"GtkListStore ",
|
||||
"GtkCellLayout ",
|
||||
"GtkCellRenderer ",
|
||||
"GtkTreePath ",
|
||||
"GtkTreeStore ",
|
||||
"GtkEntry ",
|
||||
"GtkEditable ",
|
||||
"GtkEditableInterface ",
|
||||
"GdkPixmap ",
|
||||
"GdkEventConfigure ",
|
||||
"GdkEventMotion ",
|
||||
"GdkModifierType ",
|
||||
"GtkEntryCompletion ",
|
||||
"GtkToolItem ",
|
||||
"GDir ",
|
||||
"GtkIconView ",
|
||||
"GtkCellRendererText ",
|
||||
"GtkContainer ",
|
||||
"GtkPaned ",
|
||||
"GtkPrintOperation ",
|
||||
"GtkPrintContext ",
|
||||
"cairo_t ",
|
||||
"PangoLayout "
|
||||
"PangoFontDescription ",
|
||||
"PangoRenderer ",
|
||||
"PangoMatrix ",
|
||||
"PangoContext ",
|
||||
"PangoLayout ",
|
||||
"GtkToggleButton ",
|
||||
"GString ",
|
||||
"GtkIconSize ",
|
||||
"GtkTreeView ",
|
||||
"GtkTextTag ",
|
||||
"GdkEvent ",
|
||||
"GdkEventKey ",
|
||||
"GtkTextView ",
|
||||
"GdkBitmap ",
|
||||
"GtkTextChildAnchor ",
|
||||
"GArray ",
|
||||
"GtkCellEditable ",
|
||||
"GtkCellRendererToggle ",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *control[] =
|
||||
{
|
||||
" if ",
|
||||
" while ",
|
||||
" else",
|
||||
" do ",
|
||||
" for ",
|
||||
"?",
|
||||
":",
|
||||
"return ",
|
||||
"goto ",
|
||||
NULL
|
||||
};
|
||||
void
|
||||
parse_chars (gchar *text,
|
||||
gchar **end_ptr,
|
||||
gint *state,
|
||||
const char **tag,
|
||||
gboolean start)
|
||||
{
|
||||
gint i;
|
||||
gchar *next_token;
|
||||
|
||||
/* Handle comments first */
|
||||
if (*state == STATE_IN_COMMENT)
|
||||
{
|
||||
*end_ptr = strstr (text, "*/");
|
||||
if (*end_ptr)
|
||||
{
|
||||
*end_ptr += 2;
|
||||
*state = STATE_NORMAL;
|
||||
*tag = "comment";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
*tag = NULL;
|
||||
*end_ptr = NULL;
|
||||
|
||||
/* check for comment */
|
||||
if (!strncmp (text, "/*", 2))
|
||||
{
|
||||
*end_ptr = strstr (text, "*/");
|
||||
if (*end_ptr)
|
||||
*end_ptr += 2;
|
||||
else
|
||||
*state = STATE_IN_COMMENT;
|
||||
*tag = "comment";
|
||||
return;
|
||||
}
|
||||
|
||||
/* check for preprocessor defines */
|
||||
if (*text == '#' && start)
|
||||
{
|
||||
*end_ptr = NULL;
|
||||
*tag = "preprocessor";
|
||||
return;
|
||||
}
|
||||
|
||||
/* functions */
|
||||
if (start && * text != '\t' && *text != ' ' && *text != '{' && *text != '}')
|
||||
{
|
||||
if (strstr (text, "("))
|
||||
{
|
||||
*end_ptr = strstr (text, "(");
|
||||
*tag = "function";
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* check for types */
|
||||
for (i = 0; types[i] != NULL; i++)
|
||||
if (!strncmp (text, types[i], strlen (types[i])) ||
|
||||
(start && types[i][0] == ' ' && !strncmp (text, types[i] + 1, strlen (types[i]) - 1)))
|
||||
{
|
||||
*end_ptr = text + strlen (types[i]);
|
||||
*tag = "type";
|
||||
return;
|
||||
}
|
||||
|
||||
/* check for control */
|
||||
for (i = 0; control[i] != NULL; i++)
|
||||
if (!strncmp (text, control[i], strlen (control[i])))
|
||||
{
|
||||
*end_ptr = text + strlen (control[i]);
|
||||
*tag = "control";
|
||||
return;
|
||||
}
|
||||
|
||||
/* check for string */
|
||||
if (text[0] == '"')
|
||||
{
|
||||
gint maybe_escape = FALSE;
|
||||
|
||||
*end_ptr = text + 1;
|
||||
*tag = "string";
|
||||
while (**end_ptr != '\000')
|
||||
{
|
||||
if (**end_ptr == '\"' && !maybe_escape)
|
||||
{
|
||||
*end_ptr += 1;
|
||||
return;
|
||||
}
|
||||
if (**end_ptr == '\\')
|
||||
maybe_escape = TRUE;
|
||||
else
|
||||
maybe_escape = FALSE;
|
||||
*end_ptr += 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* not at the start of a tag. Find the next one. */
|
||||
for (i = 0; tokens[i] != NULL; i++)
|
||||
{
|
||||
next_token = strstr (text, tokens[i]);
|
||||
if (next_token)
|
||||
{
|
||||
if (*end_ptr)
|
||||
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
|
||||
else
|
||||
*end_ptr = next_token;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; types[i] != NULL; i++)
|
||||
{
|
||||
next_token = strstr (text, types[i]);
|
||||
if (next_token)
|
||||
{
|
||||
if (*end_ptr)
|
||||
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
|
||||
else
|
||||
*end_ptr = next_token;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; control[i] != NULL; i++)
|
||||
{
|
||||
next_token = strstr (text, control[i]);
|
||||
if (next_token)
|
||||
{
|
||||
if (*end_ptr)
|
||||
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
|
||||
else
|
||||
*end_ptr = next_token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* While not as cool as c-mode, this will do as a quick attempt at highlighting */
|
||||
void
|
||||
fontify (GtkTextBuffer *source_buffer)
|
||||
{
|
||||
GtkTextIter start_iter, next_iter, tmp_iter;
|
||||
gint state;
|
||||
gchar *text;
|
||||
gchar *start_ptr, *end_ptr;
|
||||
const char *tag;
|
||||
|
||||
gtk_text_buffer_create_tag (source_buffer, "source",
|
||||
"font", "monospace",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "comment",
|
||||
"foreground", "DodgerBlue",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "type",
|
||||
"foreground", "ForestGreen",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "string",
|
||||
"foreground", "RosyBrown",
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "control",
|
||||
"foreground", "purple",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "preprocessor",
|
||||
"style", PANGO_STYLE_OBLIQUE,
|
||||
"foreground", "burlywood4",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "function",
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"foreground", "DarkGoldenrod4",
|
||||
NULL);
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start_iter, &tmp_iter);
|
||||
gtk_text_buffer_apply_tag_by_name (source_buffer, "source", &start_iter, &tmp_iter);
|
||||
|
||||
state = STATE_NORMAL;
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (source_buffer, &start_iter, 0);
|
||||
|
||||
next_iter = start_iter;
|
||||
while (gtk_text_iter_forward_line (&next_iter))
|
||||
{
|
||||
gboolean start = TRUE;
|
||||
start_ptr = text = gtk_text_iter_get_text (&start_iter, &next_iter);
|
||||
|
||||
do
|
||||
{
|
||||
parse_chars (start_ptr, &end_ptr, &state, &tag, start);
|
||||
|
||||
start = FALSE;
|
||||
if (end_ptr)
|
||||
{
|
||||
tmp_iter = start_iter;
|
||||
gtk_text_iter_forward_chars (&tmp_iter, end_ptr - start_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_iter = next_iter;
|
||||
}
|
||||
if (tag)
|
||||
gtk_text_buffer_apply_tag_by_name (source_buffer, tag, &start_iter, &tmp_iter);
|
||||
|
||||
start_iter = tmp_iter;
|
||||
start_ptr = end_ptr;
|
||||
}
|
||||
while (end_ptr);
|
||||
|
||||
g_free (text);
|
||||
start_iter = next_iter;
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_image (const char *resource)
|
||||
display_image (const char *format,
|
||||
const char *resource,
|
||||
char **label)
|
||||
{
|
||||
GtkWidget *sw, *image;
|
||||
|
||||
@@ -610,11 +252,62 @@ display_image (const char *resource)
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_text (const char *resource)
|
||||
display_images (const char *format,
|
||||
const char *resource_dir,
|
||||
char **label)
|
||||
{
|
||||
char **resources;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *widget;
|
||||
guint i;
|
||||
|
||||
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
|
||||
if (resources == NULL)
|
||||
return NULL;
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
grid = gtk_flow_box_new ();
|
||||
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (grid), GTK_SELECTION_NONE);
|
||||
gtk_widget_set_valign (grid, GTK_ALIGN_START);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), grid);
|
||||
|
||||
for (i = 0; resources[i]; i++)
|
||||
{
|
||||
char *resource_name;
|
||||
GtkWidget *box;
|
||||
|
||||
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
|
||||
|
||||
widget = display_image (NULL, resource_name, NULL);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_box_append (GTK_BOX (box), widget);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new (resources[i]));
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (grid), box, -1);
|
||||
|
||||
g_free (resource_name);
|
||||
}
|
||||
|
||||
g_strfreev (resources);
|
||||
|
||||
*label = g_strdup ("Images");
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_text (const char *format,
|
||||
const char *resource,
|
||||
char **label)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *textview, *sw;
|
||||
GBytes *bytes;
|
||||
const char *text;
|
||||
gsize len;
|
||||
|
||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
||||
g_assert (bytes);
|
||||
@@ -634,14 +327,17 @@ display_text (const char *resource)
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (textview), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (textview), 2);
|
||||
gtk_text_view_set_monospace (GTK_TEXT_VIEW (textview), TRUE);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
if (g_str_has_suffix (resource, ".c"))
|
||||
fontify (buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
text = g_bytes_unref_to_data (bytes, &len);
|
||||
gtk_text_buffer_set_text (buffer, text, len);
|
||||
|
||||
if (format)
|
||||
fontify (format, buffer);
|
||||
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
@@ -653,7 +349,9 @@ display_text (const char *resource)
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_video (const char *resource)
|
||||
display_video (const char *format,
|
||||
const char *resource,
|
||||
char **label)
|
||||
{
|
||||
GtkWidget *video;
|
||||
|
||||
@@ -680,27 +378,32 @@ display_nothing (const char *resource)
|
||||
|
||||
static struct {
|
||||
const char *extension;
|
||||
GtkWidget * (* display_func) (const char *resource);
|
||||
const char *format;
|
||||
GtkWidget * (* display_func) (const char *format,
|
||||
const char *resource,
|
||||
char **label);
|
||||
} display_funcs[] = {
|
||||
{ ".gif", display_image },
|
||||
{ ".jpg", display_image },
|
||||
{ ".png", display_image },
|
||||
{ ".c", display_text },
|
||||
{ ".css", display_text },
|
||||
{ ".glsl", display_text },
|
||||
{ ".h", display_text },
|
||||
{ ".txt", display_text },
|
||||
{ ".ui", display_text },
|
||||
{ ".webm", display_video }
|
||||
{ ".gif", NULL, display_image },
|
||||
{ ".jpg", NULL, display_image },
|
||||
{ ".png", NULL, display_image },
|
||||
{ ".c", "c", display_text },
|
||||
{ ".css", "css", display_text },
|
||||
{ ".glsl", NULL, display_text },
|
||||
{ ".h", "c", display_text },
|
||||
{ ".txt", NULL, display_text },
|
||||
{ ".ui", "xml", display_text },
|
||||
{ ".webm", NULL, display_video },
|
||||
{ "images/", NULL, display_images }
|
||||
};
|
||||
|
||||
static void
|
||||
add_data_tab (const gchar *demoname)
|
||||
add_data_tab (const char *demoname)
|
||||
{
|
||||
gchar *resource_dir, *resource_name;
|
||||
gchar **resources;
|
||||
char *resource_dir, *resource_name;
|
||||
char **resources;
|
||||
GtkWidget *widget, *label;
|
||||
guint i, j;
|
||||
char *label_string;
|
||||
|
||||
resource_dir = g_strconcat ("/", demoname, NULL);
|
||||
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
|
||||
@@ -714,18 +417,22 @@ add_data_tab (const gchar *demoname)
|
||||
{
|
||||
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
|
||||
|
||||
for (j = 0; j < G_N_ELEMENTS(display_funcs); j++)
|
||||
for (j = 0; j < G_N_ELEMENTS (display_funcs); j++)
|
||||
{
|
||||
if (g_str_has_suffix (resource_name, display_funcs[j].extension))
|
||||
break;
|
||||
}
|
||||
|
||||
if (j < G_N_ELEMENTS(display_funcs))
|
||||
widget = display_funcs[j].display_func (resource_name);
|
||||
label_string = NULL;
|
||||
|
||||
if (j < G_N_ELEMENTS (display_funcs))
|
||||
widget = display_funcs[j].display_func (display_funcs[j].format,
|
||||
resource_name,
|
||||
&label_string);
|
||||
else
|
||||
widget = display_nothing (resource_name);
|
||||
|
||||
label = gtk_label_new (resources[i]);
|
||||
label = gtk_label_new (label_string ? label_string : resources[i]);
|
||||
gtk_widget_show (label);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
|
||||
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
|
||||
@@ -733,6 +440,7 @@ add_data_tab (const gchar *demoname)
|
||||
NULL);
|
||||
|
||||
g_free (resource_name);
|
||||
g_free (label_string);
|
||||
}
|
||||
|
||||
g_strfreev (resources);
|
||||
@@ -742,15 +450,15 @@ add_data_tab (const gchar *demoname)
|
||||
static void
|
||||
remove_data_tabs (void)
|
||||
{
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
for (i = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) - 1; i > 1; i--)
|
||||
gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), i);
|
||||
}
|
||||
|
||||
void
|
||||
load_file (const gchar *demoname,
|
||||
const gchar *filename)
|
||||
load_file (const char *demoname,
|
||||
const char *filename)
|
||||
{
|
||||
GtkTextBuffer *info_buffer, *source_buffer;
|
||||
GtkTextIter start, end;
|
||||
@@ -758,9 +466,9 @@ load_file (const gchar *demoname,
|
||||
GError *err = NULL;
|
||||
int state = 0;
|
||||
gboolean in_para = 0;
|
||||
gchar **lines;
|
||||
char **lines;
|
||||
GBytes *bytes;
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
if (!g_strcmp0 (current_file, filename))
|
||||
return;
|
||||
@@ -800,9 +508,9 @@ load_file (const gchar *demoname,
|
||||
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
|
||||
for (i = 0; lines[i] != NULL; i++)
|
||||
{
|
||||
gchar *p;
|
||||
gchar *q;
|
||||
gchar *r;
|
||||
char *p;
|
||||
char *q;
|
||||
char *r;
|
||||
|
||||
/* Make sure \r is stripped at the end for the poor windows people */
|
||||
lines[i] = g_strchomp (lines[i]);
|
||||
@@ -916,7 +624,7 @@ load_file (const gchar *demoname,
|
||||
|
||||
g_strfreev (lines);
|
||||
|
||||
fontify (source_buffer);
|
||||
fontify ("c", source_buffer);
|
||||
|
||||
gtk_text_buffer_end_irreversible_action (source_buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source_view), source_buffer);
|
||||
@@ -970,7 +678,7 @@ filter_demo (GtkDemo *demo)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Show only if the name maches every needle */
|
||||
/* Show only if the name matches every needle */
|
||||
for (i = 0; search_needle[i]; i++)
|
||||
{
|
||||
if (!demo->title)
|
||||
@@ -992,6 +700,7 @@ demo_filter_by_name (GtkTreeListRow *row,
|
||||
GListModel *children;
|
||||
GtkDemo *demo;
|
||||
guint i, n;
|
||||
GtkTreeListRow *parent;
|
||||
|
||||
/* Show all items if search is empty */
|
||||
if (!search_needle || !search_needle[0] || !*search_needle[0])
|
||||
@@ -1000,6 +709,17 @@ demo_filter_by_name (GtkTreeListRow *row,
|
||||
g_assert (GTK_IS_TREE_LIST_ROW (row));
|
||||
g_assert (GTK_IS_FILTER_LIST_MODEL (model));
|
||||
|
||||
/* Show a row if itself of any parent matches */
|
||||
for (parent = row; parent; parent = gtk_tree_list_row_get_parent (parent))
|
||||
{
|
||||
demo = gtk_tree_list_row_get_item (parent);
|
||||
g_assert (GTK_IS_DEMO (demo));
|
||||
|
||||
if (filter_demo (demo))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Show a row if any child matches */
|
||||
children = gtk_tree_list_row_get_children (row);
|
||||
if (children)
|
||||
{
|
||||
@@ -1018,10 +738,7 @@ demo_filter_by_name (GtkTreeListRow *row,
|
||||
}
|
||||
}
|
||||
|
||||
demo = gtk_tree_list_row_get_item (row);
|
||||
g_assert (GTK_IS_DEMO (demo));
|
||||
|
||||
return filter_demo (demo);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1140,8 +857,8 @@ activate (GApplication *app)
|
||||
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
|
||||
|
||||
listmodel = create_demo_model ();
|
||||
treemodel = gtk_tree_list_model_new (FALSE,
|
||||
G_LIST_MODEL (listmodel),
|
||||
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
|
||||
FALSE,
|
||||
TRUE,
|
||||
get_child_model,
|
||||
NULL,
|
||||
@@ -1149,6 +866,7 @@ activate (GApplication *app)
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (treemodel), NULL);
|
||||
filter = gtk_custom_filter_new ((GtkCustomFilterFunc)demo_filter_by_name, filter_model, NULL);
|
||||
gtk_filter_list_model_set_filter (filter_model, filter);
|
||||
g_object_unref (filter);
|
||||
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
||||
|
||||
@@ -1190,12 +908,12 @@ list_demos (void)
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
static int
|
||||
command_line (GApplication *app,
|
||||
GApplicationCommandLine *cmdline)
|
||||
{
|
||||
GVariantDict *options;
|
||||
const gchar *name = NULL;
|
||||
const char *name = NULL;
|
||||
gboolean autoquit = FALSE;
|
||||
gboolean list = FALSE;
|
||||
DemoData *d, *c;
|
||||
@@ -1298,8 +1016,8 @@ main (int argc, char **argv)
|
||||
{ "inspector", activate_inspector, NULL, NULL, NULL },
|
||||
};
|
||||
struct {
|
||||
const gchar *action_and_target;
|
||||
const gchar *accelerators[2];
|
||||
const char *action_and_target;
|
||||
const char *accelerators[2];
|
||||
} accels[] = {
|
||||
{ "app.about", { "F1", NULL } },
|
||||
{ "app.quit", { "<Control>q", NULL } },
|
||||
|
@@ -70,6 +70,9 @@
|
||||
|
||||
<child>
|
||||
<object class="GtkListView" id="listview">
|
||||
<style>
|
||||
<class name="navigation-sidebar"/>
|
||||
</style>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="resource">/ui/main-listitem.ui</property>
|
||||
@@ -134,6 +137,10 @@
|
||||
<property name="bottom-margin">20</property>
|
||||
<property name="editable">0</property>
|
||||
<property name="cursor-visible">0</property>
|
||||
<property name="monospace">1</property>
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="pixels-above-lines">2</property>
|
||||
<property name="pixels-below-lines">2</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -21,7 +21,7 @@ source_toggled (GtkToggleButton *button)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, end;
|
||||
gchar *markup;
|
||||
char *markup;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
@@ -50,7 +50,7 @@ do_markup (GtkWidget *do_widget)
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
GBytes *bytes;
|
||||
const gchar *markup;
|
||||
const char *markup;
|
||||
GtkWidget *header;
|
||||
GtkWidget *show_source;
|
||||
|
||||
@@ -102,7 +102,7 @@ do_markup (GtkWidget *do_widget)
|
||||
gtk_stack_add_named (GTK_STACK (stack), sw, "source");
|
||||
|
||||
bytes = g_resources_lookup_data ("/markup/markup.txt", 0, NULL);
|
||||
markup = (const gchar *)g_bytes_get_data (bytes, NULL);
|
||||
markup = (const char *)g_bytes_get_data (bytes, NULL);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||
|
@@ -38,8 +38,10 @@ demos = files([
|
||||
'iconview_edit.c',
|
||||
'images.c',
|
||||
'infobar.c',
|
||||
'layoutmanager.c',
|
||||
'links.c',
|
||||
'listbox.c',
|
||||
'listbox2.c',
|
||||
'flowbox.c',
|
||||
'list_store.c',
|
||||
'listview_applauncher.c',
|
||||
@@ -51,7 +53,6 @@ demos = files([
|
||||
'listview_weather.c',
|
||||
'listview_words.c',
|
||||
'markup.c',
|
||||
'modelbutton.c',
|
||||
'overlay.c',
|
||||
'overlay2.c',
|
||||
'paint.c',
|
||||
@@ -62,7 +63,6 @@ demos = files([
|
||||
'password_entry.c',
|
||||
'peg_solitaire.c',
|
||||
'pickers.c',
|
||||
'pixbufs.c',
|
||||
'printing.c',
|
||||
'revealer.c',
|
||||
'rotated_text.c',
|
||||
@@ -93,13 +93,17 @@ demos = files([
|
||||
gtkdemo_deps = [ libgtk_dep, ]
|
||||
|
||||
extra_demo_sources = files(['main.c',
|
||||
'fontify.c',
|
||||
'gtkfishbowl.c',
|
||||
'fontplane.c',
|
||||
'gtkgears.c',
|
||||
'puzzlepiece.c',
|
||||
'bluroverlay.c',
|
||||
'demoimage.c',
|
||||
'demotaggedentry.c'])
|
||||
'demotaggedentry.c',
|
||||
'demochild.c',
|
||||
'demolayout.c',
|
||||
'demowidget.c'])
|
||||
|
||||
if harfbuzz_dep.found() and pangoft_dep.found()
|
||||
demos += files('font_features.c')
|
||||
|
@@ -1,66 +0,0 @@
|
||||
/* Model Button
|
||||
*
|
||||
* GtkModelButton is a button widget that is designed to be used with
|
||||
* a GAction as model. The button will adjust its appearance according
|
||||
* to the kind of action it is connected to.
|
||||
*
|
||||
* It is also possible to use GtkModelButton without a GAction. In this
|
||||
* case, you should set the "role" attribute yourself, and connect to the
|
||||
* "clicked" signal as you would for any other button.
|
||||
*
|
||||
* A common use of GtkModelButton is to implement menu-like content
|
||||
* in popovers.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void
|
||||
modelbutton_tool_clicked (GtkButton *button)
|
||||
{
|
||||
gboolean active;
|
||||
|
||||
g_object_get (button, "active", &active, NULL);
|
||||
g_object_set (button, "active", !active, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_modelbutton (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "color", NULL, "s", "'red'", NULL },
|
||||
{ "chocolate", NULL, NULL, "true", NULL },
|
||||
{ "vanilla", NULL, NULL, "false", NULL },
|
||||
{ "sprinkles", NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GActionGroup *actions;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/modelbutton/modelbutton.ui");
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
actions = (GActionGroup*)g_simple_action_group_new ();
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (actions),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
window);
|
||||
gtk_widget_insert_action_group (window, "win", actions);
|
||||
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -1,133 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="title" translatable="yes">Model Button</property>
|
||||
<property name="resizable">0</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin-start">80</property>
|
||||
<property name="margin-end">80</property>
|
||||
<property name="margin-top">80</property>
|
||||
<property name="margin-bottom">80</property>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_a</property>
|
||||
<property name="label">_Color</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_b</property>
|
||||
<property name="label">_Flavors</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_c</property>
|
||||
<property name="label">_Tools</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_a">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'red'</property>
|
||||
<property name="text">Red</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'green'</property>
|
||||
<property name="text">Green</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'blue'</property>
|
||||
<property name="text">Blue</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_b">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.chocolate</property>
|
||||
<property name="text">Chocolate</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.vanilla</property>
|
||||
<property name="text">Vanilla</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.sprinkles</property>
|
||||
<property name="text">Add Sprinkles</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_c">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Hammer</property>
|
||||
<property name="role">check</property>
|
||||
<signal name="clicked" handler="modelbutton_tool_clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Screwdriver</property>
|
||||
<property name="role">check</property>
|
||||
<signal name="clicked" handler="modelbutton_tool_clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Drill</property>
|
||||
<property name="role">check</property>
|
||||
<signal name="clicked" handler="modelbutton_tool_clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@@ -31,6 +31,11 @@
|
||||
<update_contact>matthias.clasen_at_gmail.com</update_contact>
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<releases>
|
||||
<release version="3.99.0" date="2020-07-30">
|
||||
<description>
|
||||
<p>A new developers snapshot towards GTK 4.0.</p>
|
||||
</description>
|
||||
</release>
|
||||
<release version="3.94.0" date="2018-06-25">
|
||||
<description>
|
||||
<p>A new developers snapshot towards GTK 4.0.</p>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Shows widgets in static positions over a main widget.
|
||||
*
|
||||
* The overlayed widgets can be interactive controls such
|
||||
* The overlaid widgets can be interactive controls such
|
||||
* as the entry in this example, or just decorative, like
|
||||
* the big blue label.
|
||||
*/
|
||||
|
@@ -12,9 +12,9 @@ static void
|
||||
margin_changed (GtkAdjustment *adjustment,
|
||||
GtkTextView *text)
|
||||
{
|
||||
gint value;
|
||||
int value;
|
||||
|
||||
value = (gint)gtk_adjustment_get_value (adjustment);
|
||||
value = (int)gtk_adjustment_get_value (adjustment);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (text), value);
|
||||
g_object_set (tag, "pixels-above-lines", value, NULL);
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include <gtk/gtkunixprint.h>
|
||||
|
||||
static void
|
||||
done_cb (GtkDialog *dialog, gint response, gpointer data)
|
||||
done_cb (GtkDialog *dialog, int response, gpointer data)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ typedef struct
|
||||
cairo_t *cr;
|
||||
GdkRGBA draw_color;
|
||||
GtkPadController *pad_controller;
|
||||
gdouble brush_size;
|
||||
double brush_size;
|
||||
} DrawingArea;
|
||||
|
||||
typedef struct
|
||||
@@ -38,7 +38,7 @@ static GtkPadActionEntry pad_actions[] = {
|
||||
{ GTK_PAD_ACTION_STRIP, -1, -1, N_("Brush size"), "pad.brush_size" },
|
||||
};
|
||||
|
||||
static const gchar *pad_colors[] = {
|
||||
static const char *pad_colors[] = {
|
||||
"black",
|
||||
"pink",
|
||||
"green",
|
||||
@@ -55,8 +55,8 @@ static void drawing_area_set_color (DrawingArea *area,
|
||||
|
||||
static void
|
||||
drawing_area_ensure_surface (DrawingArea *area,
|
||||
gint width,
|
||||
gint height)
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
if (!area->surface ||
|
||||
cairo_image_surface_get_width (area->surface) != width ||
|
||||
@@ -154,7 +154,7 @@ on_pad_button_activate (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
DrawingArea *area)
|
||||
{
|
||||
const gchar *color = g_object_get_data (G_OBJECT (action), "color");
|
||||
const char *color = g_object_get_data (G_OBJECT (action), "color");
|
||||
GdkRGBA rgba;
|
||||
|
||||
gdk_rgba_parse (&rgba, color);
|
||||
@@ -166,7 +166,7 @@ on_pad_knob_change (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
DrawingArea *area)
|
||||
{
|
||||
gdouble value = g_variant_get_double (parameter);
|
||||
double value = g_variant_get_double (parameter);
|
||||
|
||||
area->brush_size = value;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ drawing_area_root (GtkWidget *widget)
|
||||
GSimpleActionGroup *action_group;
|
||||
GSimpleAction *action;
|
||||
GtkWidget *toplevel;
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget);
|
||||
|
||||
@@ -255,9 +255,9 @@ drawing_area_class_init (DrawingAreaClass *klass)
|
||||
static void
|
||||
drawing_area_apply_stroke (DrawingArea *area,
|
||||
GdkDeviceTool *tool,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble pressure)
|
||||
double x,
|
||||
double y,
|
||||
double pressure)
|
||||
{
|
||||
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
|
||||
{
|
||||
@@ -281,8 +281,8 @@ drawing_area_apply_stroke (DrawingArea *area,
|
||||
|
||||
static void
|
||||
stylus_gesture_down (GtkGestureStylus *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
double x,
|
||||
double y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
cairo_new_path (area->cr);
|
||||
@@ -290,13 +290,13 @@ stylus_gesture_down (GtkGestureStylus *gesture,
|
||||
|
||||
static void
|
||||
stylus_gesture_motion (GtkGestureStylus *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
double x,
|
||||
double y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
GdkTimeCoord *backlog;
|
||||
GdkDeviceTool *tool;
|
||||
gdouble pressure;
|
||||
double pressure;
|
||||
guint n_items;
|
||||
|
||||
tool = gtk_gesture_stylus_get_device_tool (gesture);
|
||||
|
@@ -293,6 +293,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Nuclear MediaStream");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
nuclear = gtk_nuclear_media_stream_new ();
|
||||
gtk_media_stream_set_loop (GTK_MEDIA_STREAM (nuclear), TRUE);
|
||||
|
@@ -47,9 +47,9 @@ toggle_shrink (GtkWidget *widget,
|
||||
|
||||
static GtkWidget *
|
||||
create_pane_options (GtkPaned *paned,
|
||||
const gchar *frame_label,
|
||||
const gchar *label1,
|
||||
const gchar *label2)
|
||||
const char *frame_label,
|
||||
const char *label1,
|
||||
const char *label2)
|
||||
{
|
||||
GtkWidget *child1, *child2;
|
||||
GtkWidget *frame;
|
||||
@@ -61,10 +61,6 @@ create_pane_options (GtkPaned *paned,
|
||||
child2 = gtk_paned_get_end_child (paned);
|
||||
|
||||
frame = gtk_frame_new (frame_label);
|
||||
gtk_widget_set_margin_start (frame, 4);
|
||||
gtk_widget_set_margin_end (frame, 4);
|
||||
gtk_widget_set_margin_top (frame, 4);
|
||||
gtk_widget_set_margin_bottom (frame, 4);
|
||||
|
||||
table = gtk_grid_new ();
|
||||
gtk_frame_set_child (GTK_FRAME (frame), table);
|
||||
@@ -110,6 +106,7 @@ do_panes (GtkWidget *do_widget)
|
||||
GtkWidget *vpaned;
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *box;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@@ -120,33 +117,42 @@ do_panes (GtkWidget *do_widget)
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_widget_set_margin_start (vbox, 8);
|
||||
gtk_widget_set_margin_end (vbox, 8);
|
||||
gtk_widget_set_margin_top (vbox, 8);
|
||||
gtk_widget_set_margin_bottom (vbox, 8);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_box_append (GTK_BOX (vbox), frame);
|
||||
|
||||
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_widget_set_margin_start (vpaned, 5);
|
||||
gtk_widget_set_margin_end (vpaned, 5);
|
||||
gtk_widget_set_margin_top (vpaned, 5);
|
||||
gtk_widget_set_margin_bottom (vpaned, 5);
|
||||
gtk_box_append (GTK_BOX (vbox), vpaned);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), vpaned);
|
||||
|
||||
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (frame, 60, 60);
|
||||
gtk_paned_set_start_child (GTK_PANED (hpaned), frame);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 60, 60);
|
||||
gtk_paned_set_start_child (GTK_PANED (hpaned), box);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Hi there");
|
||||
gtk_frame_set_child (GTK_FRAME (frame), button);
|
||||
gtk_widget_set_margin_start (button, 4);
|
||||
gtk_widget_set_margin_end (button, 4);
|
||||
gtk_widget_set_margin_top (button, 4);
|
||||
gtk_widget_set_margin_bottom (button, 4);
|
||||
gtk_widget_set_hexpand (button, TRUE);
|
||||
gtk_widget_set_vexpand (button, TRUE);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (frame, 80, 60);
|
||||
gtk_paned_set_end_child (GTK_PANED (hpaned), frame);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 80, 60);
|
||||
gtk_paned_set_end_child (GTK_PANED (hpaned), box);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (frame, 60, 80);
|
||||
gtk_paned_set_end_child (GTK_PANED (vpaned), frame);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 60, 80);
|
||||
gtk_paned_set_end_child (GTK_PANED (vpaned), box);
|
||||
|
||||
/* Now create toggle buttons to control sizing */
|
||||
|
||||
|
@@ -4,10 +4,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
/* Create an object for the pegs that get moved around in the game.
|
||||
*
|
||||
* We implement the GdkPaintable interface for them, so we can use GtkPicture
|
||||
@@ -56,11 +55,25 @@ solitaire_peg_get_flags (GdkPaintable *paintable)
|
||||
return GDK_PAINTABLE_STATIC_CONTENTS | GDK_PAINTABLE_STATIC_SIZE;
|
||||
}
|
||||
|
||||
static int
|
||||
solitaire_peg_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
static int
|
||||
solitaire_peg_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
static void
|
||||
solitaire_peg_paintable_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = solitaire_peg_snapshot;
|
||||
iface->get_flags = solitaire_peg_get_flags;
|
||||
iface->get_intrinsic_width = solitaire_peg_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = solitaire_peg_get_intrinsic_height;
|
||||
}
|
||||
|
||||
/* When defining the GType, we need to implement the GdkPaintable interface */
|
||||
@@ -103,6 +116,95 @@ solitaire_peg_new (void)
|
||||
return g_object_new (SOLITAIRE_TYPE_PEG, NULL);
|
||||
}
|
||||
|
||||
/*** Helper for finding a win ***/
|
||||
|
||||
static void
|
||||
ended (GObject *object)
|
||||
{
|
||||
g_object_unref (object);
|
||||
}
|
||||
|
||||
static void
|
||||
celebrate (gboolean win)
|
||||
{
|
||||
char *path;
|
||||
GtkMediaStream *stream;
|
||||
|
||||
if (win)
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
|
||||
else
|
||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "dialog-error.oga", NULL);
|
||||
stream = gtk_media_file_new_for_filename (path);
|
||||
gtk_media_stream_set_volume (stream, 1.0);
|
||||
gtk_media_stream_play (stream);
|
||||
|
||||
g_signal_connect (stream, "notify::ended", G_CALLBACK (ended), NULL);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
static int
|
||||
check_move (GtkGrid *grid,
|
||||
int x,
|
||||
int y,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
GtkWidget *image;
|
||||
/* We have a peg at x, y.
|
||||
* Check if we can move the peg to x + 2*dx, y + 2*dy
|
||||
*/
|
||||
image = gtk_grid_get_child_at (grid, x + dx, y + dy);
|
||||
if (!GTK_IS_IMAGE (image) ||
|
||||
!SOLITAIRE_IS_PEG (gtk_image_get_paintable (GTK_IMAGE (image))))
|
||||
return 0;
|
||||
|
||||
image = gtk_grid_get_child_at (grid, x + 2*dx, y + 2*dy);
|
||||
if (!GTK_IMAGE (image) ||
|
||||
SOLITAIRE_IS_PEG (gtk_image_get_paintable (GTK_IMAGE (image))))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
check_for_end (GtkGrid *grid)
|
||||
{
|
||||
GtkWidget *image;
|
||||
int x, y;
|
||||
int pegs;
|
||||
int moves;
|
||||
|
||||
pegs = 0;
|
||||
moves = 0;
|
||||
for (x = 0; x < 7; x++)
|
||||
{
|
||||
for (y = 0; y < 7; y++)
|
||||
{
|
||||
image = gtk_grid_get_child_at (grid, x, y);
|
||||
if (GTK_IS_IMAGE (image) &&
|
||||
SOLITAIRE_IS_PEG (gtk_image_get_paintable (GTK_IMAGE (image))))
|
||||
{
|
||||
pegs++;
|
||||
moves += check_move (grid, x, y, 1, 0);
|
||||
moves += check_move (grid, x, y, -1, 0);
|
||||
moves += check_move (grid, x, y, 0, 1);
|
||||
moves += check_move (grid, x, y, 0, -1);
|
||||
}
|
||||
|
||||
if (pegs > 1 && moves > 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
image = gtk_grid_get_child_at (grid, 3, 3);
|
||||
if (pegs == 1 &&
|
||||
SOLITAIRE_IS_PEG (gtk_image_get_paintable (GTK_IMAGE (image))))
|
||||
celebrate (TRUE);
|
||||
else if (moves == 0)
|
||||
celebrate (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*** DRAG AND DROP ***/
|
||||
|
||||
/* The user tries to start a drag operation.
|
||||
@@ -154,7 +256,7 @@ drag_begin (GtkDragSource *source,
|
||||
gtk_image_clear (GTK_IMAGE (image));
|
||||
}
|
||||
|
||||
/* Thie is called once a drag operation has ended (successfully or not).
|
||||
/* This is called once a drag operation has ended (successfully or not).
|
||||
* We want to undo what we did in drag_begin() above and react
|
||||
* to a potential move of the peg.
|
||||
*/
|
||||
@@ -255,29 +357,120 @@ drop_drop (GtkDropTarget *target,
|
||||
solitaire_peg_set_position (peg, image_x, image_y);
|
||||
gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (peg));
|
||||
|
||||
/* Maybe we have something to celebrate */
|
||||
check_for_end (grid);
|
||||
|
||||
/* Success! */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
create_board (GtkWidget *window)
|
||||
{
|
||||
GtkWidget *grid;
|
||||
GtkWidget *image;
|
||||
int x, y;
|
||||
GtkDragSource *source;
|
||||
GtkDropTarget *target;
|
||||
GtkCssProvider *provider;
|
||||
const char css[] =
|
||||
".solitaire-field {"
|
||||
" border: 1px solid lightgray;"
|
||||
"}";
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_window_set_child (GTK_WINDOW (window), grid);
|
||||
|
||||
for (x = 0; x < 7; x++)
|
||||
{
|
||||
for (y = 0; y < 7; y++)
|
||||
{
|
||||
if ((x < 2 || x >= 5) && (y < 2 || y >= 5))
|
||||
continue;
|
||||
|
||||
image = gtk_image_new ();
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (image),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
gtk_widget_add_css_class (image, "solitaire-field");
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
if (x != 3 || y != 3)
|
||||
{
|
||||
SolitairePeg *peg = solitaire_peg_new ();
|
||||
solitaire_peg_set_position (peg, x, y);
|
||||
gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (peg));
|
||||
}
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), image, x, y, 1, 1);
|
||||
|
||||
/* Set up the drag source.
|
||||
* This is rather straightforward: Set the supported actions
|
||||
* (in our case, pegs can only be moved) and connect all the
|
||||
* relevant signals.
|
||||
* And because all drag'n'drop handling is done via event controllers,
|
||||
* we need to add the controller to the widget.
|
||||
*/
|
||||
source = gtk_drag_source_new ();
|
||||
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (drag_prepare), image);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
g_signal_connect (source, "drag-end", G_CALLBACK (drag_end), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
|
||||
/* Set up the drop target.
|
||||
* This is more involved, because the game logic goes here.
|
||||
*/
|
||||
|
||||
/* First we specify the data we accept: pegs.
|
||||
* And we only want moves.
|
||||
*/
|
||||
target = gtk_drop_target_new (SOLITAIRE_TYPE_PEG, GDK_ACTION_MOVE);
|
||||
/* Then we connect our signals.
|
||||
*/
|
||||
g_signal_connect (target, "accept", G_CALLBACK (drop_accept), image);
|
||||
g_signal_connect (target, "drop", G_CALLBACK (drop_drop), image);
|
||||
/* Finally, like above, we add it to the widget.
|
||||
*/
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (target));
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
restart_game (GtkButton *button,
|
||||
GtkWidget *window)
|
||||
{
|
||||
create_board (window);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_peg_solitaire (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *header;
|
||||
GtkWidget *restart;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *image;
|
||||
int x, y;
|
||||
GtkDragSource *source;
|
||||
GtkDropTarget *target;
|
||||
|
||||
window = gtk_window_new ();
|
||||
|
||||
restart = gtk_button_new_from_icon_name ("view-refresh-symbolic");
|
||||
g_signal_connect (restart, "clicked", G_CALLBACK (restart), NULL);
|
||||
g_signal_connect (restart, "clicked", G_CALLBACK (restart_game), window);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), restart);
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Peg Solitaire");
|
||||
@@ -285,63 +478,7 @@ do_peg_solitaire (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_window_set_child (GTK_WINDOW (window), grid);
|
||||
|
||||
for (x = 0; x < 7; x++)
|
||||
{
|
||||
for (y = 0; y < 7; y++)
|
||||
{
|
||||
if ((x < 2 || x >= 5) && (y < 2 || y >= 5))
|
||||
continue;
|
||||
|
||||
image = gtk_image_new ();
|
||||
if (x != 3 || y != 3)
|
||||
{
|
||||
SolitairePeg *peg = solitaire_peg_new ();
|
||||
solitaire_peg_set_position (peg, x, y);
|
||||
gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (peg));
|
||||
}
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), image, x, y, 1, 1);
|
||||
|
||||
/* Set up the drag source.
|
||||
* This is rather straightforward: Set the supported actions
|
||||
* (in our case, pegs can only be moved) and connect all the
|
||||
* relevant signals.
|
||||
* And because all drag'n'drop handling is done via event controllers,
|
||||
* we need to add the controller to the widget.
|
||||
*/
|
||||
source = gtk_drag_source_new ();
|
||||
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (drag_prepare), image);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
g_signal_connect (source, "drag-end", G_CALLBACK (drag_end), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
|
||||
/* Set up the drop target.
|
||||
* This is more involved, because the game logic goes here.
|
||||
*/
|
||||
|
||||
/* First we specify the data we accept: pegs.
|
||||
* And we only want moves.
|
||||
*/
|
||||
target = gtk_drop_target_new (SOLITAIRE_TYPE_PEG, GDK_ACTION_MOVE);
|
||||
/* Then we connect our signals.
|
||||
*/
|
||||
g_signal_connect (target, "accept", G_CALLBACK (drop_accept), image);
|
||||
g_signal_connect (target, "drop", G_CALLBACK (drop_drop), image);
|
||||
/* Finally, like above, we add it to the widget.
|
||||
*/
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (target));
|
||||
}
|
||||
}
|
||||
create_board (window);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -6,11 +6,34 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define COLOR(r,g,b) { r/255., g/255., b/255., 1.0 }
|
||||
|
||||
GtkWidget *
|
||||
do_pickers (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *table, *label, *picker;
|
||||
GdkRGBA solarized[] = {
|
||||
COLOR (0xff, 0xff, 0xff),
|
||||
COLOR (0x07, 0x36, 0x42),
|
||||
COLOR (0xdc, 0x32, 0x2f),
|
||||
COLOR (0x85, 0x99, 0x00),
|
||||
COLOR (0xb5, 0x89, 0x00),
|
||||
COLOR (0x26, 0x8b, 0xd2),
|
||||
COLOR (0xd3, 0x36, 0x82),
|
||||
COLOR (0x2a, 0xa1, 0x98),
|
||||
COLOR (0xee, 0xe8, 0xd5),
|
||||
|
||||
COLOR (0x00, 0x00, 0x00),
|
||||
COLOR (0x00, 0x2b, 0x36),
|
||||
COLOR (0xcb, 0x4b, 0x16),
|
||||
COLOR (0x58, 0x6e, 0x75),
|
||||
COLOR (0x65, 0x7b, 0x83),
|
||||
COLOR (0x83, 0x94, 0x96),
|
||||
COLOR (0x6c, 0x71, 0xc4),
|
||||
COLOR (0x93, 0xa1, 0xa1),
|
||||
COLOR (0xfd, 0xf6, 0xe3),
|
||||
};
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@@ -34,6 +57,13 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
picker = gtk_color_button_new ();
|
||||
gtk_color_button_set_title (GTK_COLOR_BUTTON (picker), "Solarized colors");
|
||||
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (picker),
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
9,
|
||||
18,
|
||||
solarized);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
|
||||
|
||||
|
@@ -1,228 +0,0 @@
|
||||
/* Pixbufs
|
||||
*
|
||||
* A GdkPixbuf represents an image, normally in RGB or RGBA format.
|
||||
* Pixbufs are normally used to load files from disk and perform
|
||||
* image scaling.
|
||||
*
|
||||
* This demo is not all that educational, but looks cool. It was written
|
||||
* by Extreme Pixbuf Hacker Federico Mena Quintero. It also shows
|
||||
* off how to use GtkDrawingArea to do a simple animation.
|
||||
*
|
||||
* Look at the Image demo for additional pixbuf usage examples.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <math.h>
|
||||
|
||||
#define BACKGROUND_NAME "/pixbufs/background.jpg"
|
||||
|
||||
static const char *image_names[] = {
|
||||
"/pixbufs/apple-red.png",
|
||||
"/pixbufs/gnome-applets.png",
|
||||
"/pixbufs/gnome-calendar.png",
|
||||
"/pixbufs/gnome-foot.png",
|
||||
"/pixbufs/gnome-gmush.png",
|
||||
"/pixbufs/gnome-gimp.png",
|
||||
"/pixbufs/gnome-gsame.png",
|
||||
"/pixbufs/gnu-keys.png"
|
||||
};
|
||||
|
||||
#define N_IMAGES G_N_ELEMENTS (image_names)
|
||||
|
||||
/* demo window */
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
/* Current frame */
|
||||
static GdkPixbuf *frame;
|
||||
|
||||
/* Background image */
|
||||
static GdkPixbuf *background;
|
||||
static gint back_width, back_height;
|
||||
|
||||
/* Images */
|
||||
static GdkPixbuf *images[N_IMAGES];
|
||||
|
||||
/* Widgets */
|
||||
static GtkWidget *da;
|
||||
|
||||
/* Loads the images for the demo and returns whether the operation succeeded */
|
||||
static gboolean
|
||||
load_pixbufs (GError **error)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (background)
|
||||
return TRUE; /* already loaded earlier */
|
||||
|
||||
background = gdk_pixbuf_new_from_resource (BACKGROUND_NAME, error);
|
||||
if (!background)
|
||||
return FALSE; /* Note that "error" was filled with a GError */
|
||||
|
||||
back_width = gdk_pixbuf_get_width (background);
|
||||
back_height = gdk_pixbuf_get_height (background);
|
||||
|
||||
for (i = 0; i < N_IMAGES; i++)
|
||||
{
|
||||
images[i] = gdk_pixbuf_new_from_resource (image_names[i], error);
|
||||
|
||||
if (!images[i])
|
||||
return FALSE; /* Note that "error" was filled with a GError */
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Expose callback for the drawing area */
|
||||
static void
|
||||
draw_func (GtkDrawingArea *area,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
{
|
||||
gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
|
||||
cairo_paint (cr);
|
||||
}
|
||||
|
||||
#define CYCLE_TIME 3000000 /* 3 seconds */
|
||||
|
||||
static gint64 start_time;
|
||||
|
||||
/* Handler to regenerate the frame */
|
||||
static gboolean
|
||||
on_tick (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer data)
|
||||
{
|
||||
gint64 current_time;
|
||||
double f;
|
||||
int i;
|
||||
double xmid, ymid;
|
||||
double radius;
|
||||
|
||||
gdk_pixbuf_copy_area (background, 0, 0, back_width, back_height,
|
||||
frame, 0, 0);
|
||||
|
||||
if (start_time == 0)
|
||||
start_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
|
||||
current_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
f = ((current_time - start_time) % CYCLE_TIME) / (double)CYCLE_TIME;
|
||||
|
||||
xmid = back_width / 2.0;
|
||||
ymid = back_height / 2.0;
|
||||
|
||||
radius = MIN (xmid, ymid) / 2.0;
|
||||
|
||||
for (i = 0; i < N_IMAGES; i++)
|
||||
{
|
||||
double ang;
|
||||
int xpos, ypos;
|
||||
int iw, ih;
|
||||
double r;
|
||||
GdkRectangle r1, r2, dest;
|
||||
double k;
|
||||
|
||||
ang = 2.0 * G_PI * (double) i / N_IMAGES - f * 2.0 * G_PI;
|
||||
|
||||
iw = gdk_pixbuf_get_width (images[i]);
|
||||
ih = gdk_pixbuf_get_height (images[i]);
|
||||
|
||||
r = radius + (radius / 3.0) * sin (f * 2.0 * G_PI);
|
||||
|
||||
xpos = floor (xmid + r * cos (ang) - iw / 2.0 + 0.5);
|
||||
ypos = floor (ymid + r * sin (ang) - ih / 2.0 + 0.5);
|
||||
|
||||
k = (i & 1) ? sin (f * 2.0 * G_PI) : cos (f * 2.0 * G_PI);
|
||||
k = 2.0 * k * k;
|
||||
k = MAX (0.25, k);
|
||||
|
||||
r1.x = xpos;
|
||||
r1.y = ypos;
|
||||
r1.width = iw * k;
|
||||
r1.height = ih * k;
|
||||
|
||||
r2.x = 0;
|
||||
r2.y = 0;
|
||||
r2.width = back_width;
|
||||
r2.height = back_height;
|
||||
|
||||
if (gdk_rectangle_intersect (&r1, &r2, &dest))
|
||||
gdk_pixbuf_composite (images[i],
|
||||
frame,
|
||||
dest.x, dest.y,
|
||||
dest.width, dest.height,
|
||||
xpos, ypos,
|
||||
k, k,
|
||||
GDK_INTERP_NEAREST,
|
||||
((i & 1)
|
||||
? MAX (127, fabs (255 * sin (f * 2.0 * G_PI)))
|
||||
: MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (da);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_pixbufs (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GError *error;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
error = NULL;
|
||||
if (!load_pixbufs (&error))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Failed to load an image: %s",
|
||||
error->message);
|
||||
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), back_width);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), back_height);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), da);
|
||||
|
||||
gtk_widget_add_tick_callback (da, on_tick, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
g_object_unref (frame);
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
@@ -14,13 +14,13 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *resourcename;
|
||||
gdouble font_size;
|
||||
char *resourcename;
|
||||
double font_size;
|
||||
|
||||
gint lines_per_page;
|
||||
gchar **lines;
|
||||
gint num_lines;
|
||||
gint num_pages;
|
||||
int lines_per_page;
|
||||
char **lines;
|
||||
int num_lines;
|
||||
int num_pages;
|
||||
} PrintData;
|
||||
|
||||
static void
|
||||
@@ -55,17 +55,17 @@ begin_print (GtkPrintOperation *operation,
|
||||
static void
|
||||
draw_page (GtkPrintOperation *operation,
|
||||
GtkPrintContext *context,
|
||||
gint page_nr,
|
||||
int page_nr,
|
||||
gpointer user_data)
|
||||
{
|
||||
PrintData *data = (PrintData *)user_data;
|
||||
cairo_t *cr;
|
||||
PangoLayout *layout;
|
||||
gint text_width, text_height;
|
||||
gdouble width;
|
||||
gint line, i;
|
||||
int text_width, text_height;
|
||||
double width;
|
||||
int line, i;
|
||||
PangoFontDescription *desc;
|
||||
gchar *page_str;
|
||||
char *page_str;
|
||||
|
||||
cr = gtk_print_context_get_cairo_context (context);
|
||||
width = gtk_print_context_get_width (context);
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gint count = 0;
|
||||
static int count = 0;
|
||||
static guint timeout = 0;
|
||||
|
||||
static void
|
||||
@@ -25,7 +25,7 @@ static gboolean
|
||||
reveal_one (gpointer data)
|
||||
{
|
||||
GtkWidget *window = data;
|
||||
gchar *name;
|
||||
char *name;
|
||||
GtkRevealer *revealer;
|
||||
|
||||
name = g_strdup_printf ("revealer%d", count);
|
||||
|
@@ -19,8 +19,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -35,8 +35,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -51,8 +51,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">3</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -66,8 +66,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -82,8 +82,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -98,8 +98,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -114,8 +114,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">4</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -129,8 +129,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column">2</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -145,8 +145,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -189,7 +189,7 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
/* Add a drawing area */
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_box_append (GTK_BOX (box), drawing_area);
|
||||
gtk_widget_add_css_class (drawing_area, GTK_STYLE_CLASS_VIEW);
|
||||
gtk_widget_add_css_class (drawing_area, "view");
|
||||
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
|
||||
rotated_text_draw,
|
||||
|
@@ -33,12 +33,9 @@
|
||||
<object class="GtkLabel" id="label_plain">
|
||||
<property name="label">Plain</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -48,12 +45,9 @@
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -61,12 +55,9 @@
|
||||
<object class="GtkLabel" id="label_marks">
|
||||
<property name="label">Marks</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -83,12 +74,9 @@
|
||||
<mark value="3" position="bottom"></mark>
|
||||
<mark value="4" position="bottom"></mark>
|
||||
</marks>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -96,12 +84,9 @@
|
||||
<object class="GtkLabel" id="label_discrete">
|
||||
<property name="label">Discrete</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_discrete"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -112,9 +97,6 @@
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment3</property>
|
||||
<property name="hexpand">1</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_discrete"/>
|
||||
</accessibility>
|
||||
<marks>
|
||||
<mark value="0" position="bottom"></mark>
|
||||
<mark value="1" position="bottom"></mark>
|
||||
@@ -123,8 +105,8 @@
|
||||
<mark value="4" position="bottom"></mark>
|
||||
</marks>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -37,6 +37,7 @@ static void
|
||||
search_progress_done (GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_progress_fraction (entry, 0.0);
|
||||
g_object_unref (entry);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -54,9 +55,11 @@ finish_search (GtkButton *button)
|
||||
static gboolean
|
||||
start_search_feedback (gpointer data)
|
||||
{
|
||||
gtk_entry_set_progress_fraction (GTK_ENTRY (data), 0.1);
|
||||
search_progress_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 100,
|
||||
(GSourceFunc)search_progress, data,
|
||||
(GSourceFunc)search_progress, g_object_ref (data),
|
||||
(GDestroyNotify)search_progress_done);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
@@ -123,7 +126,7 @@ set_search_by (GSimpleAction *action,
|
||||
|
||||
static void
|
||||
icon_press_cb (GtkEntry *entry,
|
||||
gint position,
|
||||
int position,
|
||||
gpointer data)
|
||||
{
|
||||
if (position == GTK_ENTRY_ICON_PRIMARY)
|
||||
@@ -162,7 +165,8 @@ activate_cb (GtkEntry *entry,
|
||||
}
|
||||
|
||||
static void
|
||||
search_entry_destroyed (GtkWidget *widget)
|
||||
search_entry_destroyed (gpointer data,
|
||||
GObject *widget)
|
||||
{
|
||||
if (finish_search_id != 0)
|
||||
{
|
||||
@@ -261,8 +265,8 @@ do_search_entry (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Search Entry");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (search_entry_destroyed), &window);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (window), search_entry_destroyed, &window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_widget_set_margin_start (vbox, 5);
|
||||
|
@@ -8,12 +8,12 @@
|
||||
|
||||
static void
|
||||
show_shortcuts (GtkWidget *window,
|
||||
const gchar *id,
|
||||
const gchar *view)
|
||||
const char *id,
|
||||
const char *view)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *overlay;
|
||||
gchar *path;
|
||||
char *path;
|
||||
|
||||
path = g_strdup_printf ("/shortcuts/%s.ui", id);
|
||||
builder = gtk_builder_new_from_resource (path);
|
||||
|
@@ -18,7 +18,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
GtkWidget *box;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *header;
|
||||
const gchar* pages[] = {
|
||||
const char * pages[] = {
|
||||
"Welcome to GTK",
|
||||
"GtkStackSidebar Widget",
|
||||
"Automatic navigation",
|
||||
@@ -30,7 +30,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
"Page 9",
|
||||
NULL
|
||||
};
|
||||
const gchar *c = NULL;
|
||||
const char *c = NULL;
|
||||
guint i;
|
||||
|
||||
if (!window)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user