Compare commits
518 Commits
wip/css-va
...
message-wi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cf360cd65 | ||
|
|
68fa64d61e | ||
|
|
54ca75b529 | ||
|
|
d930998f2a | ||
|
|
ae3f7d3032 | ||
|
|
5cb84afaa9 | ||
|
|
a36bf22134 | ||
|
|
8ef8514036 | ||
|
|
c1b1e96a9a | ||
|
|
9948053cd7 | ||
|
|
f1af8046d0 | ||
|
|
8324a93c73 | ||
|
|
251dcc2f86 | ||
|
|
2ca168d680 | ||
|
|
f54ab91ff3 | ||
|
|
66b062a976 | ||
|
|
15572b0183 | ||
|
|
a51a6a3ee2 | ||
|
|
8bee62dd36 | ||
|
|
4248380538 | ||
|
|
e7de4c1f99 | ||
|
|
d620197ae1 | ||
|
|
ad2552ee43 | ||
|
|
756888a53d | ||
|
|
99e1643cdd | ||
|
|
9839aca0bd | ||
|
|
9ab732ce2d | ||
|
|
6ed2d2b232 | ||
|
|
cccc74786f | ||
|
|
aeacc8f3c5 | ||
|
|
7d0ebe02db | ||
|
|
655675e6a1 | ||
|
|
f877f33c19 | ||
|
|
2fce117d15 | ||
|
|
bd5dedce12 | ||
|
|
bdc91c2339 | ||
|
|
8be7515610 | ||
|
|
2cef677aef | ||
|
|
a2e2673809 | ||
|
|
2c844e961f | ||
|
|
5c9d68a550 | ||
|
|
0248a7e43f | ||
|
|
b972decf82 | ||
|
|
66ec091461 | ||
|
|
6ca33c639e | ||
|
|
a13a681910 | ||
|
|
f6eb84189f | ||
|
|
114e2b607b | ||
|
|
21bc2c5078 | ||
|
|
a95cfb1c45 | ||
|
|
799fb41937 | ||
|
|
e6f4c596fa | ||
|
|
3d7fb26588 | ||
|
|
93f9b2d519 | ||
|
|
6f3613a06f | ||
|
|
3723778f42 | ||
|
|
3fc3f8d2ff | ||
|
|
2868f1b509 | ||
|
|
f44570e71a | ||
|
|
15d39dddc5 | ||
|
|
1028449bcc | ||
|
|
01cca279f9 | ||
|
|
a7cae4bffa | ||
|
|
3e2e29a1dc | ||
|
|
de069e15c2 | ||
|
|
f8edefd7c0 | ||
|
|
24a15b51fe | ||
|
|
1f7aba345d | ||
|
|
230212c59c | ||
|
|
86f7c19b91 | ||
|
|
e5cea4e39d | ||
|
|
22aca8952f | ||
|
|
c0e437d163 | ||
|
|
ffe97a453f | ||
|
|
c09ba28b06 | ||
|
|
81de43eba5 | ||
|
|
788be8b945 | ||
|
|
0370979225 | ||
|
|
943014074c | ||
|
|
c0e8523a01 | ||
|
|
8374ebe4c4 | ||
|
|
611d14108d | ||
|
|
25cf702345 | ||
|
|
1d9c61cada | ||
|
|
71adb26a0d | ||
|
|
e27fa33690 | ||
|
|
f7dfead861 | ||
|
|
aac04a0995 | ||
|
|
8af191e52d | ||
|
|
06382ff836 | ||
|
|
cd469788c3 | ||
|
|
44b5076cf2 | ||
|
|
e5be9e1035 | ||
|
|
b831d01f0d | ||
|
|
278bcf2680 | ||
|
|
c19d0dc9ea | ||
|
|
edd5ed169e | ||
|
|
8ec9c3fdc6 | ||
|
|
e95022040f | ||
|
|
3a2ce620e2 | ||
|
|
df49bf9eec | ||
|
|
53327f3aea | ||
|
|
c0c3d75062 | ||
|
|
d0d0409f9d | ||
|
|
3a7d094542 | ||
|
|
280adcbb8c | ||
|
|
83431a999c | ||
|
|
eeeee99aa8 | ||
|
|
0f503e0ba2 | ||
|
|
3e4ae62b44 | ||
|
|
ec4f814bd4 | ||
|
|
0141ba4e00 | ||
|
|
52ef16c21b | ||
|
|
6ca7104015 | ||
|
|
07d6166ab8 | ||
|
|
dc651c3dc3 | ||
|
|
f520801626 | ||
|
|
4e3fbd0b0f | ||
|
|
8a24fdea38 | ||
|
|
b26222b6ba | ||
|
|
c8d291ab86 | ||
|
|
0a87438432 | ||
|
|
ddf1cd6678 | ||
|
|
9c6d5e2ca5 | ||
|
|
1f2561b08e | ||
|
|
d5b31a30fd | ||
|
|
39c678988d | ||
|
|
9052c191cb | ||
|
|
766f442636 | ||
|
|
27a3d2d09e | ||
|
|
3a3482e41e | ||
|
|
44c37fa34a | ||
|
|
5c41dbfaa5 | ||
|
|
c9d2ff7a0f | ||
|
|
174af596c5 | ||
|
|
de2624faa7 | ||
|
|
cda784a5f4 | ||
|
|
cc33dbef03 | ||
|
|
ce36611c4e | ||
|
|
038cb31d27 | ||
|
|
3b53a6b0a9 | ||
|
|
619ff2338e | ||
|
|
2bcd6949df | ||
|
|
abd78ce5f5 | ||
|
|
7899fc03c4 | ||
|
|
9984f00781 | ||
|
|
a0d3bdc911 | ||
|
|
b96317b872 | ||
|
|
6c84958b9f | ||
|
|
f2559b1dbb | ||
|
|
ed2ade4801 | ||
|
|
4549172825 | ||
|
|
b877804eb6 | ||
|
|
5310abbcf7 | ||
|
|
490d4b0b9e | ||
|
|
375432f0b6 | ||
|
|
c00a23ebbc | ||
|
|
4cd2e2a11f | ||
|
|
ae7bf4dcf7 | ||
|
|
9ed1505073 | ||
|
|
e040d3663e | ||
|
|
6af69a7b7d | ||
|
|
a116e0dd26 | ||
|
|
3e2b962a36 | ||
|
|
abb60ec579 | ||
|
|
b738d4a6ac | ||
|
|
0149bd49ca | ||
|
|
e05157437f | ||
|
|
e045e798a2 | ||
|
|
7908a72fa9 | ||
|
|
593bf2bc6d | ||
|
|
cf701d5db4 | ||
|
|
bf8d4c5418 | ||
|
|
912145c81b | ||
|
|
913127b553 | ||
|
|
62f85e2f49 | ||
|
|
4b1212eb4a | ||
|
|
94a096ec4c | ||
|
|
404ee55ec4 | ||
|
|
5fbd52da49 | ||
|
|
7bf094c117 | ||
|
|
4bb79decf3 | ||
|
|
60fb93e063 | ||
|
|
1894a8960e | ||
|
|
4ba5c90bc9 | ||
|
|
1d16bd7d30 | ||
|
|
17819ad4f6 | ||
|
|
ac1ea6faca | ||
|
|
8a3f1a1fa1 | ||
|
|
46c7c0c4e6 | ||
|
|
dd60a9abd6 | ||
|
|
50835ffbf6 | ||
|
|
637713fe72 | ||
|
|
7e71c868ab | ||
|
|
aaf5c43e78 | ||
|
|
5fb6f0e410 | ||
|
|
cd031de680 | ||
|
|
eeda25ab04 | ||
|
|
acaf04a24e | ||
|
|
bcabe77799 | ||
|
|
64cf31f348 | ||
|
|
e037155a94 | ||
|
|
55cbb8a8d6 | ||
|
|
db599f2ae6 | ||
|
|
741567868e | ||
|
|
1e5e0480fd | ||
|
|
917aa7928d | ||
|
|
cd4dbd67a2 | ||
|
|
5a6eab05e9 | ||
|
|
55ccaf9df9 | ||
|
|
af0e056eec | ||
|
|
77d1f0d982 | ||
|
|
d4d7d5eafd | ||
|
|
f658027c51 | ||
|
|
7be993b728 | ||
|
|
e1d78821f6 | ||
|
|
94ac1af293 | ||
|
|
b4db48935d | ||
|
|
f5063c1435 | ||
|
|
8092a6858e | ||
|
|
0fbaeaabd0 | ||
|
|
995f00d23f | ||
|
|
100605ef0c | ||
|
|
1246cd5e73 | ||
|
|
f30e59fed9 | ||
|
|
5e8b294faf | ||
|
|
c84c469b78 | ||
|
|
1a5a65acd0 | ||
|
|
6f5d18a9f5 | ||
|
|
004f22a51c | ||
|
|
d775caff7f | ||
|
|
baf3a3eecd | ||
|
|
ca2e14788d | ||
|
|
c57d8fc6be | ||
|
|
294e5bb79f | ||
|
|
bde19f9b2a | ||
|
|
1d2071b892 | ||
|
|
b46eb5c20a | ||
|
|
3d605615ce | ||
|
|
c502d7fca6 | ||
|
|
9f8abc5d74 | ||
|
|
c8cbb3fbba | ||
|
|
fa3c8ed5f9 | ||
|
|
8ac5f1983e | ||
|
|
eccc02d084 | ||
|
|
0c94db7147 | ||
|
|
ed87473bf9 | ||
|
|
812a879ec2 | ||
|
|
5627542d7c | ||
|
|
f42fe500c9 | ||
|
|
ac3177ce95 | ||
|
|
ccaaff406f | ||
|
|
b1ec43ae33 | ||
|
|
ee8c2a235f | ||
|
|
299fbfd722 | ||
|
|
5f54ecdf2c | ||
|
|
e09138ce45 | ||
|
|
a71893f88b | ||
|
|
01324ffaff | ||
|
|
c354465ed8 | ||
|
|
50ab2386ec | ||
|
|
bf9f362597 | ||
|
|
d03ee57cc5 | ||
|
|
6f24bd9ff4 | ||
|
|
616e0a0d32 | ||
|
|
ee76105119 | ||
|
|
381f863a18 | ||
|
|
57c63d9ce7 | ||
|
|
0522dade9f | ||
|
|
484cff2182 | ||
|
|
dd3c371c08 | ||
|
|
3145bce6a1 | ||
|
|
73f991a7fd | ||
|
|
0205caa371 | ||
|
|
c2c46a7036 | ||
|
|
2b00b64e8c | ||
|
|
4e2522a080 | ||
|
|
473065dfeb | ||
|
|
60dafebd91 | ||
|
|
35370752d5 | ||
|
|
808d00906c | ||
|
|
da5d5bd71f | ||
|
|
0c99e69423 | ||
|
|
410813eb6b | ||
|
|
6cc44eb0fe | ||
|
|
11ee930b9d | ||
|
|
69e4c9b01e | ||
|
|
c32fed9238 | ||
|
|
4941ef659f | ||
|
|
6efb18330f | ||
|
|
5e256590db | ||
|
|
79303d7cd3 | ||
|
|
681a818af2 | ||
|
|
933b1eb4df | ||
|
|
c419b57754 | ||
|
|
05323869d7 | ||
|
|
2520148ebb | ||
|
|
a06a4ad59a | ||
|
|
141aac1a60 | ||
|
|
8a1578ede8 | ||
|
|
8ba7840528 | ||
|
|
3168a3e086 | ||
|
|
3cf9149129 | ||
|
|
7c8a098852 | ||
|
|
ecbdb3104a | ||
|
|
c8a332b3af | ||
|
|
b5f7d57124 | ||
|
|
0db5c7f421 | ||
|
|
ed83272f35 | ||
|
|
20b49e7c34 | ||
|
|
6a6ef0f437 | ||
|
|
32ef462f1d | ||
|
|
b895360f49 | ||
|
|
c2c094e8a1 | ||
|
|
d4d0192405 | ||
|
|
15ea36e7fd | ||
|
|
692279586a | ||
|
|
9eec475dcc | ||
|
|
661130d429 | ||
|
|
68b73ebf91 | ||
|
|
08c0020ac3 | ||
|
|
ac87c72797 | ||
|
|
5be8710774 | ||
|
|
5fa027ab8a | ||
|
|
dbe04adb1a | ||
|
|
6815f3af6d | ||
|
|
f8357512d0 | ||
|
|
8bfc19e7f7 | ||
|
|
d6f7449636 | ||
|
|
f4286e8f1a | ||
|
|
14e6fd1f12 | ||
|
|
2e57621fc5 | ||
|
|
4a8ae3a20c | ||
|
|
61393fdcce | ||
|
|
6ed6cebcf4 | ||
|
|
2f764f6c18 | ||
|
|
a646e50019 | ||
|
|
e967dfed2d | ||
|
|
2dc33a9de1 | ||
|
|
7c5e1c6195 | ||
|
|
8607312fef | ||
|
|
abac891bd2 | ||
|
|
2e25a13fc0 | ||
|
|
7a2c4e8a38 | ||
|
|
90e0ace325 | ||
|
|
9a2a5d9c8b | ||
|
|
d4dd0dcd79 | ||
|
|
d454586927 | ||
|
|
1917b6a0a3 | ||
|
|
a924b820c2 | ||
|
|
9e82d2b843 | ||
|
|
ab7a04d89f | ||
|
|
a377f95aac | ||
|
|
4356e0c3ce | ||
|
|
5d5de9f759 | ||
|
|
e1f69ea278 | ||
|
|
6a76fe41c6 | ||
|
|
aae82d7992 | ||
|
|
ca576e877f | ||
|
|
bc23038848 | ||
|
|
43e8730acd | ||
|
|
c43def5fce | ||
|
|
e68b365fa1 | ||
|
|
3867f9b8ea | ||
|
|
0b20c57867 | ||
|
|
7e9ca5b41d | ||
|
|
a527a4d82e | ||
|
|
adfc29968a | ||
|
|
e17e94d2da | ||
|
|
9af3bb8dc1 | ||
|
|
998dd11cbd | ||
|
|
9cb8d21cb5 | ||
|
|
4fc4298920 | ||
|
|
230188fb30 | ||
|
|
a96c75ff02 | ||
|
|
1b4ed00509 | ||
|
|
a54284b629 | ||
|
|
ee9e9bb3e1 | ||
|
|
cae9689281 | ||
|
|
1f6e2cf291 | ||
|
|
69a76054e8 | ||
|
|
31fea11255 | ||
|
|
5dd7e24806 | ||
|
|
848dc78112 | ||
|
|
e9d7cd3a48 | ||
|
|
b3a3a6ceb1 | ||
|
|
148c133674 | ||
|
|
d2c9cbba4f | ||
|
|
8b33900e1d | ||
|
|
0c3572312a | ||
|
|
7e683ed89b | ||
|
|
7fb892460a | ||
|
|
d517804acd | ||
|
|
ce761122b2 | ||
|
|
76a5354ad7 | ||
|
|
006b473c0c | ||
|
|
5e1af6d7d5 | ||
|
|
ec0cd4a994 | ||
|
|
86864d7bc0 | ||
|
|
485ffcde38 | ||
|
|
0304eaec94 | ||
|
|
a7814a0963 | ||
|
|
160a83023a | ||
|
|
911abe2d2c | ||
|
|
0c02573c47 | ||
|
|
4257e1ce4f | ||
|
|
39bc13c8a7 | ||
|
|
dd7cd6ffdd | ||
|
|
349cda3d36 | ||
|
|
48cc56081d | ||
|
|
aa9a7a931d | ||
|
|
3aee45de28 | ||
|
|
5f469d8903 | ||
|
|
2ce2e90205 | ||
|
|
8b76cc841d | ||
|
|
75b1d75751 | ||
|
|
2d19a1f1ec | ||
|
|
e57d005076 | ||
|
|
31d483dfbc | ||
|
|
fc2cb9d063 | ||
|
|
91cc03a81a | ||
|
|
67049c3261 | ||
|
|
c98cea3dbb | ||
|
|
0a67ac6d47 | ||
|
|
f8c0d86d6c | ||
|
|
872e04f94e | ||
|
|
d5c60438d1 | ||
|
|
60788913da | ||
|
|
f01118f2fc | ||
|
|
9db812ea7f | ||
|
|
d538e78d8a | ||
|
|
ba0499a803 | ||
|
|
1318fdc52c | ||
|
|
d3c50fad6c | ||
|
|
e2219858ae | ||
|
|
85043a2d1b | ||
|
|
cac813bbc4 | ||
|
|
94a4c2cb40 | ||
|
|
11829fe7d0 | ||
|
|
455eefa854 | ||
|
|
0f4f90d722 | ||
|
|
cefb0a3eb8 | ||
|
|
bc661a8ed5 | ||
|
|
9ff549799d | ||
|
|
e499a09759 | ||
|
|
fb280e47d6 | ||
|
|
4aabc45685 | ||
|
|
a8af7caae1 | ||
|
|
7d2c296357 | ||
|
|
c24a69549d | ||
|
|
f141da6b55 | ||
|
|
3688ece655 | ||
|
|
61a51dea7b | ||
|
|
bccb4f87be | ||
|
|
52b6dbf2b4 | ||
|
|
f33f55bcbb | ||
|
|
f4d3f45c16 | ||
|
|
1e65d6640f | ||
|
|
8a4fd30797 | ||
|
|
9818ec4ad9 | ||
|
|
4d08eb264d | ||
|
|
bc159207bd | ||
|
|
1f166ae071 | ||
|
|
ce4c2154f4 | ||
|
|
71fedee85d | ||
|
|
90c2b548e5 | ||
|
|
1d48f96fc5 | ||
|
|
10255eee72 | ||
|
|
5b2568e9e4 | ||
|
|
be6413b0e7 | ||
|
|
15d1c86b2c | ||
|
|
dd47e3bcab | ||
|
|
872534e763 | ||
|
|
d351cbbcea | ||
|
|
6c95547c3f | ||
|
|
c7a7e550dc | ||
|
|
ee1a634c25 | ||
|
|
55ab99cb98 | ||
|
|
f50b0a0bcb | ||
|
|
01054c9c79 | ||
|
|
8bd3ec2ba1 | ||
|
|
e08a9ea9ad | ||
|
|
1987398ec5 | ||
|
|
fa0fc9acb8 | ||
|
|
fa1c461c13 | ||
|
|
a99b05525d | ||
|
|
a337b21a4f | ||
|
|
1b96828667 | ||
|
|
7785c18c56 | ||
|
|
183709c522 | ||
|
|
458bf674ad | ||
|
|
3016edbe72 | ||
|
|
fa554a8e85 | ||
|
|
5b03f5c531 | ||
|
|
2acd10d7b0 | ||
|
|
a012f5bddb | ||
|
|
98796d4513 | ||
|
|
2bbf7d267a | ||
|
|
266d72a82f | ||
|
|
873c437235 | ||
|
|
15e0f3e8c6 | ||
|
|
af2a4d4a91 | ||
|
|
d4e2f23287 | ||
|
|
332bd868f5 | ||
|
|
60a83a51c3 | ||
|
|
79285bd63e | ||
|
|
3a941eff4a | ||
|
|
65adcec82f | ||
|
|
ffb6f39715 | ||
|
|
9a16269747 | ||
|
|
32f55a74b0 | ||
|
|
5320acf589 | ||
|
|
b9b2ac2ce3 | ||
|
|
ad041fc5d4 | ||
|
|
5faa300c5e | ||
|
|
4ab9592924 | ||
|
|
6f01d458d5 | ||
|
|
6f9013297a |
@@ -209,6 +209,7 @@ macos:
|
||||
-Dintrospection=disabled
|
||||
-Dcpp_std=c++11
|
||||
-Dpixman:tests=disabled
|
||||
-Dlibjpeg-turbo:simd=disabled
|
||||
_build
|
||||
- ninja -C _build
|
||||
artifacts:
|
||||
|
||||
95
NEWS
95
NEWS
@@ -1,3 +1,98 @@
|
||||
Overview of Changes in 4.9.1, dd-mm-yyyy
|
||||
========================================
|
||||
|
||||
Note that deprecations are an early outlook at changes
|
||||
that will appear in an eventual GTK 5 release, which is
|
||||
still far away. We are introducing deprecations in 4.10
|
||||
as a way to give users time to adapt, and to provide
|
||||
feedback on our plans.
|
||||
|
||||
* GtkTreeView, GtkIconView, GtkComboBox and
|
||||
auxiliary classes have been deprecated
|
||||
|
||||
* GtkEntryCompletion has been deprecated
|
||||
|
||||
* GtkStyleContext has been deprecated
|
||||
|
||||
* gtk_render_ and gtk_snapshot_render_ APIs
|
||||
have been deprecated
|
||||
|
||||
* GtkAppChooser widgets have been deprecated
|
||||
|
||||
* GtkMessageDialog has been deprecated and
|
||||
replaced by a new async dialog API
|
||||
|
||||
* GtkDialog has been deprecated
|
||||
|
||||
* GtkColorChooser, GtkFontChooser, GtkFileChooser
|
||||
interfaces and their implementations have been
|
||||
deprecated. A new family of async dialog APIs
|
||||
has been introduced to replace them
|
||||
|
||||
* GtkColorDialog, GtkFontDialog, GtkFileDialog
|
||||
and GtkAlertDialog are new dialog classes with
|
||||
a consistent and well-bindable API
|
||||
|
||||
* GtkMountOperation:
|
||||
- Fix the dialog to look reasonable
|
||||
- Make it work under non-X11
|
||||
|
||||
* GtkStringSorter:
|
||||
- Support different collation methods
|
||||
|
||||
* Accessibility:
|
||||
- Introduce GtkAccessibleRange and implement it
|
||||
|
||||
* Debugging:
|
||||
- Unify formatting for debug output
|
||||
- Make make debug options available in
|
||||
non-debug builds
|
||||
|
||||
* Translation updates:
|
||||
Abkhazian
|
||||
Basque
|
||||
Bulgarian
|
||||
Croatian
|
||||
Friulian
|
||||
Georgian
|
||||
German
|
||||
Hungarian
|
||||
Russian
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.8.1, 16-09-2022
|
||||
========================================
|
||||
|
||||
* Input:
|
||||
- Fix problems with input method interactions that caused
|
||||
dead keys not to work
|
||||
- Accept single-key compose sequences (these are used with
|
||||
some keyboard layouts)
|
||||
|
||||
* GtkColumnView:
|
||||
- Flip column order in right-to-left context
|
||||
|
||||
* GtkGridView:
|
||||
- Fix problems with rubberbanding
|
||||
|
||||
* GtkFileChooser:
|
||||
- Fix positioning of popovers in the places view
|
||||
- Make ~ and . keyboard shortcuts work again
|
||||
|
||||
* gsk:
|
||||
- Make glyph upload more similar to icons
|
||||
|
||||
* Make file transfer via portals work, this fixes file
|
||||
copy/paste and dnd in flatpaks
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Chinese (Taiwan)
|
||||
Latvian
|
||||
|
||||
|
||||
Overview of Changes in 4.8.0, 06-09-2022
|
||||
========================================
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if 'DESTDIR' not in os.environ:
|
||||
gtk_api_version = sys.argv[1]
|
||||
gtk_abi_version = sys.argv[2]
|
||||
gtk_libdir = sys.argv[3]
|
||||
gtk_datadir = sys.argv[4]
|
||||
gtk_bindir = sys.argv[5]
|
||||
|
||||
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
|
||||
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
|
||||
gtk_mediamodule_dir = os.path.join(gtk_moduledir, 'media')
|
||||
|
||||
print('Compiling GSettings schemas...')
|
||||
glib_compile_schemas = subprocess.check_output(['pkg-config',
|
||||
'--variable=glib_compile_schemas',
|
||||
'gio-2.0']).strip()
|
||||
if not os.path.exists(glib_compile_schemas):
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
glib_compile_schemas = 'glib-compile-schemas'
|
||||
subprocess.call([glib_compile_schemas,
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
update_icon_cache = os.path.join(gtk_bindir, 'gtk4-update-icon-cache')
|
||||
subprocess.call([update_icon_cache, '-q', '-t' ,'-f',
|
||||
os.path.join(gtk_datadir, 'icons', 'hicolor')])
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
os.makedirs(gtk_printmodule_dir, exist_ok=True)
|
||||
gio_querymodules = subprocess.check_output(['pkg-config',
|
||||
'--variable=gio_querymodules',
|
||||
'gio-2.0']).strip()
|
||||
if not os.path.exists(gio_querymodules):
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
gio_querymodules = 'gio-querymodules'
|
||||
subprocess.call([gio_querymodules, gtk_printmodule_dir])
|
||||
|
||||
print('Updating module cache for media backends...')
|
||||
os.makedirs(gtk_mediamodule_dir, exist_ok=True)
|
||||
subprocess.call([gio_querymodules, gtk_mediamodule_dir])
|
||||
@@ -202,43 +202,36 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
|
||||
}
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
ConstraintEditorWindow *self)
|
||||
open_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
ConstraintEditorWindow *self = user_data;
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
constraint_editor_window_load (self, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
open_cb (GtkWidget *button,
|
||||
ConstraintEditorWindow *self)
|
||||
{
|
||||
GtkFileChooserNative *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
GFile *cwd;
|
||||
|
||||
dialog = gtk_file_chooser_native_new ("Open file",
|
||||
GTK_WINDOW (self),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Load",
|
||||
"_Cancel");
|
||||
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
|
||||
|
||||
GFile *cwd = g_file_new_for_path (".");
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Open file");
|
||||
cwd = g_file_new_for_path (".");
|
||||
gtk_file_dialog_set_current_folder (dialog, cwd);
|
||||
g_object_unref (cwd);
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, NULL, open_response_cb, self);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -294,22 +287,23 @@ serialize_model (GListModel *list)
|
||||
|
||||
|
||||
static void
|
||||
save_response_cb (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
ConstraintEditorWindow *self)
|
||||
save_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
ConstraintEditorWindow *self = user_data;
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_save_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GListModel *model;
|
||||
GFile *file;
|
||||
char *text;
|
||||
GError *error = NULL;
|
||||
|
||||
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
|
||||
text = serialize_model (model);
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
g_file_replace_contents (file, text, strlen (text),
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_NONE,
|
||||
@@ -318,46 +312,39 @@ save_response_cb (GtkNativeDialog *dialog,
|
||||
&error);
|
||||
if (error != NULL)
|
||||
{
|
||||
GtkWidget *message_dialog;
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
|
||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Saving failed");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
|
||||
"%s", error->message);
|
||||
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (message_dialog);
|
||||
alert = gtk_alert_dialog_new ("Saving failed");
|
||||
gtk_alert_dialog_set_detail (alert, error->message);
|
||||
gtk_alert_dialog_show (alert,
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
|
||||
g_object_unref (alert);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_free (text);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
save_cb (GtkWidget *button,
|
||||
ConstraintEditorWindow *self)
|
||||
{
|
||||
GtkFileChooserNative *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
GFile *cwd;
|
||||
|
||||
dialog = gtk_file_chooser_native_new ("Save constraints",
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Save",
|
||||
"_Cancel");
|
||||
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
|
||||
|
||||
GFile *cwd = g_file_new_for_path (".");
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Save constraints");
|
||||
cwd = g_file_new_for_path (".");
|
||||
gtk_file_dialog_set_current_folder (dialog, cwd);
|
||||
g_object_unref (cwd);
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||
gtk_file_dialog_save (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
save_response_cb, self);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "constraint-editor.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
struct _ConstraintEditor
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "guide-editor.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
struct _GuideEditor
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
@@ -33,22 +33,12 @@ static void create_window (GApplication *app, const char *contents);
|
||||
static void
|
||||
show_action_dialog (GSimpleAction *action)
|
||||
{
|
||||
const char *name;
|
||||
GtkWidget *dialog;
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"You activated action: \"%s\"",
|
||||
name);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
dialog = gtk_alert_dialog_new ("You activated action: \"%s\n",
|
||||
g_action_get_name (G_ACTION (action)));
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -90,20 +80,19 @@ activate_new (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
int response_id,
|
||||
gpointer user_data)
|
||||
open_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFileChooserNative *native = user_data;
|
||||
GApplication *app = g_object_get_data (G_OBJECT (native), "app");
|
||||
GtkWidget *message_dialog;
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GApplication *app = G_APPLICATION (user_data);
|
||||
GFile *file;
|
||||
char *contents;
|
||||
GError *error = NULL;
|
||||
|
||||
if (response_id == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_save_finish (dialog, result, &error);
|
||||
if (file)
|
||||
{
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (native));
|
||||
char *contents;
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, NULL, NULL, &error))
|
||||
{
|
||||
@@ -112,21 +101,16 @@ open_response_cb (GtkNativeDialog *dialog,
|
||||
}
|
||||
else
|
||||
{
|
||||
message_dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Error loading file: \"%s\"",
|
||||
error->message);
|
||||
g_signal_connect (message_dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (message_dialog);
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
alert = gtk_alert_dialog_new ("Error loading file: \"%s\"", error->message);
|
||||
gtk_alert_dialog_show (alert, NULL);
|
||||
g_object_unref (alert);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (native));
|
||||
g_object_unref (native);
|
||||
g_object_unref (app);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,21 +120,11 @@ activate_open (GSimpleAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
GApplication *app = user_data;
|
||||
GtkFileChooserNative *native;
|
||||
GtkFileDialog *dialog;
|
||||
|
||||
native = gtk_file_chooser_native_new ("Open File",
|
||||
NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Open",
|
||||
"_Cancel");
|
||||
|
||||
g_object_set_data_full (G_OBJECT (native), "app", g_object_ref (app), g_object_unref);
|
||||
g_signal_connect (native,
|
||||
"response",
|
||||
G_CALLBACK (open_response_cb),
|
||||
native);
|
||||
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_open (dialog, NULL, NULL, NULL, open_response_cb, g_object_ref (app));
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -50,10 +50,10 @@ copy_button_clicked (GtkStack *source_stack,
|
||||
}
|
||||
else if (strcmp (visible_child_name, "Color") == 0)
|
||||
{
|
||||
GdkRGBA color;
|
||||
const GdkRGBA *color;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (visible_child), &color);
|
||||
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, &color);
|
||||
color = gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (visible_child));
|
||||
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, color);
|
||||
}
|
||||
else if (strcmp (visible_child_name, "File") == 0)
|
||||
{
|
||||
@@ -215,37 +215,36 @@ file_button_set_file (GtkButton *button,
|
||||
}
|
||||
|
||||
static void
|
||||
file_chooser_response (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
GtkButton *button)
|
||||
file_chooser_response (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GtkButton *button = GTK_BUTTON (user_data);
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
file_button_set_file (button, file);
|
||||
g_object_unref (file);
|
||||
|
||||
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_cb (GtkWidget *button)
|
||||
{
|
||||
GtkFileChooserNative *chooser;
|
||||
GtkFileDialog *dialog;
|
||||
|
||||
chooser = gtk_file_chooser_native_new ("Choose a file",
|
||||
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Open",
|
||||
"_Cancel");
|
||||
dialog = gtk_file_dialog_new ();
|
||||
|
||||
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), button);
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
|
||||
gtk_file_dialog_open (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
|
||||
NULL,
|
||||
NULL,
|
||||
file_chooser_response, button);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -64,7 +64,11 @@
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">Color</property>
|
||||
<property name="child">
|
||||
<object class="GtkColorButton" id="source_color">
|
||||
<object class="GtkColorDialogButton" id="source_color">
|
||||
<property name="dialog">
|
||||
<object class="GtkColorDialog">
|
||||
</object>
|
||||
</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="rgba">purple</property>
|
||||
</object>
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
enum
|
||||
{
|
||||
ICON_NAME_COL,
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
/* Theming/CSS Accordion
|
||||
*
|
||||
* A simple accordion demo written using CSS transitions and multiple backgrounds
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
|
||||
destroy_provider (GtkWidget *window,
|
||||
GtkStyleProvider *provider)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
apply_css (child, provider);
|
||||
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), provider);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -24,8 +20,8 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *container, *child;
|
||||
GtkStyleProvider *provider;
|
||||
GtkWidget *container, *styled_box, *child;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
|
||||
@@ -33,10 +29,13 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
styled_box = gtk_frame_new (NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), styled_box);
|
||||
gtk_widget_add_css_class (styled_box, "accordion");
|
||||
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
|
||||
gtk_window_set_child (GTK_WINDOW (window), container);
|
||||
gtk_frame_set_child (GTK_FRAME (styled_box), container);
|
||||
|
||||
child = gtk_button_new_with_label ("This");
|
||||
gtk_box_append (GTK_BOX (container), child);
|
||||
@@ -56,10 +55,16 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
child = gtk_button_new_with_label (":-)");
|
||||
gtk_box_append (GTK_BOX (container), child);
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/css_accordion/css_accordion.css");
|
||||
|
||||
apply_css (window, provider);
|
||||
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (destroy_provider), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
@import url("resource://css_accordion/reset.css");
|
||||
.accordion, .accordion * {
|
||||
all: unset;
|
||||
|
||||
* {
|
||||
transition-property: color, background-color, border-color, background-image, padding, border-width;
|
||||
transition-duration: 1s;
|
||||
|
||||
font: 20px Cantarell;
|
||||
}
|
||||
|
||||
window {
|
||||
.accordion {
|
||||
background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
|
||||
linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
|
||||
linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
|
||||
@@ -18,7 +18,7 @@ window {
|
||||
background-size: 20px 20px;
|
||||
}
|
||||
|
||||
button {
|
||||
.accordion button {
|
||||
color: black;
|
||||
background-color: #bbb;
|
||||
border-style: solid;
|
||||
@@ -28,25 +28,25 @@ button {
|
||||
padding: 12px 4px;
|
||||
}
|
||||
|
||||
button:first-child {
|
||||
.accordion button:first-child {
|
||||
border-radius: 5px 0 0 5px;
|
||||
}
|
||||
|
||||
button:last-child {
|
||||
.accordion button:last-child {
|
||||
border-radius: 0 5px 5px 0;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
.accordion button:hover {
|
||||
padding: 12px 48px;
|
||||
background-color: #4870bc;
|
||||
}
|
||||
|
||||
button *:hover {
|
||||
.accordion button *:hover {
|
||||
color: white;
|
||||
}
|
||||
|
||||
button:hover:active,
|
||||
button:active {
|
||||
.accordion button:hover:active,
|
||||
.accordion button:active {
|
||||
background-color: #993401;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
</gresource>
|
||||
<gresource prefix="/css_accordion">
|
||||
<file>css_accordion.css</file>
|
||||
<file>reset.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/css_basics">
|
||||
<file>css_basics.css</file>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *entry1 = NULL;
|
||||
static GtkWidget *entry2 = NULL;
|
||||
@@ -16,19 +18,23 @@ static void
|
||||
message_dialog_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
static int i = 1;
|
||||
GtkAlertDialog *dialog;
|
||||
GtkWindow *parent;
|
||||
static int count = 1;
|
||||
char *detail;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK_CANCEL,
|
||||
"Test message");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
ngettext ("Has been shown once", "Has been shown %d times", i), i);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (dialog);
|
||||
i++;
|
||||
parent = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW));
|
||||
|
||||
dialog = gtk_alert_dialog_new ("Test message");
|
||||
detail = g_strdup_printf (ngettext ("Has been shown once", "Has been shown %d times", count), count);
|
||||
gtk_alert_dialog_set_detail (dialog, detail);
|
||||
g_free (detail);
|
||||
gtk_alert_dialog_set_buttons (dialog, (const char *[]) {"_Cancel", "_OK", NULL });
|
||||
gtk_alert_dialog_set_cancel_button (dialog, 0);
|
||||
gtk_alert_dialog_set_default_button (dialog, 1);
|
||||
|
||||
gtk_alert_dialog_show (dialog, parent);
|
||||
count++;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CanvasItem, canvas_item, CANVAS, ITEM, GtkWidget)
|
||||
|
||||
struct _CanvasItem {
|
||||
@@ -24,6 +25,9 @@ struct _CanvasItem {
|
||||
double delta;
|
||||
|
||||
GtkWidget *editor;
|
||||
|
||||
GtkStyleProvider *provider;
|
||||
char *css_class;
|
||||
};
|
||||
|
||||
struct _CanvasItemClass {
|
||||
@@ -34,32 +38,41 @@ G_DEFINE_TYPE (CanvasItem, canvas_item, GTK_TYPE_WIDGET)
|
||||
|
||||
static int n_items = 0;
|
||||
|
||||
static void
|
||||
unstyle_item (CanvasItem *item)
|
||||
{
|
||||
if (item->provider)
|
||||
{
|
||||
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (item->label), item->provider);
|
||||
g_clear_object (&item->provider);
|
||||
}
|
||||
|
||||
if (item->css_class)
|
||||
{
|
||||
gtk_widget_remove_css_class (item->label, item->css_class);
|
||||
g_clear_pointer (&item->css_class, g_free);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_color (CanvasItem *item,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
char *css;
|
||||
char *str;
|
||||
GtkStyleContext *context;
|
||||
GtkCssProvider *provider;
|
||||
const char *old_class;
|
||||
const char *name;
|
||||
|
||||
unstyle_item (item);
|
||||
|
||||
str = gdk_rgba_to_string (color);
|
||||
css = g_strdup_printf ("* { background: %s; }", str);
|
||||
|
||||
context = gtk_widget_get_style_context (item->label);
|
||||
provider = g_object_get_data (G_OBJECT (context), "style-provider");
|
||||
if (provider)
|
||||
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
|
||||
|
||||
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
|
||||
if (old_class)
|
||||
gtk_widget_remove_css_class (item->label, old_class);
|
||||
name = gtk_widget_get_name (item->label);
|
||||
css = g_strdup_printf ("#%s { background: %s; }", name, str);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (item->label), GTK_STYLE_PROVIDER (provider), 800);
|
||||
g_object_set_data_full (G_OBJECT (context), "style-provider", provider, g_object_unref);
|
||||
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
|
||||
item->provider = GTK_STYLE_PROVIDER (provider);
|
||||
|
||||
g_free (str);
|
||||
g_free (css);
|
||||
@@ -69,21 +82,10 @@ static void
|
||||
set_css (CanvasItem *item,
|
||||
const char *class)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkCssProvider *provider;
|
||||
const char *old_class;
|
||||
unstyle_item (item);
|
||||
|
||||
context = gtk_widget_get_style_context (item->label);
|
||||
provider = g_object_get_data (G_OBJECT (context), "style-provider");
|
||||
if (provider)
|
||||
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
|
||||
|
||||
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
|
||||
if (old_class)
|
||||
gtk_widget_remove_css_class (item->label, old_class);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (item->label), "css-class", g_strdup (class), g_free);
|
||||
gtk_widget_add_css_class (item->label, class);
|
||||
item->css_class = g_strdup (class);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -722,8 +724,11 @@ do_dnd (GtkWidget *do_widget)
|
||||
int i;
|
||||
int x, y;
|
||||
GtkCssProvider *provider;
|
||||
GString *css;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
button = gtk_color_button_new ();
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
g_object_unref (g_object_ref_sink (button));
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
@@ -733,6 +738,18 @@ do_dnd (GtkWidget *do_widget)
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
|
||||
css = g_string_new ("");
|
||||
for (i = 0; colors[i]; i++)
|
||||
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css->str, css->len);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
g_string_free (css, TRUE);
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int number;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* Creates a tree model containing the completions */
|
||||
static GtkTreeModel *
|
||||
create_completion_model (void)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
enum {
|
||||
WIDTH_COLUMN,
|
||||
HEIGHT_COLUMN,
|
||||
|
||||
@@ -68,11 +68,13 @@ create_blurred_button (void)
|
||||
return w;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static GtkWidget *
|
||||
create_font_button (void)
|
||||
{
|
||||
return gtk_font_button_new ();
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *
|
||||
create_level_bar (void)
|
||||
|
||||
@@ -21,6 +21,77 @@
|
||||
#include "script-names.h"
|
||||
#include "language-names.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* {{{ ScriptLang object */
|
||||
|
||||
G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject)
|
||||
|
||||
struct _ScriptLang
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
char *langname;
|
||||
unsigned int script_index;
|
||||
unsigned int lang_index;
|
||||
hb_tag_t lang_tag;
|
||||
};
|
||||
|
||||
struct _ScriptLangClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ScriptLang, script_lang, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
script_lang_init (ScriptLang *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
script_lang_finalize (GObject *object)
|
||||
{
|
||||
ScriptLang *self = SCRIPT_LANG (object);
|
||||
|
||||
g_free (self->langname);
|
||||
|
||||
G_OBJECT_CLASS (script_lang_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
script_lang_class_init (ScriptLangClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = script_lang_finalize;
|
||||
}
|
||||
|
||||
static ScriptLang *
|
||||
script_lang_new (const char *langname,
|
||||
unsigned int script_index,
|
||||
unsigned int lang_index,
|
||||
hb_tag_t lang_tag)
|
||||
{
|
||||
ScriptLang *self;
|
||||
|
||||
self = g_object_new (script_lang_get_type (), NULL);
|
||||
|
||||
self->langname = g_strdup (langname);
|
||||
self->script_index = script_index;
|
||||
self->lang_index = lang_index;
|
||||
self->lang_tag = lang_tag;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static char *
|
||||
script_lang_get_langname (ScriptLang *self)
|
||||
{
|
||||
return g_strdup (self->langname);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
#define MAKE_TAG(a,b,c,d) (unsigned int)(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
|
||||
|
||||
@@ -94,6 +165,10 @@ demo_free (gpointer data)
|
||||
g_clear_pointer (&demo->axes, g_hash_table_unref);
|
||||
g_clear_pointer (&demo->text, g_free);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (demo->provider));
|
||||
g_object_unref (demo->provider);
|
||||
|
||||
g_free (demo);
|
||||
}
|
||||
|
||||
@@ -183,10 +258,10 @@ swap_colors (void)
|
||||
GdkRGBA fg;
|
||||
GdkRGBA bg;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &fg);
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &bg);
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &bg);
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &fg);
|
||||
fg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
|
||||
bg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
|
||||
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &bg);
|
||||
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &fg);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -195,8 +270,8 @@ font_features_reset_basic (void)
|
||||
gtk_adjustment_set_value (demo->size_adjustment, 20);
|
||||
gtk_adjustment_set_value (demo->letterspacing_adjustment, 0);
|
||||
gtk_adjustment_set_value (demo->line_height_adjustment, 1);
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &(GdkRGBA){1.,1.,1.,1.});
|
||||
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
|
||||
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &(GdkRGBA){1.,1.,1.,1.});
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -204,7 +279,7 @@ update_basic (void)
|
||||
{
|
||||
PangoFontDescription *desc;
|
||||
|
||||
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
|
||||
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
|
||||
|
||||
gtk_adjustment_set_value (demo->size_adjustment,
|
||||
pango_font_description_get_size (desc) / (double) PANGO_SCALE);
|
||||
@@ -471,8 +546,6 @@ update_display (void)
|
||||
GString *s;
|
||||
char *text;
|
||||
gboolean has_feature;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
PangoFontDescription *desc;
|
||||
GList *l;
|
||||
PangoAttrList *attrs;
|
||||
@@ -517,7 +590,7 @@ update_display (void)
|
||||
end = PANGO_ATTR_INDEX_TO_TEXT_END;
|
||||
}
|
||||
|
||||
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
|
||||
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
|
||||
|
||||
value = gtk_adjustment_get_value (demo->size_adjustment);
|
||||
pango_font_description_set_size (desc, value * PANGO_SCALE);
|
||||
@@ -575,14 +648,13 @@ update_display (void)
|
||||
|
||||
features = g_string_free (s, FALSE);
|
||||
|
||||
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
|
||||
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) != 0)
|
||||
{
|
||||
hb_tag_t lang_tag;
|
||||
ScriptLang *selected;
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
|
||||
gtk_tree_model_get (model, &iter, 3, &lang_tag, -1);
|
||||
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
|
||||
|
||||
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (lang_tag)));
|
||||
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (selected->lang_tag)));
|
||||
}
|
||||
else
|
||||
lang = NULL;
|
||||
@@ -609,7 +681,7 @@ update_display (void)
|
||||
GdkRGBA rgba;
|
||||
char *fg, *bg, *css;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &rgba);
|
||||
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
|
||||
attr = pango_attr_foreground_new (65535 * rgba.red,
|
||||
65535 * rgba.green,
|
||||
65535 * rgba.blue);
|
||||
@@ -622,7 +694,7 @@ update_display (void)
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
|
||||
fg = gdk_rgba_to_string (&rgba);
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &rgba);
|
||||
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
|
||||
bg = gdk_rgba_to_string (&rgba);
|
||||
css = g_strdup_printf (".font_features_background { caret-color: %s; background-color: %s; }", fg, bg);
|
||||
gtk_css_provider_load_from_data (demo->provider, css, strlen (css));
|
||||
@@ -697,7 +769,6 @@ update_display (void)
|
||||
gtk_label_set_attributes (GTK_LABEL (demo->the_label), attrs);
|
||||
|
||||
g_free (font_desc);
|
||||
pango_font_description_free (desc);
|
||||
g_free (features);
|
||||
pango_attr_list_unref (attrs);
|
||||
g_free (text);
|
||||
@@ -709,7 +780,7 @@ get_pango_font (void)
|
||||
PangoFontDescription *desc;
|
||||
PangoContext *context;
|
||||
|
||||
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
|
||||
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
|
||||
context = gtk_widget_get_pango_context (demo->font);
|
||||
|
||||
return pango_context_load_font (context, desc);
|
||||
@@ -739,50 +810,40 @@ tag_pair_equal (gconstpointer a, gconstpointer b)
|
||||
return pair_a->script_tag == pair_b->script_tag && pair_a->lang_tag == pair_b->lang_tag;
|
||||
}
|
||||
|
||||
static int
|
||||
script_sort_func (GtkTreeModel *model,
|
||||
GtkTreeIter *a,
|
||||
GtkTreeIter *b,
|
||||
gpointer user_data)
|
||||
|
||||
static GtkOrdering
|
||||
script_sort (const void *item1,
|
||||
const void *item2,
|
||||
void *data)
|
||||
{
|
||||
char *sa, *sb;
|
||||
int ret;
|
||||
ScriptLang *a = (ScriptLang *)item1;
|
||||
ScriptLang *b = (ScriptLang *)item2;
|
||||
|
||||
gtk_tree_model_get (model, a, 0, &sa, -1);
|
||||
gtk_tree_model_get (model, b, 0, &sb, -1);
|
||||
|
||||
ret = strcmp (sa, sb);
|
||||
|
||||
g_free (sa);
|
||||
g_free (sb);
|
||||
|
||||
return ret;
|
||||
return strcmp (a->langname, b->langname);
|
||||
}
|
||||
|
||||
static void
|
||||
update_script_combo (void)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GListStore *store;
|
||||
GtkSortListModel *sortmodel;
|
||||
hb_font_t *hb_font;
|
||||
int i, j, k;
|
||||
PangoFont *pango_font;
|
||||
GHashTable *tags;
|
||||
GHashTableIter iter;
|
||||
TagPair *pair;
|
||||
char *lang;
|
||||
PangoLanguage *language;
|
||||
const char *lang;
|
||||
hb_tag_t active;
|
||||
GtkTreeIter active_iter;
|
||||
gboolean have_active = FALSE;
|
||||
|
||||
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (demo->font));
|
||||
language = gtk_font_dialog_button_get_language (GTK_FONT_DIALOG_BUTTON (demo->font));
|
||||
lang = pango_language_to_string (language);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
active = hb_ot_tag_from_language (hb_language_from_string (lang, -1));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_free (lang);
|
||||
|
||||
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
||||
store = g_list_store_new (script_lang_get_type ());
|
||||
|
||||
pango_font = get_pango_font ();
|
||||
hb_font = pango_font_get_hb_font (pango_font);
|
||||
@@ -806,19 +867,19 @@ update_script_combo (void)
|
||||
|
||||
hb_face = hb_font_get_face (hb_font);
|
||||
|
||||
for (i= 0; i < 2; i++)
|
||||
for (guint i = 0; i < 2; i++)
|
||||
{
|
||||
hb_tag_t scripts[80];
|
||||
unsigned int script_count = G_N_ELEMENTS (scripts);
|
||||
|
||||
hb_ot_layout_table_get_script_tags (hb_face, tables[i], 0, &script_count, scripts);
|
||||
for (j = 0; j < script_count; j++)
|
||||
for (guint j = 0; j < script_count; j++)
|
||||
{
|
||||
hb_tag_t languages[80];
|
||||
unsigned int language_count = G_N_ELEMENTS (languages);
|
||||
|
||||
hb_ot_layout_script_get_language_tags (hb_face, tables[i], j, 0, &language_count, languages);
|
||||
for (k = 0; k < language_count; k++)
|
||||
for (guint k = 0; k < language_count; k++)
|
||||
{
|
||||
pair = g_new (TagPair, 1);
|
||||
pair->script_tag = scripts[j];
|
||||
@@ -838,7 +899,6 @@ update_script_combo (void)
|
||||
{
|
||||
const char *langname;
|
||||
char langbuf[5];
|
||||
GtkTreeIter tree_iter;
|
||||
|
||||
if (pair->lang_tag == 0 && pair->script_tag == 0)
|
||||
langname = NC_("Language", "None");
|
||||
@@ -855,31 +915,31 @@ update_script_combo (void)
|
||||
}
|
||||
}
|
||||
|
||||
gtk_list_store_insert_with_values (store, &tree_iter, -1,
|
||||
0, langname,
|
||||
1, pair->script_index,
|
||||
2, pair->lang_index,
|
||||
3, pair->lang_tag,
|
||||
-1);
|
||||
if (pair->lang_tag == active)
|
||||
{
|
||||
have_active = TRUE;
|
||||
active_iter = tree_iter;
|
||||
}
|
||||
g_list_store_append (store, script_lang_new (langname,
|
||||
pair->script_index,
|
||||
pair->lang_index,
|
||||
pair->lang_tag));
|
||||
}
|
||||
|
||||
g_hash_table_destroy (tags);
|
||||
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
|
||||
script_sort_func, NULL, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
|
||||
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
|
||||
GTK_SORT_ASCENDING);
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (demo->script_lang), GTK_TREE_MODEL (store));
|
||||
if (have_active)
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), &active_iter);
|
||||
else
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), 0);
|
||||
sortmodel = gtk_sort_list_model_new (G_LIST_MODEL (store),
|
||||
GTK_SORTER (gtk_custom_sorter_new (script_sort, NULL, NULL)));
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (demo->script_lang), G_LIST_MODEL (sortmodel));
|
||||
|
||||
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (sortmodel)); i++)
|
||||
{
|
||||
ScriptLang *item = g_list_model_get_item (G_LIST_MODEL (sortmodel), i);
|
||||
g_object_unref (item);
|
||||
|
||||
if (item->lang_tag == active)
|
||||
{
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->script_lang), i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (sortmodel);
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -904,27 +964,19 @@ static void
|
||||
update_features (void)
|
||||
{
|
||||
int i, j;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
guint script_index, lang_index;
|
||||
hb_tag_t lang_tag;
|
||||
PangoFont *pango_font;
|
||||
hb_font_t *hb_font;
|
||||
GList *l;
|
||||
ScriptLang *selected;
|
||||
|
||||
/* set feature presence checks from the font features */
|
||||
|
||||
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
|
||||
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) == 0)
|
||||
return;
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
|
||||
gtk_tree_model_get (model, &iter,
|
||||
1, &script_index,
|
||||
2, &lang_index,
|
||||
3, &lang_tag,
|
||||
-1);
|
||||
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
|
||||
|
||||
if (lang_tag == 0) /* None is selected */
|
||||
if (selected->lang_tag == 0) /* None is selected */
|
||||
{
|
||||
for (l = demo->feature_items; l; l = l->next)
|
||||
{
|
||||
@@ -954,7 +1006,7 @@ update_features (void)
|
||||
{
|
||||
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
|
||||
hb_face_t *hb_face;
|
||||
char *feat;
|
||||
const char *feat;
|
||||
|
||||
hb_face = hb_font_get_face (hb_font);
|
||||
|
||||
@@ -965,8 +1017,8 @@ update_features (void)
|
||||
|
||||
hb_ot_layout_language_get_feature_tags (hb_face,
|
||||
tables[i],
|
||||
script_index,
|
||||
lang_index,
|
||||
selected->script_index,
|
||||
selected->lang_index,
|
||||
0,
|
||||
&count,
|
||||
features);
|
||||
@@ -988,8 +1040,8 @@ update_features (void)
|
||||
|
||||
hb_ot_layout_language_find_feature (hb_face,
|
||||
tables[i],
|
||||
script_index,
|
||||
lang_index,
|
||||
selected->script_index,
|
||||
selected->lang_index,
|
||||
features[j],
|
||||
&feature_index);
|
||||
|
||||
@@ -1047,7 +1099,7 @@ update_features (void)
|
||||
}
|
||||
}
|
||||
|
||||
feat = gtk_font_chooser_get_font_features (GTK_FONT_CHOOSER (demo->font));
|
||||
feat = gtk_font_dialog_button_get_font_features (GTK_FONT_DIALOG_BUTTON (demo->font));
|
||||
if (feat)
|
||||
{
|
||||
for (l = demo->feature_items; l; l = l->next)
|
||||
@@ -1073,8 +1125,6 @@ update_features (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (feat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1321,10 +1371,9 @@ free_instance (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
add_instance (hb_face_t *face,
|
||||
unsigned int index,
|
||||
GtkWidget *combo,
|
||||
int pos)
|
||||
add_instance (hb_face_t *face,
|
||||
unsigned int index,
|
||||
GtkStringList *strings)
|
||||
{
|
||||
Instance *instance;
|
||||
hb_ot_name_id_t name_id;
|
||||
@@ -1340,20 +1389,20 @@ add_instance (hb_face_t *face,
|
||||
instance->index = index;
|
||||
|
||||
g_hash_table_add (demo->instances, instance);
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
|
||||
gtk_string_list_append (GTK_STRING_LIST (strings), instance->name);
|
||||
}
|
||||
|
||||
static void
|
||||
unset_instance (GtkAdjustment *adjustment)
|
||||
{
|
||||
if (demo->instance_combo)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (demo->instance_combo), 0);
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->instance_combo), 0);
|
||||
}
|
||||
|
||||
static void
|
||||
instance_changed (GtkComboBox *combo)
|
||||
instance_changed (GtkDropDown *combo)
|
||||
{
|
||||
char *text;
|
||||
const char *text;
|
||||
Instance *instance;
|
||||
Instance ikey;
|
||||
int i;
|
||||
@@ -1365,11 +1414,12 @@ instance_changed (GtkComboBox *combo)
|
||||
hb_font_t *hb_font;
|
||||
hb_face_t *hb_face;
|
||||
|
||||
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
|
||||
text = gtk_string_list_get_string (GTK_STRING_LIST (gtk_drop_down_get_model (combo)),
|
||||
gtk_drop_down_get_selected (combo));
|
||||
if (text[0] == '\0')
|
||||
goto out;
|
||||
|
||||
ikey.name = text;
|
||||
ikey.name = (char *) text;
|
||||
instance = g_hash_table_lookup (demo->instances, &ikey);
|
||||
if (!instance)
|
||||
{
|
||||
@@ -1410,7 +1460,6 @@ instance_changed (GtkComboBox *combo)
|
||||
}
|
||||
|
||||
out:
|
||||
g_free (text);
|
||||
g_clear_object (&pango_font);
|
||||
g_free (ai);
|
||||
g_free (coords);
|
||||
@@ -1520,6 +1569,7 @@ update_font_variations (void)
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *combo;
|
||||
GtkStringList *strings;
|
||||
|
||||
label = gtk_label_new ("Instance");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
@@ -1527,26 +1577,28 @@ update_font_variations (void)
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
|
||||
gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
|
||||
|
||||
combo = gtk_combo_box_text_new ();
|
||||
strings = gtk_string_list_new (NULL);
|
||||
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
|
||||
|
||||
gtk_widget_set_halign (combo, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
|
||||
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
|
||||
gtk_string_list_append (strings, "");
|
||||
|
||||
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
|
||||
add_instance (hb_face, i, combo, i);
|
||||
add_instance (hb_face, i, strings);
|
||||
|
||||
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
|
||||
{
|
||||
if (matches_instance (hb_face, i, n_axes, design_coords))
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
|
||||
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
|
||||
g_signal_connect (combo, "notify::selecte", G_CALLBACK (instance_changed), NULL);
|
||||
demo->instance_combo = combo;
|
||||
}
|
||||
|
||||
@@ -1693,6 +1745,7 @@ do_font_features (GtkWidget *do_widget)
|
||||
GtkBuilder *builder;
|
||||
GtkBuilderScope *scope;
|
||||
GtkEventController *controller;
|
||||
GtkExpression *expression;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
|
||||
@@ -1726,6 +1779,10 @@ do_font_features (GtkWidget *do_widget)
|
||||
demo->description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
|
||||
demo->font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
|
||||
demo->script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
|
||||
g_assert (GTK_IS_DROP_DOWN (demo->script_lang));
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (script_lang_get_langname), NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (demo->script_lang), expression);
|
||||
gtk_expression_unref (expression);
|
||||
demo->feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
|
||||
demo->stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
|
||||
demo->entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
@@ -1744,8 +1801,8 @@ do_font_features (GtkWidget *do_widget)
|
||||
demo->swin = GTK_WIDGET (gtk_builder_get_object (builder, "swin"));
|
||||
|
||||
demo->provider = gtk_css_provider_new ();
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (demo->swin),
|
||||
GTK_STYLE_PROVIDER (demo->provider), 800);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (demo->provider), 800);
|
||||
|
||||
basic_value_changed (demo->size_adjustment, demo->size_entry);
|
||||
basic_value_changed (demo->letterspacing_adjustment, demo->letterspacing_entry);
|
||||
@@ -1823,3 +1880,5 @@ do_font_features (GtkWidget *do_widget)
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -58,11 +58,14 @@
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<object class="GtkFontDialogButton" id="font">
|
||||
<property name="dialog">
|
||||
<object class="GtkFontDialog">
|
||||
</object>
|
||||
</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="font">Sans 12</property>
|
||||
<property name="level">family|style</property>
|
||||
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
|
||||
<property name="level">face</property>
|
||||
<signal name="notify::font-desc" handler="font_features_font_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -192,7 +195,11 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="foreground">
|
||||
<object class="GtkColorDialogButton" id="foreground">
|
||||
<property name="dialog">
|
||||
<object class="GtkColorDialog">
|
||||
</object>
|
||||
</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="rgba">black</property>
|
||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||
@@ -214,7 +221,11 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="background">
|
||||
<object class="GtkColorDialogButton" id="background">
|
||||
<property name="dialog">
|
||||
<object class="GtkColorDialog">
|
||||
</object>
|
||||
</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="rgba">white</property>
|
||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||
@@ -259,16 +270,10 @@
|
||||
<object class="GtkBox" id="feature_list">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="script_lang">
|
||||
<object class="GtkDropDown" id="script_lang">
|
||||
<property name="tooltip-text" translatable="yes">Language System</property>
|
||||
<property name="margin-top">10</property>
|
||||
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
<signal name="notify::selected" handler="font_features_script_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -43,7 +43,6 @@ update_image (void)
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf2;
|
||||
const char *hint;
|
||||
cairo_font_options_t *fopt;
|
||||
cairo_hint_style_t hintstyle;
|
||||
cairo_hint_metrics_t hintmetrics;
|
||||
@@ -54,22 +53,27 @@ update_image (void)
|
||||
context = gtk_widget_create_pango_context (image);
|
||||
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
|
||||
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (font_button));
|
||||
|
||||
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
|
||||
|
||||
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
if (hint)
|
||||
switch (gtk_drop_down_get_selected (GTK_DROP_DOWN (hinting)))
|
||||
{
|
||||
if (strcmp (hint, "none") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
else if (strcmp (hint, "slight") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
else if (strcmp (hint, "medium") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
else if (strcmp (hint, "full") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
case 0:
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
break;
|
||||
case 1:
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
break;
|
||||
case 2:
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
break;
|
||||
case 3:
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
break;
|
||||
default:
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
break;
|
||||
}
|
||||
cairo_font_options_set_hint_style (fopt, hintstyle);
|
||||
|
||||
@@ -283,8 +287,6 @@ retry:
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||
|
||||
g_object_unref (pixbuf2);
|
||||
|
||||
pango_font_description_free (desc);
|
||||
}
|
||||
|
||||
static gboolean fading = FALSE;
|
||||
@@ -418,7 +420,7 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
|
||||
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hinting, "notify::selected", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (anti_alias, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
|
||||
@@ -74,7 +74,11 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font_button">
|
||||
<object class="GtkFontDialogButton" id="font_button">
|
||||
<property name="dialog">
|
||||
<object class="GtkFontDialog">
|
||||
</object>
|
||||
</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
@@ -116,15 +120,18 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="hinting">
|
||||
<property name="active">0</property>
|
||||
<object class="GtkDropDown" id="hinting">
|
||||
<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>
|
||||
<property name="model">
|
||||
<object class="GtkStringList">
|
||||
<items>
|
||||
<item translatable="yes">None</item>
|
||||
<item translatable="yes">Slight</item>
|
||||
<item translatable="yes">Medium</item>
|
||||
<item translatable="yes">Full</item>
|
||||
</items>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
|
||||
@@ -144,7 +144,6 @@ make_shader_stack (const char *name,
|
||||
GtkTextBuffer *buffer;
|
||||
GBytes *bytes;
|
||||
GtkEventController *controller;
|
||||
GtkCssProvider *provider;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
stack = gtk_shader_stack_new ();
|
||||
@@ -235,12 +234,6 @@ make_shader_stack (const char *name,
|
||||
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
|
||||
g_object_set_data (G_OBJECT (button), "the-stack", stack);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (button),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
g_object_unref (provider);
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_add_css_class (button, "small");
|
||||
@@ -274,11 +267,21 @@ make_shader_stack (const char *name,
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gltransition_window (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *window, *headerbar, *scale, *outer_grid, *grid, *background;
|
||||
GdkPaintable *paintable;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
@@ -333,6 +336,14 @@ create_gltransition_window (GtkWidget *do_widget)
|
||||
make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
|
||||
1, 1, 1, 1);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
#define FOLDER_NAME "/iconview/gnome-fs-directory.png"
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
enum
|
||||
{
|
||||
COL_TEXT,
|
||||
|
||||
@@ -83,24 +83,17 @@ progressive_timeout (gpointer data)
|
||||
|
||||
if (bytes_read < 0)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Failure reading image file 'alphatest.png': %s",
|
||||
error->message);
|
||||
dialog = gtk_alert_dialog_new ("Failure reading image file 'alphatest.png': %s",
|
||||
error->message);
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
g_object_unref (image_stream);
|
||||
image_stream = NULL;
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
load_timeout = 0;
|
||||
|
||||
return FALSE; /* uninstall the timeout */
|
||||
@@ -110,25 +103,17 @@ progressive_timeout (gpointer data)
|
||||
buf, bytes_read,
|
||||
&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 image: %s",
|
||||
error->message);
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
|
||||
error->message);
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
g_object_unref (image_stream);
|
||||
image_stream = NULL;
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
load_timeout = 0;
|
||||
|
||||
return FALSE; /* uninstall the timeout */
|
||||
@@ -143,22 +128,14 @@ progressive_timeout (gpointer data)
|
||||
error = NULL;
|
||||
if (!g_input_stream_close (image_stream, NULL, &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 image: %s",
|
||||
error->message);
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
|
||||
error->message);
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
g_object_unref (image_stream);
|
||||
image_stream = NULL;
|
||||
g_object_unref (pixbuf_loader);
|
||||
@@ -177,25 +154,16 @@ progressive_timeout (gpointer data)
|
||||
* it was incomplete.
|
||||
*/
|
||||
error = NULL;
|
||||
if (!gdk_pixbuf_loader_close (pixbuf_loader,
|
||||
&error))
|
||||
if (!gdk_pixbuf_loader_close (pixbuf_loader, &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 image: %s",
|
||||
error->message);
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
|
||||
error->message);
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
g_object_unref (pixbuf_loader);
|
||||
pixbuf_loader = NULL;
|
||||
|
||||
@@ -216,20 +184,14 @@ progressive_timeout (gpointer data)
|
||||
|
||||
if (image_stream == NULL)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"%s", error->message);
|
||||
dialog = gtk_alert_dialog_new ("%s",
|
||||
error->message);
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
load_timeout = 0;
|
||||
|
||||
return FALSE; /* uninstall the timeout */
|
||||
|
||||
@@ -12,8 +12,8 @@ on_bar_response (GtkInfoBar *info_bar,
|
||||
int response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *window;
|
||||
GtkAlertDialog *dialog;
|
||||
char *detail;
|
||||
|
||||
if (response_id == GTK_RESPONSE_CLOSE)
|
||||
{
|
||||
@@ -21,19 +21,12 @@ on_bar_response (GtkInfoBar *info_bar,
|
||||
return;
|
||||
}
|
||||
|
||||
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (info_bar)));
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"You clicked a button on an info bar");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
"Your response has id %d", response_id);
|
||||
|
||||
g_signal_connect_swapped (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), dialog);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
dialog = gtk_alert_dialog_new ("You clicked a button on an info bar");
|
||||
detail = g_strdup_printf ("Your response has been %d", response_id);
|
||||
gtk_alert_dialog_set_detail (dialog, detail);
|
||||
g_free (detail);
|
||||
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (info_bar))));
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
||||
@@ -7,38 +7,22 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
response_cb (GtkWidget *dialog,
|
||||
int response_id,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
activate_link (GtkWidget *label,
|
||||
activate_link (GtkWidget *label,
|
||||
const char *uri,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
if (g_strcmp0 (uri, "keynav") == 0)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *parent;
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
parent = GTK_WIDGET (gtk_widget_get_root (label));
|
||||
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Keyboard navigation");
|
||||
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
|
||||
"The term <i>keynav</i> is a shorthand for "
|
||||
"keyboard navigation and refers to the process of using "
|
||||
"a program (exclusively) via keyboard input.");
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
|
||||
dialog = gtk_alert_dialog_new ("Keyboard navigation");
|
||||
gtk_alert_dialog_set_detail (dialog,
|
||||
"The term ‘keynav’ is a shorthand for "
|
||||
"keyboard navigation and refers to the process of using "
|
||||
"a program (exclusively) via keyboard input.");
|
||||
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (label)));
|
||||
g_object_unref (dialog);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkTreeModel *model = NULL;
|
||||
static guint timeout = 0;
|
||||
|
||||
@@ -117,19 +117,16 @@ activate_cb (GtkListView *list,
|
||||
G_APP_LAUNCH_CONTEXT (context),
|
||||
&error))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
/* And because error handling is important, even a simple demo has it:
|
||||
* We display an error dialog that something went wrong.
|
||||
*/
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Could not launch %s", g_app_info_get_display_name (app_info));
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
|
||||
dialog = gtk_alert_dialog_new ("Could not launch %s", g_app_info_get_display_name (app_info));
|
||||
gtk_alert_dialog_set_detail (dialog, error->message);
|
||||
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))));
|
||||
g_object_unref (dialog);
|
||||
g_clear_error (&error);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
g_object_unref (context);
|
||||
|
||||
@@ -422,6 +422,10 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
gtk_column_view_column_set_sorter (name_column, sorter);
|
||||
g_object_unref (sorter);
|
||||
|
||||
sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "type")));
|
||||
gtk_column_view_column_set_sorter (type_column, sorter);
|
||||
g_object_unref (sorter);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "script-names.h"
|
||||
#include "unicode-names.h"
|
||||
|
||||
|
||||
#define UCD_TYPE_ITEM (ucd_item_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (UcdItem, ucd_item, UCD, ITEM, GObject)
|
||||
|
||||
@@ -338,6 +337,15 @@ create_ucd_view (GtkWidget *label)
|
||||
|
||||
static GtkWidget *window;
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_listview_ucd (GtkWidget *do_widget)
|
||||
{
|
||||
@@ -360,7 +368,7 @@ do_listview_ucd (GtkWidget *do_widget)
|
||||
gtk_widget_add_css_class (label, "enormous");
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
|
||||
gtk_style_context_add_provider (gtk_widget_get_style_context (label), GTK_STYLE_PROVIDER (provider), 800);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
@@ -370,6 +378,8 @@ do_listview_ucd (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
|
||||
gtk_box_prepend (GTK_BOX (box), sw);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -42,7 +42,7 @@ update_title_cb (GtkFilterListModel *model)
|
||||
title = g_strdup_printf ("%u lines", g_list_model_get_n_items (G_LIST_MODEL (model)));
|
||||
|
||||
gtk_widget_set_visible (progress, pending != 0);
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), (total - pending) / (double) total);
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), total > 0 ? (total - pending) / (double) total : 0.);
|
||||
gtk_window_set_title (GTK_WINDOW (window), title);
|
||||
g_free (title);
|
||||
}
|
||||
@@ -141,39 +141,35 @@ load_file (GtkStringList *list,
|
||||
}
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
GtkStringList *stringlist)
|
||||
open_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GtkStringList *stringlist = GTK_STRING_LIST (user_data);
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
load_file (stringlist, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
file_open_cb (GtkWidget *button,
|
||||
GtkStringList *stringlist)
|
||||
{
|
||||
GtkFileChooserNative *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_native_new ("Open file",
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Load",
|
||||
"_Cancel");
|
||||
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), stringlist);
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_open (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
NULL,
|
||||
NULL,
|
||||
open_response_cb, stringlist);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
enum {
|
||||
COLOR_SET,
|
||||
N_SIGNALS
|
||||
@@ -51,8 +53,8 @@ static const char *pad_colors[] = {
|
||||
static GType drawing_area_get_type (void);
|
||||
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
|
||||
|
||||
static void drawing_area_set_color (DrawingArea *area,
|
||||
GdkRGBA *color);
|
||||
static void drawing_area_set_color (DrawingArea *area,
|
||||
const GdkRGBA *color);
|
||||
|
||||
static void
|
||||
drawing_area_ensure_surface (DrawingArea *area,
|
||||
@@ -350,8 +352,8 @@ drawing_area_new (void)
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_set_color (DrawingArea *area,
|
||||
GdkRGBA *color)
|
||||
drawing_area_set_color (DrawingArea *area,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
if (gdk_rgba_equal (&area->draw_color, color))
|
||||
return;
|
||||
@@ -361,21 +363,22 @@ drawing_area_set_color (DrawingArea *area,
|
||||
}
|
||||
|
||||
static void
|
||||
color_button_color_set (GtkColorButton *button,
|
||||
DrawingArea *draw_area)
|
||||
color_button_color_set (GtkColorDialogButton *button,
|
||||
GParamSpec *pspec,
|
||||
DrawingArea *draw_area)
|
||||
{
|
||||
GdkRGBA color;
|
||||
const GdkRGBA *color;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
|
||||
drawing_area_set_color (draw_area, &color);
|
||||
color = gtk_color_dialog_button_get_rgba (button);
|
||||
drawing_area_set_color (draw_area, color);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_color_set (DrawingArea *area,
|
||||
GdkRGBA *color,
|
||||
GtkColorButton *button)
|
||||
drawing_area_color_set (DrawingArea *area,
|
||||
GdkRGBA *color,
|
||||
GtkColorDialogButton *button)
|
||||
{
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (button), color);
|
||||
gtk_color_dialog_button_set_rgba (button, color);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -394,13 +397,13 @@ do_paint (GtkWidget *toplevel)
|
||||
|
||||
headerbar = gtk_header_bar_new ();
|
||||
|
||||
colorbutton = gtk_color_button_new ();
|
||||
g_signal_connect (colorbutton, "color-set",
|
||||
colorbutton = gtk_color_dialog_button_new (gtk_color_dialog_new ());
|
||||
g_signal_connect (colorbutton, "notify::rgba",
|
||||
G_CALLBACK (color_button_color_set), draw_area);
|
||||
g_signal_connect (draw_area, "color-set",
|
||||
G_CALLBACK (drawing_area_color_set), colorbutton);
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
|
||||
&(GdkRGBA) { 0, 0, 0, 1 });
|
||||
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (colorbutton),
|
||||
&(GdkRGBA) { 0, 0, 0, 1 });
|
||||
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
|
||||
|
||||
@@ -13,25 +13,24 @@
|
||||
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
GtkPicture *picture)
|
||||
open_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *data)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GtkPicture *picture = data;
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
paintable = svg_paintable_new (file);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
|
||||
g_object_unref (paintable);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -39,20 +38,25 @@ show_file_open (GtkWidget *button,
|
||||
GtkPicture *picture)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
GtkFileChooserNative *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
GListStore *filters;
|
||||
|
||||
dialog = gtk_file_chooser_native_new ("Open node file",
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Load",
|
||||
"_Cancel");
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Open node file");
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
|
||||
g_list_store_append (filters, filter);
|
||||
g_object_unref (filter);
|
||||
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
|
||||
g_object_unref (filters);
|
||||
|
||||
gtk_file_dialog_open (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
NULL,
|
||||
NULL,
|
||||
open_response_cb, picture);
|
||||
}
|
||||
|
||||
static GtkWidget *window;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
/* 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
|
||||
@@ -359,6 +360,15 @@ drop_drop (GtkDropTarget *target,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
create_board (GtkWidget *window)
|
||||
{
|
||||
@@ -375,6 +385,9 @@ create_board (GtkWidget *window)
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||
@@ -393,9 +406,6 @@ create_board (GtkWidget *window)
|
||||
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)
|
||||
@@ -439,7 +449,7 @@ create_board (GtkWidget *window)
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (provider);
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1,34 +1,44 @@
|
||||
/* Pickers
|
||||
* #Keywords: GtkColorChooser, GtkFontChooser, GtkApplicationChooser
|
||||
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog, GtkColorDialogButton, GtkFontDialogButton, chooser, button
|
||||
*
|
||||
* These widgets are mainly intended for use in preference dialogs.
|
||||
* They allow to select colors, fonts and applications.
|
||||
*
|
||||
* This demo shows both the default appearance for these dialogs,
|
||||
* as well as some of the customizations that are possible.
|
||||
* These widgets and async APIs are mainly intended for use in preference dialogs.
|
||||
* They allow to select colors, fonts, files and applications.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gboolean
|
||||
filter_font_cb (const PangoFontFamily *family,
|
||||
const PangoFontFace *face,
|
||||
gpointer data)
|
||||
static void
|
||||
file_opened (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *data)
|
||||
{
|
||||
const char *alias_families[] = {
|
||||
"Cursive",
|
||||
"Fantasy",
|
||||
"Monospace",
|
||||
"Sans",
|
||||
"Serif",
|
||||
"System-ui",
|
||||
NULL
|
||||
};
|
||||
const char *family_name;
|
||||
GFile *file;
|
||||
|
||||
family_name = pango_font_family_get_name (PANGO_FONT_FAMILY (family));
|
||||
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, NULL);
|
||||
|
||||
return g_strv_contains (alias_families, family_name);
|
||||
if (file)
|
||||
{
|
||||
char *name = g_file_get_basename (file);
|
||||
gtk_button_set_label (GTK_BUTTON (data), name);
|
||||
g_object_set_data_full (G_OBJECT (data), "file", file, g_object_unref);
|
||||
g_free (name);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
open_file (GtkButton *picker)
|
||||
{
|
||||
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (picker)));
|
||||
GtkFileDialog *dialog;
|
||||
GFile *file;
|
||||
|
||||
dialog = gtk_file_dialog_new ();
|
||||
|
||||
file = (GFile *) g_object_get_data (G_OBJECT (picker), "file");
|
||||
|
||||
gtk_file_dialog_open (dialog, parent, file, NULL, file_opened, picker);
|
||||
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
#define COLOR(r,g,b) { r/255., g/255., b/255., 1.0 }
|
||||
@@ -38,27 +48,6 @@ 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)
|
||||
{
|
||||
@@ -77,54 +66,46 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
|
||||
gtk_window_set_child (GTK_WINDOW (window), table);
|
||||
|
||||
label = gtk_label_new ("Standard");
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_grid_attach (GTK_GRID (table), label, 1, -1, 1, 1);
|
||||
label = gtk_label_new ("Custom");
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_grid_attach (GTK_GRID (table), label, 2, -1, 1, 1);
|
||||
|
||||
label = gtk_label_new ("Color:");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
||||
|
||||
picker = gtk_color_button_new ();
|
||||
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
|
||||
|
||||
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), picker, 2, 0, 1, 1);
|
||||
|
||||
label = gtk_label_new ("Font:");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
|
||||
|
||||
picker = gtk_font_button_new ();
|
||||
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
|
||||
|
||||
picker = gtk_font_button_new ();
|
||||
gtk_font_chooser_set_level (GTK_FONT_CHOOSER (picker),
|
||||
GTK_FONT_CHOOSER_LEVEL_FAMILY |
|
||||
GTK_FONT_CHOOSER_LEVEL_SIZE);
|
||||
gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (picker), filter_font_cb, NULL, NULL);
|
||||
label = gtk_label_new ("File:");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 2, 1, 1, 1);
|
||||
picker = gtk_button_new_with_label ("None");
|
||||
g_signal_connect (picker, "clicked", G_CALLBACK (open_file), NULL);
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
label = gtk_label_new ("Mail:");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
|
||||
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
|
||||
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ enum {
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
static void
|
||||
pixbuf_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
@@ -37,7 +36,6 @@ pixbuf_paintable_snapshot (GdkPaintable *paintable,
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
static int
|
||||
pixbuf_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
|
||||
@@ -177,19 +177,12 @@ do_printing (GtkWidget *do_widget)
|
||||
|
||||
if (error)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (do_widget),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"%s", error->message);
|
||||
dialog = gtk_alert_dialog_new ("%s", error->message);
|
||||
gtk_alert_dialog_show (dialog, GTK_WINDOW (do_widget));
|
||||
g_object_unref (dialog);
|
||||
g_error_free (error);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,24 +16,6 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Convenience function to create a combo box holding a number of strings
|
||||
*/
|
||||
GtkWidget *
|
||||
create_combo_box (const char **strings)
|
||||
{
|
||||
GtkWidget *combo_box;
|
||||
const char **str;
|
||||
|
||||
combo_box = gtk_combo_box_text_new ();
|
||||
|
||||
for (str = strings; *str; str++)
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
static void
|
||||
add_row (GtkGrid *table,
|
||||
int row,
|
||||
@@ -41,7 +23,7 @@ add_row (GtkGrid *table,
|
||||
const char *label_text,
|
||||
const char **options)
|
||||
{
|
||||
GtkWidget *combo_box;
|
||||
GtkWidget *dropdown;
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new_with_mnemonic (label_text);
|
||||
@@ -50,12 +32,12 @@ add_row (GtkGrid *table,
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_grid_attach (table, label, 0, row, 1, 1);
|
||||
|
||||
combo_box = create_combo_box (options);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box);
|
||||
gtk_widget_set_halign (combo_box, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (combo_box, GTK_ALIGN_BASELINE);
|
||||
gtk_size_group_add_widget (size_group, combo_box);
|
||||
gtk_grid_attach (table, combo_box, 1, row, 1, 1);
|
||||
dropdown = gtk_drop_down_new_from_strings (options);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), dropdown);
|
||||
gtk_widget_set_halign (dropdown, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE);
|
||||
gtk_size_group_add_widget (size_group, dropdown);
|
||||
gtk_grid_attach (table, dropdown, 1, row, 1, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -35,6 +35,7 @@ do_spinner (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
window = gtk_dialog_new_with_buttons ("Spinner",
|
||||
GTK_WINDOW (do_widget),
|
||||
0,
|
||||
@@ -48,6 +49,7 @@ do_spinner (GtkWidget *do_widget)
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_widget_set_margin_start (vbox, 5);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stdlib.h> /* for exit() */
|
||||
#include "paintable.h"
|
||||
|
||||
|
||||
static void easter_egg_callback (GtkWidget *button, gpointer data);
|
||||
|
||||
static void
|
||||
@@ -429,11 +430,11 @@ attach_widgets (GtkTextView *text_view)
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
widget = gtk_combo_box_text_new ();
|
||||
const char *options[] = {
|
||||
"Option 1", "Option 2", "Option 3", NULL
|
||||
};
|
||||
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 1");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 2");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 3");
|
||||
widget = gtk_drop_down_new_from_strings (options);
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* TreeItem structure */
|
||||
typedef struct _TreeItem TreeItem;
|
||||
struct _TreeItem
|
||||
|
||||
@@ -10,60 +10,63 @@
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
open_dialog_response_cb (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
GtkWidget *video)
|
||||
open_dialog_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GtkWidget *video = user_data;
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
gtk_video_set_file (GTK_VIDEO (video), file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_native_dialog_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
open_clicked_cb (GtkWidget *button,
|
||||
GtkWidget *video)
|
||||
{
|
||||
GtkFileChooserNative *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
GtkFileFilter *filter;
|
||||
GListStore *filters;
|
||||
|
||||
dialog = gtk_file_chooser_native_new ("Select a video",
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Open",
|
||||
"_Cancel");
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Select a video");
|
||||
|
||||
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_pattern (filter, "*");
|
||||
gtk_file_filter_set_name (filter, "All Files");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_list_store_append (filters, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/*");
|
||||
gtk_file_filter_set_name (filter, "Images");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_list_store_append (filters, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "video/*");
|
||||
gtk_file_filter_set_name (filter, "Video");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
|
||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
g_list_store_append (filters, filter);
|
||||
|
||||
gtk_file_dialog_set_current_filter (dialog, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video);
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
|
||||
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
|
||||
g_object_unref (filters);
|
||||
|
||||
gtk_file_dialog_open (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_root (button)),
|
||||
NULL,
|
||||
NULL,
|
||||
open_dialog_response_cb, video);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -548,45 +548,36 @@ node_editor_window_load (NodeEditorWindow *self,
|
||||
}
|
||||
|
||||
static void
|
||||
open_response_cb (GtkWidget *dialog,
|
||||
int response,
|
||||
NodeEditorWindow *self)
|
||||
open_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
NodeEditorWindow *self = user_data;
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
node_editor_window_load (self, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
show_open_filechooser (NodeEditorWindow *self)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
GFile *cwd;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Open node file",
|
||||
GTK_WINDOW (self),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Load", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
GFile *cwd = g_file_new_for_path (".");
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Open node file");
|
||||
cwd = g_file_new_for_path (".");
|
||||
gtk_file_dialog_set_current_folder (dialog, cwd);
|
||||
g_object_unref (cwd);
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
|
||||
gtk_widget_show (dialog);
|
||||
gtk_file_dialog_open (dialog, GTK_WINDOW (self),
|
||||
NULL, NULL, open_response_cb, self);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -597,21 +588,22 @@ open_cb (GtkWidget *button,
|
||||
}
|
||||
|
||||
static void
|
||||
save_response_cb (GtkWidget *dialog,
|
||||
int response,
|
||||
NodeEditorWindow *self)
|
||||
save_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
NodeEditorWindow *self = user_data;
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_save_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file;
|
||||
char *text;
|
||||
GError *error = NULL;
|
||||
|
||||
text = get_current_text (self->text_buffer);
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
g_file_replace_contents (file, text, strlen (text),
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_NONE,
|
||||
@@ -620,49 +612,40 @@ save_response_cb (GtkWidget *dialog,
|
||||
&error);
|
||||
if (error != NULL)
|
||||
{
|
||||
GtkWidget *message_dialog;
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
|
||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Saving failed");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
|
||||
"%s", error->message);
|
||||
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (message_dialog);
|
||||
alert = gtk_alert_dialog_new ("Saving failed");
|
||||
gtk_alert_dialog_set_detail (alert, error->message);
|
||||
gtk_alert_dialog_show (alert,
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
|
||||
g_object_unref (alert);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_free (text);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
save_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
GFile *cwd;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Save node",
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Save", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
GFile *cwd = g_file_new_for_path (".");
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Save node");
|
||||
cwd = g_file_new_for_path (".");
|
||||
gtk_file_dialog_set_current_folder (dialog, cwd);
|
||||
g_object_unref (cwd);
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
|
||||
gtk_widget_show (dialog);
|
||||
gtk_file_dialog_save (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||
NULL,
|
||||
"demo.node",
|
||||
NULL,
|
||||
save_response_cb, self);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
@@ -724,34 +707,29 @@ create_cairo_texture (NodeEditorWindow *self)
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_response_cb (GtkWidget *dialog,
|
||||
int response,
|
||||
GdkTexture *texture)
|
||||
export_image_response_cb (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GdkTexture *texture = user_data;
|
||||
GFile *file;
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_dialog_save_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
if (!gdk_texture_save_to_png (texture, g_file_peek_path (file)))
|
||||
{
|
||||
GtkWidget *message_dialog;
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))),
|
||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Exporting to image failed");
|
||||
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (message_dialog);
|
||||
alert = gtk_alert_dialog_new ("Exporting to image failed");
|
||||
gtk_alert_dialog_show (alert, GTK_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))));
|
||||
g_object_unref (alert);
|
||||
}
|
||||
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
@@ -760,25 +738,24 @@ export_image_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GtkWidget *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
|
||||
texture = create_texture (self);
|
||||
if (texture == NULL)
|
||||
return;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("",
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Save", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (export_image_response_cb), texture);
|
||||
gtk_widget_show (dialog);
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "");
|
||||
gtk_file_dialog_save (dialog,
|
||||
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
|
||||
NULL,
|
||||
"example.png",
|
||||
NULL,
|
||||
export_image_response_cb, texture);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
clip_image_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
|
||||
@@ -96,12 +96,10 @@ set_text (const char *text,
|
||||
static void
|
||||
load_file (GFile *open_filename)
|
||||
{
|
||||
GtkWidget *error_dialog;
|
||||
char *contents;
|
||||
GError *error;
|
||||
gsize len;
|
||||
|
||||
error_dialog = NULL;
|
||||
error = NULL;
|
||||
g_file_load_contents (open_filename, NULL, &contents, &len, NULL, &error);
|
||||
if (error == NULL)
|
||||
@@ -117,36 +115,28 @@ load_file (GFile *open_filename)
|
||||
{
|
||||
GFileInfo *info = g_file_query_info (open_filename, "standard::display-name", 0, NULL, &error);
|
||||
const char *display_name = g_file_info_get_display_name (info);
|
||||
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Error loading file %s:\n%s",
|
||||
display_name,
|
||||
"Not valid utf8");
|
||||
g_object_unref (info);
|
||||
}
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
alert = gtk_alert_dialog_new ("Error loading file %s", display_name);
|
||||
gtk_alert_dialog_set_detail (alert, "Not valid utf8");
|
||||
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
|
||||
g_object_unref (alert);
|
||||
g_object_unref (info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GFileInfo *info = g_file_query_info (open_filename, "standard::display-name", 0, NULL, &error);
|
||||
const char *display_name = g_file_info_get_display_name (info);
|
||||
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Error loading file %s:\n%s",
|
||||
display_name,
|
||||
error->message);
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
alert = gtk_alert_dialog_new ("Error loading file %s", display_name);
|
||||
gtk_alert_dialog_set_detail (alert, error->message);
|
||||
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
|
||||
g_object_unref (alert);
|
||||
g_object_unref (info);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (error_dialog)
|
||||
{
|
||||
g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (error_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +144,6 @@ static void
|
||||
save_file (GFile *save_filename)
|
||||
{
|
||||
char *text = get_text ();
|
||||
GtkWidget *error_dialog;
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
@@ -180,18 +169,12 @@ save_file (GFile *save_filename)
|
||||
{
|
||||
GFileInfo *info = g_file_query_info (save_filename, "standard::display-name", 0, NULL, NULL);
|
||||
const char *display_name = g_file_info_get_display_name (info);
|
||||
GtkAlertDialog *alert;
|
||||
|
||||
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Error saving to file %s:\n%s",
|
||||
display_name,
|
||||
error->message);
|
||||
|
||||
g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (error_dialog);
|
||||
|
||||
alert = gtk_alert_dialog_new ("Error saving to file %s", display_name);
|
||||
gtk_alert_dialog_set_detail (alert, error->message);
|
||||
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
|
||||
g_object_unref (alert);
|
||||
g_error_free (error);
|
||||
g_object_unref (info);
|
||||
}
|
||||
@@ -340,21 +323,24 @@ create_custom_widget (GtkPrintOperation *operation,
|
||||
PrintData *data)
|
||||
{
|
||||
GtkWidget *vbox, *hbox, *font, *label;
|
||||
GtkFontDialog *dialog;
|
||||
PangoFontDescription *desc;
|
||||
|
||||
gtk_print_operation_set_custom_tab_label (operation, "Other");
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new ("Font:");
|
||||
gtk_box_append (GTK_BOX (hbox), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
font = gtk_font_button_new_with_font (data->font);
|
||||
dialog = gtk_font_dialog_new ();
|
||||
font = gtk_font_dialog_button_new (dialog);
|
||||
desc = pango_font_description_from_string (data->font);
|
||||
gtk_font_dialog_button_set_font_desc (GTK_FONT_DIALOG_BUTTON (font), desc);
|
||||
pango_font_description_free (desc);
|
||||
gtk_box_append (GTK_BOX (hbox), font);
|
||||
gtk_widget_show (font);
|
||||
data->font_button = font;
|
||||
|
||||
return vbox;
|
||||
@@ -365,11 +351,12 @@ custom_widget_apply (GtkPrintOperation *operation,
|
||||
GtkWidget *widget,
|
||||
PrintData *data)
|
||||
{
|
||||
const char *selected_font;
|
||||
selected_font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (data->font_button));
|
||||
PangoFontDescription *desc;
|
||||
|
||||
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (data->font_button));
|
||||
|
||||
g_free (data->font);
|
||||
data->font = g_strdup (selected_font);
|
||||
data->font = pango_font_description_to_string (desc);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -377,23 +364,18 @@ print_done (GtkPrintOperation *op,
|
||||
GtkPrintOperationResult res,
|
||||
PrintData *print_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
|
||||
{
|
||||
|
||||
GtkWidget *error_dialog;
|
||||
GtkAlertDialog *alert;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_print_operation_get_error (op, &error);
|
||||
|
||||
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Error printing file:\n%s",
|
||||
error ? error->message : "no details");
|
||||
g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
|
||||
gtk_widget_show (error_dialog);
|
||||
alert = gtk_alert_dialog_new ("Error printing file");
|
||||
if (error)
|
||||
gtk_alert_dialog_set_detail (alert, error->message);
|
||||
gtk_alert_dialog_show (alert, GTK_WINDOW (main_window));
|
||||
g_object_unref (alert);
|
||||
}
|
||||
else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
|
||||
{
|
||||
@@ -499,17 +481,19 @@ activate_preview (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
on_save_response (GtkWidget *dialog,
|
||||
int response)
|
||||
on_save_response (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
GFile *save_filename = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
save_file (save_filename);
|
||||
g_object_unref (save_filename);
|
||||
}
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GFile *file;
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
file = gtk_file_dialog_save_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
save_file (file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -517,21 +501,17 @@ activate_save_as (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Select file",
|
||||
GTK_WINDOW (main_window),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Save", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (on_save_response),
|
||||
NULL);
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Select file");
|
||||
gtk_file_dialog_save (dialog,
|
||||
GTK_WINDOW (main_window),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
on_save_response, NULL);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -546,17 +526,19 @@ activate_save (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
on_open_response (GtkWidget *dialog,
|
||||
int response)
|
||||
on_open_response (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
GFile *open_filename = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
load_file (open_filename);
|
||||
g_object_unref (open_filename);
|
||||
}
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GFile *file;
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
load_file (file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -564,21 +546,16 @@ activate_open (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkFileDialog *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Select file",
|
||||
GTK_WINDOW (main_window),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Open", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (on_open_response),
|
||||
NULL);
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_set_title (dialog, "Select file");
|
||||
gtk_file_dialog_open (dialog,
|
||||
GTK_WINDOW (main_window),
|
||||
NULL,
|
||||
NULL,
|
||||
on_open_response, NULL);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -214,10 +214,19 @@ activate_background (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
file_chooser_response (GtkNativeDialog *self,
|
||||
int response)
|
||||
file_chooser_response (GObject *source,
|
||||
GAsyncResult *result,
|
||||
void *user_data)
|
||||
{
|
||||
gtk_native_dialog_destroy (self);
|
||||
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_dialog_open_finish (dialog, result, NULL);
|
||||
if (file)
|
||||
{
|
||||
g_print ("File selected: %s", g_file_peek_path (file));
|
||||
g_object_unref (file);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -225,17 +234,11 @@ activate_open_file (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFileChooserNative *chooser;
|
||||
GtkFileDialog *dialog;
|
||||
|
||||
chooser = gtk_file_chooser_native_new ("Open file",
|
||||
NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"Open",
|
||||
"Cancel");
|
||||
|
||||
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), NULL);
|
||||
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
|
||||
dialog = gtk_file_dialog_new ();
|
||||
gtk_file_dialog_open (dialog, NULL, NULL, NULL, file_chooser_response, NULL);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -664,6 +667,7 @@ on_record_button_toggled (GtkToggleButton *button,
|
||||
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static void
|
||||
on_page_combo_changed (GtkComboBox *combo,
|
||||
gpointer user_data)
|
||||
@@ -705,6 +709,7 @@ on_page_combo_changed (GtkComboBox *combo,
|
||||
default:;
|
||||
}
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
on_range_from_changed (GtkSpinButton *from)
|
||||
@@ -843,6 +848,7 @@ page_changed_cb (GtkWidget *stack, GParamSpec *pspec, gpointer data)
|
||||
}
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static void
|
||||
populate_model (GtkTreeStore *store)
|
||||
{
|
||||
@@ -960,6 +966,7 @@ row_separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
|
||||
return is_sep;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
update_title_header (GtkListBoxRow *row,
|
||||
@@ -1089,7 +1096,9 @@ set_color (GtkListBox *box, GtkListBoxRow *row, GtkColorChooser *chooser)
|
||||
if (gdk_rgba_parse (&rgba, color))
|
||||
{
|
||||
g_signal_handlers_block_by_func (chooser, rgba_changed, box);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_color_chooser_set_rgba (chooser, &rgba);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
g_signal_handlers_unblock_by_func (chooser, rgba_changed, box);
|
||||
}
|
||||
}
|
||||
@@ -1458,7 +1467,9 @@ close_selection_dialog (GtkWidget *dialog, int response, GtkWidget *tv)
|
||||
if (response == GTK_RESPONSE_CANCEL)
|
||||
return;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
box = gtk_widget_get_first_child (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
g_assert (GTK_IS_FLOW_BOX (box));
|
||||
children = gtk_flow_box_get_selected_children (GTK_FLOW_BOX (box));
|
||||
|
||||
@@ -1578,6 +1589,7 @@ osd_frame_pressed (GtkGestureClick *gesture,
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static gboolean
|
||||
page_combo_separator_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
@@ -1592,6 +1604,7 @@ page_combo_separator_func (GtkTreeModel *model,
|
||||
|
||||
return res;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
toggle_format (GSimpleAction *action,
|
||||
@@ -1844,6 +1857,7 @@ update_buttons (GtkWidget *iv, GtkIconSize size)
|
||||
gtk_widget_set_sensitive (button, size != GTK_ICON_SIZE_INHERIT);
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
static void
|
||||
increase_icon_size (GtkWidget *iv)
|
||||
{
|
||||
@@ -1894,6 +1908,7 @@ reset_icon_size (GtkWidget *iv)
|
||||
|
||||
gtk_widget_queue_resize (iv);
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
static char *
|
||||
scale_format_value_blank (GtkScale *scale, double value, gpointer user_data)
|
||||
@@ -2270,10 +2285,12 @@ activate (GApplication *app)
|
||||
g_object_set_data (G_OBJECT (window), "selection_flowbox", widget2);
|
||||
g_signal_connect_swapped (widget, "clicked", G_CALLBACK (populate_flowbox), widget2);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "charletree");
|
||||
populate_model ((GtkTreeStore *)gtk_tree_view_get_model (GTK_TREE_VIEW (widget)));
|
||||
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget), row_separator_func, NULL, NULL);
|
||||
gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (builder, "munsell"));
|
||||
widget2 = GTK_WIDGET (gtk_builder_get_object (builder, "cchooser"));
|
||||
@@ -2281,6 +2298,7 @@ activate (GApplication *app)
|
||||
populate_colors (widget, widget2);
|
||||
g_signal_connect (widget2, "notify::rgba", G_CALLBACK (rgba_changed), widget);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "page_combo");
|
||||
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (widget), page_combo_separator_func, NULL, NULL);
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "range_from_spin");
|
||||
@@ -2291,6 +2309,7 @@ activate (GApplication *app)
|
||||
g_object_set_data (G_OBJECT (widget), "range_to_spin", widget3);
|
||||
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
|
||||
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
|
||||
|
||||
|
||||
@@ -3345,10 +3345,12 @@ bad things might happen.</property>
|
||||
<attribute name="display-hint">circular-buttons</attribute>
|
||||
<item>
|
||||
<attribute name="verb-icon">printer-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Print all the things!</attribute>
|
||||
<attribute name="action">win.print</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="verb-icon">emblem-shared-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Share all the things!</attribute>
|
||||
<attribute name="action">app.share</attribute>
|
||||
</item>
|
||||
</section>
|
||||
@@ -3363,14 +3365,17 @@ bad things might happen.</property>
|
||||
<attribute name="label" translatable="yes">Edit</attribute>
|
||||
<item>
|
||||
<attribute name="verb-icon">edit-cut-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Cut</attribute>
|
||||
<attribute name="action">app.cut</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="verb-icon">edit-copy-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Copy</attribute>
|
||||
<attribute name="action">app.copy</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="verb-icon">edit-paste-symbolic</attribute>
|
||||
<attribute name="label" translatable="yes">Paste</attribute>
|
||||
<attribute name="action">app.paste</attribute>
|
||||
</item>
|
||||
</section>
|
||||
|
||||
@@ -8,8 +8,7 @@ are organized in a hierarchy. The window widget is the main container.
|
||||
The user interface is then built by adding buttons, drop-down menus, input
|
||||
fields, and other widgets to the window. If you are creating complex user
|
||||
interfaces it is recommended to use GtkBuilder and its GTK-specific markup
|
||||
description language, instead of assembling the interface manually. You can
|
||||
also use a visual user interface editor, like [Glade](https://glade.gnome.org/).
|
||||
description language, instead of assembling the interface manually.
|
||||
|
||||
GTK is event-driven. The toolkit listens for events such as a click
|
||||
on a button, and passes the event to your application.
|
||||
@@ -712,11 +711,20 @@ A common location to install UI descriptions and similar data is
|
||||
`/usr/share/appname`.
|
||||
|
||||
It is also possible to embed the UI description in the source code as a
|
||||
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping the
|
||||
UI description in a separate file has several advantages: It is then possible
|
||||
to make minor adjustments to the UI without recompiling your program, and,
|
||||
more importantly, graphical UI editors such as [Glade](http://glade.gnome.org)
|
||||
can load the file and allow you to create and modify your UI by point-and-click.
|
||||
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping
|
||||
the UI description in a separate file has several advantages:
|
||||
|
||||
- it is possible to make minor adjustments to the UI without recompiling your
|
||||
program
|
||||
- it is easier to isolate the UI code from the business logic of your
|
||||
application
|
||||
- it is easier to restructure your UI into separate classes using composite
|
||||
widget templates
|
||||
|
||||
Using [GResource](https://docs.gtk.org/gio/struct.Resource.html) it is possible
|
||||
to combine the best of both worlds: you can keep the UI definition files
|
||||
separate inside your source code repository, and then ship them embedded into
|
||||
your application.
|
||||
|
||||
## Building applications
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ SYNOPSIS
|
||||
--------
|
||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **gtk4-builder-tool** validate <FILE>
|
||||
| **gtk4-builder-tool** enumerate <FILE>
|
||||
| **gtk4-builder-tool** validate [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** enumerate [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
|
||||
@@ -33,12 +33,20 @@ Validation
|
||||
The ``validate`` command validates the given UI definition file and reports
|
||||
errors to ``stderr``.
|
||||
|
||||
``--deprecations``
|
||||
|
||||
Warn about uses of deprecated types in the UI definition file.
|
||||
|
||||
Enumeration
|
||||
^^^^^^^^^^^
|
||||
|
||||
The ``enumerate`` command lists all the named objects that are present in the UI
|
||||
The ``enumerate`` command prints all the named objects that are present in the UI
|
||||
definition file.
|
||||
|
||||
``--callbacks``
|
||||
|
||||
Print the names of callbacks as well.
|
||||
|
||||
Preview
|
||||
^^^^^^^
|
||||
|
||||
|
||||
99
docs/reference/gtk/migrating-4to5.md
Normal file
99
docs/reference/gtk/migrating-4to5.md
Normal file
@@ -0,0 +1,99 @@
|
||||
Title: Preparing for GTK 5
|
||||
Slug: gtk-migrating-4-to-5
|
||||
|
||||
GTK 5 will be a major new version of GTK that breaks both API and
|
||||
ABI compared to GTK 4.x. GTK 5 does not exist yet, so we cannot
|
||||
be entirely sure what will be involved in a migration from GTK 4
|
||||
to GTK 5. But we can already give some preliminary hints about
|
||||
the likely changes, and how to prepare for them in code that is
|
||||
using GTK 4.
|
||||
|
||||
### Do not use deprecated symbols
|
||||
|
||||
As always, functions and types that are known to go away in the
|
||||
next major version of GTK are being marked as deprecated in GTK 4.
|
||||
|
||||
Removing the use of deprecated APIs is the most important step
|
||||
to prepare your code for the next major version of GTK. Often,
|
||||
deprecation notes will include hints about replacement APIs to
|
||||
help you with this.
|
||||
|
||||
Sometimes, it is helpful to have some background information about
|
||||
the motivation and goals of larger API changes.
|
||||
|
||||
## Cell renderers are going away
|
||||
|
||||
Cell renderers were introduced in GTK 2 to support rendering of
|
||||
"big data" UIs, in particular treeviews. Over the years, more
|
||||
"data-like" widgets have started to use them, and cell renderers
|
||||
have grown into a shadowy, alternative rendering infrastructure
|
||||
that duplicates much of what widgets do, while duplicating the
|
||||
code and adding their own dose of bugs.
|
||||
|
||||
In GTK 4, replacement widgets for GtkTreeView, GtkIconView and
|
||||
GtkComboBox have appeared: GtkListView, GtkColumnView, GtkGridView
|
||||
and GtkDropDown. For GTK 5, we will take the next step and remove
|
||||
all cell renderer-based widgets.
|
||||
|
||||
## Themed rendering APIs are going away
|
||||
|
||||
The old GTK 2 era rendering APIs for theme components like
|
||||
gtk_render_frame() or gtk_render_check() have not been used by
|
||||
GTK itself even in later GTK 3, but they have been kepy around
|
||||
for the benefit of "external drawing" users - applications that
|
||||
want their controls to look like GTK without using widgets.
|
||||
|
||||
Supporting this is increasingly getting in the way of making
|
||||
the GTK CSS machinery fast and correct. One notable problem is
|
||||
that temporary style changes (using gtk_style_context_save())
|
||||
is breaking animations. Therefore, these APIs will be going away
|
||||
in GTK 5, together with their more modern GtkSnapshot variants
|
||||
like gtk_snapshot_render_background() or gtk_snapshot_render_focus().
|
||||
|
||||
The best way to render parts of your widget using CSS styling
|
||||
is to use subwidgets. For example, to show a piece of text with
|
||||
fonts, effects and shadows according to the current CSS style,
|
||||
use a GtkLabel.
|
||||
|
||||
If you have a need for custom drawing that fits into the current
|
||||
(dark or light) theme, e.g. for rendering a graph, you can still
|
||||
get the current style foreground color, using
|
||||
[method@Gtk.Widget.get_style_color].
|
||||
|
||||
## Local stylesheets are going away
|
||||
|
||||
The cascading part of GTK's CSS implementation is complicated by
|
||||
the existence of local stylesheets (i.e. those added with
|
||||
gtk_style_context_add_provider()). And local stylesheets are
|
||||
unintuitive in that they do not apply to the whole subtree of
|
||||
widgets, but just to the one widget where the stylesheet was
|
||||
added.
|
||||
|
||||
GTK 5 will no longer provide this functionality. The recommendations
|
||||
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
|
||||
and rely on style classes to make your CSS apply only where desired.
|
||||
|
||||
## Chooser interfaces are going away
|
||||
|
||||
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
|
||||
interfaces and their implementations as dialogs, buttons and widgets
|
||||
are phased out. The are being replaced by a new family of async APIs
|
||||
that will be more convenient to use from language bindings, in particular
|
||||
for languages that have concepts like promises. The new APIs are
|
||||
[class@Gtk.ColorDialog], [class@Gtk.FontDialog] and [class@Gtk.FileDialog],
|
||||
There are also equivalents for some of the 'button' widgets:
|
||||
[class@Gtk.ColorDialogButton], [class@Gtk.FontDialogButton].
|
||||
|
||||
## GtkMessageDialog is going away
|
||||
|
||||
Like the Chooser interfaces, GtkMessageDialog has been replaced by
|
||||
a new async API that will be more convenient, in particular for
|
||||
language binding. The new API is [class@Gtk.AlertDialog].
|
||||
|
||||
## GtkDialog is going away
|
||||
|
||||
After gtk_dialog_run() was removed, the usefulness of GtkDialog
|
||||
is much reduced, and it has awkward, archaice APIs. Therefore,
|
||||
it is dropped. The recommended replacement is to just create
|
||||
your own window and add buttons as required, either in the header
|
||||
or elsewhere.
|
||||
@@ -10,6 +10,10 @@ to determine paths to look for certain files. The [X11](#x11-envar),
|
||||
[Broadway](#broadway-envar) GDK backends use some additional
|
||||
environment variables.
|
||||
|
||||
Note that environment variables are generally used for debugging
|
||||
purposes. They are not guaranteed to be API stable, and should not
|
||||
be used for end-user configuration and customization.
|
||||
|
||||
### `GTK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GTK to
|
||||
@@ -75,6 +79,9 @@ A number of keys are influencing behavior instead of just logging:
|
||||
`snapshot`
|
||||
: Include debug render nodes in the generated snapshots
|
||||
|
||||
`invert-text-dir`
|
||||
: Invert the text direction, compared to the locale
|
||||
|
||||
The special value `all` can be used to turn on all debug options.
|
||||
The special value `help` can be used to obtain a list of all
|
||||
supported debug options.
|
||||
@@ -85,8 +92,7 @@ Specifies a list of directories to search when GTK is looking for
|
||||
dynamically loaded objects such as input method modules and print
|
||||
backends. If the path to the dynamically loaded object is given as
|
||||
an absolute path name, then GTK loads it directly. Otherwise, GTK
|
||||
goes in turn through the directories in `GTK_PATH`, followed by
|
||||
the directory `.gtk-4.0` in the user's home directory, followed
|
||||
goes in turn through the directories in `GTK_PATH`, followed
|
||||
by the system default directory, which is `libdir/gtk-4.0/modules`.
|
||||
(If `GTK_EXE_PREFIX` is defined, `libdir` is `$GTK_EXE_PREFIX/lib`.
|
||||
Otherwise it is the libdir specified when GTK was configured, usually
|
||||
@@ -205,24 +211,33 @@ A number of options affect behavior instead of logging:
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-software`
|
||||
: Force OpenGL software rendering
|
||||
|
||||
`gl-texture-rect`
|
||||
: Use the OpenGL texture rectangle extension, if available
|
||||
|
||||
`gl-legacy`
|
||||
: Use a legacy OpenGL context
|
||||
|
||||
`gl-gles`
|
||||
: Use a GLES OpenGL context
|
||||
|
||||
`gl-egl`
|
||||
: Use an EGL context on X11 or Windows
|
||||
|
||||
`gl-glx`
|
||||
: Use GLX on X11
|
||||
|
||||
`gl-wgl`
|
||||
: Use WGL on Windows
|
||||
|
||||
`vulkan-disable`
|
||||
: Disable Vulkan support
|
||||
|
||||
`vulkan-validate`
|
||||
: Load the Vulkan validation layer, if available
|
||||
|
||||
`default-settings`
|
||||
: Force default values for xsettings
|
||||
|
||||
`high-depth`
|
||||
: Use high bit depth rendering if possible
|
||||
|
||||
The special value `all` can be used to turn on all debug options. The special
|
||||
value `help` can be used to obtain a list of all supported debug options.
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
Title: Tree and List Widget Overview
|
||||
Slug: gtk-treeview
|
||||
|
||||
This document describes the `GtkTreeView` widget and auxiliary
|
||||
classes, like tree models and cell renderers. All of these have
|
||||
been deprecated and will be removed in GTK 5. Their replacements
|
||||
are described in the [List Widget Overview](section-list-widget.html).
|
||||
|
||||
## Introduction
|
||||
|
||||
To create a tree or list in GTK, use the `GtkTreeModel` interface in
|
||||
conjunction with the `GtkTreeView` widget. This widget is designed around
|
||||
a _Model/View/Controller_ design and consists of four major parts:
|
||||
|
||||
@@ -7,7 +7,7 @@ the default.
|
||||
|
||||
More information about GTK on Windows, including detailed build
|
||||
instructions, binary downloads, etc, can be found
|
||||
[online](https://wiki.gnome.org/Projects/GTK/Win32).
|
||||
[online](https://www.gtk.org/docs/installations/windows/).
|
||||
|
||||
## Windows-specific environment variables
|
||||
|
||||
|
||||
@@ -6,19 +6,11 @@ action_activated (GSimpleAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *parent = user_data;
|
||||
GtkWidget *dialog;
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (parent,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Activated action `%s`",
|
||||
g_action_get_name (G_ACTION (action)));
|
||||
|
||||
g_signal_connect_swapped (dialog, "response",
|
||||
G_CALLBACK (gtk_window_destroy), dialog);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
dialog = gtk_alert_dialog_new ("Activated action `%s`", g_action_get_name (G_ACTION (action)));
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
}
|
||||
|
||||
static GActionEntry doc_entries[] = {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkApplication parent_instance;
|
||||
@@ -350,7 +352,8 @@ quit_activated (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
combo_changed (GtkComboBox *combo,
|
||||
combo_changed (GtkDropDown *combo,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkDialog *dialog = user_data;
|
||||
@@ -359,7 +362,7 @@ combo_changed (GtkComboBox *combo,
|
||||
char **accels;
|
||||
char *str;
|
||||
|
||||
action = gtk_combo_box_get_active_id (combo);
|
||||
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
@@ -388,7 +391,7 @@ response (GtkDialog *dialog,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkEntry *entry = g_object_get_data (user_data, "entry");
|
||||
GtkComboBox *combo = g_object_get_data (user_data, "combo");
|
||||
GtkDropDown *combo = g_object_get_data (user_data, "combo");
|
||||
const char *action;
|
||||
const char *str;
|
||||
char **accels;
|
||||
@@ -399,7 +402,7 @@ response (GtkDialog *dialog,
|
||||
return;
|
||||
}
|
||||
|
||||
action = gtk_combo_box_get_active_id (combo);
|
||||
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
|
||||
|
||||
if (!action)
|
||||
return;
|
||||
@@ -424,6 +427,7 @@ edit_accels (GSimpleAction *action,
|
||||
char **actions;
|
||||
GtkWidget *dialog;
|
||||
int i;
|
||||
GtkStringList *strings;
|
||||
|
||||
dialog = gtk_dialog_new_with_buttons ("Accelerators",
|
||||
NULL,
|
||||
@@ -435,7 +439,8 @@ edit_accels (GSimpleAction *action,
|
||||
gtk_window_set_application (GTK_WINDOW (dialog), app);
|
||||
actions = gtk_application_list_action_descriptions (app);
|
||||
|
||||
combo = gtk_combo_box_text_new ();
|
||||
strings = gtk_string_list_new (NULL);
|
||||
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
|
||||
g_object_set (gtk_dialog_get_content_area (GTK_DIALOG (dialog)),
|
||||
"margin-top", 10,
|
||||
"margin-bottom", 10,
|
||||
@@ -446,8 +451,8 @@ edit_accels (GSimpleAction *action,
|
||||
|
||||
gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo);
|
||||
for (i = 0; actions[i]; i++)
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), actions[i], actions[i]);
|
||||
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), dialog);
|
||||
gtk_string_list_append (strings, actions[i]);
|
||||
g_signal_connect (combo, "notify::selected", G_CALLBACK (combo_changed), dialog);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (entry, TRUE);
|
||||
@@ -458,7 +463,7 @@ edit_accels (GSimpleAction *action,
|
||||
g_object_set_data (G_OBJECT (dialog), "combo", combo);
|
||||
g_object_set_data (G_OBJECT (dialog), "entry", entry);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), 0);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "gdkbroadway-server.h"
|
||||
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdk-private.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#ifdef G_OS_WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
typedef struct BroadwayInput BroadwayInput;
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ gdk_broadway_device_query_state (GdkDevice *device,
|
||||
gint32 device_root_x, device_root_y;
|
||||
guint32 mouse_toplevel_id;
|
||||
guint32 mask32;
|
||||
int origin_x, origin_y;
|
||||
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
|
||||
return;
|
||||
@@ -97,10 +98,12 @@ gdk_broadway_device_query_state (GdkDevice *device,
|
||||
&device_root_y,
|
||||
&mask32);
|
||||
|
||||
gdk_surface_get_origin (surface, &origin_x, &origin_y);
|
||||
|
||||
if (win_x)
|
||||
*win_x = device_root_x;
|
||||
*win_x = device_root_x - origin_x;
|
||||
if (win_y)
|
||||
*win_y = device_root_y;
|
||||
*win_y = device_root_y - origin_y;
|
||||
if (mask)
|
||||
*mask = mask32;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "gdkdevice-broadway.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include "gdk-private.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
@@ -213,7 +213,7 @@ _gdk_broadway_display_open (const char *display_name)
|
||||
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
|
||||
if (broadway_display->server == NULL)
|
||||
{
|
||||
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
|
||||
GDK_DEBUG (MISC, "Unable to init Broadway server: %s", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
message->key.state,
|
||||
FALSE,
|
||||
&translated,
|
||||
&translated);
|
||||
&translated,
|
||||
NULL);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, message->base.serial);
|
||||
|
||||
@@ -483,6 +483,34 @@ connection_closed (GDBusConnection *connection,
|
||||
static void
|
||||
finish_registration (void)
|
||||
{
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
G_TYPE_FILE,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* FIXME: I missed up and used the wrong mime type here when
|
||||
* I implemented my own protocol. Keep these around for a while
|
||||
* so we can interoperate with existing flatpaks using GTK 4.6
|
||||
*/
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.files",
|
||||
portal_file_serializer,
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GI_SCANNER__
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkMonitor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkSeat, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPopupLayout, gdk_popup_layout_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkVulkanContext, g_object_unref)
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentFormats, gdk_content_formats_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameTimings, gdk_frame_timings_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkRGBA, gdk_rgba_free)
|
||||
|
||||
#endif
|
||||
49
gdk/gdk.c
49
gdk/gdk.c
@@ -28,12 +28,13 @@
|
||||
|
||||
#include "gdkresources.h"
|
||||
|
||||
#include "gdkconstructor.h"
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkconstructorprivate.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkprivate.h"
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -116,19 +117,17 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "vulkan", GDK_DEBUG_VULKAN, "Information about Vulkan" },
|
||||
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" },
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force the use of portals" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows", TRUE },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11", TRUE },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows", TRUE },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support", TRUE },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
|
||||
};
|
||||
@@ -258,16 +257,12 @@ gdk_parse_debug_var (const char *variable,
|
||||
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
fprintf (stderr, " %s%*s%s", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
if (!debug_enabled && !keys[i].always_enabled)
|
||||
fprintf (stderr, " [unavailable]");
|
||||
fprintf (stderr, "\n");
|
||||
if (debug_enabled || keys[i].always_enabled)
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
}
|
||||
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values");
|
||||
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
|
||||
fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n");
|
||||
if (!debug_enabled)
|
||||
fprintf (stderr, "Values marked as [unavailable] are only accessible if GTK is built with G_ENABLE_DEBUG.\n");
|
||||
}
|
||||
|
||||
if (invert)
|
||||
@@ -298,11 +293,11 @@ gdk_pre_parse (void)
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
/* These are global */
|
||||
if (GDK_DEBUG_CHECK (GL_EGL))
|
||||
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
|
||||
gdk_gl_backend_use (GDK_GL_EGL);
|
||||
else if (GDK_DEBUG_CHECK (GL_GLX))
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_GLX)
|
||||
gdk_gl_backend_use (GDK_GL_GLX);
|
||||
else if (GDK_DEBUG_CHECK (GL_WGL))
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_WGL)
|
||||
gdk_gl_backend_use (GDK_GL_WGL);
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
@@ -361,7 +356,7 @@ gdk_running_in_sandbox (void)
|
||||
gboolean
|
||||
gdk_should_use_portal (void)
|
||||
{
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (NULL, PORTALS))
|
||||
if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_PORTALS)
|
||||
return TRUE;
|
||||
|
||||
if (gdk_running_in_sandbox ())
|
||||
|
||||
@@ -76,8 +76,6 @@
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdkvulkancontext.h>
|
||||
|
||||
#include <gdk/gdk-autocleanup.h>
|
||||
|
||||
#undef __GDK_H_INSIDE__
|
||||
|
||||
#endif /* __GDK_H__ */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "gdkapplaunchcontextprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,6 +54,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
|
||||
const char *icon_name);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
#include "gdkcontentproviderprivate.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkpipeiostreamprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdk-private.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_clipboard_set_texture (GdkClipboard *clipboard,
|
||||
GdkTexture *texture);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_CLIPBOARD_H__ */
|
||||
|
||||
@@ -16,6 +16,8 @@ G_BEGIN_DECLS
|
||||
#mesondefine GDK_WINDOWING_WAYLAND
|
||||
#mesondefine GDK_WINDOWING_WIN32
|
||||
|
||||
#mesondefine GDK_RENDERING_CAIRO
|
||||
#mesondefine GDK_RENDERING_GL
|
||||
#mesondefine GDK_RENDERING_VULKAN
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkrgbaprivate.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "loaders/gdkpngprivate.h"
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
|
||||
@@ -354,12 +355,14 @@ gdk_content_deserializer_return_success (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CONTENT_DESERIALIZER (deserializer));
|
||||
g_return_if_fail (!deserializer->returned);
|
||||
guint source_id;
|
||||
|
||||
deserializer->returned = TRUE;
|
||||
g_idle_add_full (deserializer->priority,
|
||||
gdk_content_deserializer_emit_callback,
|
||||
deserializer,
|
||||
g_object_unref);
|
||||
source_id = g_idle_add_full (deserializer->priority,
|
||||
gdk_content_deserializer_emit_callback,
|
||||
deserializer,
|
||||
g_object_unref);
|
||||
gdk_source_set_static_name_by_id (source_id, "[gtk] gdk_content_deserializer_emit_callback");
|
||||
/* NB: the idle will destroy our reference */
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_content_formats_builder_add_gtype (GdkContentFormatsBuilder *builder,
|
||||
GType type);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentFormats, gdk_content_formats_unref)
|
||||
|
||||
/* dunno where else to put this */
|
||||
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "gdkclipboard.h"
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkprivate.h"
|
||||
|
||||
/**
|
||||
* GdkContentProvider:
|
||||
|
||||
@@ -111,6 +111,9 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_content_provider_get_value (GdkContentProvider *provider,
|
||||
GValue *value,
|
||||
GError **error);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_CONTENT_PROVIDER_H__ */
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkcontentproviderimpl.h"
|
||||
|
||||
#include "gdk-private.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#define GDK_TYPE_CONTENT_PROVIDER_VALUE (gdk_content_provider_value_get_type ())
|
||||
#define GDK_CONTENT_PROVIDER_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_CONTENT_PROVIDER_VALUE, GdkContentProviderValue))
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
#include "loaders/gdkjpegprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <string.h>
|
||||
@@ -360,12 +361,14 @@ gdk_content_serializer_return_success (GdkContentSerializer *serializer)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer));
|
||||
g_return_if_fail (!serializer->returned);
|
||||
guint source_id;
|
||||
|
||||
serializer->returned = TRUE;
|
||||
g_idle_add_full (serializer->priority,
|
||||
gdk_content_serializer_emit_callback,
|
||||
serializer,
|
||||
g_object_unref);
|
||||
source_id = g_idle_add_full (serializer->priority,
|
||||
gdk_content_serializer_emit_callback,
|
||||
serializer,
|
||||
g_object_unref);
|
||||
gdk_source_set_static_name_by_id (source_id, "[gtk] gdk_content_serializer_emit_callback");
|
||||
/* NB: the idle will destroy our reference */
|
||||
}
|
||||
|
||||
@@ -876,7 +879,7 @@ file_text_serializer (GdkContentSerializer *serializer)
|
||||
g_string_append (str, path);
|
||||
g_free (path);
|
||||
if (l->next)
|
||||
g_string_append (str, " ");
|
||||
g_string_append (str, "\n");
|
||||
}
|
||||
path = g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkcursorprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -64,6 +64,7 @@ int gdk_cursor_get_hotspot_x (GdkCursor *cursor);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_cursor_get_hotspot_y (GdkCursor *cursor);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "gdktypes.h"
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -40,8 +41,6 @@ typedef enum {
|
||||
GDK_DEBUG_NOGRABS = 1 << 11,
|
||||
GDK_DEBUG_PORTALS = 1 << 12,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 13,
|
||||
GDK_DEBUG_GL_SOFTWARE = 1 << 14,
|
||||
GDK_DEBUG_GL_TEXTURE_RECT = 1 << 15,
|
||||
GDK_DEBUG_GL_LEGACY = 1 << 16,
|
||||
GDK_DEBUG_GL_GLES = 1 << 17,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 18,
|
||||
@@ -60,22 +59,27 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
GdkDebugFlags flags);
|
||||
|
||||
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) \
|
||||
G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type)
|
||||
#define GDK_DISPLAY_NOTE(display,type,action) G_STMT_START { \
|
||||
|
||||
#define GDK_DISPLAY_DEBUG(display,type,...) \
|
||||
G_STMT_START { \
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \
|
||||
{ action; }; } G_STMT_END
|
||||
gdk_debug_message (__VA_ARGS__); \
|
||||
} G_STMT_END
|
||||
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
|
||||
#define GDK_DISPLAY_NOTE(display,type,action)
|
||||
#define GDK_DISPLAY_DEBUG(display,type,...)
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
|
||||
#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action)
|
||||
#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetool.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -126,6 +126,9 @@ GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
|
||||
|
||||
GDK_AVAILABLE_IN_4_2
|
||||
guint32 gdk_device_get_timestamp (GdkDevice *device);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_H__ */
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
/**
|
||||
* GdkDeviceTool:
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include "gdkapplaunchcontext.h"
|
||||
#include "gdkclipboardprivate.h"
|
||||
@@ -1233,7 +1233,7 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
|
||||
before = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self, GL_DISABLE))
|
||||
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_GL_DISABLE)
|
||||
{
|
||||
g_set_error_literal (&priv->gl_error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
@@ -1729,28 +1729,31 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
if (priv->egl_config_high_depth == NULL)
|
||||
priv->egl_config_high_depth = priv->egl_config;
|
||||
|
||||
GDK_DISPLAY_NOTE (self, OPENGL, {
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self, OPENGL))
|
||||
{
|
||||
char *ext = describe_extensions (priv->egl_display);
|
||||
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
|
||||
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
|
||||
g_message ("EGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Version: %s\n"
|
||||
" - Client APIs: %s\n"
|
||||
" - Extensions:\n"
|
||||
"\t%s\n"
|
||||
" - Selected fbconfig: %s\n"
|
||||
" high depth: %s",
|
||||
major, minor,
|
||||
eglQueryString (priv->egl_display, EGL_VENDOR),
|
||||
eglQueryString (priv->egl_display, EGL_VERSION),
|
||||
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
|
||||
ext, std_cfg,
|
||||
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
|
||||
gdk_debug_message ("EGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Version: %s\n"
|
||||
" - Client APIs: %s\n"
|
||||
" - Extensions:\n"
|
||||
"\t%s\n"
|
||||
" - Selected fbconfig: %s\n"
|
||||
" high depth: %s",
|
||||
major, minor,
|
||||
eglQueryString (priv->egl_display, EGL_VENDOR),
|
||||
eglQueryString (priv->egl_display, EGL_VERSION),
|
||||
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
|
||||
ext, std_cfg,
|
||||
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
|
||||
g_free (hd_cfg);
|
||||
g_free (std_cfg);
|
||||
g_free (ext);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ gboolean gdk_display_get_setting (GdkDisplay *display,
|
||||
const char *name,
|
||||
GValue *value);
|
||||
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include "x11/gdkx.h"
|
||||
@@ -420,7 +420,7 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
|
||||
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
|
||||
g_str_equal (backend, gdk_backends[j].name))
|
||||
{
|
||||
GDK_NOTE (MISC, g_message ("Trying %s backend", gdk_backends[j].name));
|
||||
GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name);
|
||||
display = gdk_backends[j].open_display (name);
|
||||
if (display)
|
||||
break;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_TYPE_DISPLAY_MANAGER (gdk_display_manager_get_type ())
|
||||
#define GDK_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManager))
|
||||
#define GDK_IS_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_MANAGER))
|
||||
@@ -58,6 +57,7 @@ GdkDisplay * gdk_display_manager_open_display (GdkDisplayManager *m
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_set_allowed_backends (const char *backends);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "gdksurface.h"
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkmonitor.h"
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkcontentprovider.h"
|
||||
#include "gdkcontentserializer.h"
|
||||
|
||||
@@ -99,6 +99,8 @@ GdkContentProvider *
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_drag_get_surface (GdkDrag *drag);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DND_H__ */
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdk-private.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkdragsurfaceprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
/**
|
||||
* GdkDragSurface:
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
@@ -364,7 +364,7 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH))
|
||||
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
|
||||
prefers_high_depth = TRUE;
|
||||
|
||||
priv->frame_region = cairo_region_copy (region);
|
||||
|
||||
@@ -52,6 +52,8 @@ gboolean gdk_draw_context_is_in_frame (GdkDrawContext
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const cairo_region_t * gdk_draw_context_get_frame_region (GdkDrawContext *context);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DRAW_CONTEXT__ */
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkpipeiostreamprivate.h"
|
||||
#include "gdksurface.h"
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrop, g_object_unref)
|
||||
|
||||
#define GDK_TYPE_DROP (gdk_drop_get_type ())
|
||||
#define GDK_DROP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DROP, GdkDrop))
|
||||
#define GDK_IS_DROP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DROP))
|
||||
@@ -85,6 +83,8 @@ const GValue * gdk_drop_read_value_finish (GdkDrop
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrop, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DROP_H__ */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user